summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmkinitramfs15
-rw-r--r--mkinitramfs.87
2 files changed, 18 insertions, 4 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"
diff --git a/mkinitramfs.8 b/mkinitramfs.8
index ced5d18..b31b542 100644
--- a/mkinitramfs.8
+++ b/mkinitramfs.8
@@ -16,6 +16,8 @@ mkinitramfs \- low-level tool for generating an initramfs image
.IR root ]
.RB [ \-v ]
.RI [ version ]
+.br
+.BR mkinitramfs " " -h
.SH DESCRIPTION
The
@@ -50,7 +52,6 @@ setting in
Set an alternate configuration directory.
.TP
-.TP
\fB\-k
Keep the temporary directory used to make the image.
@@ -75,6 +76,10 @@ Set the verbose mode output.
Set the kernel version of the initramfs image
(defaults to the running kernel).
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display usage information and exit.
+
.SH ENVIRONMENT
.B mkinitramfs
honours the