From 9164984e6068edac6a1d2a23f2b25514370ba7c0 Mon Sep 17 00:00:00 2001 From: Erich Ritz Date: Tue, 10 Aug 2021 14:37:22 -0500 Subject: 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 --- system/system76-io-dkms/README | 4 ++-- system/system76-io-dkms/doinst.sh | 6 ++---- system/system76-io-dkms/douninst.sh | 6 ++++++ system/system76-io-dkms/system76-io-dkms.SlackBuild | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 system/system76-io-dkms/douninst.sh (limited to 'system') diff --git a/system/system76-io-dkms/README b/system/system76-io-dkms/README index 66dbcbc7b9ef..94475bf574c2 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 6b33ed6c2865..e7dbe2df63c1 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 000000000000..9a5a1e16a0e4 --- /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 9cd500f1daac..fe336d26202d 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 -- cgit v1.2.3