From 6d8358b99589ec7f07d1c1316f5eb250726ba753 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Sun, 26 Nov 2023 18:33:41 +0100 Subject: Added feature to back up old initramfs. --- prepare-lastboot | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prepare-lastboot b/prepare-lastboot index 4ba1042..f13afc2 100644 --- a/prepare-lastboot +++ b/prepare-lastboot @@ -30,6 +30,12 @@ if [ "$ROOT_FS" = "$BASE/$DEFAULT" ]; then # backup the current UKI echo "copying $UKI_NAME to $LASTBOOT-$DEFAULT.efi" cp "$EFI_DIR/EFI/Linux/$UKI_NAME" "$EFI_DIR/EFI/Linux/$LASTBOOT-$DEFAULT.efi" + + echo "remove old initramfs images from /boot" + rm -f /boot/initramfs-*.img + + echo "unpack current initramfs to /boot/initramfs-$(uname -r).img" + objcopy -O binary -j.initrd "$EFI_DIR/EFI/Linux/$LASTBOOT-$DEFAULT.efi" "/boot/initramfs-$(uname -r).img" else echo "not booted to $BASE/$DEFAULT, taking no action" fi -- cgit v1.2.3-70-g09d2