Joey Hess [2009-04-27 10:58 -0400]:
> Martin Pitt wrote:
> > Original patch by Scott James Remnant, I merged it to current
> > debhelper and simplified it to use the existing autoscripts.
> 
> (You forgot to attach it.)

Meh, sorry. Here it comes.

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
# dh_installudev: Default priority is now 40 by default, the target
# directory is /lib/udev/rules.d, and rules use '-' as separator instead of
# '_'.  Remove files from /etc/udev/rules.d unless they are user modified;
# if modified and of default priority, take care to rename.
# This should eventually go to Debian as well, see Debian #491117.
--- debhelper-7.2.8/dh_installudev	2009-04-14 20:13:55.000000000 +0200
+++ debhelper-7.2.8ubuntu1/dh_installudev	2009-04-24 19:47:13.000000000 +0200
@@ -20,7 +20,7 @@
 installing udev rules files.
 
 Files named debian/package.udev will be installed in
-etc/udev/rules.d/ in the package build directory.
+lib/udev/rules.d/ in the package build directory.
 
 Code is added to the preinst and postinst to handle the upgrade from the
 old udev rules file location.
@@ -37,7 +37,8 @@
 
 =item B<--priority=>I<priority>
 
-Sets the priority string of the rules.d symlink. Default is z60.
+Sets the priority string of the filename. Default is 40.
+See /lib/udev/rules.d/README to identify the appropriate priority.
 
 =item B<-n>, B<--noscripts>
 
@@ -55,11 +56,13 @@
 
 init();
 
+my $default=0;
 if (! defined $dh{PRIORITY}) {
-	$dh{PRIORITY}="z60";
+	$dh{PRIORITY}="40";
+	$default=1;
 }
 if ($dh{PRIORITY}) {
-	$dh{PRIORITY}.="_";
+	$dh{PRIORITY}.="-";
 }
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
@@ -72,16 +75,29 @@
 	$filename=~s/\.udev$/.rules/;
 
 	if ($rules_file) {
-		if (! -e "$tmp/etc/udev/rules.d") {
-			doit("install","-d","$tmp/etc/udev/rules.d");
+		if (! -e "$tmp/lib/udev/rules.d") {
+			doit("install","-d","$tmp/lib/udev/rules.d");
 		}
-		doit("install","-m","0644",$rules_file,"$tmp/etc/udev/rules.d/$dh{PRIORITY}$filename");
+		doit("install","-m","0644",$rules_file,"$tmp/lib/udev/rules.d/$dh{PRIORITY}$filename");
 		if (! $dh{NOSCRIPTS}) {
 			my $old="/etc/udev/$filename";
 			my $rule="/etc/udev/rules.d/$dh{PRIORITY}$filename";
 			autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#PACKAGE#!$package!g");
 			autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g");
 			autoscript($package,"preinst","preinst-udev","s!#RULE#!$rule!g");
+
+			# Remove old rule from /etc, unless it's modified,
+			# in which case we leave it (or rename it)
+			if ($default) {
+			        $old="/etc/udev/rules.d/50-$filename";
+			} else {
+			        $old="/etc/udev/rules.d/$dh{PRIORITY}$filename";
+			}
+			autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g;s!#PACKAGE#!$package!g");
+			if ($default) {
+			        autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g");
+			}
+
 		}
 	}
 }

Attachment: signature.asc
Description: Digital signature

Reply via email to