From 9c898a7b676b12a7bf6a6428f0e076fbbd818a93 Mon Sep 17 00:00:00 2001 From: Jonathon Hall Date: Fri, 30 Aug 2024 13:50:01 -0400 Subject: [PATCH 1/4] bin/seed_package_mirror.sh: Script to seed a package mirror Run this to download all the needed package artifacts for a mirror. Signed-off-by: Jonathon Hall --- bin/seed_package_mirror.sh | 64 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 bin/seed_package_mirror.sh diff --git a/bin/seed_package_mirror.sh b/bin/seed_package_mirror.sh new file mode 100755 index 000000000..ca1dfa61a --- /dev/null +++ b/bin/seed_package_mirror.sh @@ -0,0 +1,64 @@ +#! /usr/bin/env bash + +set -eo pipefail + +usage() { +cat >&2 < + +Downloads all current package artifacts needed to build Heads and copies them +to a mirror directory, for seeding a package mirror. + +Parameters: + : Path to a directory where the packages are placed. + Created if it does not already exist. +USAGE_END +} + +ARGS_DONE= +while [[ $# -ge 1 ]] && [ -z "$ARGS_DONE" ]; do + case "$1" in + --) + ARGS_DONE=y + shift + ;; + --help) + usage + exit 0 + ;; + --*) + echo "unknown parameter: $1" >&2 + usage + exit 1 + ;; + *) + ARGS_DONE=y + ;; + esac +done + +if [[ $# -ne 1 ]]; then + usage + exit 1 +fi + +ARG_MIRROR_DIR="$(realpath "$1")" + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +echo +echo "Cleaning build to download all packages..." +# fetch packages for representative boards +rm -rf build/x86 build/ppc64 +rm -rf packages/x86 packages/ppc64 +echo +echo "Downloading packages..." +make packages BOARD=qemu-coreboot-fbwhiptail-tpm1-hotp +make packages BOARD=talos-2 # newt, PPC +make packages BOARD=librem_l1um_v2 # TPM2 +make packages BOARD=librem_l1um # coreboot 4.11 +make packages BOARD=x230-maximized # io386 +echo +echo "Copying to mirror directory..." +mkdir -p "$ARG_MIRROR_DIR" +cp packages/x86/* packages/ppc64/* "$ARG_MIRROR_DIR/" From f06867306e43d6f2e7ca07553361722a60395d79 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Sun, 1 Sep 2024 21:01:04 -0400 Subject: [PATCH 2/4] init: make sure config.user is overriden only with new values so that going DEBUG/undoing can work reproducibly Signed-off-by: Thierry Laurion --- initrd/init | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/initrd/init b/initrd/init index 8eccbff0b..a33e601c5 100755 --- a/initrd/init +++ b/initrd/init @@ -140,8 +140,14 @@ fi # # Values in user config have higher priority during combining thus effectively # changing the value for the rest of the scripts which source /tmp/config. -echo "export CONFIG_TPM=\"$CONFIG_TPM\"" >> /etc/config.user -echo "export CONFIG_TPM2_TOOLS=\"$CONFIG_TPM2_TOOLS\"" >> /etc/config.user + +#Only set CONFIG_TPM and CONFIG_TPM2_TOOLS if they are not already set in /etc/config.user +if ! grep -q 'CONFIG_TPM=' /etc/config.user; then + echo "export CONFIG_TPM=\"$CONFIG_TPM\"" >> /etc/config.user +fi +if ! grep -q 'CONFIG_TPM2_TOOLS=' /etc/config.user; then + echo "export CONFIG_TPM2_TOOLS=\"$CONFIG_TPM2_TOOLS\"" >> /etc/config.user +fi # CONFIG_BASIC was previously CONFIG_PUREBOOT_BASIC in the PureBoot distribution. # Substitute it in config.user if present for backward compatibility. From 3c76bdc510d239422fdf0188b1d974eb46caddd3 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Wed, 4 Sep 2024 14:26:42 -0400 Subject: [PATCH 3/4] oem-factory-reset gui-init: fix whiptail_error segfaulting because selfcalling itself, fix typo in gui-init fix bugs introduced by #1698 Signed-off-by: Thierry Laurion --- initrd/bin/gui-init | 2 +- initrd/bin/oem-factory-reset | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/initrd/bin/gui-init b/initrd/bin/gui-init index 27f927cfd..4bb8f4d97 100755 --- a/initrd/bin/gui-init +++ b/initrd/bin/gui-init @@ -363,7 +363,7 @@ check_gpg_key() option=$(cat /tmp/whiptail) case "$option" in g ) - gpg-gui.sh && BG_COLOR_MAIN_MENU="normnal" + gpg-gui.sh && BG_COLOR_MAIN_MENU="normal" ;; i ) skip_to_menu="true" diff --git a/initrd/bin/oem-factory-reset b/initrd/bin/oem-factory-reset index 6ed5a28fb..35e41ac3a 100755 --- a/initrd/bin/oem-factory-reset +++ b/initrd/bin/oem-factory-reset @@ -62,7 +62,7 @@ die() { exit 1 } -whiptail_error() { +local_whiptail_error() { local msg=$1 if [ "$msg" = "" ]; then die "whiptail error: An error msg is required" @@ -71,7 +71,7 @@ whiptail_error() { } whiptail_error_die() { - whiptail_error "$@" + local_whiptail_error "$@" die } @@ -1111,7 +1111,7 @@ if [ "$GPG_GEN_KEY_IN_MEMORY" = "n" -o "$GPG_GEN_KEY_IN_MEMORY_COPY_TO_SMARTCARD echo -e "\nChecking for USB Security Dongle...\n" enable_usb if ! gpg --card-status >/dev/null 2>&1; then - whiptail_error "Can't access USB Security Dongle; \nPlease remove and reinsert, then press Enter." + local_whiptail_error "Can't access USB Security Dongle; \nPlease remove and reinsert, then press Enter." if ! gpg --card-status >/dev/null 2>/tmp/error; then ERROR=$(tail -n 1 /tmp/error | fold -s) whiptail_error_die "Unable to detect USB Security Dongle:\n\n${ERROR}" From 32bb2e59eb2586abfafe130953cafc453842be5f Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Wed, 4 Sep 2024 14:43:28 -0400 Subject: [PATCH 4/4] gui_functions: add newline after message telling user that automatic boot will happen unless interrupted Signed-off-by: Thierry Laurion --- initrd/etc/gui_functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/initrd/etc/gui_functions b/initrd/etc/gui_functions index 5b46acb5e..38958b1ab 100755 --- a/initrd/etc/gui_functions +++ b/initrd/etc/gui_functions @@ -6,8 +6,8 @@ # continue with automatic boot, nonzero if user interrupted. pause_automatic_boot() { - if IFS= read -t "$CONFIG_AUTO_BOOT_TIMEOUT" -s -n 1 -p \ - "Automatic boot in $CONFIG_AUTO_BOOT_TIMEOUT seconds unless interrupted by keypress... "; then + if IFS= read -t "$CONFIG_AUTO_BOOT_TIMEOUT" -s -n 1 -r -p \ + $'Automatic boot in '"$CONFIG_AUTO_BOOT_TIMEOUT"$' seconds unless interrupted by keypress...\n'; then return 1 # Interrupt automatic boot fi return 0 # Continue with automatic boot