summaryrefslogtreecommitdiff
path: root/dh_installdirs
blob: bab883d779819f5cc1444235c30f436dfeec0504 (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
33
34
35
36
37
38
39
#!/bin/sh -e
#
# Reads debian/dirs, creates the directories listed there there

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

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

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

	dirs=""

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

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

	if [ "$dirs" ]; then
		# Check to see if any of the dirs are absolute.
		for dir in "$dirs" ; do
			if expr "$dir" : "/" >/dev/null ; then
				error "Absolute directory name \"$dir\" specified."
			fi
		done
		# Create dirs.
		verbose_echo "cd $TMP && install -d $dirs && cd ../.."
		cd $TMP
		install -d $dirs
		cd ../..
	fi
done