summaryrefslogtreecommitdiff
path: root/data/live-build-config/hooks/live/01-live-serial.binary
blob: e138b20d7341718e2e0d369e3ebaf668f2ac7f34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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