summaryrefslogtreecommitdiff
path: root/scripts/build/binary_loopback_cfg
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-03-25 02:34:45 +0000
committerRaphaƫl Hertzog <raphael@offensive-security.com>2020-04-23 09:59:56 +0200
commite5b2b56c7c9372c601216206fbfca9d023103e8c (patch)
treef58eee2ca819b52f50c816d89d11583007d8acc1 /scripts/build/binary_loopback_cfg
parent457e800c940136425663b14e8e5c154ced184b63 (diff)
downloadvyos-live-build-e5b2b56c7c9372c601216206fbfca9d023103e8c.tar.gz
vyos-live-build-e5b2b56c7c9372c601216206fbfca9d023103e8c.zip
grub2|loopback: overwrite default files with user ones
...rather than choosing between the default set and a user provided set 1. ensures backwards compatibility after we switch from generation of certain content to that content being in pre-prepared config files, and thus no longer writing that config out to existing files. 2. means that user configs do not have to carry copies of all files; they just carry the ones they want to replace (or add). Gbp-Dch: Short
Diffstat (limited to 'scripts/build/binary_loopback_cfg')
-rwxr-xr-xscripts/build/binary_loopback_cfg20
1 files changed, 9 insertions, 11 deletions
diff --git a/scripts/build/binary_loopback_cfg b/scripts/build/binary_loopback_cfg
index ac5d0d90e..1eccbd70f 100755
--- a/scripts/build/binary_loopback_cfg
+++ b/scripts/build/binary_loopback_cfg
@@ -126,18 +126,13 @@ menuentry "Memory Diagnostic Tool ($LB_MEMTEST)" --hotkey=m {
END
}
-if [ -e "config/bootloaders/grub-pc" ]
-then
- # Internal local copy
- _SOURCE="config/bootloaders/grub-pc"
+# User config replacement/additional files
+_SOURCE_USER="config/bootloaders/grub-pc"
+
+if [ -n "${LIVE_BUILD}" ]; then
+ _SOURCE="${LIVE_BUILD}/share/bootloaders/grub-pc"
else
- # Internal system copy
- if [ -n "${LIVE_BUILD}" ]
- then
- _SOURCE="${LIVE_BUILD}/share/bootloaders/grub-pc"
- else
- _SOURCE="/usr/share/live/build/bootloaders/grub-pc"
- fi
+ _SOURCE="/usr/share/live/build/bootloaders/grub-pc"
fi
case "${LB_INITRAMFS}" in
@@ -277,6 +272,9 @@ fi
# Copying templates
mkdir -p binary/boot/grub
cp -a "${_SOURCE}"/* binary/boot/grub/
+if [ -e "${_SOURCE_USER}" ]; then
+ cp -af "${_SOURCE_USER}"/* binary/boot/grub/
+fi
escape_for_sed() {
echo -n "$1" | perl -npe 's/\n/\\n/gm'