Skip to content

Commit

Permalink
Also delete collisions folder when a kernel is gone
Browse files Browse the repository at this point in the history
  • Loading branch information
scaronni committed Jan 30, 2025
1 parent d07034f commit 38131a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions dkms.in
Original file line number Diff line number Diff line change
Expand Up @@ -1767,16 +1767,11 @@ do_uninstall()
fi

# Delete the original_module if nothing for this kernel is installed anymore
if [[ $was_active && -d $dkms_tree/$module/original_module/$1/$2 && ! -d $dkms_tree/$module/original_module/$1/$2/collisions ]]; then
if [[ $was_active && -d $dkms_tree/$module/original_module/$1/$2 ]]; then
echo ""
echo "Removing original_module from DKMS tree for kernel $1 ($2)"
echo "Removing original module(s) from DKMS tree for kernel $1 ($2)"
rm -rf "$dkms_tree/$module/original_module/$1/$2" 2>/dev/null
[[ $(find $dkms_tree/$module/original_module/$1/* -maxdepth 0 -type d 2>/dev/null) ]] || rm -rf "$dkms_tree/$module/original_module/$1"
elif [[ $was_active && -d $dkms_tree/$module/original_module/$1/$2/collisions ]]; then
echo ""
echo "Keeping directory $dkms_tree/$module/original_module/$1/$2/collisions/"
echo "for your reference purposes. Your kernel originally contained multiple"
echo "same-named modules and this directory is now where these are located."
fi
[[ $(find $dkms_tree/$module/original_module/* -maxdepth 0 -type d 2>/dev/null) ]] || rm -rf "$dkms_tree/$module/original_module"
}
Expand Down
4 changes: 2 additions & 2 deletions run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,7 @@ Deleting /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compr
Restoring archived original module
Running depmod... done.
Removing original_module from DKMS tree for kernel ${KERNEL_VER} (${KERNEL_ARCH})
Removing original module(s) from DKMS tree for kernel ${KERNEL_VER} (${KERNEL_ARCH})
EOF
if [ "${expected_dest_loc}" != "kernel/extra" ]; then
# A replaced module originating from a kernel image should get restored
Expand Down Expand Up @@ -1935,7 +1935,7 @@ Deleting /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compr
Restoring archived original module
Running depmod... done.
Removing original_module from DKMS tree for kernel ${KERNEL_VER} (${KERNEL_ARCH})
Removing original module(s) from DKMS tree for kernel ${KERNEL_VER} (${KERNEL_ARCH})
Deleting module dkms_replace_test/2.0 completely from the DKMS tree.
EOF
Expand Down

0 comments on commit 38131a2

Please sign in to comment.