Files
ps5-linux-image/distros/shared/zz-update-boot-multi
2026-06-19 20:14:58 +02:00

30 lines
1011 B
Bash

#!/bin/bash
# Multi-distro boot hook: copies kernel + initrd to the EFI partition
# using distro-specific names. Reads /etc/ps5-distro for current distro.
set -e
BOOT_PART="/boot/efi"
KVER="$1"
[ -z "$KVER" ] && KVER="$(ls -1t /lib/modules | head -1)"
DISTRO="unknown"
[ -f /etc/ps5-distro ] && DISTRO="$(cat /etc/ps5-distro)"
if [ -f "$BOOT_PART/bzImage" ]; then
mv "$BOOT_PART/bzImage" "$BOOT_PART/bzImage.old"
fi
if [ -f "$BOOT_PART/initrd-${DISTRO}.img" ]; then
mv "$BOOT_PART/initrd-${DISTRO}.img" "$BOOT_PART/initrd-${DISTRO}.img.old"
fi
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
if [ -f "$BOOT_PART/initrd.img" ]; then
mv "$BOOT_PART/initrd.img" "$BOOT_PART/initrd.img.old"
fi
cp "/boot/initrd.img-$KVER" "$BOOT_PART/initrd.img"
fi
echo ">> Kernel $KVER deployed to $BOOT_PART (distro=$DISTRO)"