summaryrefslogtreecommitdiff
path: root/dh_installexamples
blob: 033564ef2fe5e0f98dbc0daf4cdb05d3064c43f7 (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/share/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/share/doc/$PACKAGE/examples") {
			doit("install","-d","$TMP/usr/share/doc/$PACKAGE/examples");
		}
		
		doit("cp","-a",@examples,"$TMP/usr/share/doc/$PACKAGE/examples");
	}
}