diff --git a/system/system76-io-dkms/README b/system/system76-io-dkms/README index 66dbcbc7b9..94475bf574 100644 --- a/system/system76-io-dkms/README +++ b/system/system76-io-dkms/README @@ -13,5 +13,5 @@ The system76-io dkms module is automatically registered with dkms by doinst.sh with the following command: dkms install system76-io/$VER -Old versions of system76-io should be manually unregistered from dkms using: -dkms remove system76-io/$OLD_VER --all +A douninst.sh script is included which calls "dkms remove" to delete all +kernel versions of the old module on package removal or upgrade. diff --git a/system/system76-io-dkms/doinst.sh b/system/system76-io-dkms/doinst.sh index 6b33ed6c28..e7dbe2df63 100644 --- a/system/system76-io-dkms/doinst.sh +++ b/system/system76-io-dkms/doinst.sh @@ -1,7 +1,5 @@ VER=@MODULE_VERSION@ dkms install system76-io/$VER -# Before removing the system76-io package, the following command should -# be run to unregister the module from dkms: -# -# dkms remove system76-io/$VER --all +# Copy a backup of dkms.conf for module removal by douninst.sh. +cp usr/src/system76-io-$VER/dkms.conf etc/dkms/system76-io-$VER.conf diff --git a/system/system76-io-dkms/douninst.sh b/system/system76-io-dkms/douninst.sh new file mode 100644 index 0000000000..9a5a1e16a0 --- /dev/null +++ b/system/system76-io-dkms/douninst.sh @@ -0,0 +1,6 @@ +VER=@MODULE_VERSION@ +CONF=etc/dkms/system76-io-$VER.conf +if [ -r $CONF ]; then + dkms remove system76-io/$VER --all -c $CONF + rm $CONF +fi diff --git a/system/system76-io-dkms/system76-io-dkms.SlackBuild b/system/system76-io-dkms/system76-io-dkms.SlackBuild index 9cd500f1da..fe336d2620 100644 --- a/system/system76-io-dkms/system76-io-dkms.SlackBuild +++ b/system/system76-io-dkms/system76-io-dkms.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for system76-io-dkms -# Copyright 2019 Erich Ritz, Scottsdale, Arizona, USA +# Copyright 2019,2021 Erich Ritz, Jenks, Oklahoma, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -77,7 +77,7 @@ cp -a \ $PKG/usr/src/$MODNAM-$VERSION # Edit and install dkms configuration -sed "s/@MODULE_VERSION@/${VERSION}/" "debian/system76-io-dkms.dkms" > "$PKG/usr/src/$MODNAM-$VERSION/dkms.conf" +sed "s/#MODULE_VERSION#/${VERSION}/" "debian/system76-io-dkms.dkms" > "$PKG/usr/src/$MODNAM-$VERSION/dkms.conf" mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ @@ -88,6 +88,7 @@ cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc sed "s/@MODULE_VERSION@/${VERSION}/" "$CWD/doinst.sh" > "$PKG/install/doinst.sh" +sed "s/@MODULE_VERSION@/${VERSION}/" "$CWD/douninst.sh" > "$PKG/install/douninst.sh" cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE