summaryrefslogtreecommitdiff
path: root/dh_lib
blob: d92663950e3122278f07f34d0b1305bb3b2f48d3 (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
40
41
42
43
44
45
46
47
48
49
50
# Library functions for debhelper programs.

# Run a command, and display the command to stdout if verbose mode is on.
# All commands that edit debian/tmp should be ran via this function.
function doit() {
	verbose_echo "$1"
	$1
}

# Echo something if the verbose flag is on.
function verbose_echo() {
	if [ "$DH_VERBOSE" ]; then
		echo "	$1"
	fi
}

# Echo an error message and exit.
function error() {
	echo `basename $0`": $1" >&2
	exit 1
}

# Argument processing and global variable initialization is below.

# Get the package name and version from the changelog.
LINE=`head -1 debian/changelog`
PACKAGE=`expr "$LINE" : '\(.*\) (.*)'`
VERSION=`expr "$LINE" : '.* (\(.*\))'`

# Is this a native Debian package?
if ! expr "$VERSION" : '.*-' >/dev/null; then
       	NATIVE=1
fi

# Parse command line.
set -- `getopt v $*` 

for i; do
	case "$i"
	in
		-v)
			DH_VERBOSE=1
			shift
			;;
		--)
			shift
			break
			;;
	esac
done