summaryrefslogtreecommitdiff
path: root/dh_gencontrol
blob: 6a12694b60248bb4957615fe699ccf63ff9ea4c3 (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.

use Debian::Debhelper::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");
}