summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-08 07:46:46 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-08 19:26:51 -0500
commita6c3d202b14939006f39e22179a058159a8512fb (patch)
treee52ee0a6596db0e79e2dd687fa23a7ad8235ff27
parent014e7ea7f2361e9431926fca1959d868b9f3a430 (diff)
kernel-install: add -h/--help
-rw-r--r--src/kernel-install/kernel-install21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
index 9d3e75db08..f5ff3622a4 100644
--- a/src/kernel-install/kernel-install
+++ b/src/kernel-install/kernel-install
@@ -21,9 +21,9 @@
usage()
{
- echo "Usage:" >&2
- echo " $0 add <kernel-version> <kernel-image>" >&2
- echo " $0 remove <kernel-version> <kernel-image>" >&2
+ echo "Usage:"
+ echo " $0 add KERNEL-VERSION KERNEL-IMAGE"
+ echo " $0 remove KERNEL-VERSION KERNEL-IMAGE"
}
dropindirs_sort()
@@ -54,6 +54,13 @@ dropindirs_sort()
export LC_COLLATE=C
+for i in "$@"; do
+ if [ "$i" == "--help" -o "$i" == "-h" ]; then
+ usage
+ exit 0
+ fi
+done
+
if [[ "${0##*/}" == 'installkernel' ]]; then
COMMAND='add'
else
@@ -75,7 +82,7 @@ if ! [[ $MACHINE_ID ]]; then
fi
if [[ ! $COMMAND ]] || [[ ! $KERNEL_VERSION ]]; then
- usage
+ echo "Not enough arguments" >&2
exit 1
fi
@@ -90,8 +97,8 @@ readarray -t PLUGINS < <(
case $COMMAND in
add)
- if [[ ! $KERNEL_IMAGE ]]; then
- usage
+ if [[ ! "$KERNEL_IMAGE" ]]; then
+ echo "Command 'add' requires an argument" >&2
exit 1
fi
@@ -121,7 +128,7 @@ case $COMMAND in
;;
*)
- usage
+ echo "Unknown command '$COMMAND'" >&2
exit 1
;;
esac