dkms: improve consistency of relative paths in kernel hooks

This commit is contained in:
Andrew J. Hesford 2020-08-05 12:13:08 -04:00
parent 8f4c05bf76
commit 22e18e6794
3 changed files with 22 additions and 20 deletions

View file

@ -8,7 +8,7 @@ PKGNAME="$1"
VERSION="$2"
ARCH=$(uname -m)
if [ ! -x /usr/sbin/dkms ]; then
if [ ! -x /usr/bin/dkms ]; then
exit 0
fi
@ -59,16 +59,16 @@ while [ $# -gt 1 ]; do
# If adding a module, depmod is necessary unless dkms runs it
do_depmod="yes"
status=$(dkms status -m ${module} -v ${modulever} -k ${VERSION})
status=$(/usr/bin/dkms status -m ${module} -v ${modulever} -k ${VERSION})
if [ $(echo "$status"|grep -c ": built") -eq 0 ]; then
# Check if the module is still there.
if [ ! -f usr/src/${module}-${modulever}/dkms.conf ]; then
if [ ! -f /usr/src/${module}-${modulever}/dkms.conf ]; then
echo "Skipping nonexistent DKMS module: ${module}-${modulever}."
continue
fi
# Build the module
echo -n "Building DKMS module: ${module}-${modulever}... "
dkms build -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
/usr/bin/dkms build -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
rval=$?
# If the module was skipped or failed, go to the next module.
if [ $rval -eq 0 ]; then
@ -80,14 +80,14 @@ while [ $# -gt 1 ]; do
echo "FAILED!"
continue
fi
status=$(dkms status -m ${module} -v ${modulever} -k ${VERSION})
status=$(/usr/bin/dkms status -m ${module} -v ${modulever} -k ${VERSION})
fi
# If the module is built (either pre-built or just now), install it
if [ $(echo "$status"|grep -c ": built") -eq 1 ] &&
[ $(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}
/usr/bin/dkms install -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH}
rval=$?
# If the module failed installation, go to the next module.
if [ $rval -eq 0 ]; then
@ -101,9 +101,12 @@ while [ $# -gt 1 ]; do
fi
done
if [ -n "$do_depmod" ]; then
if [ -z "$do_depmod" ] || [ ! -x /usr/bin/depmod ]; then
exit 0
fi
echo -n "Generating kernel module dependency lists... "
depmod -a ${VERSION}
/usr/bin/depmod -a ${VERSION}
rval=$?
if [ $rval -eq 0 ]; then
echo "done."
@ -111,6 +114,5 @@ if [ -n "$do_depmod" ]; then
echo "FAILED!"
exit $rval
fi
fi
exit 0

View file

@ -4,14 +4,14 @@
PKGNAME="$1"
VERSION="$2"
if [ -x /usr/sbin/dkms ]; then
if [ -x /usr/bin/dkms ]; then
while read line; do
name=`echo "$line" | awk '{print $1}' | sed 's/,$//'`
vers=`echo "$line" | awk '{print $2}' | sed 's/,$//'`
arch=`echo "$line" | awk '{print $4}' | sed 's/:$//'`
echo "dkms: removing: $name $vers (${PKGNAME}-${VERSION}) ($arch)" >&2
dkms remove -q -m $name -v $vers -k ${VERSION} -a $arch
done < <(dkms status -k ${VERSION} 2>/dev/null | grep ": installed")
/usr/bin/dkms remove -q -m $name -v $vers -k ${VERSION} -a $arch
done < <(/usr/bin/dkms status -k ${VERSION} 2>/dev/null | grep ": installed")
fi
rmdir \

View file

@ -1,7 +1,7 @@
# Template file for 'dkms'
pkgname=dkms
version=2.8.3
revision=1
revision=2
conf_files="/etc/dkms/framework.conf"
depends="bash kmod gcc make coreutils linux-headers"
short_desc="Dynamic Kernel Modules System"