Make backup in zz-update-boot.

This commit is contained in:
Andy Nguyen
2026-05-24 23:01:23 +02:00
parent 0e1219f422
commit 04378b78f4
2 changed files with 9 additions and 4 deletions

View File

@@ -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"

View File

@@ -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