Files
ps5-linux-image/distros/shared/zz-update-boot-multi
Bug Bounty Zip 8160bc649b Add Kali Linux image support (#9)
* Add Kali Linux image support

* Remove forced 1080p from Kali cmdline
2026-05-25 21:16:56 +02:00

40 lines
1.5 KiB
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)"
# Debian-based desktop metapackages may also install a generic kernel. Once
# linux-ps5 is present, never deploy another kernel to the PS5 boot partition.
if command -v dpkg-query >/dev/null 2>&1 && dpkg-query -W linux-ps5 >/dev/null 2>&1; then
PS5_KVER="$(dpkg-query -L linux-ps5 | sed -n 's#^/boot/vmlinuz-##p' | head -1)"
if [ -n "$PS5_KVER" ] && [ "$KVER" != "$PS5_KVER" ]; then
echo ">> Ignoring non-PS5 kernel $KVER (PS5 kernel is $PS5_KVER)"
exit 0
fi
fi
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)"