Skip to content

Commit 4b836f3

Browse files
committed
Generate release and recovery image builds
1 parent 914a3cd commit 4b836f3

File tree

5 files changed

+73
-43
lines changed

5 files changed

+73
-43
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
zfsbootmenu_teardown+=" /zbm/contrib/xhci-teardown.sh "
2+
install_optional_items+=" /etc/zbm-commit-hash /bin/gdisk /bin/parted /bin/mkfs.vfat /bin/mkfs.ext4 /bin/curl /bin/efibootmgr"
3+
omit_drivers+=" amdgpu radeon nvidia nouveau i915 "
4+
5+
# Network related modules
6+
add_dracutmodules+=" network network-legacy kernel-network-modules "
7+
omit_dracutmodules+=" crypt-ssh nfs lunmask "
8+
9+
# qemu drivers
10+
omit_dracutmodules+=" qemu qemu-net "
11+
12+
# filesystem and other related bits
13+
omit_dracutmodules+=" nvdimm fs-lib rootfs-block dm dmraid crypt "
14+
15+
embedded_kcl="rd.hostonly=0"
16+
release_build=1

etc/zfsbootmenu/recovery.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
release.yaml

releng/docker/image-build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ EOF
4747
buildah run "${container}" \
4848
sh -c 'xbps-query -Rp run_depends zfsbootmenu | xargs xbps-install -y'
4949
buildah run "${container}" xbps-install -y \
50-
linux5.10 linux5.10-headers gummiboot-efistub curl yq-go bash kbd terminus-font
50+
linux5.10 linux5.10-headers gummiboot-efistub curl yq-go bash kbd terminus-font \
51+
gptfdisk dracut-network iproute2 iputils parted curl dosfstools e2fsprogs \
52+
efibootmgr
5153

5254
# Remove headers and development toolchain, but keep binutils for objcopy
5355
buildah run "${container}" sh -c 'echo "ignorepkg=dkms" > /etc/xbps.d/10-nodkms.conf'

releng/make-binary.sh

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,16 @@ if ! podman inspect "${buildtag}" >/dev/null 2>&1; then
3737
fi
3838
fi
3939

