Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions bin/build-rescue-usb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# Requires: curl, gpg, dosfstools, parted, util-linux (losetup), mtools.
set -euo pipefail

# Shared SystemRescue download + signature verification.
source "$(dirname "$0")/lib/iso-lib.sh"

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
CACHE_DIR="${REPO_ROOT}/.cache"
SYSRESCUE_VERSION="${SYSRESCUE_VERSION:-13.00}"
Expand Down Expand Up @@ -93,24 +96,6 @@ mkdir -p "$CACHE_DIR"
iso_path="${CACHE_DIR}/systemrescue-${SYSRESCUE_VERSION}-amd64.iso"
sig_path="${iso_path}.asc"

download_iso() {
if [[ -f "$iso_path" ]]; then
echo "==> Using cached ISO: $iso_path"
else
echo "==> Downloading SystemRescue ${SYSRESCUE_VERSION}..."
curl -fL --retry 3 -o "$iso_path" "$SYSRESCUE_ISO_URL"
fi
if [[ ! -f "$sig_path" ]]; then
curl -fL --retry 3 -o "$sig_path" "$SYSRESCUE_SIG_URL"
fi
echo "==> Verifying signature..."
# Import key if missing, then verify
if ! gpg --list-keys "$SYSRESCUE_SIGNING_KEY" > /dev/null 2>&1; then
gpg --keyserver keyserver.ubuntu.com --recv-keys "$SYSRESCUE_SIGNING_KEY" \
|| gpg --keyserver keys.openpgp.org --recv-keys "$SYSRESCUE_SIGNING_KEY"
fi
gpg --verify "$sig_path" "$iso_path"
}

build_image() {
local out="$1"
Expand Down
20 changes: 3 additions & 17 deletions bin/build-wipe-usb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# Requires: curl, gpg, dosfstools, parted, util-linux (losetup), mtools.
set -euo pipefail

# Shared SystemRescue download + signature verification.
source "$(dirname "$0")/lib/iso-lib.sh"

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
CACHE_DIR="${REPO_ROOT}/.cache"
SYSRESCUE_VERSION="${SYSRESCUE_VERSION:-13.00}"
Expand Down Expand Up @@ -68,23 +71,6 @@ mkdir -p "$CACHE_DIR"
iso_path="${CACHE_DIR}/systemrescue-${SYSRESCUE_VERSION}-amd64.iso"
sig_path="${iso_path}.asc"

download_iso() {
if [[ -f "$iso_path" ]]; then
echo "==> Using cached ISO: $iso_path"
else
echo "==> Downloading SystemRescue ${SYSRESCUE_VERSION}..."
curl -fL --retry 3 -o "$iso_path" "$SYSRESCUE_ISO_URL"
fi
if [[ ! -f "$sig_path" ]]; then
curl -fL --retry 3 -o "$sig_path" "$SYSRESCUE_SIG_URL"
fi
echo "==> Verifying signature..."
if ! gpg --list-keys "$SYSRESCUE_SIGNING_KEY" > /dev/null 2>&1; then
gpg --keyserver keyserver.ubuntu.com --recv-keys "$SYSRESCUE_SIGNING_KEY" \
|| gpg --keyserver keys.openpgp.org --recv-keys "$SYSRESCUE_SIGNING_KEY"
fi
gpg --verify "$sig_path" "$iso_path"
}

build_image() {
local out="$1"
Expand Down
24 changes: 24 additions & 0 deletions bin/lib/iso-lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# Shared SystemRescue ISO download + signature verification for the USB build
# scripts. Requires the caller to define:
# iso_path, sig_path,
# SYSRESCUE_VERSION, SYSRESCUE_ISO_URL, SYSRESCUE_SIG_URL, SYSRESCUE_SIGNING_KEY

download_iso() {
if [[ -f "$iso_path" ]]; then
echo "==> Using cached ISO: $iso_path"
else
echo "==> Downloading SystemRescue ${SYSRESCUE_VERSION}..."
curl -fL --retry 3 -o "$iso_path" "$SYSRESCUE_ISO_URL"
fi
if [[ ! -f "$sig_path" ]]; then
curl -fL --retry 3 -o "$sig_path" "$SYSRESCUE_SIG_URL"
fi
echo "==> Verifying signature..."
# Import key if missing, then verify
if ! gpg --list-keys "$SYSRESCUE_SIGNING_KEY" > /dev/null 2>&1; then
gpg --keyserver keyserver.ubuntu.com --recv-keys "$SYSRESCUE_SIGNING_KEY" \
|| gpg --keyserver keys.openpgp.org --recv-keys "$SYSRESCUE_SIGNING_KEY"
fi
gpg --verify "$sig_path" "$iso_path"
}
Loading