Generate release and recovery image builds

This commit is contained in:
Zach Dykstra 2021-11-27 17:30:29 -06:00
parent 914a3cdff3
commit 4b836f3cf0
5 changed files with 73 additions and 43 deletions

View File

@ -0,0 +1,16 @@
zfsbootmenu_teardown+=" /zbm/contrib/xhci-teardown.sh "
install_optional_items+=" /etc/zbm-commit-hash /bin/gdisk /bin/parted /bin/mkfs.vfat /bin/mkfs.ext4 /bin/curl /bin/efibootmgr"
omit_drivers+=" amdgpu radeon nvidia nouveau i915 "
# Network related modules
add_dracutmodules+=" network network-legacy kernel-network-modules "
omit_dracutmodules+=" crypt-ssh nfs lunmask "
# qemu drivers
omit_dracutmodules+=" qemu qemu-net "
# filesystem and other related bits
omit_dracutmodules+=" nvdimm fs-lib rootfs-block dm dmraid crypt "
embedded_kcl="rd.hostonly=0"
release_build=1

View File

@ -0,0 +1 @@
release.yaml

View File

@ -47,7 +47,9 @@ EOF
buildah run "${container}" \
sh -c 'xbps-query -Rp run_depends zfsbootmenu | xargs xbps-install -y'
buildah run "${container}" xbps-install -y \
linux5.10 linux5.10-headers gummiboot-efistub curl yq-go bash kbd terminus-font
linux5.10 linux5.10-headers gummiboot-efistub curl yq-go bash kbd terminus-font \
gptfdisk dracut-network iproute2 iputils parted curl dosfstools e2fsprogs \
efibootmgr
# Remove headers and development toolchain, but keep binutils for objcopy
buildah run "${container}" sh -c 'echo "ignorepkg=dkms" > /etc/xbps.d/10-nodkms.conf'

View File

