summaryrefslogtreecommitdiff
path: root/scripts/vyos/grub-serial.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vyos/grub-serial.sh')
-rw-r--r--scripts/vyos/grub-serial.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/vyos/grub-serial.sh b/scripts/vyos/grub-serial.sh
index b72b1a8..5beb889 100644
--- a/scripts/vyos/grub-serial.sh
+++ b/scripts/vyos/grub-serial.sh
@@ -3,6 +3,7 @@
set -e
set -x
+#GRUB_SERIAL=1
if [[ "${GRUB_SERIAL}" -ne 1 ]]; then
echo "$0 - info: grub will keep default=0 (kvm). to use serial add to .env: GRUB_SERIAL=1"
exit 0
@@ -12,4 +13,13 @@ GRUB_CFG="/boot/grub/grub.cfg"
GRUB_DEFAULT="/etc/default/grub"
sed -i 's/^set default=.*/set default=1/' $GRUB_CFG
-sed -i 's/^set default=.*/set default=1/' $GRUB_DEFAULT
+
+if grep -q "^GRUB_DEFAULT=" $GRUB_DEFAULT; then
+ sed -i 's/^GRUB_DEFAULT=.*/GRUB_DEFAULT=1/' $GRUB_DEFAULT
+else
+ echo "GRUB_DEFAULT=1" >> $GRUB_DEFAULT
+fi
+
+# update-grub
+
+