diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2023-11-26 22:19:26 +0100 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2023-11-26 22:19:26 +0100 |
commit | 210bfe445a650686cc3815387da3e064d0afb303 (patch) | |
tree | 102dde28a7b4c06618b95241d6c9119caa39d8c2 | |
parent | b1b3c063d4f5de12fc17f8b705c18f331fde61df (diff) | |
download | prepare-lastboot-master.tar.gz prepare-lastboot-master.tar.bz2 prepare-lastboot-master.zip |
-rw-r--r-- | prepare-lastboot | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/prepare-lastboot b/prepare-lastboot index 21ab825..a384ebb 100644 --- a/prepare-lastboot +++ b/prepare-lastboot @@ -13,6 +13,17 @@ UKI_NAME="$(cat /etc/machine-id)-$(uname -r).efi" if [ "$ROOT_FS" = "$BASE/$DEFAULT" ]; then echo "sucessfully booted to $BASE/$DEFAULT, preparing lastboot" + # 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" + chmod a-x "/boot/initramfs-$(uname -r).img" + # destroy the old lastboot file system and children zfs destroy -Rv "$BASE/$DEFAULT@$LASTBOOT" @@ -26,17 +37,6 @@ if [ "$ROOT_FS" = "$BASE/$DEFAULT" ]; then done zfs set mountpoint=/ "$BASE/$LASTBOOT-$DEFAULT" - - # 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" - chmod a-x "/boot/initramfs-$(uname -r).img" else echo "not booted to $BASE/$DEFAULT, taking no action" fi |