]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
kernel-install: install addons in 90-uki-copy.install if they are present
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 6 Dec 2024 23:46:12 +0000 (23:46 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 1 Feb 2025 09:12:47 +0000 (18:12 +0900)
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.

src/kernel-install/90-uki-copy.install

index 04bf5d1752f77462d816db720af0529bddf99959..e34c8dcdcf7c5616f402e78db96aabadc6b496a1 100755 (executable)
@@ -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