summaryrefslogtreecommitdiff
path: root/dh_installexamples
blob: e8e5e3d64f74849467433a3df9bbf098fb41c9e7 (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
#!/usr/bin/perl -w
#
# Reads debian/examples, installs all files listed there into
# /usr/doc/$PACKAGE/examples

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

foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
	$TMP=tmpdir($PACKAGE);
	$file=pkgfile($PACKAGE,"examples");
	
	undef @examples;
	
	if ($file) {
		@examples=filearray($file);
	}	

	if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
		push @examples, @ARGV;
	}

	if (@examples) {
		if (! -d "$TMP/usr/doc/$PACKAGE/examples") {
			doit("install","-d","$TMP/usr/doc/$PACKAGE/examples");
		}
		
		doit("cp","-a",@examples,"$TMP/usr/doc/$PACKAGE/examples");
	}
}