Skip to content

Commit

Permalink
Merge remote-tracking branch 'osresearch/master' into loftlifter31_galp5
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Laurion <[email protected]>
  • Loading branch information
tlaurion committed Sep 5, 2024
2 parents 9638cdb + c0762aa commit 4878b84
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 8 deletions.
64 changes: 64 additions & 0 deletions bin/seed_package_mirror.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#! /usr/bin/env bash

set -eo pipefail

usage() {
cat >&2 <<USAGE_END
$0 <mirror-directory>
Downloads all current package artifacts needed to build Heads and copies them
to a mirror directory, for seeding a package mirror.
Parameters:
<mirror-directory>: 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/"
2 changes: 1 addition & 1 deletion initrd/bin/gui-init
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions initrd/bin/oem-factory-reset
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -71,7 +71,7 @@ whiptail_error() {
}

whiptail_error_die() {
whiptail_error "$@"
local_whiptail_error "$@"
die
}

Expand Down Expand Up @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions initrd/etc/gui_functions
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions initrd/init
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4878b84

Please sign in to comment.