From a3446bc1a7bd4824177e5765ce7a5e7c6489a23a Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Mon, 23 Sep 2024 12:09:08 +0100 Subject: [PATCH] copy-firmware.sh: reset and consistently handle destdir Currently we don't reset/override the destdir variable, so we end up inheriting whatever the caller's environment has for it. While it may work, it's not particularly consistent (be that within the script or other tools) nor is it obvious. While in here, ensure we handle the variable with test -z/-n instead of varying other constructs. Signed-off-by: Emil Velikov --- copy-firmware.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/copy-firmware.sh b/copy-firmware.sh index 21ed20d5..65a1b39b 100755 --- a/copy-firmware.sh +++ b/copy-firmware.sh @@ -9,6 +9,7 @@ prune=no # shellcheck disable=SC2209 compress=cat compext= +destdir= while test $# -gt 0; do case $1 in @@ -45,7 +46,7 @@ while test $# -gt 0; do ;; *) - if test "x$destdir" != "x"; then + if test -n "$destdir"; then echo "ERROR: unknown command-line options: $*" exit 1 fi @@ -56,7 +57,7 @@ while test $# -gt 0; do esac done -if [ -z "$destdir" ]; then +if test -z "$destdir"; then echo "ERROR: destination directory was not specified" exit 1 fi