diff options
Diffstat (limited to 'scripts/vyos/grub-serial.sh')
-rw-r--r-- | scripts/vyos/grub-serial.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/vyos/grub-serial.sh b/scripts/vyos/grub-serial.sh new file mode 100644 index 0000000..5beb889 --- /dev/null +++ b/scripts/vyos/grub-serial.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +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 +fi + +GRUB_CFG="/boot/grub/grub.cfg" +GRUB_DEFAULT="/etc/default/grub" + +sed -i 's/^set default=.*/set default=1/' $GRUB_CFG + +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 + + |