From: Colin Watson <cjwatson@ubuntu.com>
To: grub-devel@gnu.org
Subject: Re: Option handling in grub-mkconfig
Date: Fri, 21 May 2010 11:57:14 +0100 [thread overview]
Message-ID: <20100521105714.GD21862@riva.ucam.org> (raw)
In-Reply-To: <4BF65BB0.6010303@gmail.com>
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 [cjwatson@ubuntu.com]
next prev parent reply other threads:[~2010-05-21 10:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-21 10:08 Option handling in grub-mkconfig Grégoire Sutre
2010-05-21 10:57 ` Colin Watson [this message]
2010-05-21 12:19 ` Grégoire Sutre
2010-05-21 13:16 ` Colin Watson
2010-05-21 18:20 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-05-24 4:42 ` BVK Chaitanya
2010-05-24 12:12 ` Grégoire Sutre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100521105714.GD21862@riva.ucam.org \
--to=cjwatson@ubuntu.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.