python-virt-firmware/systemd-fixes.patch

78 lines
3.0 KiB
Diff

diff --git a/systemd/99-uki-uefi-setup.install b/systemd/99-uki-uefi-setup.install
index a2234e10f4d1..7d7fa47a4fa0 100755
--- a/systemd/99-uki-uefi-setup.install
+++ b/systemd/99-uki-uefi-setup.install
@@ -23,13 +23,22 @@ fi
UKI_FILE_BOOT="$UKI_DIR_BOOT/$ENTRY_TOKEN-$KERNEL_VERSION.efi"
UKI_FILE_ESP="$UKI_DIR_ESP/$ENTRY_TOKEN-$KERNEL_VERSION.efi"
+if [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ]; then
+ LOGLEVEL="--loglevel info"
+else
+ LOGLEVEL="--loglevel error"
+fi
+
case "$COMMAND" in
remove)
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
- echo "Removing $UKI_DIR_ESP/$ENTRY_TOKEN-$KERNEL_VERSION.efi from UEFI boot entries"
- for uki in "$UKI_DIR_ESP/$ENTRY_TOKEN-$KERNEL_VERSION.efi"; do
- [ -f "$uki" ] && kernel-bootcfg --remove-uki "$uki"
- done
+ echo "Removing $UKI_FILE_ESP from UEFI boot entries"
+ kernel-bootcfg $LOGLEVEL --remove-uki "$UKI_FILE_ESP"
+ if [ "$UKI_FILE_BOOT" != "$UKI_FILE_ESP" -a -f "$UKI_FILE_ESP" ]; then
+ [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
+ echo "Removing $UKI_FILE_ESP from ESP"
+ rm -f "$UKI_FILE_ESP"
+ fi
;;
add)
[ "$KERNEL_INSTALL_LAYOUT" = "uki" ] || exit 0
@@ -40,18 +49,19 @@ case "$COMMAND" in
exit 1
fi
- [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
- echo "Adding $UKI_FILE_ESP to ESP and UEFI boot entries"
-
- # Copy the UKI to the ESP when $BOOT and ESP differ
- if [ ! -f "$UKI_FILE_ESP" ]; then
- install -D -m 0644 "$UKI_FILE_BOOT" "$UKI_FILE_ESP" || {
- echo "Error: could not copy '$UKI_FILE_BOOT' to '$UKI_FILE_ESP'." >&2
+ # Move the UKI to the ESP when $BOOT and ESP differ
+ if [ "$UKI_FILE_BOOT" != "$UKI_FILE_ESP" -a ! -f "$UKI_FILE_ESP" ]; then
+ [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
+ echo "Moving $UKI_FILE_BOOT to ESP"
+ mv "$UKI_FILE_BOOT" "$UKI_FILE_ESP" || {
+ echo "Error: could not move '$UKI_FILE_BOOT' to '$UKI_FILE_ESP'." >&2
exit 1
}
fi
- kernel-bootcfg --add-uki "$UKI_FILE_ESP" --title "$KERNEL_VERSION" --once
+ [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
+ echo "Adding $UKI_FILE_ESP to UEFI boot entries"
+ kernel-bootcfg $LOGLEVEL --add-uki "$UKI_FILE_ESP" --title "$KERNEL_VERSION" --once
;;
*)
exit 0
diff --git a/systemd/kernel-bootcfg-boot-successful.service b/systemd/kernel-bootcfg-boot-successful.service
index 7bf851496982..b45a317daf96 100644
--- a/systemd/kernel-bootcfg-boot-successful.service
+++ b/systemd/kernel-bootcfg-boot-successful.service
@@ -2,8 +2,11 @@
[Unit]
Description=UKI Successful Boot
-After=sysinit.target
-Before=systemd-user-sessions.service
+Requires=boot-complete.target
+After=local-fs.target boot-complete.target
+Conflicts=shutdown.target
+Before=shutdown.target
+ConditionFirmware=uefi
ConditionPathExists=!/etc/initrd-release
[Service]