summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--prepare-lastboot6
1 files changed, 6 insertions, 0 deletions
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