Make all commands return 2 in case of a usage error

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
This commit is contained in:
Ben Hutchings 2019-02-06 02:40:07 +00:00
parent ccf07ee2f1
commit c80032179c
4 changed files with 7 additions and 7 deletions

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -56,7 +56,7 @@ usage_error()
printf "%s\\n\\n" "${*}" >&2
fi
usage >&2
exit 1
exit 2
}
mild_panic()