summaryrefslogtreecommitdiff
path: root/dh_lib
diff options
context:
space:
mode:
authorjoey <joey>1999-08-17 04:12:54 +0000
committerjoey <joey>1999-08-17 04:12:54 +0000
commit938b66ee19e113785e6655b1c3e73e9003e6464c (patch)
treed06bd22faa3da8940bec71ba2e34e2028b6e7764 /dh_lib
r1: Initial revision
Diffstat (limited to 'dh_lib')
-rw-r--r--dh_lib50
1 files changed, 50 insertions, 0 deletions
diff --git a/dh_lib b/dh_lib
new file mode 100644
index 00000000..d9266395
--- /dev/null
+++ b/dh_lib
@@ -0,0 +1,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