summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-06-16 18:25:29 +0200
committerAaron Griffin <aaron@archlinux.org>2006-06-16 18:25:29 +0200
commitf915839219cadde8cba5e286df51a6a8de404149 (patch)
treee0202009ab624d650ba9adf1eb9d9947da365073
parentc3115e19e9874dc0e193bf82ef671f5f879321a6 (diff)
downloadmkinitcpio-f915839219cadde8cba5e286df51a6a8de404149.tar.gz
mkinitcpio-f915839219cadde8cba5e286df51a6a8de404149.tar.xz
Fixed optarg picking up other options...
git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@129 880c04e9-e011-0410-abf7-b926e227c9cd
-rw-r--r--mkinitcpio8
1 files changed, 7 insertions, 1 deletions
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