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

PATH=debian:$PATH:/usr/lib/debhelper
source dh_lib

for PACKAGE in $DH_DOPACKAGES; do
	TMP=`tmpdir $PACKAGE`
	EXT=`pkgext $PACKAGE`

	examples=""

	if [ -e debian/${EXT}examples ]; then
		examples=`tr "\n" " " < debian/${EXT}examples`
	fi

	if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then
		examples="$* $examples"
	fi

	if [ "$examples" ]; then
		if [ ! -d debian/$TMP/usr/doc/$PACKAGE/examples ]; then
			doit "install -d debian/$TMP/usr/doc/$PACKAGE/examples"
		fi

		for file in $examples; do
			doit "cp -a $file debian/$TMP/usr/doc/$PACKAGE/examples/"
		done
	fi
done