bts tag 470894 patch thanks Am Freitag, den 31.07.2009, 10:25 +0200 schrieb Felix Zielcke: > Am Donnerstag, den 11.06.2009, 15:03 +0100 schrieb Colin Watson: > > If you, and others on this list, agree with that claim, then we can > > simply go ahead and have grub-installer edit /etc/default/grub to > > insert > > the output of user-params, on the condition that the default text - > > i.e. > > what you get if you just press enter at the boot: prompt - is > > character-for-character the same as what's in the conffile shipped in > > the grub-pc package. However, if you disagree, then I think it will be > > necessary to convert grub-pc (and I suppose the other grub-* binary > > packages) to manage /etc/default/grub using ucf. > > Now that we use ucf for it, it should be easy to implement for someone > who knows sed. > Which I don't unfortunately, so I don't know how to do it. > > Should there be then a check for the version with ucf in case people > install lenny with current grub-installer to be real policy compliant? > In that case the version would be 1.96+20090611-1.
Here's now a patch which does it without a version check. -- Felix Zielcke Proud Debian Maintainer
Index: grub-installer =================================================================== --- grub-installer (revision 59908) +++ grub-installer (working copy) @@ -731,10 +731,30 @@ for u_param in $user_params; do esac done if [ "$defopt_params" ]; then - sed -i "s!^\(# defoptions=.*\)!\1 $defopt_params!" $ROOT/boot/grub/$menu_file + case "$grub_version" in + grub) + sed -i "s!^\(# defoptions=.*\)!\1 $defopt_params!" $ROOT/boot/grub/$menu_file ;; + grub2) + if grep -q GRUB_CMDLINE_LINUX $ROOT/boot/grub/$menu_file ; then + sed -i "s!^GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)\"!GRUB_CMDLINE_LINUX_DEFAULT=\"\1 $defopt_params\"!" $ROOT/boot/grub/$menu_file + else + echo "GRUB_CMDLINE_LINUX_DEFAULT=\"$defopt_params\"" >> $ROOT/boot/grub/$menu_file + fi + ;; + esac fi if [ "$kopt_params" ]; then - sed -i "s!^\(# kopt=.*\)!\1 $kopt_params!" $ROOT/boot/grub/$menu_file + case ("$grub_version") in + grub) + sed -i "s!^\(# kopt=.*\)!\1 $kopt_params!" $ROOT/boot/grub/$menu_file + grub2) + if grep -q GRUB_CMDLINE_LINUX $ROOT/boot/grub/$menu_file ; then + sed -i "s!^GRUB_CMDLINE_LINUX=\"\(.*\)\"!GRUB_CMDLINE_LINUX_DEFAULT=\"\1 $kopt_params\"!" $ROOT/boot/grub/$menu_file + else + echo "GRUB_CMDLINE_LINUX=\"$kopt_params\"" >> $ROOT/boot/grub/$menu_file + fi + ;; + esac fi # In either case, update the Debian kernel entries if [ "$user_params" ]; then