also upload kexec images

This commit is contained in:
Jörg Thalheim 2021-06-10 10:06:41 +02:00
parent e2ac3905a9
commit c824fc505a
No known key found for this signature in database
GPG key ID: B3F5D81B0C6967C4

View file

@ -1,22 +1,33 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -p nix -p coreutils -p bash -p gh -i bash #!nix-shell -p nixos-generators -p nix -p coreutils -p bash -p gh -i bash
# shellcheck shell=bash # shellcheck shell=bash
set -xeuo pipefail set -xeuo pipefail
build_netboot_image() { build_netboot_image() {
declare -r tag=$1 arch=$2 tmp=$3 declare -r tag=$1 arch=$2 tmp=$3
img=$(nix-build --no-out-link -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz" '<nixpkgs/nixos/release.nix>' -A "netboot.$arch") img=$(nix-build --no-out-link -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz" '<nixpkgs/nixos/release.nix>' -A "netboot.$arch")
cp "$(readlink "$img/bzImage")" "$tmp/bzImage-$arch" cp "$img/bzImage" "$tmp/bzImage-$arch"
echo "$tmp/bzImage-$arch" echo "$tmp/bzImage-$arch"
cp "$(readlink "$img/initrd")" "$tmp/initrd-$arch" cp "$img/initrd" "$tmp/initrd-$arch"
echo "$tmp/initrd-$arch" echo "$tmp/initrd-$arch"
} }
build_kexec_bundle() {
declare -r tag=$1 arch=$2 tmp=$3
# the default configuration conflicts with the kexec bundle configuration
echo "{}" > "$tmp/config.nix"
nixos-generate -o "$tmp/kexec-bundle-$arch" -c "$tmp/config.nix" -f kexec-bundle -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/${tag}.tar.gz"
echo "$tmp/kexec-bundle-$arch"
}
main() { main() {
declare -r tag=${1:-nixos-unstable} arch=${2:-x86_64-linux} declare -r tag=${1:-nixos-unstable} arch=${2:-x86_64-linux}
tmp="$(mktemp -d)" tmp="$(mktemp -d)"
trap 'rm -rf -- "$tmp"' EXIT trap 'rm -rf -- "$tmp"' EXIT
readarray -t assets < <(build_netboot_image "$tag" "$arch" "$tmp") readarray -t assets < <(
build_kexec_bundle "$tag" "$arch" "$tmp"
build_netboot_image "$tag" "$arch" "$tmp"
)
for asset in "${assets[@]}"; do for asset in "${assets[@]}"; do
pushd "$(dirname "$asset")" pushd "$(dirname "$asset")"