X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fkernel-install%2Fkernel-install;h=3ae1d77e33e026507891a84076d1fc6c5a1065bf;hb=cc64d0175a3c2c974709e9962c00fbe04d74c43f;hp=9d3e75db08102dd582252be422654a2579208b93;hpb=ea52e2aee8dd7b3f51e9a00e76a54ef12dc0e898;p=elogind.git diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install index 9d3e75db0..3ae1d77e3 100644 --- a/src/kernel-install/kernel-install +++ b/src/kernel-install/kernel-install @@ -21,9 +21,9 @@ usage() { - echo "Usage:" >&2 - echo " $0 add " >&2 - echo " $0 remove " >&2 + echo "Usage:" + echo " $0 add KERNEL-VERSION KERNEL-IMAGE" + echo " $0 remove KERNEL-VERSION" } 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