On Tue, 2009-05-19 at 23:49 +0200, Giuseppe Iuculano wrote:
> Ben Hutchings ha scritto:
> > I've reviewed all changes up to:
> > 
> > commit 2fe5bb9e74f34607dcfb46f794abba1ddeb209b6
> > Author: Giuseppe Iuculano <[email protected]>
> > Date:   Mon May 18 22:16:14 2009 +0200
> > 
> >     Updated changelog
> > 
> > I saw a few small problems:
> > 
> 
> Thanks, these should been fixed now.

The patches dkms still won't run dpkg-divert for the first module found
that needs to be diverted, and I'm fairly sure it is passing incorrect
paths to dpkg-divert.  You really need to test these changes with a DKMS
package that updates an in-tree module.  The attached patch might do the
right thing but you will still need to test it because I haven't.

Ben.

-- 
Ben Hutchings
Teamwork is essential - it allows you to blame someone else.
Use dpkg-divert to override an existing kernel module, thanks to Andrea Mennucci. (Closes: #529059)
--- dkms.orig/dkms
+++ dkms/dkms
@@ -1234,11 +1234,16 @@
 	    local found_orginal=""
 	    for original_module in $archive_pref1 $archive_pref2 $archive_pref3 $archive_pref4; do
 		if [ -f "$original_module" ]; then
-		    echo $"   - Found $original_module"
-		    echo $"   - Storing in $dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/"
-		    echo $"   - Archiving for uninstallation purposes"
-		    mkdir -p "$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}"
-		    mv -f "$original_module" "$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/"
+		    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]}/${dest_module_name[$count]}$module_suffix" "$module_dup"
+		    else
+			echo $"   - Found $original_module"
+			echo $"   - Storing in $dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/"
+			echo $"   - Archiving for uninstallation purposes"
+			mkdir -p "$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}"
+			mv -f "$original_module" "$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/"
+		    fi
 		    found_original="yes"
 		    break
 		fi
@@ -1258,13 +1263,20 @@
 	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/${dest_module_name[$count]}$module_suffix" $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 +1617,16 @@
 	    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]}/${dest_module_name[$count]}$module_suffix"
+		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."

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to