[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#470894: grub-installer: user parameters are not added to grub.cfg for grub2



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: