summaryrefslogtreecommitdiff
path: root/dh_lib
diff options
context:
space:
mode:
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