From 04378b78f40543e1a23b2226c9606ff24c69680e Mon Sep 17 00:00:00 2001 From: Andy Nguyen Date: Sun, 24 May 2026 23:01:23 +0200 Subject: [PATCH] Make backup in zz-update-boot. --- distros/shared/zz-update-boot | 6 ++++-- distros/shared/zz-update-boot-multi | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/distros/shared/zz-update-boot b/distros/shared/zz-update-boot index 4124fc7..8f4b224 100755 --- a/distros/shared/zz-update-boot +++ b/distros/shared/zz-update-boot @@ -5,6 +5,8 @@ set -e BOOT_PART="/boot/efi" KVER="$1" [ -z "$KVER" ] && KVER="$(ls -1t /lib/modules | head -1)" -cp "/boot/vmlinuz-$KVER" "$BOOT_PART/bzImage" -cp "/boot/initrd.img-$KVER" "$BOOT_PART/initrd.img" +mv "$BOOT_PART/bzImage" "$BOOT_PART/bzImage.old" +mv "$BOOT_PART/initrd.img" "$BOOT_PART/initrd.img.old" +cp "/boot/vmlinuz-$KVER" "$BOOT_PART/bzImage" +cp "/boot/initrd.img-$KVER" "$BOOT_PART/initrd.img" echo ">> Kernel $KVER deployed to $BOOT_PART" diff --git a/distros/shared/zz-update-boot-multi b/distros/shared/zz-update-boot-multi index 560bba2..19a4753 100644 --- a/distros/shared/zz-update-boot-multi +++ b/distros/shared/zz-update-boot-multi @@ -9,11 +9,14 @@ KVER="$1" DISTRO="unknown" [ -f /etc/ps5-distro ] && DISTRO="$(cat /etc/ps5-distro)" -cp "/boot/vmlinuz-$KVER" "$BOOT_PART/bzImage" -cp "/boot/initrd.img-$KVER" "$BOOT_PART/initrd-${DISTRO}.img" +mv "$BOOT_PART/bzImage" "$BOOT_PART/bzImage.old" +mv "$BOOT_PART/initrd-${DISTRO}.img" "$BOOT_PART/initrd-${DISTRO}.img.old" +cp "/boot/vmlinuz-$KVER" "$BOOT_PART/bzImage" +cp "/boot/initrd.img-$KVER" "$BOOT_PART/initrd-${DISTRO}.img" # Ubuntu 26.04 is default boot — also update the generic initrd.img if [ "$DISTRO" = "ubuntu2604" ]; then + mv "$BOOT_PART/initrd.img" "$BOOT_PART/initrd.img.old" cp "/boot/initrd.img-$KVER" "$BOOT_PART/initrd.img" fi