]> git.donarmstrong.com Git - debhelper.git/blob - dh_installifupdown
r1981: * Add dh_installifupdown. Please consider using this if you have
[debhelper.git] / dh_installifupdown
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installifupdown - install if-up and if-down hooks
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_installifupdown> [S<I<debhelper options>>] [B<--name=>I<name>]
15
16 =head1 DESCRIPTION
17
18 dh_installifupdown is a debhelper program that is responsible for installing
19 if-up, if-down, if-pre-up, and if-post-down hook scripts into package build
20 directories.
21
22 If a file named debian/package.if-up exists, then it is installed into
23 etc/network/if-up.d/package in the package build directory. Similar is done
24 for if-down, if-pre-up, and if-post-down.
25
26 =head1 OPTIONS
27
28 =over 4
29
30 =item B<--name=>I<name>
31
32 Look for files named debian/package.name.if-* and install them as
33 etc/network/if-*/name, instead of using the usual files and installing them
34 as the package name.
35
36 =back
37
38 =cut
39
40 init();
41
42 foreach my $package (@{$dh{DOPACKAGES}}) {
43         my $tmp=tmpdir($package);
44         
45         foreach my $script (qw(pre-up up down post-down)) {
46                 my $file=pkgfile($package, "if-$script");
47                 if ($file ne '') {
48                         if (! -d "$tmp/etc/network/if-$script.d") {
49                                 doit("install","-d","$tmp/etc/network/if-$script.d");
50                         }
51                         doit("install","-p","-m755",$file,"$tmp/etc/network/if-$script.d/".pkgfilename($package));
52                 }
53         }
54 }
55
56 =head1 SEE ALSO
57
58 L<debhelper(7)>
59
60 This program is a part of debhelper.
61
62 =head1 AUTHOR
63
64 Joey Hess <joeyh@debian.org>
65
66 =cut