mirror of
https://github.com/netbootxyz/netboot.xyz.git
synced 2026-07-20 17:59:49 +00:00
Ensure autoexec.ipxe is available at the root of the S3 bucket
(boot.netboot.xyz/{version}/autoexec.ipxe) alongside other boot
files, not only nested under ipxe/secureboot-x86_64/.
93 lines
3 KiB
Bash
Executable file
93 lines
3 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
TYPE=$1
|
|
HARD_RELEASE="3.x"
|
|
HARD_RC="3.x-RC"
|
|
DEV_URL="dev.boot.netboot.xyz"
|
|
STAGING_URL="staging.boot.netboot.xyz"
|
|
PROD_URL="boot.netboot.xyz"
|
|
NBXYZ_OVERRIDES=production
|
|
|
|
# Set boot domain
|
|
if [[ "${TYPE}" == "dev" ]]; then
|
|
BOOT_DOMAIN="s3.amazonaws.com/${DEV_URL}/${GITHUB_SHA}"
|
|
BOOT_VERSION="${GITHUB_SHA}"
|
|
elif [[ "${TYPE}" == "pr" ]]; then
|
|
BOOT_DOMAIN="test.com"
|
|
BOOT_VERSION="test"
|
|
NBXYZ_OVERRIDES=default
|
|
elif [[ "${TYPE}" == "rc" ]]; then
|
|
BOOT_VERSION=$(cat version.txt)-RC
|
|
BOOT_DOMAIN="${STAGING_URL}/${BOOT_VERSION}"
|
|
elif [[ "${TYPE}" == "release" ]]; then
|
|
BOOT_VERSION=$(cat version.txt)
|
|
BOOT_DOMAIN="${PROD_URL}/${BOOT_VERSION}"
|
|
elif [[ "${TYPE}" == "rolling" ]]; then
|
|
HARD_RELEASE="3.x"
|
|
PROD_URL="boot.netboot.xyz"
|
|
fi
|
|
|
|
# build release files
|
|
if ! [[ "${TYPE}" == "rolling" ]]; then
|
|
sed -i \
|
|
"/^# boot_version/c\boot_version: \"${BOOT_VERSION}\"" \
|
|
user_overrides.yml
|
|
sed -i \
|
|
"/^# boot_domain/c\boot_domain: ${BOOT_DOMAIN}" \
|
|
user_overrides.yml
|
|
|
|
# Build release
|
|
docker build -t localbuild --build-arg NBXYZ_OVERRIDES=${NBXYZ_OVERRIDES} .
|
|
docker run --rm -i -v $(pwd):/buildout localbuild
|
|
|
|
# Generate folder outputs
|
|
mkdir -p s3out
|
|
mkdir -p s3outver
|
|
cp -r buildout/* s3out/
|
|
cp buildout/version.ipxe s3outver/
|
|
mkdir -p githubout
|
|
mv buildout/ipxe/* githubout/
|
|
# Extract autoexec.ipxe as a standalone release asset for Secure Boot.
|
|
# The signed iPXE binaries are consumed directly from the upstream iPXE
|
|
# release (ipxeboot.tar.gz) to preserve provenance; netboot.xyz only
|
|
# ships the boot script that chains into the menu system.
|
|
if [[ -f "githubout/secureboot-x86_64/autoexec.ipxe" ]]; then
|
|
cp githubout/secureboot-x86_64/autoexec.ipxe githubout/autoexec.ipxe
|
|
cp githubout/secureboot-x86_64/autoexec.ipxe s3out/autoexec.ipxe
|
|
fi
|
|
# Remove secureboot directories from githubout since the signed binaries
|
|
# are not re-distributed as netboot.xyz release assets
|
|
rm -rf githubout/secureboot-x86_64 githubout/secureboot-arm64
|
|
cd buildout
|
|
rm -Rf ipxe
|
|
tar -czf menus.tar.gz *
|
|
mv menus.tar.gz ../githubout
|
|
cd ..
|
|
if [[ "${TYPE}" == "dev" ]]; then
|
|
cp githubout/menus.tar.gz s3out/
|
|
fi
|
|
fi
|
|
|
|
# Latest style endpoints for RC and Live
|
|
if [[ "${TYPE}" == "release" ]] || [[ "${TYPE}" == "rolling" ]] || [[ "${TYPE}" == "rc" ]]; then
|
|
rm -Rf buildout/
|
|
if [[ "${TYPE}" == "release" ]] || [[ "${TYPE}" == "rolling" ]]; then
|
|
sed -i \
|
|
-e "/^boot_version/c\boot_version: \"${HARD_RELEASE}\"" \
|
|
-e "/^boot_domain/c\boot_domain: ${PROD_URL}" \
|
|
user_overrides.yml
|
|
docker build -t localbuild --build-arg NBXYZ_OVERRIDES=${NBXYZ_OVERRIDES} .
|
|
docker run --rm -i -v $(pwd):/buildout localbuild
|
|
fi
|
|
if [[ "${TYPE}" == "rc" ]]; then
|
|
sed -i \
|
|
-e "/^boot_version/c\boot_version: \"${HARD_RC}\"" \
|
|
-e "/^boot_domain/c\boot_domain: ${STAGING_URL}/rc" \
|
|
user_overrides.yml
|
|
docker build -t localbuild --build-arg NBXYZ_OVERRIDES=${NBXYZ_OVERRIDES} .
|
|
docker run --rm -i -v $(pwd):/buildout localbuild
|
|
fi
|
|
mkdir -p s3out-latest
|
|
cp -r buildout/* s3out-latest/
|
|
fi
|