[arch-projects] [MKINITCPIO][PATCH 1/2] Fix printing of bash usage when asking for a bad hook
Thomas Bächler
thomas at archlinux.org
Sat Jun 25 06:36:51 EDT 2011
Am 20.06.2011 00:25, schrieb Dave Reisner:
> On Sat, Jun 18, 2011 at 07:04:26AM +0200, Sebastien Luttringer wrote:
>> 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 | 3 ++-
>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/mkinitcpio b/mkinitcpio
>> index 70710eb..7b8f503 100755
>> --- a/mkinitcpio
>> +++ b/mkinitcpio
>> @@ -102,7 +102,8 @@ while getopts ':c:k:s:b:g:a:p:m:vH:LMhS:' arg; do
>> IFS=${OLDIFS}
>> unset OLDIFS
>> ;;
>> - H) . "${INSTDIR}/${OPTARG}";
>> + H) [[ ! -r "${INSTDIR}/${OPTARG}" ]] && echo "No such hook: ${OPTARG}" && exit 1
>> + . "${INSTDIR}/${OPTARG}";
>> echo "Help for hook '${OPTARG}':"
>> help
>> cleanup
>> --
>> Sebastien "Seblu" Luttringer
>>
>
> If we're going to check this (and I agree we should -- was about to push
> my own patch), there should be a check to make sure 'help' exists as a
> function as well after sourcing the hook.
>
> d
>
>
I am applying this as-is, we can complete this check later.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-projects/attachments/20110625/0ee0103c/attachment.asc>
More information about the arch-projects
mailing list