]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdebconf
r446: spelling patch
[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   dh_installdebconf [debhelper options] [-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 If you use this feature, your package should build-depend on debconf-utils.
46
47 =head1 OPTIONS
48
49 =over 4
50
51 =item B<-n>, B<--noscripts>
52
53 Do not modify postrm script.
54
55 =back
56
57 =cut
58
59 init();
60
61 foreach my $package (@{$dh{DOPACKAGES}}) {
62         my $tmp=tmpdir($package);
63         my $config=pkgfile($package,"config");
64         my $templates=pkgfile($package,"templates");
65
66         if (! -d "$tmp/DEBIAN") {
67                 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
68         }
69
70         if ($config ne '') {
71                 doit("install", "-o", 0, "-g", 0, "-m", 755, "-p",
72                      $config, "$tmp/DEBIAN/config");
73         }
74         
75         if ($templates ne '') {
76                 # Are there translated templates too?
77                 my @trans=(glob("$templates.??"), glob("$templates.??_??"));
78                 if (@trans) {
79                         complex_doit("debconf-mergetemplate @trans $templates > $tmp/DEBIAN/templates");
80                         chmod 0644, "$tmp/DEBIAN/templates";
81                         chown 0, 0, "$tmp/DEBIAN/templates";
82                 }
83                 else {
84                         doit("install", "-o", 0, "-g", 0, "-m", 644, "-p",
85                              $templates, "$tmp/DEBIAN/templates");
86                 }
87         }
88
89         if (($config ne ''|| $templates ne '') && ! $dh{NOSCRIPTS}) {
90                 autoscript($package,"postrm","postrm-debconf");
91         }
92 }
93
94 =head1 SEE ALSO
95
96 L<debhelper(1)>
97
98 This program is a part of debhelper.
99
100 =head1 AUTHOR
101
102 Joey Hess <joeyh@debian.org>
103
104 =cut