From f915839219cadde8cba5e286df51a6a8de404149 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Fri, 16 Jun 2006 16:25:29 +0000 Subject: Fixed optarg picking up other options... git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@129 880c04e9-e011-0410-abf7-b926e227c9cd --- mkinitcpio | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mkinitcpio b/mkinitcpio index 9b85fab..fb53086 100644 --- a/mkinitcpio +++ b/mkinitcpio @@ -47,7 +47,12 @@ usage () exit 1 } -while getopts 'c:k:s:b:g:a:vH:LMh' arg; do +while getopts ':c:k:s:b:g:a:vH:LMh' arg; do + if [ "${OPTARG:0:1}" = "-" ]; then + echo "error: optional argument to '-$arg' begins with a '-'" + echo " you probably don't want this....aborting." + usage + fi case "$arg" in c) CONFIG="$OPTARG" ;; k) KERNELVERSION="$OPTARG" ;; @@ -67,6 +72,7 @@ while getopts 'c:k:s:b:g:a:vH:LMh' arg; do exit 0 ;; M) SHOW_AUTOMODS="y" ;; h|?) usage ;; + :) echo "${OPTARG} requires a value..."; usage ;; *) echo "invalid argument '$arg'"; usage ;; esac done -- cgit v1.2.3-24-g4f1b