Bug#470894: grub-installer: user parameters are not added to grub.cfg for grub2
- To: Colin Watson <cjwatson@debian.org>
- Cc: 470894@bugs.debian.org
- Subject: Bug#470894: grub-installer: user parameters are not added to grub.cfg for grub2
- From: Felix Zielcke <fzielcke@z-51.de>
- Date: Tue, 01 Sep 2009 09:15:32 +0200
- Message-id: <[🔎] 1251789332.2864.1.camel@fz.local>
- Reply-to: Felix Zielcke <fzielcke@z-51.de>, 470894@bugs.debian.org
- In-reply-to: <20090831231432.GM16966@riva.ucam.org>
- References: <200803141224.19699.elendil@planet.nl> <20090610143917.GA7827@riva.ucam.org> <1244721456.3552.29.camel@fz.local> <20090611140336.GA25892@riva.ucam.org> <1249028706.3635.1.camel@fz.local> <1249379149.3524.21.camel@fz.local> <1249624744.3592.1.camel@fz.local> <20090831231432.GM16966@riva.ucam.org>
Am Dienstag, den 01.09.2009, 00:14 +0100 schrieb Colin Watson:
> On Fri, Aug 07, 2009 at 07:59:04AM +0200, Felix Zielcke wrote:
> > Am Dienstag, den 04.08.2009, 11:45 +0200 schrieb Felix Zielcke:
> > > Here's now a patch which does it without a version check.
> >
> > I suggest to change the sed expression to
> > "s!^GRUB_CMDLINE_LINUX=\"\?\([^\"]*\)\"\?!GRUB_CMDLINE_LINUX=\"\1 xyz\"!"
> > because in lenny we just have GRUB_CMDLINE_LINUX= in /etc/defaul/grub
> > or does someone have a better one?
>
> Better to sed s!^GRUB_CMDLINE_LINUX=$!GRUB_CMDLINE_LINUX=""! first. But
> then that also leaves unsightly leading spaces. There's no obvious
> reason why we need to preserve any existing value in these variables, of
> course.
>
> However, now that grub2/linux_cmdline and grub2/linux_cmdline_default
> debconf questions exist, we need to preseed them anyway to stop them
> being asked in a default installation. As long as we have to do that, it
> seems to me that we might as well set them to reasonable values.
>
> How does this patch look?
>
> Index: grub-installer
> ===================================================================
> --- grub-installer (revision 60561)
> +++ grub-installer (working copy)
> @@ -394,6 +394,25 @@
> ;;
> esac
>
> +user_params=$(user-params) || true
> +defopt_params=""
> +kopt_params=""
> +for u_param in $user_params; do
> + case "$u_param" in
> + quiet)
> + defopt_params=${defopt_params:+$defopt_params }$u_param ;;
> + *)
> + kopt_params=${kopt_params:+$kopt_params }$u_param ;;
> + esac
> +done
> +if [ "$grub_version" = grub2 ]; then
> + # quoting to deconfuse vim
> + chroot /target 'debconf-set-selections' <<EOF
> +$grub_package grub2/linux_cmdline string $kopt_params
> +$grub_package grub2/linux_cmdline_default string $defopt_params
> +EOF
> +fi
> +
> db_progress START 0 6 grub-installer/progress/title
>
> db_subst grub-installer/progress/step_install GRUB "$grub_version"
> @@ -726,17 +745,6 @@
>
> # Add user parameters to menu.list; some options are only added to the
> # default entry for a kernel instead of all entries
You forgot to move that comment and maybe it shouldn't say anymore
menu.list but menu.lst or /etc/default/grub or something like that.
Except of this, it looks fine to me.
> -user_params=$(user-params) || true
> -defopt_params=""
> -kopt_params=""
> -for u_param in $user_params; do
> - case "$u_param" in
> - quiet)
> - defopt_params=${defopt_params:+$defopt_params }$u_param ;;
> - *)
> - kopt_params=${kopt_params:+$kopt_params }$u_param ;;
> - esac
> -done
> if [ "$defopt_params" ]; then
> sed -i "s!^\(# defoptions=.*\)!\1 $defopt_params!" $ROOT/boot/grub/$menu_file
> fi
>
Reply to: