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 Files named debian/package.udev will be installed in
23 lib/udev/rules.d/ in the package build directory.
25 Code is added to the preinst and postinst to handle the upgrade from the
26 old udev rules file location.
32 =item B<--name=>I<name>
34 When this parameter is used, dh_installudev looks for and
35 installs files named debian/package.name.udev instead of the usual
38 =item B<--priority=>I<priority>
40 Sets the priority string of the rules.d symlink. Default is 60.
42 =item B<-n>, B<--noscripts>
44 Do not modify postinst/postrm scripts.
50 Note that this command is not idempotent. L<dh_prep(1)> should be called
51 between invocations of this command. Otherwise, it may cause multiple
52 instances of the same text to be added to maintainer scripts.
58 # The priority used to look like z60_;
59 # we need to calculate that old value to handle
60 # conffile moves correctly.
61 my $old_priority=$dh{PRIORITY};
63 # In case a caller still uses the `z` prefix, remove it.
64 if (defined $dh{PRIORITY}) {
65 $dh{PRIORITY}=~s/^z//;
68 if (! defined $dh{PRIORITY}) {
77 foreach my $package (@{$dh{DOPACKAGES}}) {
78 my $tmp=tmpdir($package);
79 my $rules_file=pkgfile($package,"udev");
80 my $filename=basename($rules_file);
81 if ($filename eq 'udev') {
82 $filename = "$package.udev";
84 $filename=~s/\.udev$/.rules/;
87 if (! -e "$tmp/lib/udev/rules.d") {
88 doit("install","-d","$tmp/lib/udev/rules.d");
90 my $rule="/lib/udev/rules.d/$dh{PRIORITY}$filename";
91 doit("install","-m","0644",$rules_file,$tmp.$rule);
92 if (! $dh{NOSCRIPTS}) {
93 # Remove old rule from /etc, unless it's modified,
94 # in which case we rename it to match the new
95 # file in /lib, so it will override.
96 my $old="/etc/udev/rules.d/$old_priority$filename";
97 $rule=~s/^\/lib/\/etc/;
98 autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g;s!#PACKAGE#!$package!g");
99 autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g");
108 This program is a part of debhelper.
112 Joey Hess <joeyh@debian.org>