Skip to content

Commit f5b7c8e

Browse files
committed
releng/make-binary.sh: build images for all installed kernels
1 parent fe3d959 commit f5b7c8e

File tree

1 file changed

+49
-30
lines changed

1 file changed

+49
-30
lines changed

releng/make-binary.sh

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,52 +59,71 @@ else
5959
mkdir -p "${assets}"
6060
fi
6161

62+
kernels="$(podman run --rm --entrypoint /bin/sh "${buildtag}" -c \
63+
"xbps-query -p pkgver -s '^linux[0-9]+\.[0-9]+' --regex \
64+
| sed 's/: .*//' | xargs -n1 xbps-uhelper getpkgversion | sort | uniq")" || kernels=
65+
6266
for style in release recovery; do
6367
echo "Building style: ${style}"
6468

6569
# Always start with a fresh configuration tree
6670
mkdir -p "${buildtmp}/build/dracut.conf.d" || error "cannot create config tree"
6771

72+
# Copy style-specific configuration components in place;
73+
# build container sets up standard configuration elements
74+
cp "./etc/zfsbootmenu/${style}.yaml" "${buildtmp}/build/config.yaml"
75+
cp "./etc/zfsbootmenu/${style}.conf.d/"*.conf "${buildtmp}/build/dracut.conf.d"
76+
6877
# Make sure there is an output directory for this asset style
6978
zbmtriplet="zfsbootmenu-${style}-${arch}-v${release}"
79+
7080
outdir="${buildtmp}/${zbmtriplet}"
7181
mkdir -p "${outdir}" || error "cannot create output directory"
7282

73-
# Copy style-specific configuration components in place;
74-
# build container sets up standard configuration elements
75-
cp "./etc/zfsbootmenu/${style}.yaml" "${buildtmp}/build/config.yaml"
76-
cp "./etc/zfsbootmenu/${style}.conf.d/"*.conf "${buildtmp}/build/dracut.conf.d"
83+
for kern in ${kernels}; do
84+
kern_args=()
85+
if [ -n "${kern}" ]; then
86+
echo "Building style ${style} for kernel ${kern}"
87+
kern_args=( "--" "--kver" "${kern}" )
88+
fi
7789

78-
# In addition to common mounts which expose source repo and build configs,
79-
# make sure a writable output directory is available for this style and
80-
# build the EFI bundle if it is supported for this arch
81-
if ! podman run --rm \
82-
"${volmounts[@]}" -v "${outdir}:/out" \
83-
"${buildtag}" -o /out -e ".EFI.Enabled = ${BUILD_EFI}"; then
84-
error "failed to create image"
85-
fi
90+
# In addition to common mounts which expose source repo and build configs,
91+
# make sure a writable output directory is available for this style and
92+
# build the EFI bundle if it is supported for this arch
93+
if ! podman run --rm \
94+
"${volmounts[@]}" -v "${outdir}:/out" \
95+
"${buildtag}" -o /out -e ".EFI.Enabled = ${BUILD_EFI}" "${kern_args[@]}"; then
96+
error "failed to create image"
97+
fi
8698

87-
# EFI file is currently only built on x86_64
88-
if [ "${BUILD_EFI}" = "true" ]; then
89-
if ! cp "${outdir}/vmlinuz.EFI" "${assets}/${zbmtriplet}-vmlinuz.EFI"; then
90-
error "failed to copy UEFI bundle"
99+
if [ "${BUILD_EFI}" = "true" ]; then
100+
# If EFI file was produced, copy it
101+
efibase="${zbmtriplet}-vmlinuz"
102+
[ -n "${kern}" ] && efibase="${efibase}-${kern}"
103+
if ! cp "${outdir}/vmlinuz.EFI" "${assets}/${efibase}.EFI"; then
104+
error "failed to copy UEFI bundle"
105+
fi
106+
rm -f "${outdir}/vmlinuz.EFI"
91107
fi
92-
rm -f "${outdir}/vmlinuz.EFI"
93-
fi
94108

95-
have_components=
96-
for f in "${outdir}"/*; do
97-
[ -e "${f}" ] || continue
98-
have_components="yes"
99-
break
100-
done
109+
have_components=
110+
for f in "${outdir}"/*; do
111+
[ -e "${f}" ] || continue
112+
have_components="yes"
113+
break
114+
done
115+
116+
if [ -n "${have_components}" ]; then
117+
# If components were produced, archive them
118+
tarbase="${zbmtriplet}"
119+
[ -n "${kern}" ] && tarbase="${tarbase}-${kern}"
120+
( cd "${buildtmp}" && \
121+
tar -czvf "${assets}/${tarbase}.tar.gz" "${zbmtriplet}"
122+
) || error "failed to pack components"
123+
fi
101124

102-
if [ -n "${have_components}" ]; then
103-
# If components were produced, archive them
104-
( cd "${buildtmp}" && \
105-
tar -czvf "${assets}/${zbmtriplet}.tar.gz" "${zbmtriplet}"
106-
) || error "failed to pack components"
107-
fi
125+
rm -f "${outdir}/*"
126+
done
108127

109128
# Clean up the style-specific build components
110129
rm -rf "${buildtmp}/build" "${outdir}"

0 commit comments

Comments
 (0)