1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-25 18:50:18 +03:00

kernel-install: install addons in 90-uki-copy.install if they are present

mkosi now has a kernel-install plugin to build addons, mkosi-addon.
If there are addons in <uki>.extra.d/ install them too to
the ESP.
This commit is contained in:
Luca Boccassi 2024-12-06 23:46:12 +00:00 committed by Yu Watanabe
parent e14e9c9f17
commit 75ee025c5d

View File

@ -73,6 +73,8 @@ else
UKI_FILE="$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION.efi"
fi
ADDON_DIR="$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION.efi.extra.d"
# If there is a UKI named uki.efi on the staging area use that, if not use what
# was passed in as $KERNEL_IMAGE but insist it has a .efi extension
if [ -f "$KERNEL_INSTALL_STAGING_AREA/uki.efi" ]; then
@ -81,6 +83,14 @@ if [ -f "$KERNEL_INSTALL_STAGING_AREA/uki.efi" ]; then
echo "Error: could not copy '$KERNEL_INSTALL_STAGING_AREA/uki.efi' to '$UKI_FILE'." >&2
exit 1
}
for f in "$KERNEL_INSTALL_STAGING_AREA/uki.efi.extra.d"/*; do
[ -f "$f" ] || continue
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Installing $f as $ADDON_DIR/$(basename "$f")"
install -D -m 0644 "$f" "$ADDON_DIR/$(basename "$f")" || {
echo "Error: could not copy '$f' to '$ADDON_DIR/$(basename "$f")'." >&2
exit 1
}
done
elif [ -n "$KERNEL_IMAGE" ]; then
[ -f "$KERNEL_IMAGE" ] || {
echo "Error: UKI '$KERNEL_IMAGE' not a file." >&2
@ -95,6 +105,14 @@ elif [ -n "$KERNEL_IMAGE" ]; then
echo "Error: could not copy '$KERNEL_IMAGE' to '$UKI_FILE'." >&2
exit 1
}
for f in "$KERNEL_IMAGE.extra.d"/* "$KERNEL_INSTALL_STAGING_AREA/uki.efi.extra.d"/*; do
[ -f "$f" ] || continue
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Installing $f as $ADDON_DIR/$(basename "$f")"
install -D -m 0644 "$f" "$ADDON_DIR/$(basename "$f")" || {
echo "Error: could not copy '$f' to '$ADDON_DIR/$(basename "$f")'." >&2
exit 1
}
done
else
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "No UKI available. Nothing to do."
exit 0