[Pkg-dkms-maint] Bug#657145: [PATCH] remove the directory where the module was installed

Andreas Beckmann debian at abeckmann.de
Mon Jun 25 09:46:11 UTC 2012


after removing a module try to remove the path (below
/lib/modules/KVERS) were the module was installed to cleanup any
remaining empty directories
Closes: #657145
---
 dkms |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/dkms b/dkms
index 042acc0..c96cd8f 100644
--- a/dkms
+++ b/dkms
@@ -1579,6 +1579,9 @@ do_uninstall()
 	    echo $" - Uninstallation"
 	    echo $"   - Deleting from: $install_tree/$1${real_dest_module_location}/"
 	    rm -f "$install_tree/$1${real_dest_module_location}/${dest_module_name[$count]}$module_suffix"
+	    dir_to_remove="${real_dest_module_location#/}"
+	    while [ "${dir_to_remove}" != "${dir_to_remove#/}" ]; do dir_to_remove="${dir_to_remove#/}" ; done
+	    (cd "$install_tree/$1" && rmdir --parents --ignore-fail-on-non-empty "${dir_to_remove}" || true)
 	    echo $" - Original module"
 	    if [[ -e $dkms_tree/$module/original_module/$1/$2/${dest_module_name[$count]}$module_suffix ]]; then
 		case "$running_distribution" in
-- 
1.7.10






More information about the Pkg-dkms-maint mailing list