]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdebconf
r496: * Man page cleanups, Closes: #119335
[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>]
15
16 =head1 DESCRIPTION
17
18 dh_installdebconf is a debhelper program that is responsible for installing
19 files used by the debconf package into package build directories.
20
21 It also automatically generates the postrm commands needed to
22 interface with debconf. See L<dh_installdeb(1)> for an explanation of how
23 that works.
24
25 Files named debian/package.config and debian/package.templates are
26 installed into the DEBIAN directory in the package build directory.
27
28 Note that if you use debconf, your package probably needs to depend on it.
29
30 =head1 LOCALIZED TEMPLATE FILES
31
32 Debconf also supports localized template files, and this program has some
33 support to aid working with them. You may find it easiest to keep the
34 translations in separate files, and merge them only at build time. See
35 L<debconf-mergetemplate(1)> and L<debconf-getlang(1)> for details.
36
37 This program will automatically call debconf-mergetemplate and merge 
38 templates on the fly if it finds your template files are accompanied
39 by translated files that have the same name as the template file, with a
40 dot and a locale name repended.
41
42 For example, if you have a German translation,
43 debian/package.templates.de is merged with debian/package.templates.
44
45 =head1 OPTIONS
46
47 =over 4
48
49 =item B<-n>, B<--noscripts>
50
51 Do not modify postrm script.
52
53 =back
54
55 =cut
56
57 init();
58
59 foreach my $package (@{$dh{DOPACKAGES}}) {
60         my $tmp=tmpdir($package);
61         my $config=pkgfile($package,"config");
62         my $templates=pkgfile($package,"templates");
63
64         if (! -d "$tmp/DEBIAN") {
65                 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
66         }
67
68         if ($config ne '') {
69                 doit("install", "-o", 0, "-g", 0, "-m", 755, "-p",
70                      $config, "$tmp/DEBIAN/config");
71         }
72         
73         if ($templates ne '') {
74                 # Are there translated templates too?
75                 my @trans=(glob("$templates.??"), glob("$templates.??_??"));
76                 if (@trans) {
77                         complex_doit("debconf-mergetemplate @trans $templates > $tmp/DEBIAN/templates");
78                         chmod 0644, "$tmp/DEBIAN/templates";
79                         chown 0, 0, "$tmp/DEBIAN/templates";
80                 }
81                 else {
82                         doit("install", "-o", 0, "-g", 0, "-m", 644, "-p",
83                              $templates, "$tmp/DEBIAN/templates");
84                 }
85         }
86
87         if (($config ne ''|| $templates ne '') && ! $dh{NOSCRIPTS}) {
88                 autoscript($package,"postrm","postrm-debconf");
89         }
90 }
91
92 =head1 SEE ALSO
93
94 L<debhelper(1)>
95
96 This program is a part of debhelper.
97
98 =head1 AUTHOR
99
100 Joey Hess <joeyh@debian.org>
101
102 =cut