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 --- dkms.old/dkms 2013-11-06 10:50:21.452660834 +0100 +++ dkms/dkms 2013-11-06 10:50:26.685549748 +0100 @@ -1621,6 +1621,9 @@ 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