diff --git a/src/kernel-install/90-loaderentry.install.in b/src/kernel-install/90-loaderentry.install.in index 6945a0fd28..66cfec8886 100755 --- a/src/kernel-install/90-loaderentry.install.in +++ b/src/kernel-install/90-loaderentry.install.in @@ -115,8 +115,14 @@ if [ -f "$TRIES_FILE" ]; then if [ -f "$LOADER_ENTRY" ]; then [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ echo "Removing previous loader entry '$LOADER_ENTRY' without boot counting." >&2 - rm -f "$LOADER_ENTRY" "${LOADER_ENTRY%.conf}+"*.conf + rm -f "$LOADER_ENTRY" fi + for loaderentry in "${LOADER_ENTRY%.conf}+"*.conf; do + [ "$loaderentry" = "${LOADER_ENTRY%.conf}+*.conf" ] && break + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "Removing previous loader entry '$loaderentry' that has not yet booted successfully." >&2 + rm -f "$loaderentry" + done LOADER_ENTRY="${LOADER_ENTRY%.conf}+$TRIES.conf" fi diff --git a/src/kernel-install/90-uki-copy.install b/src/kernel-install/90-uki-copy.install index 90aa876e6a..a55c7b8e84 100755 --- a/src/kernel-install/90-uki-copy.install +++ b/src/kernel-install/90-uki-copy.install @@ -70,8 +70,14 @@ if [ -f "$TRIES_FILE" ]; then if [ -f "$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION.efi" ]; then [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ echo "Removing previous UKI '$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION.efi' without boot counting." >&2 - rm -f "$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION.efi" "$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION+"*.efi + rm -f "$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION.efi" fi + for uki in "$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION+"*.efi; do + [ "$uki" = "$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION+*.efi" ] && break + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "Removing previous UKI '$uki' that has not yet booted successfully." >&2 + rm -f "$uki" + done UKI_FILE="$UKI_DIR/$ENTRY_TOKEN-$KERNEL_VERSION+$TRIES.efi" else