added getopt like error for missing option parameters

This commit is contained in:
BVK Chaitanya committed 2010-04-12 21:33:03 +05:30
1 parent 8f33d5549f
commit b02c7c8fb5
8 files changed
+120 -30

No files matched your search

+14 -3
View File
@@ -52,6 +52,17 @@ Report bugs to <bug-grub@gnu.org>.
EOF
}
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
input_dir=${pkglibdir}
# Check the arguments.
@@ -69,17 +80,17 @@ do
exit 0 ;;
--modules)
modules=$1; shift ;;
modules=`argument $option "$@"`; shift ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
--pkglibdir)
input_dir=$1; shift ;;
input_dir=`argument $option "$@"`; shift ;;
--pkglibdir=*)
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
--grub-mkimage)
grub_mkimage=$1; shift ;;
grub_mkimage=`argument $option "$@"`; shift ;;
--grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;