On Thu, 11 Feb 2010 08:01:58 -0500, James Vega <james...@debian.org>
wrote:
> Is there a chance of getting the below patch applied at some point? 
It's
> fairly straight forward and will be required when the modprobe finally
> stops
> loading files from /etc/modprobe.d that don't end in ".conf".

This patch is a bit incomplete. It does not deal with the case where the
upgrade fails. A postrm is needed to get the old configuration file back
in
this case (a corner case, admittedly). I have prepared such a patch.

I have (as announced on the mailing-list) a nvidia-kernel-common package
which resolves all declared bugs,
and some others. I post the relevant parts here for reference, but as some
reformatting was involved,
I hope the patch is good enough.
Index: debian/nvidia-kernel-common.postinst
===================================================================
--- debian/nvidia-kernel-common.postinst	(révision 0)
+++ debian/nvidia-kernel-common.postinst	(révision 460)
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -e 
+
+if [ "$1" = "configure" ]; then
+    if [ -e "/etc/modprobe.d/nvidia-kernel-nkc" ]; then
+    	echo "Preserving user changes to /etc/modprobe.d/nvidia-kernel-nkc(.conf) ..."
+    	if [ -e "/etc/modprobe.d/nvidia-kernel-nkc.conf" ]; then
+    	    mv -f "/etc/modprobe.d/nvidia-kernel-nkc.conf" "/etc/modprobe.d/nvidia-kernel-nkc.conf.dpkg-new"
+    	fi
+    	mv -f "/etc/modprobe.d/nvidia-kernel-nkc" "/etc/modprobe.d/nvidia-kernel-nkc.conf"
+    fi
+    if [ -e "/etc/modprobe.d/nvidia-kernel-nkc.dpkg-move" ]; then
+        rm -f "/etc/modprobe.d/nvidia-kernel-nkc.dpkg-move"
+    fi
+fi
+
+#DEBHELPER#
\ No newline at end of file
Index: debian/nvidia-kernel-common.postrm
===================================================================
--- debian/nvidia-kernel-common.postrm	(révision 0)
+++ debian/nvidia-kernel-common.postrm	(révision 460)
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -e 
+
+if [ "$1" = "abort-upgrade" ]; then
+    if [ -e "/etc/modprobe.d/nvidia-kernel-nkc.dpkg-move" ]; then
+        if [ -e "/etc/modprobe.d/nvidia-kernel-nkc" ]; then
+            mv "/etc/modprobe.d/nvidia-kernel-nkc" "/etc/modprobe.d/nvidia-kernel-nkc.dpkg-abort"
+        fi
+        mv "/etc/modprobe.d/nvidia-kernel-nkc.dpkg-move" "/etc/modprobe.d/nvidia-kernel-nkc"
+    fi
+fi
+
+#DEBHELPER#
\ No newline at end of file
Index: debian/nvidia-kernel-common.preinst
===================================================================
--- preinst	2010-02-11 15:54:12.000000000 +0100
+++ nvidia-kernel-common.preinst	2010-02-11 15:55:17.000000000 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
-
 set -e
 
+# Migration etch->lenny
 if [ "$1" = install ] || [ "$1" = upgrade ]; then
 	if dpkg --compare-versions "$2" lt-nl '20051028+1+nmu2'; then
 		rm -f /etc/devfs/conf.d/nvidia-kernel-nkc
@@ -9,4 +9,15 @@
 	fi
 fi
 
+# Migration lenny->squeeze
+if [ "$1" = install ] || [ "$1" = upgrade ]; then
+    if [ -e "/etc/modprobe.d/nvidia-kernel-nkc" ]; then
+	if [ $(md5sum "/etc/modprobe.d/nvidia-kernel-nkc" | cut -c1-32) = \
+	    $(dpkg-query -W -f='${Conffiles}' nvidia-kernel-common | sed -ne \
+            '/\/etc\/modprobe.d\/nvidia-kernel-nkc/ {s/^ .* //g;p}') ]; then
+	    mv "/etc/modprobe.d/nvidia-kernel-nkc" "/etc/modprobe.d/nvidia-kernel-nkc.dpkg-move"
+	fi
+    fi
+fi
+
 #DEBHELPER#

Reply via email to