]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdebconf
Add FILES sections to man pages. Closes: #545041
[debhelper.git] / dh_installdebconf
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installdebconf - install files used by debconf 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_installdebconf> [S<I<debhelper options>>] [B<-n>] [S<B<--> I<params>>]
15
16 =head1 DESCRIPTION
17
18 dh_installdebconf is a debhelper program that is responsible for installing
19 files used by debconf into package build directories.
20
21 It also automatically generates the postrm commands needed to interface
22 with debconf. The commands are added to the maintainer scripts by
23 dh_installdeb. See L<dh_installdeb(1)> for an explanation of how that
24 works.
25
26 Note that if you use debconf, your package probably needs to depend on it
27 (it will be added to ${misc:Depends} by this program).
28
29 Note that for your config script to be called by dpkg, your postinst
30 needs to source debconf's confmodule. dh_installdebconf does not
31 install this statement into the postinst automatically as it it too
32 hard to do it right.
33
34 =head1 FILES
35
36 =over 4
37
38 =item debian/I<package>.config
39
40 This is the debconf config script, and is installed into the DEBIAN
41 directory in the package build directory.
42
43 Inside the script, the token B<#DEBHELPER#> is replaced with
44 shell script snippets generated by other debhelper commands.
45
46 =item debian/I<package>.templates
47
48 This is the debconf templates file, and is installed into the DEBIAN
49 directory in the package build directory.
50
51 =item debian/po/
52
53 If this directory is present, this program will automatically use
54 L<po2debconf(1)> to generate merged templates
55 files that include the translations from there.
56
57 For this to work, your package should build-depend on po-debconf.
58
59 =back
60
61 =head1 OPTIONS
62
63 =over 4
64
65 =item B<-n>, B<--noscripts>
66
67 Do not modify postrm script.
68
69 =item B<--> I<params>
70
71 Pass the params to po2debconf.
72
73 =back
74
75 =cut
76
77 init();
78
79 my @extraparams;
80 if (defined($dh{U_PARAMS})) {
81         @extraparams=@{$dh{U_PARAMS}};
82 }
83
84 foreach my $package (@{$dh{DOPACKAGES}}) {
85         my $tmp=tmpdir($package);
86         my $config=pkgfile($package,"config");
87         my $templates=pkgfile($package,"templates");
88
89         if (! -d "$tmp/DEBIAN") {
90                 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
91         }
92
93         if (! is_udeb($package)) {
94                 debhelper_script_subst($package, "config");
95         }
96         
97         if ($templates ne '') {
98                 # Are there old-style translated templates?
99                 if (glob("$templates.??"), glob("$templates.??_??")) {
100                         warning "Ignoring debian/templates.ll files. Switch to po-debconf!";
101                 }
102
103                 umask(0022); # since I do a redirect below
104                 
105                 if (-d "debian/po") {
106                         complex_doit("po2debconf @extraparams $templates > $tmp/DEBIAN/templates");
107                 }
108                 else {
109                         doit("install", "-o", 0, "-g", 0, "-m", 644, "-p",
110                              $templates, "$tmp/DEBIAN/templates");
111                 }
112         }
113
114         # I'm going with debconf 0.5 because it was the first
115         # "modern" one. udebs just need cdebconf.
116         my $debconfdep=is_udeb($package) ? "cdebconf-udeb" : "debconf (>= 0.5) | debconf-2.0";
117         if ($config ne '' || $templates ne '') {
118                 addsubstvar($package, "misc:Depends", $debconfdep);
119         }
120         else {
121                 addsubstvar($package, "misc:Depends", $debconfdep, undef, 1); # remove
122         }
123         
124         if (($config ne '' || $templates ne '') && ! $dh{NOSCRIPTS}) {
125                 autoscript($package,"postrm","postrm-debconf");
126         }
127 }
128
129 =head1 SEE ALSO
130
131 L<debhelper(7)>
132
133 This program is a part of debhelper.
134
135 =head1 AUTHOR
136
137 Joey Hess <joeyh@debian.org>
138
139 =cut