@ -37,23 +37,16 @@ if ! podman inspect "${buildtag}" >/dev/null 2>&1; then
fi
fi
buildtmp="$( mktemp -d )" || error "cannot create build directory"
mkdir -p "${buildtmp}/out" || error "cannot create output directory"
mkdir -p "${buildtmp}/etc/dracut.conf.d" || error "cannot create config tree"
# Copy configuration components in place
cp ./etc/zfsbootmenu/release.yaml "${buildtmp}/etc"
cp ./etc/zfsbootmenu/dracut.conf.d/*.conf "${buildtmp}/etc/dracut.conf.d"
# Files in release.conf.d are allowed to shadow regular defaults
cp ./etc/zfsbootmenu/release.conf.d/*.conf "${buildtmp}/etc/dracut.conf.d"
arch="$( uname -m )"
case "${arch}" in
x86_64) BUILD_EFI="true" ;;
*) BUILD_EFI="false" ;;
esac
buildtmp="$( mktemp -d )" || error "cannot create build directory"
mkdir -p "${buildtmp}/out" || error "cannot create output directory"
mkdir -p "${buildtmp}/etc/dracut.conf.d" || error "cannot create config tree"
# Volume mounts for the container; make sure stock config tree, with release
# addendum, is available in-container at /etc/zfsbootmenu
volmounts=(
@ -62,19 +55,6 @@ volmounts=(
"-v" "${buildtmp}/out:/out"
)
# Specify options for the build st
buildopts=(
"-o" "/out"
"-e" ".EFI.Enabled = ${BUILD_EFI}"
"-c" "/etc/zfsbootmenu/release.yaml"
)
# For the containerized build, use current repo by mounting at /zbm
# Custom configs and outputs will be in the temp dir, mounted at /build
if ! podman run --rm "${volmounts[@]}" "${buildtag}" "${buildopts[@]}"; then
error "failed to create image"
fi
if ! assets="$( realpath -e releng )/assets/${release}"; then
error "unable to define path to built assets"
fi
@ -85,20 +65,46 @@ else
mkdir -p "${assets}"
fi
zbmtriplet="zfsbootmenu-vmlinuz-${arch}-v${release}"
for style in release recovery; do
echo "Building style: ${style}"
# Copy configuration components in place
cp "./etc/zfsbootmenu/${style}.yaml" "${buildtmp}/etc"
cp ./etc/zfsbootmenu/dracut.conf.d/*.conf "${buildtmp}/etc/dracut.conf.d"
# EFI file is currently only built on x86_64
if [ "${BUILD_EFI}" = "true" ]; then
if ! cp "${buildtmp}/out/vmlinuz.EFI" "${assets}/${zbmtriplet}.EFI"; then
error "failed to copy UEFI bundle"
# Files in release.conf.d are allowed to shadow regular defaults
cp ./etc/zfsbootmenu/"${style}".conf.d/*.conf "${buildtmp}/etc/dracut.conf.d"
# Specify options for the build st
buildopts=(
"-o" "/out"
"-e" ".EFI.Enabled = ${BUILD_EFI}"
"-c" "/etc/zfsbootmenu/${style}.yaml"
)
# For the containerized build, use current repo by mounting at /zbm
# Custom configs and outputs will be in the temp dir, mounted at /build
if ! podman run --rm "${volmounts[@]}" "${buildtag}" "${buildopts[@]}"; then
error "failed to create image"
fi
fi
# Nothing to archive if no components were produced
[ -d "${buildtmp}/out/components" ] || exit 0
zbmtriplet="zfsbootmenu-${style}-vmlinuz-${arch}-v${release}"
zbmtriplet="zfsbootmenu-${arch}-v${release}"
# If components were produced, archive them
( cd "${buildtmp}/out" && mv components "${zbmtriplet}" && \
tar czvf "${assets}/${zbmtriplet}.tar.gz" "${zbmtriplet}"
) || error "failed to pack components"
# EFI file is currently only built on x86_64
if [ "${BUILD_EFI}" = "true" ]; then
if ! cp "${buildtmp}/out/vmlinuz.EFI" "${assets}/${zbmtriplet}.EFI"; then
error "failed to copy UEFI bundle"
fi
fi
# Nothing to archive if no components were produced
[ -d "${buildtmp}/out/components" ] || exit 0
zbmtriplet="zfsbootmenu-${style}-${arch}-v${release}"
# If components were produced, archive them
( cd "${buildtmp}/out" && mv components "${zbmtriplet}" && \
tar czvf "${assets}/${zbmtriplet}.tar.gz" "${zbmtriplet}"
) || error "failed to pack components"
rm "${buildtmp}"/etc/*.yaml
rm "${buildtmp}"/etc/dracut.conf.d/*.conf
done

View File

@ -118,18 +118,23 @@ if ! releng/sign-assets.sh "${release}"; then
error "ERROR: unable to sign release assets, exiting!"
fi
assets="$( realpath -e "releng/assets/${release}" )"
asset_dir="$( realpath -e "releng/assets/${release}" )"
asset_files=()
for asset in zfsbootmenu-vmlinuz-${arch}-v${release}.EFI zfsbootmenu-${arch}-v${release}tar.gz; do
f="${assets}/${asset}"
for style in release recovery; do
assets+=( "zfsbootmenu-${style}-vmlinuz-${arch}-v${release}.EFI" )
assets+=( "zfsbootmenu-${style}-${arch}-v${release}.tar.gz" )
done
for asset in "${assets[@]}" ; do
f="${asset_dir}/${asset}"
[ -f "${f}" ] || error "ERROR: missing boot image ${f}"
asset_files+=( "${f}" )
done
for f in sha256.{txt,sig}; do
[ -f "${assets}/${f}" ] || error "ERROR: missng sum file ${assets}/${f}"
asset_files+=( "${assets}/${f}" )
[ -f "${asset_dir}/${f}" ] || error "ERROR: missng sum file ${asset_dir}/${f}"
asset_files+=( "${asset_dir}/${f}" )
done
# github-cli does not automatically strip header that hub uses for a title