From ffb8b4fb170686dc5027498e48c21fe9ac57a769 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Sat, 4 Jul 2020 16:33:31 -0400 Subject: [PATCH] dkms: run depmod if necessary in kernel post-install hook Normally, `dkms install` will run depmod with each installed module to update module dependency lists. When force-reinstalling kernel packages, `dkms install` will not run because modules are already marked installed, but the kernel package will overwrite `modules.dep` and `modules.dep.bin` with packaged versions that do not include any modules installed by dkms. The kernel post-install hook now tracks whether depmod should be run and will do so if necessary. --- srcpkgs/dkms/files/kernel.d/dkms.postinst | 24 ++++++++++++++++++++--- srcpkgs/dkms/template | 2 +- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/srcpkgs/dkms/files/kernel.d/dkms.postinst b/srcpkgs/dkms/files/kernel.d/dkms.postinst index bfeaf34fccf..1d05ec88e08 100644 --- a/srcpkgs/dkms/files/kernel.d/dkms.postinst +++ b/srcpkgs/dkms/files/kernel.d/dkms.postinst @@ -45,6 +45,9 @@ while [ $# -ne 0 ]; do module="$1" modulever="$2" + # If adding a module, depmod is necessary unless dkms runs it + do_depmod="yes" + status=$(dkms status -m ${module} -v ${modulever} -k ${VERSION}) if [ $(echo "$status"|grep -c ": built") -eq 0 ]; then # Check if the module is still there. @@ -65,7 +68,7 @@ while [ $# -ne 0 ]; do echo "done." else echo "FAILED!" - exit $? + exit $rval fi status=$(dkms status -m ${module} -v ${modulever} -k ${VERSION}) fi @@ -75,14 +78,29 @@ while [ $# -ne 0 ]; do [ $(echo "$status"|grep -c ": installed") -eq 0 ]; then echo -n "Installing DKMS module: ${module}-${modulever}... " dkms install -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH} - if [ $? -eq 0 ]; then + rval=$? + if [ $rval -eq 0 ]; then echo "done." + # dkms runs depmod as part of the installation + unset do_depmod else echo "FAILED!" - exit $? + exit $rval fi fi shift; shift done +if [ -n "$do_depmod" ]; then + echo -n "Generating kernel module dependency lists... " + depmod -a ${VERSION} + rval=$? + if [ $rval -eq 0 ]; then + echo "done." + else + echo "FAILED!" + exit $rval + fi +fi + exit 0 diff --git a/srcpkgs/dkms/template b/srcpkgs/dkms/template index 521dfde1114..32345b9b421 100644 --- a/srcpkgs/dkms/template +++ b/srcpkgs/dkms/template @@ -2,7 +2,7 @@ pkgname=dkms reverts="2.8.2_1" version=2.8.1 -revision=3 +revision=4 conf_files="/etc/dkms/framework.conf" depends="bash kmod gcc make coreutils linux-headers" short_desc="Dynamic Kernel Modules System"