X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dh_installudev;h=243dc732435d4c67046a1e6ba57573a4b7d57b70;hb=9a867d7d344bc3c59a3326123f7323655c311d6c;hp=1e8ccea85f85de3c933bb50a1b86bf1175f008a6;hpb=90ffad95d71aec0ae98401ebc0f27d8b740f8307;p=debhelper.git diff --git a/dh_installudev b/dh_installudev index 1e8ccea..243dc73 100755 --- a/dh_installudev +++ b/dh_installudev @@ -19,23 +19,16 @@ B [S>] [B<-n>] [B<--name=>I] [B<--pri dh_installudev is a debhelper program that is responsible for installing udev rules files. -Files named debian/package.udev will be installed as -etc/udev/package.rules in the package build directory. +Files named debian/package.udev will be installed in +etc/udev/rules.d/ in the package build directory. -Then postinst and postrm commands are automatically generated to enable -the rules file when the package is first installed, by creating a symlink -to it in the /etc/udev/rules.d/ directory. These commands are inserted into -the maintainer scripts by dh_installdeb. See L for an -explanation of how this works. +Code is added to the preinst and postinst to handle the upgrade from the +old udev rules file location. =head1 OPTIONS =over 4 -=item B<-n>, B<--noscripts> - -Do not modify postinst/postrm scripts. - =item B<--name=>I When this parameter is used, dh_installudev looks for and @@ -46,11 +39,15 @@ debian/package.udev. Sets the priority string of the rules.d symlink. Default is z60. +=item B<-n>, B<--noscripts> + +Do not modify postinst/postrm scripts. + =back =head1 NOTES -Note that this command is not idempotent. "dh_clean -k" should be called +Note that this command is not idempotent. L should be called between invocations of this command. Otherwise, it may cause multiple instances of the same text to be added to maintainer scripts. @@ -69,19 +66,22 @@ foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $rules_file=pkgfile($package,"udev"); my $filename=basename($rules_file); + if ($filename eq 'udev') { + $filename = "$package.udev"; + } $filename=~s/\.udev$/.rules/; if ($rules_file) { if (! -e "$tmp/etc/udev/rules.d") { doit("install","-d","$tmp/etc/udev/rules.d"); } - doit("install","-m","0644",$rules_file,"$tmp/etc/udev/$filename"); - + doit("install","-m","0644",$rules_file,"$tmp/etc/udev/rules.d/$dh{PRIORITY}$filename"); if (! $dh{NOSCRIPTS}) { - autoscript($package,"postinst","postinst-udev", - "s/#FILE#/$filename/g;s/#PRIO#/$dh{PRIORITY}/g"); - autoscript($package,"postrm","postrm-udev", - "s/#FILE#/$filename/g;s/#PRIO#/$dh{PRIORITY}/g"); + 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"); } } }