40-
buildtmp="$( mktemp -d )" || error "cannot create build directory"
41-
mkdir -p "${buildtmp}/out" || error "cannot create output directory"
42-
mkdir -p "${buildtmp}/etc/dracut.conf.d" || error "cannot create config tree"
43-
44-
# Copy configuration components in place
45-
cp ./etc/zfsbootmenu/release.yaml "${buildtmp}/etc"
46-
cp ./etc/zfsbootmenu/dracut.conf.d/*.conf "${buildtmp}/etc/dracut.conf.d"
47-
48-
# Files in release.conf.d are allowed to shadow regular defaults
49-
cp ./etc/zfsbootmenu/release.conf.d/*.conf "${buildtmp}/etc/dracut.conf.d"
50-
5140
arch="$( uname -m )"
5241
case "${arch}" in
5342
x86_64) BUILD_EFI="true" ;;
5443
*) BUILD_EFI="false" ;;
5544
esac
5645

46+
buildtmp="$( mktemp -d )" || error "cannot create build directory"
47+
mkdir -p "${buildtmp}/out" || error "cannot create output directory"
48+
mkdir -p "${buildtmp}/etc/dracut.conf.d" || error "cannot create config tree"
49+
5750
# Volume mounts for the container; make sure stock config tree, with release
5851
# addendum, is available in-container at /etc/zfsbootmenu
5952
volmounts=(
@@ -62,19 +55,6 @@ volmounts=(
6255
"-v" "${buildtmp}/out:/out"
6356
)
6457

65-
# Specify options for the build st
66-
buildopts=(
67-
"-o" "/out"
68-
"-e" ".EFI.Enabled = ${BUILD_EFI}"
69-
"-c" "/etc/zfsbootmenu/release.yaml"
70-
)
71-
72-
# For the containerized build, use current repo by mounting at /zbm
73-
# Custom configs and outputs will be in the temp dir, mounted at /build
74-
if ! podman run --rm "${volmounts[@]}" "${buildtag}" "${buildopts[@]}"; then
75-
error "failed to create image"
76-
fi
77-
7858
if ! assets="$( realpath -e releng )/assets/${release}"; then
7959
error "unable to define path to built assets"
8060
fi
@@ -85,20 +65,46 @@ else
8565
mkdir -p "${assets}"
8666
fi
8767

88-
zbmtriplet="zfsbootmenu-vmlinuz-${arch}-v${release}"
68+
for style in release recovery; do
69+
echo "Building style: ${style}"
70+
# Copy configuration components in place
71+
cp "./etc/zfsbootmenu/${style}.yaml" "${buildtmp}/etc"
72+
cp ./etc/zfsbootmenu/dracut.conf.d/*.conf "${buildtmp}/etc/dracut.conf.d"
73+
74+
# Files in release.conf.d are allowed to shadow regular defaults
75+
cp ./etc/zfsbootmenu/"${style}".conf.d/*.conf "${buildtmp}/etc/dracut.conf.d"
76+
77+
# Specify options for the build st
78+
buildopts=(
79+
"-o" "/out"
80+
"-e" ".EFI.Enabled = ${BUILD_EFI}"
81+
"-c" "/etc/zfsbootmenu/${style}.yaml"
82+
)
83+
84+
# For the containerized build, use current repo by mounting at /zbm
85+
# Custom configs and outputs will be in the temp dir, mounted at /build
86+
if ! podman run --rm "${volmounts[@]}" "${buildtag}" "${buildopts[@]}"; then
87+
error "failed to create image"
88+
fi
89+
90+
zbmtriplet="zfsbootmenu-${style}-vmlinuz-${arch}-v${release}"
8991

90-
# EFI file is currently only built on x86_64
91-
if [ "${BUILD_EFI}" = "true" ]; then
92-
if ! cp "${buildtmp}/out/vmlinuz.EFI" "${assets}/${zbmtriplet}.EFI"; then
93-
error "failed to copy UEFI bundle"
92+
# EFI file is currently only built on x86_64
93+
if [ "${BUILD_EFI}" = "true" ]; then
94+
if ! cp "${buildtmp}/out/vmlinuz.EFI" "${assets}/${zbmtriplet}.EFI"; then
95+
error "failed to copy UEFI bundle"
96+
fi
9497
fi
95-
fi
9698

97-
# Nothing to archive if no components were produced
98-
[ -d "${buildtmp}/out/components" ] || exit 0
99+
# Nothing to archive if no components were produced
100+
[ -d "${buildtmp}/out/components" ] || exit 0
101+
102+
zbmtriplet="zfsbootmenu-${style}-${arch}-v${release}"
103+
# If components were produced, archive them
104+
( cd "${buildtmp}/out" && mv components "${zbmtriplet}" && \
105+
tar czvf "${assets}/${zbmtriplet}.tar.gz" "${zbmtriplet}"
106+
) || error "failed to pack components"
99107

100-
zbmtriplet="zfsbootmenu-${arch}-v${release}"
101-
# If components were produced, archive them
102-
( cd "${buildtmp}/out" && mv components "${zbmtriplet}" && \
103-
tar czvf "${assets}/${zbmtriplet}.tar.gz" "${zbmtriplet}"
104-
) || error "failed to pack components"
108+
rm "${buildtmp}"/etc/*.yaml
109+
rm "${buildtmp}"/etc/dracut.conf.d/*.conf
110+
done

releng/tag-release.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,23 @@ if ! releng/sign-assets.sh "${release}"; then
118118
error "ERROR: unable to sign release assets, exiting!"
119119
fi
120120

121-
assets="$( realpath -e "releng/assets/${release}" )"
121+
asset_dir="$( realpath -e "releng/assets/${release}" )"
122122
asset_files=()
123123

124-
for asset in zfsbootmenu-vmlinuz-${arch}-v${release}.EFI zfsbootmenu-${arch}-v${release}tar.gz; do
125-
f="${assets}/${asset}"
124+
for style in release recovery; do
125+
assets+=( "zfsbootmenu-${style}-vmlinuz-${arch}-v${release}.EFI" )
126+
assets+=( "zfsbootmenu-${style}-${arch}-v${release}.tar.gz" )
127+
done
128+
129+
for asset in "${assets[@]}" ; do
130+
f="${asset_dir}/${asset}"
126131
[ -f "${f}" ] || error "ERROR: missing boot image ${f}"
127132
asset_files+=( "${f}" )
128133
done
129134

130135
for f in sha256.{txt,sig}; do
131-
[ -f "${assets}/${f}" ] || error "ERROR: missng sum file ${assets}/${f}"
132-
asset_files+=( "${assets}/${f}" )
136+
[ -f "${asset_dir}/${f}" ] || error "ERROR: missng sum file ${asset_dir}/${f}"
137+
asset_files+=( "${asset_dir}/${f}" )
133138
done
134139

135140
# github-cli does not automatically strip header that hub uses for a title

0 commit comments

Comments
 (0)