summaryrefslogtreecommitdiff
path: root/data/live-build-config/hooks/live
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2023-09-14 16:27:17 +0200
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2023-09-14 22:04:26 +0200
commitd9e93d73535fd8ed8974605e355b5890fcdacd4b (patch)
tree6a29bf8fba31db2b6f11885c79c4a9b201ddbf66 /data/live-build-config/hooks/live
parent4727dc17566a85eb15c95ac97511bf6452352adb (diff)
downloadvyos-build-d9e93d73535fd8ed8974605e355b5890fcdacd4b.tar.gz
vyos-build-d9e93d73535fd8ed8974605e355b5890fcdacd4b.zip
live: T5568: Add serial boot option to live ISO
Diffstat (limited to 'data/live-build-config/hooks/live')
-rwxr-xr-xdata/live-build-config/hooks/live/01-live-serial.binary31
1 files changed, 31 insertions, 0 deletions
diff --git a/data/live-build-config/hooks/live/01-live-serial.binary b/data/live-build-config/hooks/live/01-live-serial.binary
new file mode 100755
index 00000000..e138b20d
--- /dev/null
+++ b/data/live-build-config/hooks/live/01-live-serial.binary
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+GRUB_PATH=boot/grub/grub.cfg
+ISOLINUX_PATH=isolinux/live.cfg
+
+KVM_CONSOLE="console=ttyS0,115200 console=tty0"
+SERIAL_CONSOLE="console=tty0 console=ttyS0,115200"
+
+# Grub.cfg Update
+GRUB_MENUENTRY=$(sed -e '/menuentry.*hotkey.*/,/^}/!d' -e 's/--hotkey=l//g' $GRUB_PATH)
+
+# Update KVM menuentry name
+sed -i 's/"Live system \((.*-vyos)\)"/"Live system \1 - KVM console"/' $GRUB_PATH
+
+# Insert serial menuentry
+echo "$GRUB_MENUENTRY" | sed \
+ -e 's/"Live system \((.*-vyos)\)"/"Live system \1 - Serial console"/' \
+ -e "s/$KVM_CONSOLE/$SERIAL_CONSOLE/g" >> $GRUB_PATH
+
+# Live.cfg Update
+ISOLINUX_MENUENTRY=$(sed -e '/label live-\(.*\)-vyos$/,/^\tappend.*/!d' $ISOLINUX_PATH)
+
+# Update KVM menuentry name
+sed -i 's/Live system \((.*-vyos)\)/Live system \1 - KVM console/' $ISOLINUX_PATH
+
+# Insert serial menuentry
+echo "\n$ISOLINUX_MENUENTRY" | sed \
+ -e 's/live-\(.*\)-vyos/live-\1-vyos-serial/' \
+ -e '/^\tmenu default/d' \
+ -e 's/Live system \((.*-vyos)\)/Live system \1 - Serial console/' \
+ -e "s/$KVM_CONSOLE/$SERIAL_CONSOLE/g" >> $ISOLINUX_PATH