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

[PATCH 1/2] Fix regular expressions to work with Jessie grub



---
 cronscript   | 4 ++--
 preseed_late | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cronscript b/cronscript
index e7a4aae..ded6349 100755
--- a/cronscript
+++ b/cronscript
@@ -29,7 +29,7 @@ if [ $(echo "$LANGSEL" | wc -l) -eq 2 ]; then
 else
 	# Selected language is the last in the file
 	LANG="$LANGSEL"
-	NEXTLANG="$(egrep -v "^[[:space:]]*(#.*)?$" langlist | head -n1)"
+	NEXTLANG="$(egrep -v '^[[:space:]]*(#.*)?$' langlist | head -n1)"
 fi
 
 LOCALE=$(echo "$LANG" | cut -d: -f1)
@@ -39,7 +39,7 @@ GRUBLINE=$(echo "$LANG" | cut -d: -f4)
 sed -i "s/LANGNAME \".*\"/LANGNAME \"$LANGNAME\"/" preseed_early
 
 sed -i "s/locale=.*$/locale=$LOCALE $GRUBLINE/
-        s/^set default=.*$/set default=\"2\"/" $ROOT/boot/grub/grub.cfg
+        s/^\([[:space:]]*\)set default=\"[[:digit:]]*\"$/\1set default=\"2\"/" $ROOT/boot/grub/grub.cfg
 
 # Comment out the next three lines if you don't want the language to change
 N_LOCALE=$(echo "$NEXTLANG" | cut -d: -f1)
diff --git a/preseed_late b/preseed_late
index 326e4ac..e70889a 100755
--- a/preseed_late
+++ b/preseed_late
@@ -11,7 +11,7 @@ echo "@reboot	root	/root/cronscript; reboot" >>/target/etc/crontab
 
 mount /dev/discs/disc0/part1 /hd-media -o remount,rw
 
-sed -i "s/^set default=.*$/set default=\"3\"/" /hd-media/boot/grub/grub.cfg
+sed -i "s/^\([[:space:]]*\)set default=\"[[:digit:]]*\"$/\1set default=\"3\"/" /hd-media/boot/grub/grub.cfg
 
 if [ -d /target/etc/gdm3 ] ; then
 	# Enable automatic login (chroot because of bug in busybox sed)
-- 
2.7.0


-- 
Jan Dittberner - Debian Developer
GPG-key: 4096R/558FB8DD 2009-05-10
         B2FF 1D95 CE8F 7A22 DF4C  F09B A73E 0055 558F B8DD
https://portfolio.debian.net/ - https://people.debian.org/~jandd/

Attachment: signature.asc
Description: PGP signature


Reply to: