summaryrefslogtreecommitdiff
path: root/dh_installdebconf
blob: 0392b8103406b8957e2fef08bfb7ace659d9667a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl -w
#
# Integration with debconf.

use strict;
use Debian::Debhelper::Dh_Lib;
init();

foreach my $package (@{$dh{DOPACKAGES}}) {
	my $tmp=tmpdir($package);
	my $config=pkgfile($package,"config");
	my $templates=pkgfile($package,"templates");

	if (! -d "$tmp/DEBIAN") {
		doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
	}

	if ($config ne '') {
		doit("install", "-o", 0, "-g", 0, "-m", 755, "-p",
		     $config, "$tmp/DEBIAN/config");
	}
	
	if ($templates ne '') {
		# Are there translated templates too?
<<<<<<< dh_installdebconf
		my @trans=glob("$templates.??", "$templates.??_??");
=======
		my @trans=(glob("$templates.??"), glob("$templates.??_??"));
>>>>>>> 1.5
		if (@trans) {
			complex_doit("debconf-mergetemplate @trans $templates > $tmp/DEBIAN/templates");
			chmod 0644, "$tmp/DEBIAN/templates";
			chown 0, 0, "$tmp/DEBIAN/templates";
		}
		else {
			doit("install", "-o", 0, "-g", 0, "-m", 644, "-p",
			     $templates, "$tmp/DEBIAN/templates");
		}
	}

	if (($config ne ''|| $templates ne '') && ! $dh{NOSCRIPTS}) {
		autoscript($package,"postrm","postrm-debconf");
	}
}