5 dh_installdebconf - install files used by debconf in package build directories
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_installdebconf> [S<I<debhelper options>>] [B<-n>] [S<B<--> I<params>>]
18 dh_installdebconf is a debhelper program that is responsible for installing
19 files used by debconf into package build directories.
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
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).
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
38 =item debian/I<package>.config
40 This is the debconf config script, and is installed into the DEBIAN
41 directory in the package build directory.
43 Inside the script, the token B<#DEBHELPER#> is replaced with
44 shell script snippets generated by other debhelper commands.
46 =item debian/I<package>.templates
48 This is the debconf templates file, and is installed into the DEBIAN
49 directory in the package build directory.
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.
57 For this to work, your package should build-depend on po-debconf.
65 =item B<-n>, B<--noscripts>
67 Do not modify postrm script.
71 Pass the params to po2debconf.
80 if (defined($dh{U_PARAMS})) {
81 @extraparams=@{$dh{U_PARAMS}};
84 foreach my $package (@{$dh{DOPACKAGES}}) {
85 my $tmp=tmpdir($package);
86 my $config=pkgfile($package,"config");
87 my $templates=pkgfile($package,"templates");
89 if (! -d "$tmp/DEBIAN") {
90 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
93 if (! is_udeb($package)) {
94 debhelper_script_subst($package, "config");
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!";
103 umask(0022); # since I do a redirect below
105 if (-d "debian/po") {
106 complex_doit("po2debconf @extraparams $templates > $tmp/DEBIAN/templates");
109 doit("install", "-o", 0, "-g", 0, "-m", 644, "-p",
110 $templates, "$tmp/DEBIAN/templates");
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);
121 if (($config ne '' || $templates ne '') && ! $dh{NOSCRIPTS}) {
122 autoscript($package,"postrm","postrm-debconf");
130 This program is a part of debhelper.
134 Joey Hess <joeyh@debian.org>