mirror of
https://salsa.debian.org/kernel-team/initramfs-tools.git
synced 2026-01-26 15:39:08 +00:00
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:
parent
ccf07ee2f1
commit
c80032179c
@ -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"
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -56,7 +56,7 @@ usage_error()
|
||||
printf "%s\\n\\n" "${*}" >&2
|
||||
fi
|
||||
usage >&2
|
||||
exit 1
|
||||
exit 2
|
||||
}
|
||||
|
||||
mild_panic()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user