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
This commit is contained in:
Lyndon Brown 2020-03-25 02:34:45 +00:00 committed by Raphaël Hertzog
parent 457e800c94
commit e5b2b56c7c
1 changed files with 9 additions and 11 deletions

View File

@ -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'