]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdirs
r496: * Man page cleanups, Closes: #119335
[debhelper.git] / dh_installdirs
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installdirs - create subdirectories in package build directories
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_installdirs> [S<I<debhelper options>>] [B<-A>] [S<I<dir ...>>]
15
16 =head1 DESCRIPTION
17
18 dh_installdirs is a debhelper program that is responsible for creating
19 subdirectories in package build directories.
20
21 Any directory names specified as parameters will be created in the package
22 build directory of the first package dh_installdirs is told to act on. By
23 default, this is the first binary package in debian/control, but if you use
24 -p, -i, or -a flags, it will be the first package specified by those flags.
25
26 A file named debian/package.dirs can list other directories to be created.
27 Separate the directory names with whitespace.
28
29 Be sure to only use directory names relative to the package build
30 directory. Ie, "/usr/bin" should not be used, use "usr/bin" instead.
31
32 =head1 OPTIONS
33
34 =over 4
35
36 =item B<-A>, B<--all>
37
38 Create any directories specified by command line parameters in ALL packages
39 acted on, not just the first.
40
41 =item I<dir ...>
42
43 Create these directories in the package build directory of the first
44 package acted on. (Or in all packages if -A is specified.)
45
46 =back
47
48 =cut
49
50 init();
51
52 foreach my $package (@{$dh{DOPACKAGES}}) {
53         my $tmp=tmpdir($package);
54         my $file=pkgfile($package,"dirs");
55
56         if (! -e $tmp) {
57                 doit("install","-d",$tmp);
58         }
59
60         my @dirs;
61
62         if ($file) {
63                 @dirs=filearray($file)
64         }
65
66         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
67                 push @dirs, @ARGV;
68         }       
69
70         if (@dirs) {
71                 # Stick the $tmp onto the front of all the dirs.
72                 # This is necessary, for 2 reasons, one to make them 
73                 # be in the right directory, but more importantly, it 
74                 # protects against the danger of absolute dirs being
75                 # specified.
76                 @dirs=map {
77                                 $_="$tmp/$_";
78                                 tr:/:/:s; # just beautification.
79                                 $_
80                           } @dirs;
81
82                 # Create dirs.
83                 doit("install","-d",@dirs);
84         }
85 }
86
87 =head1 SEE ALSO
88
89 L<debhelper(1)>
90
91 This program is a part of debhelper.
92
93 =head1 AUTHOR
94
95 Joey Hess <joeyh@debian.org>
96
97 =cut