From: joeyh Date: Thu, 23 Feb 2006 16:51:33 +0000 (+0000) Subject: r1881: * Add dh_installudev by Marco d'Itri. X-Git-Tag: 5.0.24~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=51c3322ebaed2029aab342f10b759e982e05668f;p=debhelper.git r1881: * Add dh_installudev by Marco d'Itri. --- diff --git a/autoscripts/postinst-udev b/autoscripts/postinst-udev new file mode 100644 index 0000000..e73cb01 --- /dev/null +++ b/autoscripts/postinst-udev @@ -0,0 +1,3 @@ +if [ "$1" = configure -a -z "$2" ]; then + ln -s ../#FILE# /etc/udev/rules.d/#PRIO##FILE# +fi diff --git a/autoscripts/postrm-udev b/autoscripts/postrm-udev new file mode 100644 index 0000000..15779ca --- /dev/null +++ b/autoscripts/postrm-udev @@ -0,0 +1,4 @@ +if [ "$1" = purge ]; then + [ -L /etc/udev/rules.d/#PRIO##FILE# ] && \ + rm /etc/udev/rules.d/#PRIO##FILE# +fi diff --git a/debian/changelog b/debian/changelog index b8c08d2..24666c0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +debhelper (5.0.24) unstable; urgency=low + + * Add dh_installudev by Marco d'Itri. + + -- Joey Hess Thu, 23 Feb 2006 11:40:22 -0500 + debhelper (5.0.23) unstable; urgency=low * dh_strip: remove binutils build-dep lines since stable has a new enough diff --git a/debian/copyright b/debian/copyright index 632397a..889a7e2 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,4 +1,4 @@ -Debhelper is written by and copyright 1997-2005 Joey Hess . +Debhelper is written by and copyright 1997-2006 Joey Hess . Increasingly miniscule parts of the code (and certainly my inspiration for the whole thing) came from debmake, by Christoph Lameter . @@ -9,6 +9,7 @@ dh_installcatalogs is by Adam Di Carlo . dh_scrollkeeper is by Ross Burton . dh_usrlocal is by Andrew Stribblehill . dh_installlogcheck is by Jon Middleton . +dh_installudev is by Marco d'Itri . Some of the dh_md5sums command is from a program by Charles Briscoe-Smith . diff --git a/dh_installudev b/dh_installudev new file mode 100755 index 0000000..696543f --- /dev/null +++ b/dh_installudev @@ -0,0 +1,100 @@ +#!/usr/bin/perl -w + +=head1 NAME + +dh_installudev - install udev rules files + + +=cut + +use strict; +use Debian::Debhelper::Dh_Lib; +use File::Find; + +=head1 SYNOPSIS + +B [S>] [B<-n>] [B<--name=>I] [B<--priority=>I] + +=head1 DESCRIPTION + +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. + +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. See L for an +explanation of how this works. + +=head1 OPTIONS + +=over 4 + +=item B<-n>, B<--noscripts> + +Do not modify postinst/postrm scripts. + +=item B<--name=>I + +Use "name" as the filename the rules file is installed in +/etc/udev/. When this parameter is used, dh_installudev looks for and +installs files named debian/package.name.udev instead of the usual +debian/package.udev. + +=item B<--priority=>I + +Sets the priority string of the rules.d symlink. Default is z60. + +=back + +=head1 NOTES + +Note that this command is not idempotent. "dh_clean -k" should be called +between invocations of this command. Otherwise, it may cause multiple +instances of the same text to be added to maintainer scripts. + +=cut + +init(); + +if (! defined $dh{PRIORITY}) { + $dh{PRIORITY}="z60"; +} +if ($dh{PRIORITY}) { + $dh{PRIORITY}.="_"; +} + +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmp=tmpdir($package); + my $rules_file=pkgfile($package,"udev"); + my $filename=basename($rules_file); + $filename=~s/\.udev$/.rules/; + + if ($rules_file) { + if (! -e "$tmp/etc/udev") { + doit("install","-d","$tmp/etc/udev"); + } + doit("install","-m","0644",$rules_file,"$tmp/etc/udev/$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"); + } + } +} + +=head1 SEE ALSO + +L + +This program is a part of debhelper. + +=head1 AUTHOR + +Joey Hess + +=cut