summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-03-25 02:23:32 +0000
committerRaphaƫl Hertzog <raphael@offensive-security.com>2020-04-23 09:59:56 +0200
commit69093d9e3b7ebc2d3691f683fd447653e211a654 (patch)
tree53cf425c3212d3877f627b5e78a277a77fecf59c
parent1f1b156697154179cdc0b8d95452b2f22c67eb9f (diff)
downloadvyos-live-build-69093d9e3b7ebc2d3691f683fd447653e211a654.tar.gz
vyos-live-build-69093d9e3b7ebc2d3691f683fd447653e211a654.zip
grub2|loopback: extract install menu entries to config files
backwards compatibility: 1. the new install.cfg and install_start.cfg files (chosen automatically from the install_*gui.cfg and install_*test.cfg files) will be included alongside any user custom config. 2. the placeholders are now replaced with lines importing these files thus everything will work just as before, i.e. no backwards compatibility breakage. Gbp-Dch: Short
-rwxr-xr-xscripts/build/binary_loopback_cfg66
-rw-r--r--share/bootloaders/grub-pc/install_gui.cfg44
-rw-r--r--share/bootloaders/grub-pc/install_start_gui.cfg4
-rw-r--r--share/bootloaders/grub-pc/install_start_text.cfg4
-rw-r--r--share/bootloaders/grub-pc/install_text.cfg19
5 files changed, 90 insertions, 47 deletions
diff --git a/scripts/build/binary_loopback_cfg b/scripts/build/binary_loopback_cfg
index 113fd7be0..acf654885 100755
--- a/scripts/build/binary_loopback_cfg
+++ b/scripts/build/binary_loopback_cfg
@@ -65,31 +65,6 @@ Grub_live_entry ()
LINUX_LIVE="${LINUX_LIVE}$(Grub_menu_entry "$@")$NL"
}
-Grub_install_entry ()
-{
- local LABEL="${1}"
- local TYPE="${2}"
- local KERNEL="${3}"
- local INITRD="${4}"
- local APPEND="${5}"
- local HOTKEY="${6}"
-
- # Drop "quiet" kernel parameter for expert entries
- case $TYPE in
- expert|expertgui)
- APPEND=$(echo "$APPEND" | sed -e 's/ --- quiet//')
- ;;
- esac
-
- if [ -z "$LINUX_INSTALL" ]; then
- # First entry recorded in LINUX_INSTALL
- LINUX_INSTALL="$(Grub_menu_entry "$LABEL" "$KERNEL" "$INITRD" "$APPEND" "$HOTKEY")$NL"
- else
- # Remaining entries recorded in LINUX_ADVANCED_INSTALL
- LINUX_ADVANCED_INSTALL="$LINUX_ADVANCED_INSTALL$(Grub_menu_entry "$LABEL" "$KERNEL" "$INITRD" "$APPEND" "$HOTKEY")$NL"
- fi
-}
-
Grub_live_autodetect_menu_entry ()
{
local LABEL="${1}"
@@ -234,6 +209,8 @@ fi
if [ "${LB_DEBIAN_INSTALLER}" != "none" ]
then
ENABLE_INSTALL_MENU="true"
+ LINUX_INSTALL="source /boot/grub/install_start.cfg"
+ LINUX_ADVANCED_INSTALL="source /boot/grub/install.cfg"
KERNEL_DI="/install/vmlinuz"
INITRD_DI="/install/initrd.gz"
@@ -244,28 +221,22 @@ then
APPEND_GI="vga=788 ${LB_BOOTAPPEND_INSTALL} --- quiet"
if [ "${LB_DEBIAN_INSTALLER_GUI}" = "true" ]; then
- Grub_install_entry "Start installer" "installgui" "${KERNEL_GI}" "${INITRD_GI}" "${APPEND_GI}" "i"
-
- Grub_install_entry "Install in graphical mode" "installgui" "${KERNEL_GI}" "${INITRD_GI}" "${APPEND_GI}" "g"
- Grub_install_entry "Install in text mode" "install" "${KERNEL_DI}" "${INITRD_DI}" "${APPEND_DI}" "i"
- Grub_install_entry "Expert install in graphical mode" "expertgui" "${KERNEL_GI}" "${INITRD_GI}" "priority=low ${APPEND_GI}" "x"
- Grub_install_entry "Expert install in text mode" "expert" "${KERNEL_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}"
- Grub_install_entry "Automatic install in graphical mode" "autogui" "${KERNEL_GI}" "${INITRD_GI}" "auto=true priority=critical ${APPEND_GI}" "a"
- Grub_install_entry "Automatic install in text mode" "auto" "${KERNEL_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}"
- Grub_install_entry "Rescue system in graphical mode" "rescuegui" "${KERNEL_GI}" "${INITRD_GI}" "rescue/enable=true ${APPEND_GI}" "r"
- Grub_install_entry "Rescue system in text mode" "rescue" "${KERNEL_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}"
- # Note, the following speech synthesis entry deliberately uses graphical kernel, but normal video params, copying the official Debian install disc
- Grub_install_entry "Install in graphical mode with speech synthesis" "${KERNEL_GI}" "${INITRD_GI}" "speakup.synth=soft ${APPEND_GI}" "s"
+ rm binary/boot/grub/install_text.cfg
+ rm binary/boot/grub/install_start_text.cfg
+ mv binary/boot/grub/install_gui.cfg binary/boot/grub/install.cfg
+ mv binary/boot/grub/install_start_gui.cfg binary/boot/grub/install_start.cfg
else
- Grub_install_entry "Start installer" "install" "${KERNEL_DI}" "${INITRD_DI}" "${APPEND_DI}" "i"
-
- Grub_install_entry "Install in text mode" "install" "${KERNEL_DI}" "${INITRD_DI}" "${APPEND_DI}" "i"
- Grub_install_entry "Expert install in text mode" "expert" "${KERNEL_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}" "x"
- Grub_install_entry "Automatic install in text mode" "auto" "${KERNEL_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}" "a"
- Grub_install_entry "Rescue system in text mode" "rescue" "${KERNEL_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}" "r"
+ rm binary/boot/grub/install_gui.cfg
+ rm binary/boot/grub/install_start_gui.cfg
+ mv binary/boot/grub/install_text.cfg binary/boot/grub/install.cfg
+ mv binary/boot/grub/install_start_text.cfg binary/boot/grub/install_start.cfg
fi
else
ENABLE_INSTALL_MENU="false"
+ rm binary/boot/grub/install_text.cfg
+ rm binary/boot/grub/install_gui.cfg
+ rm binary/boot/grub/install_start_text.cfg
+ rm binary/boot/grub/install_start_gui.cfg
fi
# Assembling memtest configuration
@@ -281,8 +252,8 @@ escape_for_sed() {
# Those without '@' markers are for backwards compatibility
sed -i \
-e "s|@LINUX_LIVE@|$(escape_for_sed "${LINUX_LIVE}")|" \
- -e "s|@LINUX_INSTALL@|$(escape_for_sed "${LINUX_INSTALL}")|" \
- -e "s|@LINUX_ADVANCED_INSTALL@|$(escape_for_sed "${LINUX_ADVANCED_INSTALL}")|" \
+ -e "s|@LINUX_INSTALL@|${LINUX_INSTALL}|" \
+ -e "s|@LINUX_ADVANCED_INSTALL@|${LINUX_ADVANCED_INSTALL}|" \
-e "s|@MEMTEST@|$(escape_for_sed "${MEMTEST}")|" \
-e "s|@KERNEL_GI@|${KERNEL_GI}|" \
-e "s|@INITRD_GI@|${INITRD_GI}|" \
@@ -296,10 +267,11 @@ sed -i \
-e "s|@LB_BOOTAPPEND_INSTALL@|${LB_BOOTAPPEND_INSTALL}|" \
-e "s|@LB_BOOTAPPEND_LIVE_FAILSAFE@|${LB_BOOTAPPEND_LIVE_FAILSAFE}|" \
-e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|" \
+ -e "s|@APPEND_INSTALL@|${LB_BOOTAPPEND_INSTALL}|" \
-e "s|@ENABLE_INSTALL_MENU@|${ENABLE_INSTALL_MENU}|" \
-e "s|LINUX_LIVE|$(escape_for_sed "${LINUX_LIVE}")|" \
- -e "s|LINUX_INSTALL|$(escape_for_sed "${LINUX_INSTALL}")|" \
- -e "s|LINUX_ADVANCED_INSTALL|$(escape_for_sed "${LINUX_ADVANCED_INSTALL}")|" \
+ -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" \
+ -e "s|LINUX_ADVANCED_INSTALL|${LINUX_ADVANCED_INSTALL}|" \
-e "s|MEMTEST|$(escape_for_sed "${MEMTEST}")|" \
-e "s|KERNEL_GI|${KERNEL_GI}|" \
-e "s|INITRD_GI|${INITRD_GI}|" \
diff --git a/share/bootloaders/grub-pc/install_gui.cfg b/share/bootloaders/grub-pc/install_gui.cfg
new file mode 100644
index 000000000..c4361de5a
--- /dev/null
+++ b/share/bootloaders/grub-pc/install_gui.cfg
@@ -0,0 +1,44 @@
+menuentry 'Graphical install' --hotkey=g {
+ linux @KERNEL_GI@ vga=788 @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_GI@
+}
+
+menuentry 'Graphical expert install' --hotkey=x {
+ linux @KERNEL_GI@ priority=low vga=788 @APPEND_INSTALL@
+ initrd @INITRD_GI@
+}
+
+menuentry 'Graphical rescue mode' --hotkey=r {
+ linux @KERNEL_GI@ rescue/enable=true vga=788 @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_GI@
+}
+
+menuentry 'Graphical automated install' --hotkey=a {
+ linux @KERNEL_GI@ auto=true priority=critical vga=788 @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_GI@
+}
+
+menuentry 'Install' --hotkey=i {
+ linux @KERNEL_DI@ vga=normal @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_DI@
+}
+
+menuentry 'Expert install' {
+ linux @KERNEL_DI@ priority=low vga=normal @APPEND_INSTALL@
+ initrd @INITRD_DI@
+}
+
+menuentry 'Rescue mode' {
+ linux @KERNEL_DI@ rescue/enable=true vga=normal @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_DI@
+}
+
+menuentry 'Automated install' {
+ linux @KERNEL_DI@ auto=true priority=critical vga=normal @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_DI@
+}
+
+menuentry 'Install with speech synthesis' --hotkey=s {
+ linux @KERNEL_GI@ speakup.synth=soft vga=788 @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_GI@
+}
diff --git a/share/bootloaders/grub-pc/install_start_gui.cfg b/share/bootloaders/grub-pc/install_start_gui.cfg
new file mode 100644
index 000000000..94c61b367
--- /dev/null
+++ b/share/bootloaders/grub-pc/install_start_gui.cfg
@@ -0,0 +1,4 @@
+menuentry 'Start installer' --hotkey=i {
+ linux @KERNEL_GI@ vga=788 @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_GI@
+}
diff --git a/share/bootloaders/grub-pc/install_start_text.cfg b/share/bootloaders/grub-pc/install_start_text.cfg
new file mode 100644
index 000000000..eb3af3fa9
--- /dev/null
+++ b/share/bootloaders/grub-pc/install_start_text.cfg
@@ -0,0 +1,4 @@
+menuentry 'Start installer' --hotkey=i {
+ linux @KERNEL_DI@ vga=normal @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_DI@
+}
diff --git a/share/bootloaders/grub-pc/install_text.cfg b/share/bootloaders/grub-pc/install_text.cfg
new file mode 100644
index 000000000..e77a2d34c
--- /dev/null
+++ b/share/bootloaders/grub-pc/install_text.cfg
@@ -0,0 +1,19 @@
+menuentry 'Install' --hotkey=i {
+ linux @KERNEL_DI@ vga=normal @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_DI@
+}
+
+menuentry 'Expert install' --hotkey=x {
+ linux @KERNEL_DI@ priority=low vga=normal @APPEND_INSTALL@
+ initrd @INITRD_DI@
+}
+
+menuentry 'Rescue mode' --hotkey=r {
+ linux @KERNEL_DI@ rescue/enable=true vga=normal @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_DI@
+}
+
+menuentry 'Automated install' --hotkey=a {
+ linux @KERNEL_DI@ auto=true priority=critical vga=normal @APPEND_INSTALL@ --- quiet
+ initrd @INITRD_DI@
+}