Skip to content

Commit 1aede49

Browse files
dracut.install: fork, simplify and workaround zfs issues (2)
Signed-off-by: Nowa Ammerlaan <[email protected]>
1 parent 3960f59 commit 1aede49

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

hooks/50-dracut.install

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ main() {
9191
die "Cannot read ${INSTALLKERNEL_STAGING_AREA}/${out}"
9292
if [[ ${magic} == MZ ]]; then
9393
einfo "Combined UEFI kernel+initramfs executable found"
94-
mv "${INSTALLKERNEL_STAGING_AREA}/dracut-tmp" \
94+
mv "${INSTALLKERNEL_STAGING_AREA}/${out}" \
9595
"${INSTALLKERNEL_STAGING_AREA}/uki.efi" || die "Failed to rename UKI"
9696
else
9797
einfo "Plain initramfs image found"
98-
mv "${INSTALLKERNEL_STAGING_AREA}/dracut-tmp" \
98+
mv "${INSTALLKERNEL_STAGING_AREA}/${out}" \
9999
"${INSTALLKERNEL_STAGING_AREA}/initrd" || die "Failed to rename initramfs"
100100
fi
101101
fi

hooks/systemd/52-dracut.install

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,21 @@ INITRAMFS_GEN_ARGS+=(
6262
)
6363

6464
dracut "${INITRAMFS_GEN_ARGS[@]}" || exit 1
65+
66+
# Fallback path for if we don't know if we generated an initramfs or
67+
# UKI. If dracut is used in uefi=yes mode, initrd will actually
68+
# be a combined kernel+initramfs UEFI executable. We can easily
69+
# recognize it by PE magic (vs cpio for a regular initramfs)
70+
if [[ ${IMAGE} == dracut-tmp ]]; then
71+
read -rn 2 magic <"${KERNEL_INSTALL_STAGING_AREA}/${IMAGE}" ||
72+
die "Cannot read ${KERNEL_INSTALL_STAGING_AREA}/${IMAGE}"
73+
if [[ ${magic} == MZ ]]; then
74+
einfo "Combined UEFI kernel+initramfs executable found"
75+
mv "${KERNEL_INSTALL_STAGING_AREA}/${IMAGE}" \
76+
"${KERNEL_INSTALL_STAGING_AREA}/uki.efi" || die "Failed to rename UKI"
77+
else
78+
einfo "Plain initramfs image found"
79+
mv "${KERNEL_INSTALL_STAGING_AREA}/${IMAGE}" \
80+
"${KERNEL_INSTALL_STAGING_AREA}/initrd" || die "Failed to rename initramfs"
81+
fi
82+
fi

0 commit comments

Comments
 (0)