]> git.ipfire.org Git - thirdparty/linux-firmware.git/commitdiff
copy-firmware.sh: reset and consistently handle destdir
authorEmil Velikov <emil.l.velikov@gmail.com>
Mon, 23 Sep 2024 11:09:08 +0000 (12:09 +0100)
committerMario Limonciello <superm1@gmail.com>
Thu, 10 Oct 2024 14:33:32 +0000 (14:33 +0000)
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 <emil.l.velikov@gmail.com>
copy-firmware.sh

index 21ed20d5886fe71588b923914265f992cf5c29b0..65a1b39b93293d1f876ea0cd2991e811247e9ecd 100755 (executable)
@@ -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