[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Option handling in grub-mkconfig
From: |
Colin Watson |
Subject: |
Re: Option handling in grub-mkconfig |
Date: |
Fri, 21 May 2010 11:57:14 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Fri, May 21, 2010 at 12:08:48PM +0200, Grégoire Sutre wrote:
> The processing of option `-o' in grub-mkconfig only works when
> it is the first option. The code is:
>
> # Check the arguments.
> for option in "$@"; do
> case "$option" in
> [...]
> -o)
> shift
> grub_cfg=$1
> ;;
> --output=*)
> grub_cfg=`echo "$option" | sed 's/--output=//'`
> ;;
How about:
=== modified file 'util/grub-mkconfig.in'
--- util/grub-mkconfig.in 2010-04-19 19:25:41 +0000
+++ util/grub-mkconfig.in 2010-05-21 10:54:18 +0000
@@ -50,7 +50,13 @@ EOF
}
# Check the arguments.
+next_grub_cfg=false
for option in "$@"; do
+ if $next_grub_cfg; then
+ grub_cfg=$option
+ next_grub_cfg=false
+ continue
+ fi
case "$option" in
-h | --help)
usage
@@ -59,8 +65,7 @@ for option in "$@"; do
echo "$0 (GNU GRUB ${package_version})"
exit 0 ;;
-o)
- shift
- grub_cfg=$1
+ next_grub_cfg=:
;;
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
@@ -72,6 +77,11 @@ for option in "$@"; do
;;
esac
done
+if $next_grub_cfg; then
+ echo "Missing argument to \`-o'" 1>&2
+ usage
+ exit 1
+fi
. ${libdir}/grub/grub-mkconfig_lib
--
Colin Watson address@hidden