From 743086d278987c908bc7b3f1d1b1f45ecf012a00 Mon Sep 17 00:00:00 2001 From: q66 Date: Thu, 11 Jul 2024 22:45:49 +0200 Subject: [PATCH] main/base-kernel: do not brick systems with chimera-buildkernel This was always meant to be more like a packaging helper but it can be useful for building/installing on actual systems too. When doing that, do not remove /lib as that would render the system unbootable afterwards. --- main/base-kernel/files/chimera-buildkernel.sh | 9 +++++++-- main/base-kernel/template.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/main/base-kernel/files/chimera-buildkernel.sh b/main/base-kernel/files/chimera-buildkernel.sh index 90b11d0d8f..180ed02df1 100755 --- a/main/base-kernel/files/chimera-buildkernel.sh +++ b/main/base-kernel/files/chimera-buildkernel.sh @@ -358,10 +358,14 @@ do_install() { mkdir -p "${DESTDIR}/usr/lib" # needed for depmod - ln -sf usr/lib "${DESTDIR}/lib" + [ -e "${DESTDIR}/lib" -o -L "${DESTDIR}/lib" ] || \ + ln -s usr/lib "${DESTDIR}/lib" [ -d "$DESTDIR" ] || die "Could not create destination directory." + # resolve absolute + DESTDIR=$(realpath "$DESTDIR") + echo "=> Installing modules..." strip_exe=/usr/bin/true @@ -423,7 +427,8 @@ do_install() { "${DESTDIR}/usr/lib/debug/boot/vmlinux-${kernver}" fi - rm -f "${DESTDIR}/lib" + # do not remove when installing to system + [ "$DESTDIR" = "/" ] || rm -f "${DESTDIR}/lib" cd "${DESTDIR}/usr/lib/modules/${kernver}" \ || die "Could not change directory" diff --git a/main/base-kernel/template.py b/main/base-kernel/template.py index 35695b85c5..7cb5d06c77 100644 --- a/main/base-kernel/template.py +++ b/main/base-kernel/template.py @@ -1,6 +1,6 @@ pkgname = "base-kernel" pkgver = "0.1" -pkgrel = 12 +pkgrel = 13 depends = [ "kmod", "procps",