[arch-projects] [MKINITCPIO][PATCH 1/2] Fix printing of bash usage when asking for a bad hook

Sebastien Luttringer seblu at seblu.net
Sun Jun 26 13:13:34 EDT 2011


before:
mkinitcpio -H sex
/sbin/mkinitcpio: line 105: /lib/initcpio/install/sex: No such file or directory
Help for hook 'sex':
GNU bash, version 4.2.10(2)-release (x86_64-unknown-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.

after:
mkinitcpio -H sex
No such hook: sex

Signed-off-by: Sebastien Luttringer <seblu at seblu.net>
---
 mkinitcpio |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/mkinitcpio b/mkinitcpio
index 4082ba5..6be7fbd 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -118,8 +118,9 @@ while getopts ':c:k:sb:g:p:m:nvH:LMhS:t:z:' arg; do
            IFS=${OLDIFS}
            unset OLDIFS
            ;;
-        H) . "${INSTDIR}/${OPTARG}";
-           msg "Help for hook '${OPTARG}'"
+        H) [[ ! -r "${INSTDIR}/${OPTARG}" ]] && echo "No such hook: ${OPTARG}" && exit 1
+	   . "${INSTDIR}/${OPTARG}";
+           echo "Help for hook '${OPTARG}':"
            help
            exit 0 ;;
         L) msg "Available hooks"
-- 
Sebastien "Seblu" Luttringer



More information about the arch-projects mailing list