summaryrefslogtreecommitdiff
path: root/dh_gencontrol
blob: a2d152c432e367613daf7931efeaf19d7c0ae5b2 (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
#!/usr/bin/perl -w
#
# Generate and install the control file. Simple dpkg-gencontrol wrapper.

BEGIN { push @INC, "debian", "/usr/share/debhelper" }
use Dh_Lib;
init();

foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
	$TMP=tmpdir($PACKAGE);
	$EXT=pkgext($PACKAGE);
	
	$changelog=pkgfile($PACKAGE,'changelog');
	if (! $changelog) {
		$changelog='debian/changelog';
	}

	if ( ! -d '$TMP/DEBIAN' ) {
		doit("install","-o","root","-g","root","-d","$TMP/DEBIAN");
	}

	# Generate and install control file.
	doit("dpkg-gencontrol","-l$changelog","-isp","-p$PACKAGE",
		"-Tdebian/$EXT\substvars","-P$TMP",@{$dh{U_PARAMS}});

	# This chmod is only necessary if the user sets the umask to something odd.
	doit("chmod","644","$TMP/DEBIAN/control");
	
	doit("chown","root.root","$TMP/DEBIAN/control");
}