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/" 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}" 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 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.