summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlsinitramfs12
-rwxr-xr-xmkinitramfs6
-rwxr-xr-xunmkinitramfs5
3 files changed, 9 insertions, 14 deletions
diff --git a/lsinitramfs b/lsinitramfs
index 03ee517..c106697 100755
--- a/lsinitramfs
+++ b/lsinitramfs
@@ -16,17 +16,19 @@ See lsinitramfs(8) for further details.
EOF
}
-if [ "$#" -eq 0 ] ; then
+usage_error()
+{
usage >&2
exit 2
+}
+
+if [ "$#" -eq 0 ] ; then
+ usage_error
fi
umi_opts="--list"
-OPTIONS=$(getopt -o hl --long help,long -n "$0" -- "$@")
-# Check for non-GNU getopt
-# shellcheck disable=SC2181
-if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi
+OPTIONS=$(getopt -o hl --long help,long -n "$0" -- "$@") || usage_error
eval set -- "$OPTIONS"
diff --git a/mkinitramfs b/mkinitramfs
index 30ef48b..0fff550 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -35,11 +35,7 @@ usage_error()
exit 2
}
-OPTIONS=$(getopt -o c:d:hko:r:v --long help -n "$0" -- "$@")
-
-# Check for non-GNU getopt
-# shellcheck disable=SC2181
-if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi
+OPTIONS=$(getopt -o c:d:hko:r:v --long help -n "$0" -- "$@") || usage_error
eval set -- "$OPTIONS"
diff --git a/unmkinitramfs b/unmkinitramfs
index 3efe8eb..2124c48 100755
--- a/unmkinitramfs
+++ b/unmkinitramfs
@@ -132,10 +132,7 @@ splitinitramfs()
fi
}
-OPTIONS=$(getopt -o hv --long help,list,verbose -n "$0" -- "$@")
-# Check for non-GNU getopt
-# shellcheck disable=SC2181
-if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi
+OPTIONS=$(getopt -o hv --long help,list,verbose -n "$0" -- "$@") || usage_error
cpio_opts="--preserve-modification-time --no-absolute-filenames --quiet"
expected_args=2