From cfa15765e2c76c1aca03026aded1d2f93b840c19 Mon Sep 17 00:00:00 2001 From: Stacy Harper Date: Sun, 25 Jul 2021 09:54:53 +0200 Subject: [PATCH] Fix some shellchecks issues --- scripts/core/sxmo_appmenu.sh | 2 +- scripts/core/sxmo_common.sh | 7 +++++-- scripts/core/sxmo_migrate.sh | 2 +- scripts/core/sxmo_postwake.sh | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index 3b503bb..fa70e3c 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -13,7 +13,7 @@ gracefulexit() { } confirm() { - PICKED="$(echo -e "Yes\nNo" | dmenu -l 16 -c -p "Confirm $1")" + PICKED="$(printf "Yes\nNo\n" | dmenu -l 16 -c -p "Confirm $1")" if [ "$PICKED" = "Yes" ]; then return 0 diff --git a/scripts/core/sxmo_common.sh b/scripts/core/sxmo_common.sh index 44317b8..6e65758 100644 --- a/scripts/core/sxmo_common.sh +++ b/scripts/core/sxmo_common.sh @@ -18,7 +18,9 @@ export CACHEDIR="${XDG_CACHE_HOME:-$HOME/.cache}"/sxmo # shellcheck disable=SC2034 export LOGDIR="${XDG_DATA_HOME:-$HOME/.local/share}"/sxmo/modem # shellcheck disable=SC2034 -export CONTACTFILE="${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/contacts.tsv" +export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +# shellcheck disable=SC2034 +export CONTACTFILE="$XDG_CONFIG_HOME/sxmo/contacts.tsv" # shellcheck disable=SC2034 export MODEMSTATEFILE="$XDG_RUNTIME_DIR/sxmo.modem.state" # shellcheck disable=SC2034 @@ -255,4 +257,5 @@ icon_bok="" icon_map="" #allow the user to override icons -[ -x "$XDG_CONFIG_HOME/sxmo/hooks/icons" ] && source "$XDG_CONFIG_HOME/sxmo/hooks/icons" +# shellcheck disable=SC1091 +[ -x "$XDG_CONFIG_HOME/sxmo/hooks/icons" ] && . "$XDG_CONFIG_HOME/sxmo/hooks/icons" diff --git a/scripts/core/sxmo_migrate.sh b/scripts/core/sxmo_migrate.sh index 9e70444..6159ce9 100644 --- a/scripts/core/sxmo_migrate.sh +++ b/scripts/core/sxmo_migrate.sh @@ -52,7 +52,7 @@ checkhooks() { $EDITOR "$hook" "$defaulthook" fi else - printf "\e[33mHook $hook is identical to the default, so you don't need a custom hook, remove it? [Y/n]\e[0m" + printf "\e[33mHook %s is identical to the default, so you don't need a custom hook, remove it? [Y/n]\e[0m" "$hook" if [ "n" != "$reply" ]; then rm "$hook" fi diff --git a/scripts/core/sxmo_postwake.sh b/scripts/core/sxmo_postwake.sh index 56816c7..39d7728 100755 --- a/scripts/core/sxmo_postwake.sh +++ b/scripts/core/sxmo_postwake.sh @@ -1,5 +1,7 @@ #!/usr/bin/env sh +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh . "$(which sxmo_common.sh)" UNSUSPENDREASON="$1" @@ -16,7 +18,7 @@ REDLED_PATH="/sys/class/leds/red:indicator/brightness" BLUELED_PATH="/sys/class/leds/blue:indicator/brightness" finish() { - kill $BLINKPID + kill "$BLINKPID" echo 0 > "$REDLED_PATH" echo 0 > "$BLUELED_PATH"