From fd18d46e0eb6abfe757f8764c65ac4c472fcdeef Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Thu, 26 Mar 2020 04:59:15 +0000 Subject: grub2|loopback: avoid perl for live entry creation, use temp file instead of cramming the live entries into a string via a layer of functions for terminating entries with newlines, which we then have to run through perl to tweak the newlines for correct use with sed... let's write the entries to a temp file, then use that file in the sed replacement. the helper functions injecting newlines to the end of entries as they were built into a long string have obviously become unnecessary and so were removed. one function was renamed for reasons of consistency and clarity. the file is initially deleted before use for reasons of wanting to bullet proof the codebase to work properly under conditions of recovering from failure/cancellation, `--force` re-running and such. this removes the last use of perl. Gbp-Dch: Short --- scripts/build/binary_loopback_cfg | 50 ++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/scripts/build/binary_loopback_cfg b/scripts/build/binary_loopback_cfg index 58fa854e3..09f94aca5 100755 --- a/scripts/build/binary_loopback_cfg +++ b/scripts/build/binary_loopback_cfg @@ -42,19 +42,15 @@ Check_crossarchitectures _TARGET="binary/boot/grub" -# Variable used to embed newlines -NL=" -" - # Local functions -Grub_menu_entry() { +Grub_live_menu_entry() { local LABEL="$1" local KERNEL="$2" local INITRD="$3" local APPEND="$4" local HOTKEY="${5:+ --hotkey=$5}" - cat <> "${LIVE_ENTRIES_TMP}" <> "${LIVE_ENTRIES_TMP}" <