5 dh_installudev - install udev rules files
10 use Debian::Debhelper::Dh_Lib;
15 B<dh_installudev> [S<I<debhelper options>>] [B<-n>] [B<--name=>I<name>] [B<--priority=>I<priority>]
19 dh_installudev is a debhelper program that is responsible for
20 installing udev rules files.
22 Code is added to the preinst and postinst to handle the upgrade from the
23 old udev rules file location.
29 =item debian/I<package>.udev
31 Installed into lib/udev/rules.d/ in the package build directory.
39 =item B<--name=>I<name>
41 When this parameter is used, dh_installudev looks for and
42 installs files named debian/I<package>.I<name>.udev instead of the usual
43 debian/I<package>.udev.
45 =item B<--priority=>I<priority>
47 Sets the priority string of the rules.d symlink. Default is 60.
49 =item B<-n>, B<--noscripts>
51 Do not modify postinst/postrm scripts.
57 Note that this command is not idempotent. L<dh_prep(1)> should be called
58 between invocations of this command. Otherwise, it may cause multiple
59 instances of the same text to be added to maintainer scripts.
65 # The priority used to look like z60_;
66 # we need to calculate that old value to handle
67 # conffile moves correctly.
68 my $old_priority=$dh{PRIORITY};
70 # In case a caller still uses the `z` prefix, remove it.
71 if (defined $dh{PRIORITY}) {
72 $dh{PRIORITY}=~s/^z//;
75 if (! defined $dh{PRIORITY}) {
84 foreach my $package (@{$dh{DOPACKAGES}}) {
85 my $tmp=tmpdir($package);
86 my $rules_file=pkgfile($package,"udev");
87 my $filename=basename($rules_file);
88 if ($filename eq 'udev') {
89 $filename = "$package.udev";
91 $filename=~s/\.udev$/.rules/;
92 my $oldfilename=$filename;
93 if (defined $dh{NAME}) {
94 $filename="$dh{NAME}.rules";
98 if (! -e "$tmp/lib/udev/rules.d") {
99 doit("install","-d","$tmp/lib/udev/rules.d");
101 my $rule="/lib/udev/rules.d/$dh{PRIORITY}$filename";
102 doit("install","-m","0644",$rules_file,$tmp.$rule);
103 if (! $dh{NOSCRIPTS}) {
104 # Remove old rule from /etc, unless it's modified,
105 # in which case we rename it to match the new
106 # file in /lib, so it will override.
107 my $old="/etc/udev/rules.d/$old_priority$oldfilename";
108 $rule=~s/^\/lib/\/etc/;
109 autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g;s!#PACKAGE#!$package!g");
110 autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g");
119 This program is a part of debhelper.
123 Joey Hess <joeyh@debian.org>