|
59 | 59 | mkdir -p "${assets}" |
60 | 60 | fi |
61 | 61 |
|
| 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 | + |
62 | 66 | for style in release recovery; do |
63 | 67 | echo "Building style: ${style}" |
64 | 68 |
|
65 | 69 | # Always start with a fresh configuration tree |
66 | 70 | mkdir -p "${buildtmp}/build/dracut.conf.d" || error "cannot create config tree" |
67 | 71 |
|
| 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 | + |
68 | 77 | # Make sure there is an output directory for this asset style |
69 | 78 | zbmtriplet="zfsbootmenu-${style}-${arch}-v${release}" |
| 79 | + |
70 | 80 | outdir="${buildtmp}/${zbmtriplet}" |
71 | 81 | mkdir -p "${outdir}" || error "cannot create output directory" |
72 | 82 |
|
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 |
77 | 89 |
|
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 |
86 | 98 |
|
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" |
91 | 107 | fi |
92 | | - rm -f "${outdir}/vmlinuz.EFI" |
93 | | - fi |
94 | 108 |
|
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 |
101 | 124 |
|
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 |
108 | 127 |
|
109 | 128 | # Clean up the style-specific build components |
110 | 129 | rm -rf "${buildtmp}/build" "${outdir}" |
|
0 commit comments