mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-21 06:49:35 +00:00
added getopt like error for missing option parameters
This commit is contained in:
1 parent
8f33d5549f
commit
b02c7c8fb5
8 files changed
+120
-30
No files matched your search
@@ -71,6 +71,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
|
||||
@@ -86,27 +97,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-mkimage)
|
||||
grub_mkimage=$1; shift ;;
|
||||
grub_mkimage=`argument $option "$@"`; shift ;;
|
||||
--grub-mkimage=*)
|
||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||
|
||||
--grub-mkdevicemap)
|
||||
grub_mkdevicemap=$1; shift ;;
|
||||
grub_mkdevicemap=`argument $option "$@"`; shift ;;
|
||||
--grub-mkdevicemap=*)
|
||||
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
||||
|
||||
--grub-probe)
|
||||
grub_probe=$1; shift ;;
|
||||
grub_probe=`argument $option "$@"`; shift ;;
|
||||
--grub-probe=*)
|
||||
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
||||
|
||||
|
||||
Reference in new issue
Block a user