Files
marfrit-packages/arch/daedalus-v4l2-dkms/daedalus-v4l2-dkms.install
T
test0r 4776dc01d2 daedalus-v4l2-dkms: loud warning when DKMS build doesn't land
Sonnet pre-deployment review caught a BLOCKER: on a fresh higgs
(Debian 13 / Pi CM5) install without the RPi kernel headers
pre-installed, the postinst's `dkms autoinstall || true` silently
swallowed the build failure. Package appeared installed but the
.ko was absent; `modprobe daedalus_v4l2` then failed and the
entire stack was dead with no clear pointer to the cause.

Fix in both ecosystems:

debian/daedalus-v4l2-dkms/build-deb.sh:
- After `dkms autoinstall`, verify the post-condition with
  `dkms status -m daedalus_v4l2 -v VER -k $(uname -r)`.
- If the module isn't 'installed' / 'loaded' for the running
  kernel, emit a yellow-bolded ANSI warning naming the most
  likely cause (kernel headers package missing) and the exact
  recovery steps (linux-headers-rpi-2712 for RPi or
  linux-headers-$KERNELVER for Debian generic, then
  `dkms autoinstall` + `modprobe`).
- Colour only on TTY; the warning is unconditional regardless.

arch/daedalus-v4l2-dkms/:
- New daedalus-v4l2-dkms.install with post_install +
  post_upgrade hooks that run the same `dkms status` check.
- post_upgrade catches the case where a kernel-headers package
  was uninstalled / pruned between upgrades, silently
  regressing the build.
- Wired into the PKGBUILD via install="${pkgname}.install".

Both versions point at the actual repair commands rather than
just saying "build failed", so the user is one apt/pacman away
from a working stack instead of debugging dkms internals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 18:38:52 +00:00

62 lines
1.9 KiB
Plaintext

# post-install / post-upgrade hook for daedalus-v4l2-dkms.
#
# pacman + the dkms-helpers alpm hook will already attempt
# `dkms install` on its own. This script's job is to emit a
# loud, actionable warning when the module didn't actually
# build for the running kernel — most commonly because the
# kernel headers package isn't installed yet.
#
# Without this you get a silent failure: the package looks
# installed but `modprobe daedalus_v4l2` returns ENOENT.
_check_dkms_built() {
local name=daedalus_v4l2
local ver=$1
local kernelver=$(uname -r)
if ! command -v dkms >/dev/null 2>&1; then
return 1 # the hard-dep should have caught this
fi
local status
status=$(dkms status -m "$name" -v "$ver" -k "$kernelver" 2>/dev/null || true)
if printf '%s\n' "$status" | grep -q -E 'installed|loaded'; then
return 0 # all good
fi
cat >&2 <<EOF
==> daedalus-v4l2-dkms: DKMS build did NOT land for kernel $kernelver.
==> dkms status -m $name -v $ver -k $kernelver:
==> $(printf '%s' "$status" | head -1)
==>
==> Most likely cause: kernel headers package is missing.
==> Arch / ALARM: pacman -S linux-rpi-headers (or linux-rpi5-headers)
==> Raspberry Pi OS: apt install linux-headers-rpi-2712
==>
==> After installing headers, finish the install with:
==> sudo dkms autoinstall $name/$ver
==> sudo modprobe daedalus_v4l2
==>
==> Until then daedalus_v4l2 will NOT be loadable and the
==> userspace daedalus-v4l2 daemon will have nothing to talk to.
EOF
return 1
}
post_install() {
_check_dkms_built "$1" || true
}
post_upgrade() {
# New version pinned by the bump may have built fine, but if
# a kernel-headers package was uninstalled / pruned since the
# last upgrade we'd silently regress. Re-check.
_check_dkms_built "$1" || true
}
pre_remove() {
# The dkms alpm hook handles dkms remove on its own; nothing
# we need to add here.
:
}