diff --git a/releng/make-binary.sh b/releng/make-binary.sh index 165f5783d..8d178849b 100755 --- a/releng/make-binary.sh +++ b/releng/make-binary.sh @@ -59,52 +59,71 @@ else mkdir -p "${assets}" fi +kernels="$(podman run --rm --entrypoint /bin/sh "${buildtag}" -c \ + "xbps-query -p pkgver -s '^linux[0-9]+\.[0-9]+' --regex \ + | sed 's/: .*//' | xargs -n1 xbps-uhelper getpkgversion | sort | uniq")" || kernels= + for style in release recovery; do echo "Building style: ${style}" # Always start with a fresh configuration tree mkdir -p "${buildtmp}/build/dracut.conf.d" || error "cannot create config tree" + # Copy style-specific configuration components in place; + # build container sets up standard configuration elements + cp "./etc/zfsbootmenu/${style}.yaml" "${buildtmp}/build/config.yaml" + cp "./etc/zfsbootmenu/${style}.conf.d/"*.conf "${buildtmp}/build/dracut.conf.d" + # Make sure there is an output directory for this asset style zbmtriplet="zfsbootmenu-${style}-${arch}-v${release}" + outdir="${buildtmp}/${zbmtriplet}" mkdir -p "${outdir}" || error "cannot create output directory" - # Copy style-specific configuration components in place; - # build container sets up standard configuration elements - cp "./etc/zfsbootmenu/${style}.yaml" "${buildtmp}/build/config.yaml" - cp "./etc/zfsbootmenu/${style}.conf.d/"*.conf "${buildtmp}/build/dracut.conf.d" + for kern in ${kernels}; do + kern_args=() + if [ -n "${kern}" ]; then + echo "Building style ${style} for kernel ${kern}" + kern_args=( "--" "--kver" "${kern}" ) + fi - # In addition to common mounts which expose source repo and build configs, - # make sure a writable output directory is available for this style and - # build the EFI bundle if it is supported for this arch - if ! podman run --rm \ - "${volmounts[@]}" -v "${outdir}:/out" \ - "${buildtag}" -o /out -e ".EFI.Enabled = ${BUILD_EFI}"; then - error "failed to create image" - fi + # In addition to common mounts which expose source repo and build configs, + # make sure a writable output directory is available for this style and + # build the EFI bundle if it is supported for this arch + if ! podman run --rm \ + "${volmounts[@]}" -v "${outdir}:/out" \ + "${buildtag}" -o /out -e ".EFI.Enabled = ${BUILD_EFI}" "${kern_args[@]}"; then + error "failed to create image" + fi - # EFI file is currently only built on x86_64 - if [ "${BUILD_EFI}" = "true" ]; then - if ! cp "${outdir}/vmlinuz.EFI" "${assets}/${zbmtriplet}-vmlinuz.EFI"; then - error "failed to copy UEFI bundle" + if [ "${BUILD_EFI}" = "true" ]; then + # If EFI file was produced, copy it + efibase="${zbmtriplet}-vmlinuz" + [ -n "${kern}" ] && efibase="${efibase}-${kern}" + if ! cp "${outdir}/vmlinuz.EFI" "${assets}/${efibase}.EFI"; then + error "failed to copy UEFI bundle" + fi + rm -f "${outdir}/vmlinuz.EFI" fi - rm -f "${outdir}/vmlinuz.EFI" - fi - have_components= - for f in "${outdir}"/*; do - [ -e "${f}" ] || continue - have_components="yes" - break - done + have_components= + for f in "${outdir}"/*; do + [ -e "${f}" ] || continue + have_components="yes" + break + done + + if [ -n "${have_components}" ]; then + # If components were produced, archive them + tarbase="${zbmtriplet}" + [ -n "${kern}" ] && tarbase="${tarbase}-${kern}" + ( cd "${buildtmp}" && \ + tar -czvf "${assets}/${tarbase}.tar.gz" "${zbmtriplet}" + ) || error "failed to pack components" + fi - if [ -n "${have_components}" ]; then - # If components were produced, archive them - ( cd "${buildtmp}" && \ - tar -czvf "${assets}/${zbmtriplet}.tar.gz" "${zbmtriplet}" - ) || error "failed to pack components" - fi + rm -f "${outdir}/*" + done # Clean up the style-specific build components rm -rf "${buildtmp}/build" "${outdir}" diff --git a/releng/tag-release.sh b/releng/tag-release.sh index 91c1189eb..c14c63676 100755 --- a/releng/tag-release.sh +++ b/releng/tag-release.sh @@ -140,7 +140,6 @@ mkdir -p "releng/assets/${release}" asset_dir="$( realpath -e "releng/assets/${release}" )" asset_files=() -assets=() # Create binary assets if ! releng/make-binary.sh "${release}"; then @@ -153,18 +152,20 @@ if ! releng/sign-assets.sh "${release}"; then fi for style in release recovery; do - assets+=( "zfsbootmenu-${style}-${arch}-v${release}-vmlinuz.EFI" ) - assets+=( "zfsbootmenu-${style}-${arch}-v${release}.tar.gz" ) -done - -for asset in "${assets[@]}" ; do - f="${asset_dir}/${asset}" - [ -f "${f}" ] || error "ERROR: missing release asset ${f}" - asset_files+=( "${f}" ) + asset_base="zfsbootmenu-${style}-${arch}-v${release}" + for f in "${asset_dir}/${asset_base}"*.EFI; do + [ -f "${f}" ] || error "ERROR: missing EFI ${style} asset" + asset_files+=( "${f}" ) + done + + for f in "${asset_dir}/${asset_base}"*.tar.gz; do + [ -f "${f}" ] || error "ERROR: missing component ${style} asset" + asset_files+=( "${f}" ) + done done for f in sha256.{txt,sig}; do - [ -f "${asset_dir}/${f}" ] || error "ERROR: missng sum file ${asset_dir}/${f}" + [ -f "${asset_dir}/${f}" ] || error "ERROR: missing sum file ${asset_dir}/${f}" asset_files+=( "${asset_dir}/${f}" ) done