summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Ritz <erich.public@protonmail.com>2021-08-10 14:37:22 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2021-11-23 01:11:15 +0700
commit9164984e6068edac6a1d2a23f2b25514370ba7c0 (patch)
treec28028b534d95404d6dffa4ade77af6b48e773c7
parentfa6c85fcad17a20d02bcc14ee339209860feac75 (diff)
downloadslackbuilds-9164984e6068edac6a1d2a23f2b25514370ba7c0.tar.gz
system/system76-io-dkms: Add douninst.sh.
The douninst.sh script will remove all versions of the module built by dkms so that this package properly cleans up after itself. Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--system/system76-io-dkms/README4
-rw-r--r--system/system76-io-dkms/doinst.sh6
-rw-r--r--system/system76-io-dkms/douninst.sh6
-rw-r--r--system/system76-io-dkms/system76-io-dkms.SlackBuild5
4 files changed, 13 insertions, 8 deletions
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