]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdirs
r420: big monsta changes
[debhelper.git] / dh_installdirs
1 #!/usr/bin/perl -w
2 #
3 # Reads debian/dirs, creates the directories listed there
4
5 use strict;
6 use Debian::Debhelper::Dh_Lib;
7 init();
8
9 foreach my $package (@{$dh{DOPACKAGES}}) {
10         my $tmp=tmpdir($package);
11         my $file=pkgfile($package,"dirs");
12
13         if (! -e $tmp) {
14                 doit("install","-d",$tmp);
15         }
16
17         my @dirs;
18
19         if ($file) {
20                 @dirs=filearray($file)
21         }
22
23         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
24                 push @dirs, @ARGV;
25         }       
26
27         if (@dirs) {
28                 # Stick the $tmp onto the front of all the dirs.
29                 # This is necessary, for 2 reasons, one to make them 
30                 # be in the right directory, but more importantly, it 
31                 # protects against the danger of absolute dirs being
32                 # specified.
33                 @dirs=map {
34                                 $_="$tmp/$_";
35                                 tr:/:/:s; # just beautification.
36                                 $_
37                           } @dirs;
38
39                 # Create dirs.
40                 doit("install","-d",@dirs);
41         }
42 }