From c80032179ca00694a70ff71aa5cd0db14a8a45e2 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 6 Feb 2019 02:40:07 +0000 Subject: Make all commands return 2 in case of a usage error Signed-off-by: Ben Hutchings --- lsinitramfs | 4 ++-- mkinitramfs | 6 +++--- unmkinitramfs | 2 +- update-initramfs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lsinitramfs b/lsinitramfs index 1235e4d..f86ad9c 100755 --- a/lsinitramfs +++ b/lsinitramfs @@ -9,7 +9,7 @@ usage() if [ "$#" -eq 0 ] ; then usage >&2 - exit 1 + exit 2 fi umi_opts="--list" @@ -17,7 +17,7 @@ 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 1 ; fi +if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi eval set -- "$OPTIONS" diff --git a/mkinitramfs b/mkinitramfs index aaed605..3c3eb6c 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -26,14 +26,14 @@ Options: See mkinitramfs(8) for further details. EOF - exit 1 + exit 2 } OPTIONS=$(getopt -o c:d:ko:r:v -n "$0" -- "$@") # Check for non-GNU getopt # shellcheck disable=SC2181 -if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi +if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi eval set -- "$OPTIONS" @@ -154,7 +154,7 @@ esac case "${version}" in */*) echo "$PROG: ${version} is not a valid kernel version" >&2 - exit 1 + exit 2 ;; esac diff --git a/unmkinitramfs b/unmkinitramfs index 9414403..852bc1b 100755 --- a/unmkinitramfs +++ b/unmkinitramfs @@ -120,7 +120,7 @@ splitinitramfs() 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 1 ; fi +if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 2 ; fi cpio_opts="--preserve-modification-time --no-absolute-filenames --quiet" expected_args=2 diff --git a/update-initramfs b/update-initramfs index c059266..2a8a413 100755 --- a/update-initramfs +++ b/update-initramfs @@ -56,7 +56,7 @@ usage_error() printf "%s\\n\\n" "${*}" >&2 fi usage >&2 - exit 1 + exit 2 } mild_panic() -- cgit v1.2.3