Package: dkms / 2.2.0.3-2

657145.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
From: Andreas Beckmann <debian@abeckmann.de>
Subject: remove the directory where the module was installed
 after removing a module try to remove the path (below
 /lib/modules/KVERS) were the module was installed to cleanup any
 remaining empty directories
Bug-Debian: http://bugs.debian.org/657145

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