added getopt like error for missing option parameters
This commit is contained in:
parent
8f33d5549f
commit
b02c7c8fb5
8 changed files with 120 additions and 30 deletions
|
@ -74,6 +74,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
|
||||
}
|
||||
|
||||
# Check the arguments.
|
||||
while test $# -gt 0
|
||||
do
|
||||
|
@ -89,27 +100,27 @@ do
|
|||
exit 0 ;;
|
||||
|
||||
--modules)
|
||||
modules=$1; shift ;;
|
||||
modules=`argument $option "$@"`; shift ;;
|
||||
--modules=*)
|
||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||
|
||||
--root-directory)
|
||||
rootdir=$1; shift ;;
|
||||
rootdir=`argument $option "$@"`; shift ;;
|
||||
--root-directory=*)
|
||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||
|
||||
--grub-mkdevicemap)
|
||||
grub_mkdevicemap=$1; shift ;;
|
||||
grub_mkdevicemap=`argument $option "$@"`; shift ;;
|
||||
--grub-mkdevicemap=*)
|
||||
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
||||
|
||||
--grub-mkimage)
|
||||
grub_mkimage=$1; shift ;;
|
||||
grub_mkimage=`argument $option "$@"`; shift ;;
|
||||
--grub-mkimage=*)
|
||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||
|
||||
--grub-probe)
|
||||
grub_probe=$1; shift ;;
|
||||
grub_probe=`argument $option "$@"`; shift ;;
|
||||
--grub-probe=*)
|
||||
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue