summaryrefslogtreecommitdiff
path: root/mkinitramfs
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2019-02-06 01:47:03 +0000
committerBen Hutchings <ben@decadent.org.uk>2019-02-06 03:37:04 +0000
commitfc81f7f5f0da28d3f7b89bf57c8ddd4f8fd7d4f2 (patch)
treece21db4b55a8feec5c84404614f9477e5940499e /mkinitramfs
parentc80032179ca00694a70ff71aa5cd0db14a8a45e2 (diff)
mkinitramfs: Support -h and --help options
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'mkinitramfs')
-rwxr-xr-xmkinitramfs15
1 files changed, 12 insertions, 3 deletions
diff --git a/mkinitramfs b/mkinitramfs
index 3c3eb6c..4a4a4ea 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -13,7 +13,7 @@ export BUSYBOXDIR
usage()
{
- cat >&2 << EOF
+ cat << EOF
Usage: ${0} [OPTION]... -o outfile [version]
@@ -26,10 +26,15 @@ Options:
See mkinitramfs(8) for further details.
EOF
+}
+
+usage_error()
+{
+ usage >&2
exit 2
}
-OPTIONS=$(getopt -o c:d:ko:r:v -n "$0" -- "$@")
+OPTIONS=$(getopt -o c:d:hko:r:v --long help -n "$0" -- "$@")
# Check for non-GNU getopt
# shellcheck disable=SC2181
@@ -51,6 +56,10 @@ while true; do
exit 1
fi
;;
+ -h|--help)
+ usage
+ exit 0
+ ;;
-o)
outfile="$2"
shift 2
@@ -128,7 +137,7 @@ if [ -n "${UMASK:-}" ]; then
fi
if [ -z "${outfile}" ]; then
- usage
+ usage_error
fi
touch "$outfile"