X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fkernel-install%2Fkernel-install;h=3ae1d77e33e026507891a84076d1fc6c5a1065bf;hp=fb2ee57b5b1b2260929c51fc44dba8c72fea3ec7;hb=1238ee09b7babb175b9bf7ad1d0e8eb2a414ee6e;hpb=8f51399e75e5d0d0741ecb18c549a57840bd1cc3 diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install index fb2ee57b5..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,9 +54,22 @@ dropindirs_sort() export LC_COLLATE=C -COMMAND="$1" -KERNEL_VERSION="$2" -KERNEL_IMAGE="$3" +for i in "$@"; do + if [ "$i" == "--help" -o "$i" == "-h" ]; then + usage + exit 0 + fi +done + +if [[ "${0##*/}" == 'installkernel' ]]; then + COMMAND='add' +else + COMMAND="$1" + shift +fi + +KERNEL_VERSION="$1" +KERNEL_IMAGE="$2" if [[ -f /etc/machine-id ]]; then read MACHINE_ID < /etc/machine-id @@ -69,7 +82,7 @@ if ! [[ $MACHINE_ID ]]; then fi if [[ ! $COMMAND ]] || [[ ! $KERNEL_VERSION ]]; then - usage + echo "Not enough arguments" >&2 exit 1 fi @@ -84,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 @@ -115,7 +128,7 @@ case $COMMAND in ;; *) - usage + echo "Unknown command '$COMMAND'" >&2 exit 1 ;; esac