Skip to content

Commit

Permalink
xbps-triggers: dkms trigger updated and bugfixed
Browse files Browse the repository at this point in the history
The output format of `dkms status` has changed in v2.8.6
old -	zfs, 2.1.4, 5.15.39_1, x86_64: installed
new -	zfs/2.1.4, 5.15.39_1, x86_64: installed
So, I've re-worked the _modver and _kver detection logic.

Also, there was a bug. If a package tried to install a dkms module that
failed to build for *all* of the installed kernels, then the output of
dkms status for that module would be -

	module-name, x.y.z: added

Which would cause the dkms trigger to set _kver to "added", and then the
following call to `dkms remove` would set the flag `-k $_kver`, and poor
dkms would get confused trying to find a kernel of version "added".
  • Loading branch information
subnut committed May 18, 2022
1 parent 8f4fd31 commit b3c6393
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions srcpkgs/xbps-triggers/files/dkms
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# DKMS trigger. Used to add/build/install or remove the specified modules
# from all kernels.
#
#
# Modules can be specified like:
# dkms_modules="<modulename> <version> ..."
#
Expand All @@ -21,19 +21,23 @@ UPDATE="$5"
export PATH="usr/bin:usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin"

remove_modules() {
local _modver _kver
local modname modver kver line

# Remove the specified modules from all kernels.
set -- ${dkms_modules}
while [ $# -gt 0 ]; do
$DKMS status -m "$1" | while read line; do
if $(echo "$line" | egrep -vq '(added|built|installed)'); then
$DKMS status -m "$1" | while IFS=':/, ' read modname modver kver line; do
if echo "$modname $modver $kver $line" | grep -Evq '(added|built|installed)'; then
shift 2; continue
fi
_modver=$(echo "$line"|sed "s/$1,[[:blank:]]\([^,]*\)[,:].*/\1/;t;d")
_kver=$(echo "$line"|awk '{print $3}'|sed "s/\(.*\),$/\1/")
echo -n "Removing DKMS module '${1}-${_modver}' for kernel-${_kver}... "
$DKMS remove -m "$1" -v "${_modver}" -k "${_kver}" >/dev/null 2>&1
if [ "$kver" = added ]; then
# The module wasn't built successfully for any kernel version
printf %s "Cleaning up DKMS module '$modname-$modver'... "
$DKMS remove -m "$modname" -v "$modver" >/dev/null 2>&1
else
printf %s "Removing DKMS module '$modname-$modver' for kernel-$kver... "
$DKMS remove -m "$modname" -v "$modver" -k "$kver" >/dev/null 2>&1
fi
if [ $? -eq 0 ]; then
echo "done."
else
Expand Down
2 changes: 1 addition & 1 deletion srcpkgs/xbps-triggers/template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Template file for 'xbps-triggers'
pkgname=xbps-triggers
version=0.122
version=0.123
revision=1
bootstrap=yes
short_desc="XBPS triggers for Void Linux"
Expand Down

0 comments on commit b3c6393

Please sign in to comment.