23 lines
1.3 KiB
Bash
23 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
# Build in a new directory so old profiles and work directories are never reused.
|
|
set -Eeuo pipefail
|
|
ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
DEST=${1:?Usage: bash scripts/build-iso.sh /absolute/path/to/new-build-directory}
|
|
[[ ! -e "$DEST" ]] || { echo 'Destination must not already exist.' >&2; exit 2; }
|
|
mkdir -p "$DEST"
|
|
DEST=$(cd "$DEST" && pwd)
|
|
bash "$ROOT/scripts/create-profile.sh" "$DEST/profile"
|
|
python3 "$ROOT/scripts/release-manifest.py" --verify-profile "$DEST/profile"
|
|
sudo mkarchiso -v -w "$DEST/work" -o "$DEST/out" "$DEST/profile"
|
|
python3 "$ROOT/scripts/release-manifest.py" --verify-profile "$DEST/profile"
|
|
shopt -s nullglob
|
|
isos=("$DEST"/out/*.iso)
|
|
[[ ${#isos[@]} == 1 ]] || { echo 'Expected exactly one ISO.' >&2; exit 1; }
|
|
bsdtar -tf "${isos[0]}" > "$DEST/iso-files.txt"
|
|
grep -qx 'arch/boot/x86_64/vmlinuz-linux' "$DEST/iso-files.txt"
|
|
grep -qx 'arch/boot/x86_64/initramfs-linux.img' "$DEST/iso-files.txt"
|
|
[[ $(stat -c %s "${isos[0]}") -lt 4294967295 ]] || { echo 'ISO exceeds FAT32 file size limit.' >&2; exit 1; }
|
|
sha256sum "${isos[0]}" > "$DEST/out/SHA256SUMS"
|
|
cp "$DEST/profile/airootfs/etc/csr-intake/release.json" "$DEST/out/release.json"
|
|
echo "ISO validated in $DEST/out. Physical UEFI/BIOS boot and hardware tests still required."
|