The following commit has been merged in the master branch:
commit f4a197fbf478099136a97482e430bf4abab75f21
Author: Giuseppe Iuculano <[email protected]>
Date:   Mon May 18 22:10:30 2009 +0200

    debian/patches/16_dpkg-divert.patch: Use dpkg-divert to override an 
existing kernel module, thanks to Andrea Mennucci. (Closes: #529059)
    
    when dkms installs, it may override an existing kernel module
    by a new one. To this end, dkms moves away the old module using 'mv'
    
    But this breaks if the kernel is upated/reinstalled (as for example
    after the recent security updates).
    
    There is though a more effective way, and it is to use dpkg-divert

diff --git a/debian/patches/16_dpkg-divert.patch 
b/debian/patches/16_dpkg-divert.patch
new file mode 100644
index 0000000..d9de25b
--- /dev/null
+++ b/debian/patches/16_dpkg-divert.patch
@@ -0,0 +1,50 @@
+Use dpkg-divert to override an existing kernel module, thanks to Andrea 
Mennucci. (Closes: #529059)
+--- a/dkms
++++ b/dkms
+@@ -1258,13 +1258,20 @@ function install_module()
+       if [ "$module_count" -gt 1 ]; then
+           echo $" - Multiple same named modules!"
+           echo $"   - $module_count named 
${dest_module_name[$count]}$module_suffix in $lib_tree/"
+-          echo $"   - All instances of this module will now be stored for 
reference purposes ONLY"
+-          echo $"   - Storing in 
$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/"
++          if ! which dpkg-divert >/dev/null 2>&1 ; then
++                  echo $"   - All instances of this module will now be stored 
for reference purposes ONLY"
++                  echo $"   - Storing in 
$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/"
++          fi
+           for module_dup in `find $lib_tree -name 
${dest_module_name[$count]}$module_suffix -type f`; do
+               dup_tree=`echo $module_dup | sed "s#^$lib_tree##" | sed 
"s#${dest_module_name[$count]}$module_suffix##"`
+-              echo $"     - Stored $module_dup"
+-              mkdir -p 
"$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/$dup_tree"
+-              mv -f $module_dup 
"$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/$dup_tree"
++              if which dpkg-divert >/dev/null 2>&1 ; then
++                      dpkg-divert --add --rename --divert \
++                      
"$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/$dup_tree/$module_dup"
  $module_dup
++              else
++                     echo $"     - Stored $module_dup"
++                     mkdir -p 
"$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/$dup_tree"
++                     mv -f $module_dup 
"$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/$dup_tree"
++              fi
+           done
+       fi
+ 
+@@ -1605,10 +1612,16 @@ function do_uninstall()
+           rm -f 
"$install_tree/$1${real_dest_module_location}/${dest_module_name[$count]}$module_suffix"
+           echo $" - Original module"
+           if [ -e 
"$dkms_tree/$module/original_module/$1/$2/${dest_module_name[$count]}$module_suffix"
 ]; then
+-              echo $"   - Archived original module found in the DKMS tree"
+-              echo $"   - Moving it to: 
$install_tree/$1${DEST_MODULE_LOCATION[$count]}/"
+-              mkdir -p "$install_tree/$1${DEST_MODULE_LOCATION[$count]}/"
+-              mv -f 
"$dkms_tree/$module/original_module/$1/$2/${dest_module_name[$count]}$module_suffix"
 "$install_tree/$1${DEST_MODULE_LOCATION[$count]}/" 2>/dev/null
++              if ! which dpkg-divert >/dev/null 2>&1 ; then
++                      echo $"   - Archived original module found in the DKMS 
tree"
++                      echo $"   - Moving it to: 
$install_tree/$1${DEST_MODULE_LOCATION[$count]}/"
++                      mkdir -p 
"$install_tree/$1${DEST_MODULE_LOCATION[$count]}/"
++                      mv -f 
"$dkms_tree/$module/original_module/$1/$2/${dest_module_name[$count]}$module_suffix"
 \
++                      "$install_tree/$1${DEST_MODULE_LOCATION[$count]}/" 
2>/dev/null
++              else
++                      dpkg-divert --remove --rename --divert 
"$dkms_tree/$module/original_module/$1/$2/${dest_module_name[$count]}$module_suffix"
 \
++                      "$install_tree/$1${DEST_MODULE_LOCATION[$count]}/"
++              fi
+           else
+               echo $"   - No original module was found for this module on 
this kernel."
+               echo $"   - Use the dkms install command to reinstall any 
previous module version."
diff --git a/debian/patches/series b/debian/patches/series
index e4373fe..24bf59f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 08-use-update-initramfs.patch
 15_modprobe.patch
+16_dpkg-divert.patch

-- 
Maintainance of the dkms package

_______________________________________________
Pkg-dkms-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-dkms-commits

Reply via email to