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

[PATCH grub-installer master] put grub-installer modifications in grub.d



To prevent loss of config when grub-pc is updated and the user naively
chooses to take the maintainer's version any intelligent modifications
done during installation will be lost.

Instead we take advantage of the fact that the grub-pc package in
Debian since tag 2.00-10 contained some version of reading
/etc/default/grub.d/*.cfg to read additional configuration without
triggering a ucf missmatch.

Reported-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
---

Please consider this for backport to Jessie, I was able to cherry-pick
this patch cleanly on top of version 1.117+deb8u1. Also of note I only
tested with a rebuilt Jessie installer using monolithic and localudebs
version of grub-installer udeb.

Thanks!

 grub-installer | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/grub-installer b/grub-installer
index 8b4531231e09..c6d911e882d8 100755
--- a/grub-installer
+++ b/grub-installer
@@ -1151,16 +1151,9 @@ if [ "$serial" ] ; then
 		mv $ROOT/boot/grub/$menu_file.new $ROOT/boot/grub/$menu_file
 		;;
 	    grub-pc|grub-efi*)
-		if grep -q "^GRUB_TERMINAL=" $ROOT/etc/default/grub; then
-			sed -i $ROOT/etc/default/grub -e "s/^\(GRUB_TERMINAL\)=.*/\1=serial/g"
-		else
-			echo "GRUB_TERMINAL=serial" >> $ROOT/etc/default/grub
-		fi
-		if grep -q "^GRUB_SERIAL_COMMAND=" $ROOT/etc/default/grub ; then
-			sed -i $ROOT/etc/default/grub -e "s/^\(GRUB_SERIAL_COMMAND\)=.*/\1=\"`grub_serial_console $serial`\"/g"
-		else
-			echo "GRUB_SERIAL_COMMAND=\"`grub_serial_console $serial`\"" >> $ROOT/etc/default/grub
-		fi
+		mkdir -p $ROOT/etc/default/grub.d
+		echo "GRUB_TERMINAL=serial" > $ROOT/etc/default/grub.d/00-installer-defaults.cfg
+		echo "GRUB_SERIAL_COMMAND=\"`grub_serial_console $serial`\"" >> $ROOT/etc/default/grub.d/00-installer-defaults.cfg
 		update_grub # propagate to grub.cfg
 		;;
 	esac
-- 
2.1.4


Reply to: