From d079e6683cfcbef6a979eb7a02780eebdf480a74 Mon Sep 17 00:00:00 2001
From: joey <joey>
Date: Tue, 17 Aug 1999 04:34:25 +0000
Subject: [PATCH] r12: Initial Import

---
 .foo                                |   0
 BUGS                                |   3 +
 autoscripts/postinst-init           |   2 +
 autoscripts/postinst-init-norestart |   1 +
 autoscripts/postinst-suid           |   6 ++
 autoscripts/postrm-init             |   3 +
 autoscripts/postrm-suid             |   3 +
 autoscripts/prerm-init              |   1 +
 debian/changelog                    |   6 ++
 dh_builddeb                         |   2 +-
 dh_clean                            |   2 +-
 dh_compress                         |   2 +-
 dh_du                               |  19 ++++
 dh_du.1                             |  42 +++++++++
 dh_fixperms                         |   2 +-
 dh_gencontrol                       |  19 ++++
 dh_gencontrol.1                     |  55 +++++++++++
 dh_getopt.pl                        | 138 ++++++++++++++++++++++++++++
 dh_installchangelogs                |   2 +-
 dh_installcron                      |   2 +-
 dh_installdeb                       |  46 ++++++++++
 dh_installdeb.1                     |  67 ++++++++++++++
 dh_installdebfiles                  |   2 +-
 dh_installdirs                      |  39 ++++++++
 dh_installdirs.1                    |  59 ++++++++++++
 dh_installdocs                      |   2 +-
 dh_installdocs.1                    |  13 ++-
 dh_installexamples                  |   2 +-
 dh_installexamples.1                |   4 +
 dh_installinit                      |  58 ++++++++++++
 dh_installinit.1                    |  70 ++++++++++++++
 dh_installmanpages                  |   2 +-
 dh_installmenu                      |   2 +-
 dh_lib                              |  12 +--
 dh_makeshlibs                       |  30 ++++++
 dh_makeshlibs.1                     |  47 ++++++++++
 dh_md5sums                          |  22 +++++
 dh_md5sums.1                        |  45 +++++++++
 dh_movefiles.1                      |  46 ++++++++++
 dh_shlibdeps                        |  24 +++++
 dh_shlibdeps.1                      |  56 +++++++++++
 dh_strip                            |   2 +-
 dh_suidregister                     |  58 ++++++++++++
 dh_suidregister.1                   |  62 +++++++++++++
 dh_testdir                          |   2 +-
 dh_testroot                         |   2 +-
 dh_testversion.1                    |  46 ++++++++++
 dh_testversion.in                   |  23 +++++
 dh_undocumented                     |  51 ++++++++++
 dh_undocumented.1                   |  68 ++++++++++++++
 examples/rules.indep                |  56 +++++++++++
 51 files changed, 1304 insertions(+), 24 deletions(-)
 create mode 100644 .foo
 create mode 100644 BUGS
 create mode 100644 autoscripts/postinst-init
 create mode 100644 autoscripts/postinst-init-norestart
 create mode 100644 autoscripts/postinst-suid
 create mode 100644 autoscripts/postrm-init
 create mode 100644 autoscripts/postrm-suid
 create mode 100644 autoscripts/prerm-init
 create mode 100755 dh_du
 create mode 100644 dh_du.1
 create mode 100755 dh_gencontrol
 create mode 100644 dh_gencontrol.1
 create mode 100755 dh_getopt.pl
 create mode 100755 dh_installdeb
 create mode 100644 dh_installdeb.1
 create mode 100755 dh_installdirs
 create mode 100644 dh_installdirs.1
 create mode 100755 dh_installinit
 create mode 100644 dh_installinit.1
 create mode 100755 dh_makeshlibs
 create mode 100644 dh_makeshlibs.1
 create mode 100755 dh_md5sums
 create mode 100644 dh_md5sums.1
 create mode 100644 dh_movefiles.1
 create mode 100755 dh_shlibdeps
 create mode 100644 dh_shlibdeps.1
 create mode 100755 dh_suidregister
 create mode 100644 dh_suidregister.1
 create mode 100644 dh_testversion.1
 create mode 100644 dh_testversion.in
 create mode 100755 dh_undocumented
 create mode 100644 dh_undocumented.1
 create mode 100755 examples/rules.indep

diff --git a/.foo b/.foo
new file mode 100644
index 0000000..e69de29
diff --git a/BUGS b/BUGS
new file mode 100644
index 0000000..3a33f32
--- /dev/null
+++ b/BUGS
@@ -0,0 +1,3 @@
+dh_compress: doesn't verbose echo that it's cd'd to $TMP. 
+dh_installdirs, dh_md5sums: uses ../.. to cd back to original location, but
+	we don't know that $TMP is 2 levels deep.
diff --git a/autoscripts/postinst-init b/autoscripts/postinst-init
new file mode 100644
index 0000000..976c6b3
--- /dev/null
+++ b/autoscripts/postinst-init
@@ -0,0 +1,2 @@
+update-rc.d #SCRIPT# #INITPARMS# >/dev/null
+/etc/init.d/#SCRIPT# start
diff --git a/autoscripts/postinst-init-norestart b/autoscripts/postinst-init-norestart
new file mode 100644
index 0000000..05357d0
--- /dev/null
+++ b/autoscripts/postinst-init-norestart
@@ -0,0 +1 @@
+update-rc.d #SCRIPT# #INITPARMS# >/dev/null
diff --git a/autoscripts/postinst-suid b/autoscripts/postinst-suid
new file mode 100644
index 0000000..1294d31
--- /dev/null
+++ b/autoscripts/postinst-suid
@@ -0,0 +1,6 @@
+if [ -e /etc/suid.conf -a -x /usr/sbin/suidregister ]; then
+        suidregister -s #PACKAGE# /#FILE# #OWNER# #GROUP# #PERMS#
+else
+        chown #OWNER#.#GROUP# /#FILE#
+        chmod #PERMS# /#FILE#
+fi
diff --git a/autoscripts/postrm-init b/autoscripts/postrm-init
new file mode 100644
index 0000000..9596dd9
--- /dev/null
+++ b/autoscripts/postrm-init
@@ -0,0 +1,3 @@
+if [ "$1" = "purge" ] ; then
+	update-rc.d #SCRIPT# remove #INITPARMS# >/dev/null
+fi
diff --git a/autoscripts/postrm-suid b/autoscripts/postrm-suid
new file mode 100644
index 0000000..9712d25
--- /dev/null
+++ b/autoscripts/postrm-suid
@@ -0,0 +1,3 @@
+if [ -e /etc/suid.conf -a -x /usr/sbin/suidunregister ]; then
+        suidunregister -s #PACKAGE# /#FILE#
+fi
diff --git a/autoscripts/prerm-init b/autoscripts/prerm-init
new file mode 100644
index 0000000..64975a3
--- /dev/null
+++ b/autoscripts/prerm-init
@@ -0,0 +1 @@
+/etc/init.d/#SCRIPT# stop
diff --git a/debian/changelog b/debian/changelog
index 99a22f7..a4d47c4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+debhelper (0.6) unstable; urgency=low
+
+  * Got rid of bashisms - this package should work now if /bin/sh is ash.
+
+ -- Joey Hess <joeyh@master.debian.org>  Fri, 10 Oct 1997 15:24:40 -0400
+
 debhelper (0.5) unstable; urgency=low
 
   * Added dh_installcron to install cron jobs.
diff --git a/dh_builddeb b/dh_builddeb
index 7bea3c0..aea8a1b 100755
--- a/dh_builddeb
+++ b/dh_builddeb
@@ -3,7 +3,7 @@
 # Build the .deb package, assuming all the files are set up.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_clean b/dh_clean
index cb20e97..964eec3 100755
--- a/dh_clean
+++ b/dh_clean
@@ -4,7 +4,7 @@
 # build process.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_compress b/dh_compress
index a1ff97e..347f0f5 100755
--- a/dh_compress
+++ b/dh_compress
@@ -4,7 +4,7 @@
 # compressed files get fixed.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_du b/dh_du
new file mode 100755
index 0000000..a7ec6f4
--- /dev/null
+++ b/dh_du
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+#
+# Generate a DEBIAN/du file, that lists the disk usage of the directories in 
+# the package.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+	TMP=`tmpdir $PACKAGE`
+
+	if [ ! -d "debian/$TMP/DEBIAN" ]; then
+		doit "install -d debian/$TMP/DEBIAN"
+	fi
+
+	verbose_echo "du -k debian/$TMP | sed \"s:	debian/$TMP/:	:\" | grep -v \"	DEBIAN$\" | grep -v \"	debian/$TMP$\" > debian/$TMP/DEBIAN/du"
+	du -k debian/$TMP | sed "s:	debian/$TMP/:	:" | grep -v "	DEBIAN$" | grep -v "	debian/$TMP$" >debian/$TMP/DEBIAN/du
+	doit "chown root.root debian/tmp/DEBIAN/du"
+done
diff --git a/dh_du.1 b/dh_du.1
new file mode 100644
index 0000000..98a9c80
--- /dev/null
+++ b/dh_du.1
@@ -0,0 +1,42 @@
+.TH DH_DU 1
+.SH NAME
+dh_du \- generate DEBIAN/du file
+.SH SYNOPSIS
+.B dh_md5sums
+.I "[-v] [-a] [-i] [-ppackage]"
+.SH "DESCRIPTION"
+dh_du is a debhelper program that is responsible for generating
+a DEBIAN/du file, which lists the disk usage of directories in the package.
+This file isn't used by anthing yet, but it could be helpful for a future
+debian installer program.
+.P
+The du file is installed with proper permissions and ownerships.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Generate du files for all architecture dependent packages.
+.TP
+.B \-i
+Generate du files for all architecture independent packages.
+.TP
+.B \-ppackage
+Generate du file for the package named "package".
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_fixperms b/dh_fixperms
index 9773831..6e935a8 100755
--- a/dh_fixperms
+++ b/dh_fixperms
@@ -3,7 +3,7 @@
 # Do some general file permission fixups.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_gencontrol b/dh_gencontrol
new file mode 100755
index 0000000..e2a4e70
--- /dev/null
+++ b/dh_gencontrol
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+#
+# Generate and install the control file. Simple dpkg-gencontrol wrapper.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+	TMP=`tmpdir $PACKAGE`
+	EXT=`pkgext $PACKAGE`
+
+	if [ ! -d $TMP/DEBIAN ]; then
+		doit "install -o root -g root -d $TMP/DEBIAN"
+	fi
+
+	# Generate and install control file.
+	doit "dpkg-gencontrol -p$PACKAGE -Tdebian/${EXT}substvars -P$TMP $DH_U_PARAMS"
+	doit "chown root.root $TMP/DEBIAN/control"
+done
diff --git a/dh_gencontrol.1 b/dh_gencontrol.1
new file mode 100644
index 0000000..7b78248
--- /dev/null
+++ b/dh_gencontrol.1
@@ -0,0 +1,55 @@
+.TH DH_INSTALLDEBFILES 1
+.SH NAME
+dh_gencontrol \- generate and install control file
+.SH SYNOPSIS
+.B dh_gencontrol
+.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir] [-uparams]"
+.SH "DESCRIPTION"
+dh_gencontrol is a debhelper program that is responsible for generating and
+installing control files, and installing them into the DEBIAN directory with
+the proper permissions.
+.P
+This program is merely a wrapper around
+.BR dpkg-gencontrol (1)
+You may prefer to simply run
+.BR dpkg-gencontrol (1)
+by hand.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Install files for all architecture dependent packages.
+.TP
+.B \-i
+Install files for all architecture independent packages.
+.TP
+.B \-ppackage
+Install files for the package named "package".
+.TP
+.B \-Ptmpdir
+Use "tmpdir" for package build directory. 
+.TP
+.B \-uparams
+Pass "params" to 
+.BR dpkg-gencontrol (1)
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.BR dpkg-shlibdeps (1)
+.SH "CONFORMS TO"
+Debian policy, version 2.3.0.0
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_getopt.pl b/dh_getopt.pl
new file mode 100755
index 0000000..bb7d513
--- /dev/null
+++ b/dh_getopt.pl
@@ -0,0 +1,138 @@
+#!/usr/bin/perl
+#
+# Because the getopt() program is so horribly broken, I wrote my own argument
+# processer that uses the find Getopt::Long module. This is used by all
+# debhelper scripts.
+#
+# Joey Hess, GPL copyright 1998.
+
+# Returns a list of packages in the control file.
+# Must pass "arch" or "indep" to specify arch-dependant or -independant
+# packages.
+sub GetPackages { $type=shift;
+	my $package;
+	my $arch;
+	my @list;
+	open (CONTROL,"<debian/control") || 
+		( $parse_error="cannot read debian/control: $!\n" );
+	while (<CONTROL>) {
+		chomp;
+		s/\s+$//;
+		if (/^Package:\s+(.*)/) {
+			$package=$1;
+		}
+		if (/^Architecture:\s+(.*)/) {
+			$arch=$1;
+		}
+		if (!$_ or eof) { # end of stanza.
+			if ($package &&
+			    (($type eq 'indep' && $arch eq 'all') ||
+				   ($type eq 'arch' && $arch ne 'all'))) {
+				push @list, $package;
+				undef $package, $arch;
+			}
+		}
+	}
+	close CONTROL;
+
+	return @list;
+}
+
+# Passed an option name and an option value, adds packages to the list
+# of packages. We need this so the list will be built up in the right
+# order.
+sub AddPackage { my($option,$value)=@_;
+	if ($option eq 'i' or $option eq 'indep') {
+		push @packages, GetPackages('indep');
+		$indep=1;
+	}
+	elsif ($option eq 'a' or $option eq 'arch') {
+		push @packages, GetPackages('arch');
+		$arch=1;
+	}
+	elsif ($option eq 'p' or $option eq 'package') {
+		push @packages, $value;
+	}
+	else {
+		$parse_error="bad option $option - should never happen!\n";
+	}
+}
+
+use Getopt::Long;
+
+# Enable bundling of short command line options.
+Getopt::Long::config("bundling");
+
+# Parse options.
+GetOptions(
+	"v" => \$verbose,
+	"verbose" => \$verbose,
+
+	"i" => \&AddPackage,
+	"indep" => \&AddPackage,
+
+	"a" => \&AddPackage,
+	"arch" => \&AddPackage,
+
+	"p=s" => \&AddPackage,
+  "package=s" => \&AddPackage,
+
+	"n" => \$noscripts,
+	"noscripts" => \$noscripts,
+
+	"x" => \$include, # is -x for some unknown historical reason..
+	"include-conffiles" => \$include,
+	
+	"d" => \$d_flag,
+	"remove-d" => \$d_flag,
+
+	"r" => \$r_flag,
+	"no-restart-on-upgrade" => \$r_flag,
+
+	"k" => \$k_flag,
+	"keep" => \$k_flag,
+
+	"P=s" => \$tmpdir,
+	"tmpdir=s" => \$tmpdir,
+
+	"u=s", => \$u_params,
+	"update-rcd-params=s", => \$u_params,
+  "dpkg-shlibdeps-params=s", => \$u_params,
+
+	"m=s", => \$major,
+	"major=s" => \$major,
+
+	"V:s", => \$version_info,
+	"version-info:s" => \$version_info,
+
+	"A" => \$all,
+	"all" => \$all,
+);
+
+# Check to see if -V was specified. If so, but no parameters were passed,
+# the variable will be defined but empty.
+if (defined($version_info)) {
+	$version_info_set=1;
+}
+
+# Now output everything, in a format suitable for a shell to eval it. 
+# Note the last line sets $@ in the shell to whatever arguements remain.
+print qq{
+DH_VERBOSE='$verbose'
+DH_DOPACKAGES='@packages'
+DH_DOINDEP='$indep'
+DH_DOARCH='$arch'
+DH_NOSCRIPTS='$noscripts'
+DH_EXCLUDE='$include'
+DH_D_FLAG='$d_flag'
+DH_R_FLAG='$r_flag'
+DH_K_FLAG='$k_flag'
+DH_TMPDIR='$tmpdir'
+DH_U_PARAMS='$u_params'
+DH_M_PARAMS='$major'
+DH_V_FLAG='$version_info'
+DH_V_FLAG_SET='$version_info_set'
+DH_PARAMS_ALL='$all'
+DH_PARSE_ERROR='$parse_error'
+set -- @ARGV
+};
diff --git a/dh_installchangelogs b/dh_installchangelogs
index 4a93188..17ff731 100755
--- a/dh_installchangelogs
+++ b/dh_installchangelogs
@@ -8,7 +8,7 @@
 # error to specify an upstream changelog on the command line.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 UPSTREAM=$1
 
diff --git a/dh_installcron b/dh_installcron
index 7db8cdc..f5c4f8b 100755
--- a/dh_installcron
+++ b/dh_installcron
@@ -3,7 +3,7 @@
 # Install cron scripts into the appropriate places.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_installdeb b/dh_installdeb
new file mode 100755
index 0000000..43aca90
--- /dev/null
+++ b/dh_installdeb
@@ -0,0 +1,46 @@
+#!/bin/sh -e
+#
+# Install files from debian/ into the package's DEBIAN directory.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+	TMP=`tmpdir $PACKAGE`
+	EXT=`pkgext $PACKAGE`
+
+	if [ ! -d $TMP/DEBIAN ]; then
+		doit "install -o root -g root -d $TMP/DEBIAN"
+	fi
+
+	# Install debian install scripts.
+	# If any .debhelper files exist, add them into the scripts.
+	for file in postinst preinst prerm postrm; do
+		if [ -f debian/$EXT$file ]; then
+			# Add this into the script, where it has #DEBHELPER#
+			if [ -f debian/$EXT$file.debhelper ]; then
+				complex_doit "perl -pe 's~#DEBHELPER#~qx{cat debian/$EXT$file.debhelper}~eg' < debian/$EXT$file > $TMP/DEBIAN/$file"
+				doit "chown root.root $TMP/DEBIAN/$file"
+				doit "chmod 755 $TMP/DEBIAN/$file"
+			else
+				doit "install -o root -g root -p debian/$EXT$file $TMP/DEBIAN/$file"
+			fi
+		else
+			# Auto-generate script header and add .debhelper
+			# content to it.
+			if [ -f debian/$EXT$file.debhelper ]; then
+				complex_doit "echo '#!/bin/sh -e' > $TMP/DEBIAN/$file"
+				complex_doit "cat debian/$EXT$file.debhelper >> $TMP/DEBIAN/$file"
+				doit "chown root.root $TMP/DEBIAN/$file"
+				doit "chmod 755 $TMP/DEBIAN/$file"
+			fi
+		fi
+	done
+
+	# Install non-executable files
+	for file in shlibs conffiles; do
+		if [ -f debian/$EXT$file ]; then
+			doit "install -o root -g root -m 644 -p debian/$EXT$file $TMP/DEBIAN/$file"
+		fi                                               
+	done
+done
diff --git a/dh_installdeb.1 b/dh_installdeb.1
new file mode 100644
index 0000000..08b6cba
--- /dev/null
+++ b/dh_installdeb.1
@@ -0,0 +1,67 @@
+.TH DH_INSTALLDEBFILES 1
+.SH NAME
+dh_installdeb \- install files into the DEBIAN directory
+.SH SYNOPSIS
+.B dh_installdeb
+.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir]"
+.SH "DESCRIPTION"
+dh_installdeb is a debhelper program that is responsible for installing
+files into the DEBIAN directory in package build directories with the
+correct permissions.
+.P
+dh_installdeb automatically installs the following files from debian/ into
+the DEBIAN directory:
+.IP postinst
+.IP preinst
+.IP postrm
+.IP prerm
+.IP shlibs
+.IP conffiles
+.P
+(For packages other than the first binary package listed in debian/control,
+prefix these filenames with then name of the "package.", for example, 
+"foo.postinst".)
+.P
+The files postinst, preinst, postrm, and prerm are handled specially: If a
+corresponding file named debian/script.debhelper exists, the contents of that 
+file are merged into the script as follows: If the script exists, then 
+anywhere in it that "#DEBHELPER#" appears, the text of the .debhelper file is
+inserted. If the script does not exist, then a script is generated from 
+the .debhelper file. The .debhelper files are created by other debhelper 
+programs, such as 
+.BR dh_installmenu (1)
+, and are shell scripts.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Install files for all architecture dependent packages.
+.TP
+.B \-i
+Install files for all architecture independent packages.
+.TP
+.B \-ppackage
+Install files for the package named "package".
+.TP
+.B \-Ptmpdir
+Use "tmpdir" for package build directory. 
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.SH "CONFORMS TO"
+Debian policy, version 2.3.0.0
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_installdebfiles b/dh_installdebfiles
index 37c6308..58aed3b 100755
--- a/dh_installdebfiles
+++ b/dh_installdebfiles
@@ -4,7 +4,7 @@
 # Also generates the control file.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_installdirs b/dh_installdirs
new file mode 100755
index 0000000..bab883d
--- /dev/null
+++ b/dh_installdirs
@@ -0,0 +1,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
diff --git a/dh_installdirs.1 b/dh_installdirs.1
new file mode 100644
index 0000000..41dd0fd
--- /dev/null
+++ b/dh_installdirs.1
@@ -0,0 +1,59 @@
+.TH DH_INSTALLDIRS 1
+.SH NAME
+dh_installdirs \- create subdirectories in package build directories
+.SH SYNOPSIS
+.B dh_installdirs
+.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir] [dir ...]"
+.SH "DESCRIPTION"
+dh_installdirs is a debhelper program that is responsible for creating
+subdirectories in package build directories.
+.P
+Any directory names specified as parameters will be created in the package
+build directory of the first binary package listed in debian/control, if 
+dh_installdirs is acting on that package.
+.P
+A file named debian/dirs (for the first binary package in debian/control),
+or debian/package.dirs (for each additional package in debian/control) can
+list other directories to be created. Seperate the directory names with
+whitespace.
+.P
+Be sure to only use directory names relative to the package build
+directory. Ie, "/usr/bin" should not be used, use "usr/bin" instead.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Create directories for all architecture dependent packages.
+.TP
+.B \-i
+Create directories for all architecture independent packages.
+.TP
+.B \-ppackage
+Create directories for the package named "package".
+.TP
+.B \-Ptmpdir
+Use "tmpdir" for package build directory. 
+.TP
+.B dir ...
+Create these directories in the package build directory of the first binary 
+package listed in debian/control, if we are acting on that package.
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.SH BUGS
+Directories with spaces in them will not currently be installed.
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_installdocs b/dh_installdocs
index dc21628..90be53c 100755
--- a/dh_installdocs
+++ b/dh_installdocs
@@ -4,7 +4,7 @@
 # Also installs the debian/copyright and debian/README.debian and debian/TODO
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_installdocs.1 b/dh_installdocs.1
index f21563c..4b5f068 100644
--- a/dh_installdocs.1
+++ b/dh_installdocs.1
@@ -12,10 +12,11 @@ dh_installdocs automatically installs debian/copyright if it exists. If
 dh_installdocs is acting on multiple packages, debian/copyright files will be 
 installed into all packages.
 .P
-Any filenames specified as parameters, as well as debian/README.debian and
-debian/TODO, if they exist, will be installed into the first binary
-package listed in debian/control, if dh_installdocs is acting on that
-package.
+Any filenames specified as parameters, as well as debian/README.debian (or
+debian/README.Debian) and debian/TODO, if they exist, will be installed into
+the first binary package listed in debian/control, if dh_installdocs is acting
+on that package. Note that debian/TODO will be installed named TODO.Debian,
+if the package is not a debian native package.
 .P
 A file named debian/docs (for the first binary package in debian/control),
 or debian/package.docs (for each additional package in debian/control) can
@@ -45,6 +46,10 @@ and
 .B \-p
 arguments are cumulative. If none are specified, then all packages listed in
 the control file will be effected.
+.P
+Note that dh_installdocs will happily copy entire directory hiearchies if
+you ask it to (it uses cp -a internally). If it is asked to install a
+directory, it will install the complete contents of the directory.
 .SH ENVIRONMENT
 .TP
 .I DH_VERBOSE
diff --git a/dh_installexamples b/dh_installexamples
index f82b000..23d11af 100755
--- a/dh_installexamples
+++ b/dh_installexamples
@@ -4,7 +4,7 @@
 # /usr/doc/$PACKAGE/examples
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_installexamples.1 b/dh_installexamples.1
index 1fb5c44..e7ad6c6 100644
--- a/dh_installexamples.1
+++ b/dh_installexamples.1
@@ -40,6 +40,10 @@ and
 .B \-p
 arguments are cumulative. If none are specified, then all packages listed in
 the control file will be effected.
+.P
+Note that dh_examples will happily copy entire directory hiearchies if
+you ask it to (it uses cp -a internally). If it is asked to install a
+directory, it will install the complete contents of the directory.
 .SH ENVIRONMENT
 .TP
 .I DH_VERBOSE
diff --git a/dh_installinit b/dh_installinit
new file mode 100755
index 0000000..2ea3440
--- /dev/null
+++ b/dh_installinit
@@ -0,0 +1,58 @@
+#!/bin/sh -e
+#
+# Install debian/init[.d], and set up the postinst and postrm for init
+# scripts.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+	TMP=`tmpdir $PACKAGE`
+	EXT=`pkgext $PACKAGE`
+
+	if [ -e debian/${EXT}init ]; then
+		if [ ! -d $TMP/etc/init.d ]; then
+			doit "install -d $TMP/etc/init.d"
+		fi
+
+		# Figure out what filename to install it as.
+		if [ "$DH_D_FLAG" ]; then
+			# -d on the command line sets DH_D_FLAG. We will 
+			# remove a trailing 'd' from the package name and 
+			# use that as the name.
+			script=`expr $PACKAGE : '\(.*\)d$'` || true
+			if [ ! "$script" ]; then
+				echo `basename $0`" warning: \"$PACKAGE\" has no final -d, but -d was specified."
+				script=$PACKAGE
+			fi
+		else
+			script=$PACKAGE
+		fi
+		doit "install -p -m755 debian/${EXT}init $TMP/etc/init.d/$script"
+
+		# This is set by the -u "foo" command line switch, it's
+		# the parameters to pass to update-rc.d. If not set, 
+		# we have to say "defaults".
+		if [ "$DH_U_PARAMS" = "" ]; then
+			DH_U_PARAMS="defaults"
+		fi
+
+		# -r on the command line sets DH_R_FLAG. If it's set, there
+		# is no restart on upgrade.
+		if [ ! "$DH_NOSCRIPTS" ]; then
+			if [ "$DH_R_FLAG" ]; then
+				autoscript "postinst" "postinst-init-norestart" \
+					"s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+				autoscript "postrm" "postrm-init" \
+					"s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+			else
+				autoscript "postinst" "postinst-init" \
+					"s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+				autoscript "postrm" "postrm-init" \
+					"s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+				autoscript "prerm" "prerm-init" \
+					"s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
+			fi
+		fi
+	fi
+done
diff --git a/dh_installinit.1 b/dh_installinit.1
new file mode 100644
index 0000000..4eb4ee0
--- /dev/null
+++ b/dh_installinit.1
@@ -0,0 +1,70 @@
+.TH DH_INSTALLINIT 1
+.SH NAME
+dh_installinit \- install init scripts into package build directories
+.SH SYNOPSIS
+.B dh_installinit
+.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir] [-n] [-r] [-d] [-u params]"
+.SH "DESCRIPTION"
+dh_installmenu is a debhelper program that is responsible for installing
+init scripts into package build directories. 
+.P
+It also automatically generates the postinst and postrm and prerm commands 
+needed to set up the symlinks in /etc/rc*.d/ and to start and stop the init
+scripts.
+.P
+If a file named debian/init exists, then it is installed into
+etc/init.d/package in the package build directory (with "package" replaced
+by the package name, unless the -d flag is specified, see below)
+.P
+For packages other than the first binary package listed in
+the control file, use debian/package.init instead (replace "package" with 
+the name of the package.)
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Install init scripts into all architecture dependent packages.
+.TP
+.B \-i
+Install init scripts into all architecture independent packages.
+.TP
+.B \-ppackage
+Install init scripts into the package named "package".
+.TP
+.B \-Ptmpdir
+Use "tmpdir" for package build directory. 
+.TP
+.B \-n
+Do not modify postinst/postrm/prerm scripts.
+.TP
+.B \-r
+Do not restart daemon on upgrade.
+.TP
+.B \-d
+Remove trailing "d" from the name of the package, and use the result for the
+filename the init script is installed as in etc/init.d/ . This may be useful
+for daemons with named ending in "d".
+.TP
+.B \-u params
+Pass "params" to 
+.BR update-rc.d (8)
+If not specified, "default" will be passed to
+.BR update-rc.d (8)
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_installmanpages b/dh_installmanpages
index 7ee35a9..304c3b1 100755
--- a/dh_installmanpages
+++ b/dh_installmanpages
@@ -5,7 +5,7 @@
 # This is a little bit DWIMish, but still very handy.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
         TMP=`tmpdir $PACKAGE`
diff --git a/dh_installmenu b/dh_installmenu
index 1180c60..c837e04 100755
--- a/dh_installmenu
+++ b/dh_installmenu
@@ -9,7 +9,7 @@
 # Also, add to postinst and postrm.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_lib b/dh_lib
index b18c7e5..618953d 100644
--- a/dh_lib
+++ b/dh_lib
@@ -5,20 +5,20 @@
 # function.
 # Unfortunatly, this function doesn't work if your command uses redirection,
 # you will have to call verbose_echo by hand then.
-function doit() {
+doit() {
 	verbose_echo "$*"
 	$*
 }
 
 # Echo something if the verbose flag is on.
-function verbose_echo() {
+verbose_echo() {
 	if [ "$DH_VERBOSE" ]; then
 		echo "	$*"
 	fi
 }
 
 # Echo an error message and exit.
-function error() {
+error() {
 	echo `basename $0`": $1" >&2
 	exit 1
 }
@@ -26,7 +26,7 @@ function error() {
 # Pass it a name of a binary package, it returns the name of the tmp dir to
 # use, for that package, relative to debian/
 # This is for back-compatability with the debian/tmp tradition.
-function tmpdir() {
+tmpdir() {
 	if [ "$1" = "$MAINPACKAGE" ]; then
 		echo tmp
 	else
@@ -36,7 +36,7 @@ function tmpdir() {
 
 # Pass it a name of a binary package, it returns the name to prefix to files
 # in debian for this package.
-function pkgext() {
+pkgext() {
 	if [ "$1" != "$MAINPACKAGE" ]; then
 		echo "$PACKAGE."
 	fi
@@ -49,7 +49,7 @@ function pkgext() {
 # 1: script to add to
 # 2: filename of snippet
 # 3: sed commands to run on the snippet. Ie, s/#PACKAGE#/$PACKAGE/
-function autoscript() {
+autoscript() {
 	autoscript_script=$1
 	autoscript_filename=$2
 	autoscript_sed=$3
diff --git a/dh_makeshlibs b/dh_makeshlibs
new file mode 100755
index 0000000..a09e26f
--- /dev/null
+++ b/dh_makeshlibs
@@ -0,0 +1,30 @@
+#!/bin/sh -e
+#
+# Automatically generate shlibs files.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+	TMP=`tmpdir $PACKAGE`
+
+	if [ -e "debian/$TMP/DEBIAN/shlibs" ]; then
+		error "debian/$TMP/DEBIAN/shlibs already exists."
+	fi
+
+	for file in `find debian/$TMP -type f -name "*.so*" | tr "\n" " "` ; do
+		LIBRARY=`expr $file : ".*/\(.*\)\.so\..*"` || true
+		VERSION=`expr $file : ".*/.*\.so\.\(.*\)"` || true
+		MAJOR=`expr $VERSION : "\([0-9]*\)\."` || true
+		LIBSTUB=`expr $file : "\(.*\/.*\.so\)\..*"` || true
+		if [ ! -d "debian/$TMP/DEBIAN" ] ; then
+			doit "install -d debian/$TMP/DEBIAN"
+		fi
+		verbose_echo "echo \"$LIBRARY $MAJOR $PACKAGE\" >>debian/$TMP/DEBIAN/shlibs"
+		echo "$LIBRARY $MAJOR $PACKAGE" >>debian/$TMP/DEBIAN/shlibs
+	done
+
+	if [ -e "debian/$TMP/DEBIAN/shlibs" ]; then
+		doit "chown root.root debian/$TMP/DEBIAN/shlibs"
+	fi
+done
diff --git a/dh_makeshlibs.1 b/dh_makeshlibs.1
new file mode 100644
index 0000000..51ba8fe
--- /dev/null
+++ b/dh_makeshlibs.1
@@ -0,0 +1,47 @@
+.TH DH_MAKESHLIBS 1
+.SH NAME
+dh_makeshlibs \- automatically create shlibs file
+.SH SYNOPSIS
+.B dh_makeshlibs
+.I "[-v] [-a] [-i] [-ppackage]"
+.SH "DESCRIPTION"
+dh_makeshlibs is a debhelper program that automatically scans for shared
+libraries, and generates a shlibs file for the libraries it finds.
+.P
+For this program to work, you cannot have already installed a DEBIAN/shlibs
+file. If such a file exits, the program will exit with an error.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Generate shlibs files for all architecture dependent packages.
+.TP
+.B \-i
+Generate shlibs files for all architecture independent packages.
+.TP
+.B \-ppackage
+Generate shlibs file for the package named "package".
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.SH BUGS
+There is no guarentee that the program will get the shlibs file right. For
+example, it may not correctly guess the major number of your package. In
+casews like these (and perhaps in general, just to be safe), it is better to
+create a debian/shlibs file by hand.
+This is a "do what I Mean" type program - you have been warned!
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_md5sums b/dh_md5sums
new file mode 100755
index 0000000..634e2fd
--- /dev/null
+++ b/dh_md5sums
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+#
+# Generate a DEBIAN/md5sums file, that lists the md5sums of all
+# non-conffiles in the package
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+	TMP=`tmpdir $PACKAGE`
+
+	if [ ! -d "debian/$TMP/DEBIAN" ]; then
+		doit "install -d debian/$TMP/DEBIAN"
+	fi
+
+	doit "pushd debian/$TMP" >/dev/null
+	# Doit isn't smart enough to hande this next command so echo by hand. (sigh)
+	verbose_echo 'md5sum `find * -type f ! -regex "^DEBIAN/.*"` > DEBIAN/md5sums </dev/null'
+	md5sum `find * -type f ! -regex "^DEBIAN/.*"` >DEBIAN/md5sums </dev/null
+	doit "chown root.root DEBIAN/md5sums"
+	doit "popd 2>/dev/null" >/dev/null 
+done
diff --git a/dh_md5sums.1 b/dh_md5sums.1
new file mode 100644
index 0000000..422a4aa
--- /dev/null
+++ b/dh_md5sums.1
@@ -0,0 +1,45 @@
+.TH DH_MD5SUMS 1
+.SH NAME
+dh_md5sums \- generate DEBIAN/md5sums file
+.SH SYNOPSIS
+.B dh_md5sums
+.I "[-v] [-a] [-i] [-ppackage]"
+.SH "DESCRIPTION"
+dh_md5sums is a debhelper program that is responsible for generating
+a DEBIAN/md5sums file, which lists the md5sums of each file in the package.
+.P
+All files in DEBIAN/ are omitted from the md5sums file.
+.P
+The md5sums file is installed with proper permissions and ownerships.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Generate md5sums files for all architecture dependent packages.
+.TP
+.B \-i
+Generate md5sums files for all architecture independent packages.
+.TP
+.B \-ppackage
+Generate md5sums file for the package named "package".
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH BUGS
+It would be better if it did not include md5sums of conffiles, since this
+info is duplicated elsewhere.
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_movefiles.1 b/dh_movefiles.1
new file mode 100644
index 0000000..228f940
--- /dev/null
+++ b/dh_movefiles.1
@@ -0,0 +1,46 @@
+.TH DH_MOVEFILES 1
+.SH NAME
+dh_movefiles \- moves files out of debian/tmp into subpackages
+.SH SYNOPSIS
+.B dh_movefiles
+.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir]"
+.SH "DESCRIPTION"
+dh_movefiles is a debhelper program that is responsible for moving files out
+of debian/tmp and into other package build directories. This may be useful
+if your package has a Makefile that installs everything into debian/tmp, and
+you need to break that up into subpackages.
+.P
+Files named debian/package.files list the files to be moved, separated by
+whitespace.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Move files for all architecture dependent packages.
+.TP
+.B \-i
+Move files for all architecture independent packages.
+.TP
+.B \-ppackage
+Move files for the package named "package".
+.TP
+.B \-Ptmpdir
+Use "tmpdir" for package build directory. 
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_shlibdeps b/dh_shlibdeps
new file mode 100755
index 0000000..e30c4a5
--- /dev/null
+++ b/dh_shlibdeps
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+#
+# Find dependancies. Simple dpkg-shlibdeps wrapper.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+	TMP=`tmpdir $PACKAGE`
+	EXT=`pkgext $PACKAGE`
+
+	# Run dpkg-shlibdeps to generate dependancies.
+	filelist=""
+	for file in `find $TMP -type f \( -perm +111 -or -name "*.so*" \) | tr "\n" " "` ; do
+		case "`file $file`" in
+			*ELF*)
+				filelist="$file $filelist"
+			;;
+		esac
+	done
+	if [ "$filelist" ]; then
+		doit "dpkg-shlibdeps -Tdebian/${EXT}substvars $DH_U_PARAMS $filelist"
+	fi
+done
diff --git a/dh_shlibdeps.1 b/dh_shlibdeps.1
new file mode 100644
index 0000000..77d90c2
--- /dev/null
+++ b/dh_shlibdeps.1
@@ -0,0 +1,56 @@
+.TH DH_INSTALLDEBFILES 1
+.SH NAME
+dh_shlibdeps \- calculate shared library dependancies
+.SH SYNOPSIS
+.B dh_shlibdeps
+.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir] [-uparams]"
+.SH "DESCRIPTION"
+dh_shlibdeps is a debhelper program that is responsible for calculating
+shared library dependancies for all executables found in the package build
+directory.
+.P
+This program is merely a wrapper around
+.BR dpkg-shlibdeps (1)
+that calls it once for each package listed in the control file. You may 
+prefer to simply run 
+.BR dpkg-shlibdeps (1)
+by hand.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Install files for all architecture dependent packages.
+.TP
+.B \-i
+Install files for all architecture independent packages.
+.TP
+.B \-ppackage
+Install files for the package named "package".
+.TP
+.B \-Ptmpdir
+Use "tmpdir" for package build directory. 
+.TP
+.B \-uparams
+Pass "params" to 
+.BR dpkg-shlibdeps (1)
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.BR dpkg-shlibdeps (1)
+.SH "CONFORMS TO"
+Debian policy, version 2.3.0.0
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_strip b/dh_strip
index 2ecdcd2..77d670a 100755
--- a/dh_strip
+++ b/dh_strip
@@ -3,7 +3,7 @@
 # Strip files.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for PACKAGE in $DH_DOPACKAGES; do
 	TMP=`tmpdir $PACKAGE`
diff --git a/dh_suidregister b/dh_suidregister
new file mode 100755
index 0000000..4ca72a1
--- /dev/null
+++ b/dh_suidregister
@@ -0,0 +1,58 @@
+#!/bin/sh -e
+#
+# If no parameters are given, and no debian/suid files exists, scan for 
+# suid/sgid files and suidregister them. 
+#
+# If there are parameters, or there is a debian/suid, register the files
+# listed there.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+	TMP=`tmpdir $PACKAGE`
+	EXT=`pkgext $PACKAGE`
+
+	files=""
+
+	if [ -e debian/${EXT}suid ]; then
+		files=`tr "\n" " " < debian/${EXT}suid`
+	fi
+
+	if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then
+		files="$* $files"
+	fi
+
+	if [ ! "$files" -a ! -e debian/${EXT}suid ]; then
+		# No files specified (and no empty debian/suid file), so
+		# guess what files to process.
+		files=`find debian/$TMP -type f -perm +6000`
+
+		# We will strip the debian working directory off of the
+		# filenames.
+		tostrip="debian/$TMP/"
+	else
+		# We will strip leading /'s, so the user can feed this
+		# program either absolute filenames, or relative filenames,
+		# and it will do the right thing either way.
+		tostrip="/"
+	fi
+
+	if [ "$files" ]; then
+		for file in $files; do
+			# Strip leading $tostrip from $file. If not there,
+			# leave $file untouched.
+			if [ `expr "$file" : "$tostrip\\(.*\\)"` ]; then
+				file=`expr "$file" : "$tostrip\\(.*\\)"`
+			fi
+			
+			# Create the sed string that will be used to 
+			# fill in the blanks in the autoscript files.
+			# Fill with the owner, group, and perms of the file.
+			sedstr=`find debian/$TMP/$file -printf "s:#FILE#:$file:;s/#PACKAGE#/$PACKAGE/;s/#OWNER#/%u/;s/#GROUP#/%g/;s/#PERMS#/%m/"`
+			
+			autoscript "postinst" "postinst-suid" "$sedstr"
+			autoscript "postrm" "postrm-suid" "$sedstr"
+		done
+	fi
+done
diff --git a/dh_suidregister.1 b/dh_suidregister.1
new file mode 100644
index 0000000..e15e6d5
--- /dev/null
+++ b/dh_suidregister.1
@@ -0,0 +1,62 @@
+.TH DH_SUIDREGISTER 1
+.SH NAME
+dh_suidregister \- set up package to register files with suidregister
+.SH SYNOPSIS
+.B dh_suidregister
+.I "[-v] [-a] [-i] [-ppackage] [file ...]"
+.SH "DESCRIPTION"
+dh_suidregister is a debhelper program that is responsible for modifying the
+postinst and postrm scripts of a package so the package will register files
+with 
+.BR suidregister (1)
+when it is installed.
+.P
+Any files specified as parameters will be registered, if dh_suidregister is
+acting on the first binary package listed in debian/control.
+.P
+The files debian/suid (for the first binary package in debian/control) or 
+debian/package.suid (for  each  additional package in debian/control) can 
+list other files to be registered.
+.P
+If neither of these methods is used to specify files, dh_suidregister will
+scan the package build directory for files that have suid permissions, and
+will automatically register all files it finds.
+.P
+Note that this package modifies your postinst and postrm files. See
+.BR dh_installdebfiles (1)
+for an explination of how this works.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Register files for all architecture dependent packages.
+.TP
+.B \-i
+Register files for all architecture independent packages.
+.TP
+.B \-ppackage
+Register files for the package named "package".
+.TP
+.B file ...
+Register these files in the first binary package listed in debian/control, 
+if we are acting on that package.
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+,
+.BR suidregister (1)
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_testdir b/dh_testdir
index 4d3c700..4e482fc 100755
--- a/dh_testdir
+++ b/dh_testdir
@@ -5,7 +5,7 @@
 # of any other files you specify on the command line.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 for file in debian/control $@; do
 	if [ ! -e "$file" ] ; then
diff --git a/dh_testroot b/dh_testroot
index fcc9b47..36577b2 100755
--- a/dh_testroot
+++ b/dh_testroot
@@ -3,7 +3,7 @@
 # Checks to make sure you are root.
 
 PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+. dh_lib
 
 if  [ "`whoami`" != root ]; then
 	error "You must run this as root."
diff --git a/dh_testversion.1 b/dh_testversion.1
new file mode 100644
index 0000000..f385a8c
--- /dev/null
+++ b/dh_testversion.1
@@ -0,0 +1,46 @@
+.TH DH_TESTROOT 1
+.SH NAME
+dh_testversion \- ensure that the correct version of debhelper is installed
+.SH SYNOPSIS
+.B dh_testversion [operator] [version]
+.SH "DESCRIPTION"
+dh_testversion compares the version of debhelper against the version you
+specify, and if the condition is not met, exits with an error message.
+.P
+You should use this in your debian/rules files if a new debhelper feature is
+introduced, and your package requires that feature to build correctly. Use
+debhelper's changelog to figure out the version you need.
+.P
+Be sure not to overuse dh_testversion. If debhelper version 9.5
+introduces a new dh_autofixbugs command, and your package uses it, then if
+someone tries to build it with debhelper 1.0, the build will fail anyway when
+dh_autofixbugs cannot be found, so there is no need for you to use
+dh_testversion.
+.SH OPTIONS
+.TP
+.B operator
+Optional comparison operator used in comparing the versions. If not 
+specified, ">=" is used. For descriptions of the comparison operators, see 
+dpkg --help.
+.TP
+.B version
+Version number to compare against the current version of debhelper. If not
+specified, dh_testroot does nothing.
+.SH EXAMPLES
+.TP
+.I dh_testversion 0.50
+Make sure debhelper version 0.50 or higher is installed.
+.TP
+.I dh_testversion ge 0.50
+Another way to make sure debhelper version 0.50 or higher is installed.
+.TP
+.I dh_testversion le 0.50
+Make sure a version of debhelper less than version 0.50 is installed.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode.
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/dh_testversion.in b/dh_testversion.in
new file mode 100644
index 0000000..9e2f14e
--- /dev/null
+++ b/dh_testversion.in
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+#
+# Debhelper version check.
+
+# Current version of debhelper is:
+DH_VERSION=#DEBHELPER_VERSION#
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+if [ "$1" -a "$2" ]; then
+	compare=$1
+	ver=$2
+elif [ "$1" ]; then
+	compare=">="
+	ver=$1
+fi
+
+if [ "$compare" -a "$ver" ] ; then
+	if ! dpkg --compare-versions $DH_VERSION $compare $ver; then
+		error "debhelper version $DH_VERSION is installed, but a version $compare $ver is needed to build this package."
+	fi
+fi
diff --git a/dh_undocumented b/dh_undocumented
new file mode 100755
index 0000000..ebde890
--- /dev/null
+++ b/dh_undocumented
@@ -0,0 +1,51 @@
+#!/bin/sh -e
+#
+# Passed a list of undocumented man pages, generates symlinks to
+# undocumented.7 for those man pages.
+#
+# Also, it looks for debian/undocumented files for more lists of
+# undocumented man pages.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+. dh_lib
+
+for PACKAGE in $DH_DOPACKAGES; do
+        TMP=`tmpdir $PACKAGE`
+	EXT=`pkgext $PACKAGE`
+
+	undoc=""
+
+	if [ -e debian/${EXT}undocumented ]; then
+		undoc=`tr "\n" " " < debian/${EXT}undocumented`
+	fi
+
+	if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then
+		undoc="$* $undoc"
+	fi
+
+	if [ "$undoc" ]; then
+		for file in $undoc; do
+			# Remove .gz extention from the filename, if present.
+			if [ `expr "$file" : '\(.*\).gz'` ]; then
+				file=`expr "$file" : '\(.*\).gz'`
+			fi
+
+			# Determine what directory the file belongs in,
+			# /usr/man, or /usr/X11R6/man.
+			section=`expr "$file" : '.*\.\([123456789]\)'`
+			if [ `expr "$file" : '.*\.[123456789]\(x\)'` ] ; then
+				dir=usr/X11R6/man/man$section
+				reldir=../../../man
+			else
+				dir=usr/man/man$section
+				reldir=..
+			fi
+
+			if [ ! -d debian/$TMP/$dir ]; then
+				doit "install -d debian/$TMP/$dir"
+			fi
+
+			doit ln -s $reldir/man7/undocumented.7.gz debian/$TMP/$dir/$file.gz
+		done
+	fi
+done
diff --git a/dh_undocumented.1 b/dh_undocumented.1
new file mode 100644
index 0000000..ab45baa
--- /dev/null
+++ b/dh_undocumented.1
@@ -0,0 +1,68 @@
+.TH DH_UNDOCUMENTED 1
+.SH NAME
+dh_undocumented \- make symlinks to undocumented.7 man page
+.SH SYNOPSIS
+.B dh_undocumented
+.I "[-v] [-a] [-i] [-ppackage] [manpage ...]"
+.SH "DESCRIPTION"
+dh_undocumented is a debhelper program that is responsible for making
+symlinks to the
+.BR undocumented (7)
+man page for man pages that are not present in your package.
+.P
+The program takes a list of man pages that should be symlinked to
+.BR undocumented (7)
+It determines what directory the man pages should be placed in by examining
+their extentions - pages ending in "x" go into /usr/X11R6/man/, while pages
+that end in anything else go in /usr/man/. It also examines the extention to
+see what section the man page belongs in. After figuring this out, it
+generates the necessary symlinks to
+.BR undocumented (7)
+, placing the sylinks in the package build directory.
+.P
+The lists of man pages that need 
+.BR undocumented (7)
+symlinks can be specified in two ways. Any man page names specified as 
+parameters will be set up in the first binary package listed in 
+debian/control, if dh_installdocs is acting on that package. 
+Also, if a file named debian/undocumented (for the first binary package in 
+debian/control), or debian/package.undocumented (for each additional package 
+in debian/control) can list other man page names to set up.
+.SH OPTIONS
+.TP
+.B \-v
+Verbose mode; show all commands that modify the package build directory.
+.TP
+.B \-a
+Install undocumented man page symlinks for all architecture dependent packages.
+.TP
+.B \-i
+Install undocumented man page symlinks for all architecture independent packages.
+.TP
+.B \-ppackage
+Install undocumented man page symlinks for the package named "package".
+.TP
+.B manpage ...
+Install undocumented man page symlinks for each of these man pages
+into the first binary package listed in debian/control, if we are acting on 
+that package.
+.SH NOTES
+The
+.B \-a
+.B \-i
+and
+.B \-p
+arguments are cumulative. If none are specified, then all packages listed in
+the control file will be effected.
+.SH ENVIRONMENT
+.TP
+.I DH_VERBOSE
+Enables verbose mode
+.SH "SEE ALSO"
+.BR /usr/doc/debhelper/README
+,
+.BR undocumented (7)
+.SH "CONFORMS TO"
+Debian policy, version 2.3.0.0
+.SH AUTHOR
+Joey Hess <joeyh@master.debian.org>
diff --git a/examples/rules.indep b/examples/rules.indep
new file mode 100755
index 0000000..a257a19
--- /dev/null
+++ b/examples/rules.indep
@@ -0,0 +1,56 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+# This version is for packages that are architecure independant.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+	# Add here commands to compile the pacckage.
+	#$(MAKE)
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+	# Add here commands to clean up after the build process.
+	#-$(MAKE) distclean
+	dh_clean
+
+# Build architecture-independent files here.
+binary-indep: build
+	dh_testdir
+	dh_testroot
+	dh_clean
+	dh_installdirs
+        # Add here commands to install the files into debian/tmp
+        #$(MAKE) PREFIX=debian/tmp install
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+#	dh_installinit
+	dh_installcron
+#	dh_installmanpages
+#	dh_undocumented
+	dh_installchangelogs
+	dh_compress
+	dh_fixperms
+	dh_suidregister
+	dh_installdeb
+	dh_gencontrol
+	dh_du
+	dh_md5sums
+	dh_builddeb
+
+# Build architecture-dependent files here.
+binary-arch: build
+# We have nothing to do by default.
+
+source diff:
+	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
-- 
2.39.5