summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2023-11-26 18:33:41 +0100
committerJaron Kent-Dobias <jaron@kent-dobias.com>2023-11-26 18:33:41 +0100
commit6d8358b99589ec7f07d1c1316f5eb250726ba753 (patch)
treeb246a9990902c92839513306dc4a000e22d9c9e3
parent62b5588e2abc4f435b72c31b8fdb54e480ac71d3 (diff)
downloadprepare-lastboot-6d8358b99589ec7f07d1c1316f5eb250726ba753.tar.gz
prepare-lastboot-6d8358b99589ec7f07d1c1316f5eb250726ba753.tar.bz2
prepare-lastboot-6d8358b99589ec7f07d1c1316f5eb250726ba753.zip
Added feature to back up old initramfs.v1.3
-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