--- daemontools-0.76.orig/debian/changelog
+++ daemontools-0.76/debian/changelog
@@ -0,0 +1,207 @@
+daemontools (1:0.76-3) unstable; urgency=low
+
+  * debian/daemontools-run.postinst: don't exec into the kill program, so
+    that the shell builtin is used (closes: #475619).
+  * debian/daemontools-run.postrm: ignore error if 'kill -s HUP 1' fails
+    for some reason on package removal (#474141).
+  * debian/control: Standards-Version: 3.7.3.0.
+
+ -- Gerrit Pape <pape@smarden.org>  Wed, 16 Apr 2008 21:20:38 +0000
+
+daemontools (1:0.76-2) unstable; urgency=low
+
+  * debian/daemontools-run.postinst: also remove inittab entry on upgrade
+    from daemontools-installer FHS version, to have new entry added
+    afterwards; look also for /var/lib/svscan, to possibly copy content to
+    /etc/service/ on upgrade (closes: #468853).
+  * debian/daemontools.NEWS.Debian: mention /etc/service/ as default
+    directory for services; recommend compatibility symlink.
+
+ -- Gerrit Pape <pape@smarden.org>  Sun, 02 Mar 2008 15:28:46 +0000
+
+daemontools (1:0.76-1) unstable; urgency=low
+
+  * debian/changelog: add epoch 1 to supersede unofficial package.
+  * switch from tarball in tarball .orig.tar.gz to original upstream
+    tarball.
+  * debian/rules: remove target configure:; use glibc by default instead
+    of dietlibc.
+  * debian/control: no longer Build-Depends: dietlibc.
+  * debian/gcc/: remove; obsolete.
+  * debian/rules: build programs in target build:; install programs into
+    /usr/bin/.
+  * debian/rules: new target patch: apply diffs from debian/diff/, reverse
+    apply in target clean:.
+  * debian/diff/0001-error.h-include-errno.h-instead-of-extern-int.patch:
+    new; error.h: '#include <errno.h>' instead of 'extern int errno;'.
+  * debian/daemontools-man/: new; add manpages downloaded from
+    http://smarden.org/pape/djb/manpages/daemontools-0.76-man-20020131.tar.gz.
+  * debian/rules: install manpages from debian/daemontools-man/ into
+    /usr/share/man/man8/.
+  * debian/daemontools.postinst, debian/daemontools.postrm: remove;
+    obsolete.
+  * debian/implicit: add proper dependencies to support 'parallel build'
+    through make -j (thx Daniel Schepler for the patch).
+  * debian/daemontools-run.README.Debian, debian/daemontools-run.postinst,
+    debian/daemontools-run.postrm: new; from the (unofficial) daemontools-run
+    package, slightly modified.
+  * debian/control, debian/rules: new package daemontools-run.
+  * debian/control: daemontools: no longer Depends: daemontools-run
+    (>= 0.76.1); no longer Recommends: daemontools-doc (>= 0.76-1);
+    Suggests: daemontools-run (>> 1:0.76); Replaces: daemontools-doc.
+  * debian/control: dameontools-run: Conflicts: runit.
+  * debian/rules: run dpkg-shlibdeps; remove debian/substvars in target
+    clean:.
+  * debian/control: Depends: ${shlibs:Depends}.
+  * debian/control: Standards-Version: 3.7.2.2.
+  * debian/copyright: rewrite copyright.
+  * debian/daemontools.README.Debian, debian/daemontools-run.README.Debian:
+    redo.
+  * debian/control: minor updates to short and long descriptions; Suggests:
+    daemontools-run | runit.
+  * debian/daemontools-run.postrm: use svc -dx to signal services and log
+    services to stop on package removal.
+  * debian/rules: adapt svscanboot: default directory for services is
+    /var/service/; find svc through PATH.
+  * upload to Debian/main (closes: #453684).
+  * debian/control, debian/daemontools-run.README.Debian,
+    debian/daemontools-run.postrm, debian/daemontools.README.Debian,
+    debian/rules: change default directory for services from /var/service/
+    to /etc/service/ (see also #461478).
+  * debian/diff/0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.diff:
+    new; supervise.c: ./supervise may be a symlink, if it's dangling, create
+    link target.
+  * debian/update-service, debian/update-service.8: new; a variant of
+    runit's update-service(8) program.
+  * debian/rules: packages daemontools-run: install update-service program
+    plus manpage, provide /var/lib/supervise/.
+  * debian/daemontools-run.README.Debian: talk about the update-service(8)
+    program.
+  * debian/daemontools-run.postinst: on fresh install, or update from
+    unofficial package, look for /var/service, then /service, and copy
+    content to /etc/service/ if its a non-emtpy directory, and provide
+    compatibility symlink.
+  * debian/daemontools-run.postinst: on fresh install, or update from
+    unofficial package, remove inittab entry if present, to have new entry
+    added afterwards.
+  * debian/daemontools.NEWS.Debian: new; package introduced to Debian/main,
+    mention how to put on hold if upgrade from non-free is not desired.
+  * debian/daemontools-run.postinst: really remove inittab entry on upgrade
+    from daemontools-installer.
+
+ -- Gerrit Pape <pape@smarden.org>  Tue, 26 Feb 2008 20:01:21 +0000
+
+daemontools (0.76-zarge2) sarge; urgency=low
+
+  * build against sarge's dietlibc-dev (0.28-3).
+
+ -- Gerrit Pape <pape@smarden.org>  Thu, 26 May 2005 18:59:14 +0000
+
+daemontools (0.76-zarge1) sarge; urgency=low
+
+  * debian/copyright: typo.
+  * debian/daemontools.postinst, debian/daemontools.postrm: minor cleanup.
+  * debian/implicit: update to revision 1.10.
+  * debian/rules: minor cleanup.
+
+ -- Gerrit Pape <pape@smarden.org>  Sun, 15 Aug 2004 16:13:06 +0000
+
+daemontools (0.76-zarge0.3) sarge; urgency=low
+
+  * debian/rules: stop using debhelper, use implicit rules.
+  * debian/implicit: new; implicit Makefile rules.
+  * debian/postinst, debian/postrm: simplify; rename to debian/daemontools.*.
+  * debian/docs, debian/dirs: remove; obsolete.
+  * debian/README.Debian: rename to debian/daemontools.README.Debian.
+  * debian/control: no longer Build-Depends: dephelper; remove
+    Standards-Version.
+
+ -- Gerrit Pape <pape@smarden.org>  Mon, 22 Mar 2004 14:29:10 +0000
+
+daemontools (0.76-zarge0.2) sarge; urgency=low
+
+  * use diet libc.
+  * debian/rules: set up diet program as c compiler wrapper; conditionally
+    overwrite PATH to have diet program used as c compiler wrapper; minor
+    cleanup.
+  * debian/gcc/gcc*: new; diet program as c compiler wrapper.
+  * debian/control: Build-Depends: dietlibc-dev; no longer Depends:
+    ${shlibs:Depends}.
+
+ -- Gerrit Pape <pape@smarden.org>  Wed, 12 Nov 2003 14:39:11 +0000
+
+daemontools (0.76-woody1) woody; urgency=low
+
+  * bump version for release.
+
+ -- Gerrit Pape <pape@smarden.org>  Tue,  9 Jul 2002 11:05:14 +0200
+
+daemontools (0.76-woody0.1) woody; urgency=low
+
+  * send init a HUP signal in postinst if /command/svscanboot did not
+    exist before; daemontools-run no more does this in that case.
+    This fixes a rarely seen problem when installing a bunch of packages
+    at once and daemontools-run is configured before daemontools is fully
+    installed: init reports SV respawning to fast and disables it for five
+    minutes.
+
+ -- Gerrit Pape <pape@smarden.org>  Sat, 16 Feb 2002 13:58:57 +0100
+
+daemontools (0.76-1) woody; urgency=low
+
+  * new upstream version 0.76.
+  * depends on daemontools-run, just recommends daemontools-doc.
+
+ -- Gerrit Pape <pape@innominate.com>  Wed, 18 Jul 2001 12:02:57 +0200
+
+daemontools (0.70-1) stable; urgency=low
+
+  * 1st debian version, no other changes.
+
+ -- Gerrit Pape <pape@innominate.com>  Thu,  1 Feb 2001 09:46:39 +0100
+
+daemontools (0.70-0.8) unstable; urgency=low
+
+  * binaries are now installed in /usr/local/bin .
+
+ -- Gerrit Pape <pape@innominate.com>  Mon, 18 Dec 2000 10:42:31 +0100
+
+daemontools (0.70-0.7) unstable; urgency=low
+
+  * removed all documentation -> will be in daemontools-doc.
+  * removed init-script, /var/service and /var/log/service -> will be
+    in daemontools-run.
+
+ -- Gerrit Pape <pape@innominate.de>  Mon, 14 Aug 2000 12:05:44 +0200
+
+daemontools (0.70-0.6) unstable; urgency=low
+
+  * lintian fixes.
+
+ -- Gerrit Pape <pape@innominate.de>  Mon, 19 Jun 2000 12:30:19 +0200
+
+daemontools (0.70-0.5) unstable; urgency=low
+
+  * providing /var/log/service/ for multilog directories.
+
+ -- Gerrit Pape <pape@innominate.de>  Tue, 13 Jun 2000 17:14:59 +0200
+
+daemontools (0.70-0.4) unstable; urgency=low
+
+  * init-script added, svscan will be started at boottime, monitoring
+    /var/service.
+
+ -- Gerrit Pape <pape@innominate.de>  Mon, 15 May 2000 11:05:58 +0200
+
+daemontools (0.70-0.3) unstable; urgency=low
+
+  * man-pages added.
+
+ -- Gerrit Pape <pape@innominate.de>  Tue, 25 Apr 2000 09:21:24 +0200
+
+daemontools (0.70-0.1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Gerrit Pape <pape@innominate.de>  Tue, 18 Apr 2000 11:38:23 +0200
+
--- daemontools-0.76.orig/debian/control
+++ daemontools-0.76/debian/control
@@ -0,0 +1,29 @@
+Source: daemontools
+Section: admin
+Priority: optional
+Maintainer: Gerrit Pape <pape@smarden.org>
+Standards-Version: 3.7.3.0
+
+Package: daemontools
+Architecture: any
+Suggests: daemontools-run | runit
+Depends: ${shlibs:Depends}
+Replaces: daemontools-doc
+Description: a collection of tools for managing UNIX services
+ supervise monitors a service. It starts the service and restarts the
+ service if it dies. Setting up a new service is easy: all supervise
+ needs is a directory with a run script that runs the service. 
+ .
+ multilog saves error messages to one or more logs. It optionally timestamps
+ each line and, for each log, includes or excludes lines matching specified
+ patterns. It automatically rotates logs to limit the amount of disk space
+ used. If the disk fills up, it pauses and tries again, without losing any
+ data.
+
+Package: daemontools-run
+Architecture: all
+Depends: daemontools (>> 1:0.76)
+Conflicts: runit
+Description: daemontools service supervision
+ Starts svscanboot from inittab, and provides the directory /etc/service/
+ for services to be supervised by daemontools.
--- daemontools-0.76.orig/debian/copyright
+++ daemontools-0.76/debian/copyright
@@ -0,0 +1,21 @@
+This package was debianized by Gerrit Pape <pape@smarden.org> on
+Wed, 18 Jul 2001 12:02:57 +0200.
+
+It was downloaded from
+ http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
+
+Upstream Author: D. J. Bernstein <djb@cr.yp.to>
+
+The man-pages in debian/daemontools-man/ were downloaded from
+ http://smarden.org/pape/djb/manpages/daemontools-0.76-man-20020131.tar.gz
+
+Copyright:
+
+D. J. Bernstein placed the daemontools package into the public domain.
+From http://cr.yp.to/distributors.html
+ What are the distribution terms for daemontools?
+ 2007.12.28: I hereby place the daemontools package (in particular,
+ daemontools-0.76.tar.gz, with MD5 checksum 1871af2453d6e464034968a0fbcb2bfc)
+ into the public domain. The package is no longer copyrighted.
+
+The Debian diff is in the public domain.
--- daemontools-0.76.orig/debian/daemontools-run.README.Debian
+++ daemontools-0.76/debian/daemontools-run.README.Debian
@@ -0,0 +1,13 @@
+daemontools-run for Debian
+--------------------------
+
+This package provides the service directory /etc/service/, adds an
+entry with the name SV to /etc/inittab in order to provide service
+supervision on systems running sysvinit as init scheme, and includes
+the update-service(8) program.
+
+When adding or removing services to or from daemontools' system-wide
+service supervision, update-service(8) should be used, instead of
+manipulating symbolic links in /etc/service/ directly.
+
+ -- Gerrit Pape <pape@smarden.org>, Mon, 07 Jan 2008 18:26:56 +0000
--- daemontools-0.76.orig/debian/daemontools-run.postinst
+++ daemontools-0.76/debian/daemontools-run.postinst
@@ -0,0 +1,76 @@
+#!/bin/sh
+set -e
+
+test "$1" = 'configure' || exit 0
+
+if test -z "$2" || dpkg --compare-versions "$2" lt '1:0.76'; then
+  test -n "$(ls -1 /etc/service/)" ||
+    for i in /var/service /service /var/lib/svscan; do
+      test -d $i || continue
+      test -n "$(ls -1 $i)" || continue
+      echo "Found directory $i, copying content to /etc/service/..."
+      cp -a $i/* /etc/service/
+      echo "Moving $i to $i{old} and creating compatibility symlink..."
+      rm -rf $i'{old}'
+      mv $i $i'{old}'
+      ln -s /etc/service $i
+      break
+    done
+  # upgrade from unofficial daemontools-run
+  if grep -q '#-- daemontools-run begin' /etc/inittab; then
+    echo 'Removing SV inittab entry...'
+    rm -f /etc/inittab'{new}'
+    sed -e '/#-- daemontools-run begin/,/#-- daemontools-run end/d' \
+      /etc/inittab > /etc/inittab'{new}'
+    mv -f /etc/inittab'{new}' /etc/inittab
+    kill -s HUP 1
+    sleep 1
+  fi
+  # update from daemontools-installer
+  if grep -q 'SV:123456:respawn:/command/svscanboot' /etc/inittab; then
+    echo 'Removing SV inittab entry...'
+    rm -f /etc/inittab'{new}'
+    sed -e '/SV:123456:respawn:\/command\/svscanboot/d' \
+      /etc/inittab > /etc/inittab'{new}'
+    mv -f /etc/inittab'{new}' /etc/inittab
+    kill -s HUP 1
+    sleep 1
+  fi
+  # update from daemontools-installer (fhs version)
+  if grep -q 'SV:123456:respawn:/usr/bin/svscanboot' /etc/inittab; then
+    echo 'Removing SV inittab entry...'
+    rm -f /etc/inittab'{new}'
+    sed -e '/SV:123456:respawn:\/usr\/bin\/svscanboot/d' \
+      /etc/inittab > /etc/inittab'{new}'
+    mv -f /etc/inittab'{new}' /etc/inittab
+    kill -s HUP 1
+    sleep 1
+  fi
+fi
+if test -z "$2"; then
+  # not upgrading
+  if grep '^SV:' /etc/inittab >/dev/null; then
+    cat <<-\EOT >&2
+	
+	There already is an SV entry in /etc/inittab.  In order to have this
+	package add an entry with the name SV to have daemontools' service
+	supervision started through sysvinit, you need to remove or rename
+	the current SV entry first.
+	
+	Installation failed.
+	
+	EOT
+    exit 1
+  fi
+fi
+if ! grep '^SV:' /etc/inittab >/dev/null; then
+  echo 'Adding SV inittab entry...'
+  cp /etc/inittab /etc/inittab'{new}'
+  cat >>/etc/inittab'{new}' <<-\EOT
+	#-- daemontools-run begin
+	SV:123456:respawn:/usr/bin/svscanboot
+	#-- daemontools-run end
+	EOT
+  mv -f /etc/inittab'{new}' /etc/inittab
+  kill -s HUP 1
+fi
--- daemontools-0.76.orig/debian/daemontools-run.postrm
+++ daemontools-0.76/debian/daemontools-run.postrm
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -e
+
+test "$1" = 'remove' || exit 0
+
+if grep -q "#-- daemontools-run begin" /etc/inittab; then
+  echo 'Removing SV inittab entry...'
+  rm -f /etc/inittab'{new}'
+  sed -e '/#-- daemontools-run begin/,/#-- daemontools-run end/d' \
+    /etc/inittab > /etc/inittab'{new}'
+  mv -f /etc/inittab'{new}' /etc/inittab
+  kill -s HUP 1 || :
+  echo 'Sending services the TERM and CONT signals...'
+  svc -dx /etc/service/* || :
+  sleep 5
+  echo 'Sending log services the TERM and CONT signals...'
+  svc -dx /etc/service/*/log || :
+fi
--- daemontools-0.76.orig/debian/daemontools.README.Debian
+++ daemontools-0.76/debian/daemontools.README.Debian
@@ -0,0 +1,12 @@
+daemontools for Debian
+----------------------
+
+This package provides the daemontools programs, installed into /usr/bin/,
+and man pages; it does not set up svscanboot to run on system boot,
+respawned by init.  To do so, install the daemontools-run package, which
+adds an entry with the name SV to /etc/inittab in order to provide service
+supervision on systems running sysvinit as init scheme.
+
+daemontools' default directory for services on Debian is /etc/service/.
+
+ -- Gerrit Pape <pape@smarden.org>, Mon, 07 Jan 2008 18:26:56 +0000
--- daemontools-0.76.orig/debian/implicit
+++ daemontools-0.76/debian/implicit
@@ -0,0 +1,93 @@
+# $Id: 60d9070435b8d5608f20f60bc44e081960b6e39d $
+
+.PHONY: deb-checkdir deb-checkuid
+
+deb-checkdir:
+	@test -e debian/control || sh -cx '! : wrong directory'
+deb-checkuid:
+	@test "`id -u`" -eq 0 || sh -cx '! : need root privileges'
+
+%.deb: %.deb-docs %.deb-DEBIAN
+	@rm -f $*.deb $*.deb-checkdir $*.deb-docs $*.deb-docs-base \
+	  $*.deb-docs-docs $*.deb-docs-examples $*.deb-DEBIAN \
+	  $*.deb-DEBIAN-dir $*.deb-DEBIAN-scripts $*.deb-DEBIAN-md5sums
+
+%.udeb: %.deb-DEBIAN
+	@rm -f $*.deb $*.deb-checkdir $*.deb-DEBIAN $*.deb-DEBIAN-dir \
+	  $*.deb-DEBIAN-scripts $*.deb-DEBIAN-md5sums
+
+%.deb-checkdir: install
+	@test -d debian/$* || sh -cx '! : directory debian/$* missing'
+	@test "`id -u`" -eq 0 || sh -cx '! : need root privileges'
+
+%.deb-docs-base: install
+	: implicit
+	@rm -f debian/$*/usr/share/doc/$*/* || :
+	@install -d -m0755 debian/$*/usr/share/doc/$*
+	: debian/$*/usr/share/doc/$*/
+	@sh -cx 'install -m0644 debian/copyright debian/$*/usr/share/doc/$*/'
+	@sh -cx 'install -m0644 debian/changelog \
+	  debian/$*/usr/share/doc/$*/changelog.Debian'
+	@test ! -r changelog || \
+	  sh -cx 'install -m0644 changelog debian/$*/usr/share/doc/$*/'
+	@test -r debian/$*/usr/share/doc/$*/changelog || \
+	  sh -cx 'mv debian/$*/usr/share/doc/$*/changelog.Debian \
+	    debian/$*/usr/share/doc/$*/changelog'
+	@test -s debian/$*/usr/share/doc/$*/changelog || \
+	  sh -cx 'rm -f debian/$*/usr/share/doc/$*/changelog'
+	@gzip -9 debian/$*/usr/share/doc/$*/changelog*
+%.deb-docs-docs: %.deb-docs-base
+	@for i in `cat debian/$*.docs 2>/dev/null || :`; do \
+	  if test -d $$i; then \
+	    sh -cx "install -d -m0755 debian/$*/usr/share/doc/$*/$${i##*/}" && \
+	    for j in $$i/*; do \
+	      sh -cx "install -m0644 $$j \
+	        debian/$*/usr/share/doc/$*/$${i##*/}/" || exit 1; \
+	    done || exit 1; \
+	    continue; \
+	  fi; \
+	  sh -cx "install -m0644 $$i debian/$*/usr/share/doc/$*/" || exit 1; \
+	done
+	@test ! -r debian/$*.README.Debian || \
+	  sh -cx 'install -m0644 debian/$*.README.Debian \
+	    debian/$*/usr/share/doc/$*/README.Debian'
+	@if test -r debian/$*.NEWS.Debian; then \
+	  sh -cx 'install -m0644 debian/$*.NEWS.Debian \
+	    debian/$*/usr/share/doc/$*/NEWS.Debian && \
+	      gzip -9 debian/$*/usr/share/doc/$*/NEWS.Debian'; \
+	fi
+%.deb-docs-examples: %.deb-docs-docs
+	@rm -rf debian/$*/usr/share/doc/$*/examples
+	: debian/$*/usr/share/doc/$*/examples/
+	@test ! -r debian/$*.examples || \
+	  install -d -m0755 debian/$*/usr/share/doc/$*/examples
+	@for i in `cat debian/$*.examples 2>/dev/null || :`; do \
+	  sh -cx "install -m0644 $$i debian/$*/usr/share/doc/$*/examples/" \
+	    || exit 1; \
+	done
+%.deb-docs: %.deb-checkdir %.deb-docs-base %.deb-docs-docs %.deb-docs-examples
+	: debian/$*/usr/share/doc/$*/ ok
+
+%.deb-DEBIAN-base: install
+	@rm -rf debian/$*/DEBIAN
+	: debian/$*/DEBIAN/
+	@install -d -m0755 debian/$*/DEBIAN
+	@for i in conffiles shlibs templates; do \
+	  test ! -r debian/$*.$$i || \
+	    sh -cx "install -m0644 debian/$*.$$i debian/$*/DEBIAN/$$i" \
+	      || exit 1; \
+	done
+%.deb-DEBIAN-scripts: %.deb-DEBIAN-base
+	@for i in preinst prerm postinst postrm config; do \
+	  test ! -r debian/$*.$$i || \
+	    sh -cx "install -m0755 debian/$*.$$i debian/$*/DEBIAN/$$i" \
+	      || exit 1; \
+	done
+%.deb-DEBIAN-md5sums: %.deb-DEBIAN-base %.deb-docs
+	: debian/$*/DEBIAN/md5sums
+	@rm -f debian/$*/DEBIAN/md5sums
+	@cd debian/$* && find * -path 'DEBIAN' -prune -o \
+	  -type f -exec md5sum {} >>DEBIAN/md5sums \;
+%.deb-DEBIAN: %.deb-checkdir %.deb-DEBIAN-base %.deb-DEBIAN-scripts \
+	  %.deb-DEBIAN-md5sums
+	: debian/$*/DEBIAN/ ok
--- daemontools-0.76.orig/debian/rules
+++ daemontools-0.76/debian/rules
@@ -0,0 +1,83 @@
+#!/usr/bin/make -f
+
+STRIP =strip
+ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+  STRIP =: nostrip
+endif
+
+DIR =$(shell pwd)/debian/daemontools
+
+patch: deb-checkdir patch-stamp
+patch-stamp:
+	for i in `ls -1 debian/diff/*.diff || :`; do \
+	  patch -p1 <$$i || exit 1; \
+	done
+	touch patch-stamp
+
+build: deb-checkdir build-stamp
+build-stamp: patch-stamp
+	cd daemontools-0.76 && package/compile
+	touch build-stamp
+
+clean: deb-checkdir deb-checkuid
+	rm -rf daemontools-0.76/compile daemontools-0.76/command
+	test ! -e patch-stamp || \
+	  for i in `ls -1r debian/diff/*.diff || :`; do patch -p1 -R <$$i; done
+	rm -f patch-stamp build-stamp
+	rm -rf '$(DIR)' '$(DIR)'-run
+	rm -f debian/files debian/substvars changelog
+
+install: install-arch install-indep
+install-arch: deb-checkdir deb-checkuid build-stamp
+	# daemontools
+	rm -rf '$(DIR)'
+	#  programs
+	install -d -m0755 '$(DIR)'/usr/bin
+	install -m0755 daemontools-0.76/command/* '$(DIR)'/usr/bin/
+	for i in envdir envuidgid fghack multilog pgrphack readproctitle \
+	 setlock setuidgid softlimit supervise svc svok svscan svstat tai64n \
+	 tai64nlocal; do \
+	  $(STRIP) -R .comment -R .note '$(DIR)'/usr/bin/$$i || exit 1; \
+	done
+	sed -e 's}/command/svc}svc};s}/service}/etc/service}g' \
+	  <'$(DIR)'/usr/bin/svscanboot >'$(DIR)'/usr/bin/svscanboot'{new}'
+	cat '$(DIR)'/usr/bin/svscanboot'{new}' >'$(DIR)'/usr/bin/svscanboot
+	rm -f '$(DIR)'/usr/bin/svscanboot'{new}'
+	#  manpages
+	install -d -m0755 '$(DIR)'/usr/share/man/man8
+	for i in debian/daemontools-man/*.8; do \
+	  install -m0644 $$i '$(DIR)'/usr/share/man/man8/ && \
+	  gzip -9 '$(DIR)'/usr/share/man/man8/$${i##*/} || exit 1; \
+	done
+	#  changelog
+	test -r changelog || ln -s daemontools-0.76/src/CHANGES changelog
+install-indep: deb-checkdir deb-checkuid
+	# daemontools-run
+	rm -rf '$(DIR)'-run
+	install -d -m0755 '$(DIR)'-run/etc/service
+	install -d -m0755 '$(DIR)'-run/var/lib/supervise
+	#  update-service
+	install -d -m0755 '$(DIR)'-run/usr/sbin
+	install -m0755 debian/update-service \
+	  '$(DIR)'-run/usr/sbin/update-service
+	install -d -m0755 '$(DIR)'-run/usr/share/man/man8
+	install -m0644 debian/update-service.8 '$(DIR)'-run/usr/share/man/man8/
+	gzip -9 '$(DIR)'-run/usr/share/man/man8/update-service.8
+	#  changelog
+	test -r changelog || ln -s daemontools-0.76/src/CHANGES changelog
+
+binary: binary-arch binary-indep
+binary-arch: install-arch daemontools.deb
+	dpkg-shlibdeps '$(DIR)'/usr/bin/*
+	dpkg-gencontrol -isp -pdaemontools -P'$(DIR)'
+	dpkg -b '$(DIR)' ..
+binary-indep: install-indep daemontools-run.deb
+	dpkg-gencontrol -isp -pdaemontools-run -P'$(DIR)'-run
+	dpkg -b '$(DIR)'-run ..
+
+binary: binary-indep binary-arch
+
+.PHONY: patch build clean install install-arch install-indep binary \
+	  binary-arch binary-indep
+
+include debian/implicit
--- daemontools-0.76.orig/debian/daemontools.NEWS.Debian
+++ daemontools-0.76/debian/daemontools.NEWS.Debian
@@ -0,0 +1,30 @@
+daemontools (1:0.76-1) unstable; urgency=low
+
+  With the daemontools package being put into the public domain by the
+  upstream author, daemontools is now available as binary package in
+  Debian/main.
+
+  Please note that this new binary package differs from the package created
+  through the daemontools-installer package available in Debian/non-free;
+  most notably this package doesn't set up svscanboot to run and provide
+  system-wide service supervision.  To do so, additionally install the
+  daemontools-run package.
+
+  daemontools' default directory for services on Debian is /etc/service/,
+  not the top-level directory /service/ as provided by the upstream package;
+  to be consistent with existing documentation, it is recommended to create
+  a compatibility symlink through
+
+    ln -s /etc/service /service
+
+  after installing the daemontools-run package.
+  
+  daemontools-installer is still available, if you don't want to upgrade to
+  these new binary packages, you should stop the installation, make sure the
+  daemontools-installer package is installed, and put daemontools on hold,
+  as described in
+
+   http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html#s-puttingonhold
+  
+ -- Gerrit Pape <pape@smarden.org>  Mon, 25 Feb 2008 20:24:49 +0000
+
--- daemontools-0.76.orig/debian/update-service
+++ daemontools-0.76/debian/update-service
@@ -0,0 +1,88 @@
+#!/bin/sh
+set -e
+
+servicedir=$SVDIR
+test -n "$servicedir" || servicedir=/etc/service
+
+err() { >&2 printf '%s\n\n' "$*"; exit 1; }
+fatal() { err "${0##*/}: fatal: $*"; }
+warn() { err "${0##*/}: warning: $*"; }
+usage() {
+  err "Usage: ${0##*/} --add|--remove <service-directory> [<service-name>]
+       ${0##*/} --list|--check [<service-name>]"
+}
+
+opt=$1
+svdir=${2%/}
+sv=$3
+test -z "${opt##-*}" || usage
+
+case "$opt" in
+  -c|--check) exec >/dev/null; exec 2>/dev/null; opt=-l;;
+esac
+case "$opt" in
+  -l|--list)
+    test -n "$svdir" || exec ls -1 "$servicedir"
+    test -h "$servicedir"/"$svdir" || err "Service $svdir not registered."
+    printf '%s -> %s\n' "$svdir" "$(readlink "$servicedir"/"$svdir")"
+    exit 0
+  ;;
+esac
+
+test -n "$svdir" || usage
+test -d "$svdir" ||
+  fatal "$svdir does not exist, or is not a directory."
+test -z "${svdir%%/*}" ||
+  fatal "The <service-directory> must start with a slash."
+test -n "$sv" || sv=${svdir##*/}
+test -n "${sv##.*}" ||
+  fatal "The <service-name> must not start with a dot."
+test "$sv" = "${sv#*/}" ||
+  fatal "The <service-name> must not contain a slash."
+
+case "$opt" in
+  -a|--add)
+    test "$(id -u)" = 0 || fatal "${0##*/} -a must be run by root."
+    if test -e "$servicedir"/"$sv"; then
+      test -h "$servicedir"/"$sv" ||
+        fatal "$servicedir/$sv exists, but is not a symbolic link."
+      test "$(readlink "$servicedir"/"$sv")" = "$svdir" ||
+        fatal "$servicedir/$sv exists, but doesn't point to $svdir."
+      printf '%s\n' "Service $sv already added."
+      exit 0
+    fi
+    ! sv stat "$svdir" >/dev/null 2>&1 ||
+      fatal "$svdir is currently controlled by a supervise(8) process."
+    if test "${svdir#/etc/}" != "$svdir"; then
+      if test ! -h "$svdir"/supervise; then
+        rm -rf "$svdir"/supervise
+        ln -s /var/lib/supervise/"$sv" "$svdir"/supervise
+      fi
+      if test -d "$svdir"/log && test ! -h "$svdir"/log/supervise; then
+        rm -rf "$svdir"/log/supervise
+        ln -s /var/lib/supervise/"$sv".log "$svdir"/log/supervise
+      fi
+    fi
+    ln -s "$svdir" "$servicedir"/"$sv"
+    printf '%s\n' "Service $sv added."
+    exit 0
+  ;;
+  -r|--remove)
+    test "$(id -u)" = 0 || fatal "${0##*/} -r must be run by root."
+    test -e "$servicedir"/"$sv" ||
+      warn "$servicedir/$sv does not exist."
+    test -h "$servicedir"/"$sv" ||
+      fatal "$servicedir/$sv is not a symbolic link."
+    test "$svdir" = "$(readlink "$servicedir"/"$sv")" ||
+      fatal "$servicedir/$sv does not point to $svdir."
+    rm -f "$servicedir"/"$sv"
+    svc -dx "$svdir" ||
+      fatal "Unable to send the service $sv the down and exit commands."
+    printf '%s %s\n' \
+      "Service $sv removed," \
+      "the service daemon received the TERM and CONT signals."
+    exit 0
+  ;;
+  *) usage
+  ;;
+esac
--- daemontools-0.76.orig/debian/update-service.8
+++ daemontools-0.76/debian/update-service.8
@@ -0,0 +1,122 @@
+.TH update-service 8
+.SH NAME
+update-service \- add/remove a service to/from system-wide service supervision
+.SH SYNOPSIS
+.B update-service
+\--add|--remove
+.I service-directory
+[\fIservice-name\fB]
+.P
+.B update-service
+\--list|--check
+[\fIservice-name\fB]
+.SH DESCRIPTION
+.I service-directory
+must be a directory to be used by
+.BR supervise (8),
+.I service-name
+must not start with a dot, and must not contain a slash.
+.P
+.B update-service
+adds or removes the
+.I service-directory
+to the system-wide service supervision provided through daemontools'
+.BR svscan (8),
+lists all registered system-wide services, or checks for a specific
+.I service-name
+whether it is registered.
+.P
+When adding a service,
+and the
+.I service-directory
+resides in /etc/,
+.B update-service
+makes sure that the ./supervise/ subdirectories in the
+.IR service-directory ,
+and the optional
+.IR service-directory /log/,
+are symbolic links pointing into /var/lib/supervise/, unless they
+already are symbolic links.
+.SH OPTIONS
+.TP
+.B \--add | \-a
+Add the service directory
+.I service-directory
+to the system-wide service supervision,
+under the name
+.IR service-name .
+If
+.I service-name
+is not specified,
+.B update-service
+will use the basename of
+.IR service-directory .
+You can use the
+.BR svc (8)
+program to control the newly added service, and the
+.BR svstat (8)
+program to query its status, e.g.:
+
+# svstat /etc/service/\fIservice-name\fR
+
+.TP
+.B \--remove | \-r
+Remove the service directory
+.IR service-directory ,
+which has been added under the name
+.IR service-name ,
+from the system-wide service supervision.
+If
+.I service-name
+is not specified,
+.B update-service
+will use the basename of
+.IR service-directory .
+When removing the
+.IR service-directory ,
+the
+.I exit
+command is sent to the corresponding
+.BR supervise (8)
+process, telling it to take the service down and exit afterwards.
+You can use the
+.BR svc (8)
+and
+.BR svstat (8)
+programs to control the removed service, or query its status, e.g.:
+
+# svstat
+.I service-directory
+
+.TP
+.B \--list | \-l
+If
+.I service-name
+is specified,
+.B update-service
+checks whether
+.I service-name
+is registered as system-wide service, prints a message and exits non-zero
+if not, or prints the
+.I service-name
+and the directory it points to and exits zero if yes.
+If
+.I service-name
+is not specified, it prints the names of all system-widely registered
+services, one per line.
+.TP
+.B \--check | \-c
+The same as --list, but
+.B update-service
+doesn't print anything to standard out or standard error.
+.SH ENVIRONMENT
+.TP
+.B SVDIR
+The environment variable $SVDIR overrides the default services directory
+.IR /etc/service/ .
+.SH FILES
+/etc/service/
+.SH SEE ALSO
+svc(8), svstat(8), svscan(8), svscanboot(8)
+.SH AUTHOR
+Gerrit Pape <pape@smarden.org>
--- daemontools-0.76.orig/debian/daemontools-man/README
+++ daemontools-0.76/debian/daemontools-man/README
@@ -0,0 +1,24 @@
+Mon, 24 Apr 2000 18:47:32 +0200
+
+These man-pages were created from djb's documentation found at
+http://cr.yp.to/daemontools.html .
+
+Gzip the man-pages and copy them to a subdirectory man8/ of any directory
+found in Your $MANPATH:
+
+  # gzip *.8 ; cp *.8.gz /usr/share/man/man8/
+
+See http://smarden.org/pape/djb/ for recent informations.
+
+G. Pape <pape@smarden.org>
+
+Thu, 16 Nov 2000 12:16:46 +0100
+  * added missing .TP in softlimit.8, option -o is now shown.
+
+Sat, 14 Jul 2001 18:41:17 +0200
+  * man-pages adapted to version 0.76: http://cr.yp.to/daemontools.html
+
+Thu, 31 Jan 2002 10:54:46 +0100
+  * updated readproctitle.8 according to readproctitle.html.
+  * updated multilog.8 according to mutlilog.html.
+  * minor cosmetics.
--- daemontools-0.76.orig/debian/daemontools-man/envdir.8
+++ daemontools-0.76/debian/daemontools-man/envdir.8
@@ -0,0 +1,76 @@
+.TH envdir 8
+.SH NAME
+envdir \- runs another program with environment modified according to files
+in a specified directory.
+.SH SYNOPSIS
+.B envdir
+.I d
+.I child
+.SH DESCRIPTION
+.I d
+is a single argument.
+.I child
+consists of one or more arguments. 
+
+.B envdir
+sets various environment variables as specified by files in the directory
+named
+.IR d .
+It then runs
+.IR child .
+
+If
+.I d
+contains a file named
+.I s
+whose first line is
+.IR t ,
+.B envdir
+removes an environment variable named
+.I s
+if one exists, and then adds an environment variable named
+.I s
+with value
+.IR t .
+The name
+.I s
+must not contain =. Spaces and tabs at the end of
+.I t
+are removed. Nulls in
+.I t
+are changed to newlines in the environment variable. 
+
+If the file
+.I s
+is completely empty (0 bytes long),
+.B envdir
+removes an environment variable named
+.I s
+if one exists, without adding a new variable.
+.SH EXIT CODES
+.B envdir
+exits 111 if it has trouble reading
+.IR d ,
+if it runs out of memory for environment variables, or if it cannot run
+.IR child .
+Otherwise its exit code is the same as that of
+.IR child .
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/envuidgid.8
+++ daemontools-0.76/debian/daemontools-man/envuidgid.8
@@ -0,0 +1,48 @@
+.TH envuidgid 8
+.SH NAME
+envuidgid \- runs another program with environment variables indicating a
+specified account's uid and gid.
+.SH SYNOPSIS
+.B envuidgid
+.I account
+.I child
+.SH DESCRIPTION
+.I account
+is a single argument.
+.I child
+consists of one or more arguments. 
+
+.B envuidgid
+sets $UID to
+.IR account 's
+uid and $GID to
+.IR account 's
+gid. It then runs
+.IR child .
+.SH EXIT CODES
+.B envuidgid
+exits 111 if it cannot find a UNIX account named
+.IR account ,
+if it runs out of memory for environment variables, or if it cannot run
+.IR child .
+Otherwise its exit code is the same as that of
+.IR child .
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/fghack.8
+++ daemontools-0.76/debian/daemontools-man/fghack.8
@@ -0,0 +1,36 @@
+.TH fghack 8
+.SH NAME
+fghack \- is an anti-backgrounding tool.
+.SH SYNOPSIS
+.B fghack
+.I child
+.SH DESCRIPTION
+.B fghack
+runs
+.I child
+with many extra descriptors writing to a pipe.
+.B fghack
+reads and discards any data written to the pipe. After
+.I child
+has exited and the pipe has been closed,
+.B fghack
+exits. 
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/multilog.8
+++ daemontools-0.76/debian/daemontools-man/multilog.8
@@ -0,0 +1,285 @@
+.TH multilog 8
+.SH NAME
+multilog \- reads a sequence of lines from stdin and appends selected lines to
+any number of logs.
+.SH SYNOPSIS
+.B multilog
+.I script
+.SH DESCRIPTION
+.I script
+consists of any number of arguments. Each argument specifies one action. The
+actions are carried out in order for each line of input. Note that actions may
+contain shell metacharacters that need to be quoted when
+.B multilog
+is run from a shell. 
+
+.B multilog
+exits 0 when it sees the end of stdin. If stdin has a partial final line then
+.B multilog
+inserts a final newline. 
+
+.B multilog
+writes a message to stderr and exits 111, without reading any input, if it
+runs out of memory or if another
+.B multilog
+process is writing to one of the same automatically rotated logs.
+
+If
+.B multilog
+has trouble writing to disk after it starts reading input, it writes a message
+to stderr, pauses, and tries again, without losing any data. Note that this
+may block any program feeding input to
+.BR multilog .
+
+If
+.B multilog
+receives a TERM signal, it will read and process data until the next newline,
+and then exit, leaving stdin at the first byte of data it has not processed.
+.SH SELECTING LINES
+Each line is initially selected. The action 
+.TP
+.B -\fIpattern
+deselects the line if
+.I pattern
+matches the line. The action 
+.TP
+.B +\fIpattern
+selects the line if
+.I pattern
+matches the line. 
+.PP
+.I pattern
+is a string of stars and non-stars. It matches any concatenation of strings
+matched by all the stars and non-stars in the same order. A non-star matches
+itself. A star before the end of
+.I pattern
+matches any string that does not include the next character in
+.IR pattern .
+A star at the end of
+.I pattern
+matches any string. 
+
+For example, the action 
+
+  +hello
+
+selects hello. It does not select hello world. 
+
+The action 
+
+  -named[*]: Cleaned cache *
+
+deselects named[135]: Cleaned cache of 3121 RRs. The first star matches any
+string that does not include a right bracket. 
+
+The action 
+
+  -*
+
+deselects every line. 
+
+To save memory,
+.B multilog
+actually checks pattern against only the first 1000 characters of each line.
+.SH ALERTS
+The action 
+.TP
+.B e
+prints (the first 200 bytes of) each selected line to stderr.
+.SH STATUS FILES
+The action 
+.TP
+.B =\fIfile
+replaces the contents of
+.I file
+with (the first 1000 bytes of) each selected line, padded with newlines to
+1001 bytes. There is no protection of
+.I file
+against power outages. 
+
+For example, the sequence of actions 
+
+     -*
+     +STAT*
+     =log/status
+
+maintains log/status as a copy of the most recent line starting with STAT. 
+.SH TIMESTAMPING
+The action 
+.TP
+.B t
+inserts an @, a precise timestamp, and a space in front of each line, using
+the same format as
+.BR tai64n (8).
+This is required to be the first action.
+.PP
+Patterns apply to the line after the timestamp is inserted. For example, if
+
+  multilog t '-*' '+* fatal: *' ./main
+
+reads the line
+
+  fatal: out of memory
+
+then it will log a line such as
+
+  @400000003b4a39c23294b13c fatal: out of memory
+
+with the first * matching the timestamp.
+
+You can use
+.BR tai64nlocal (8)
+to convert these timestamps to human-readable form.
+.SH AUTOMATICALLY ROTATED LOGS
+If
+.I dir
+starts with a dot or slash then the action 
+.TP
+.I dir
+appends each selected line to a log named
+.IR dir .
+If
+.I dir
+does not exist,
+.B multilog
+creates it. 
+
+Do not attempt to write to one log from two simultaneous
+.B multilog
+processes, or two actions in one process.
+
+The log format is as follows.
+.I dir
+is a directory containing some number of old log files, a log file named
+.IR current ,
+and other files for
+.B multilog
+to keep track of its actions. Each old log file has a name beginning with @,
+continuing with a precise timestamp showing when the file was finished, and
+ending with one of the following codes:
+.TP
+.B .s
+This file is completely processed and safely written to disk. 
+.TP
+.B .u
+This file was being created at the moment of an outage. It may have been
+truncated and has not been processed. 
+
+Beware that NFS, async filesystems, and softupdates filesystems may discard
+files that were not safely written to disk before an outage.
+
+While
+.B multilog
+is running,
+.I current
+has mode 644. If
+.B multilog
+sees the end of stdin, it writes
+.I current
+safely to disk, and sets the mode of
+.I current
+to 744. When it restarts, it sets the mode of
+.I current
+back to 644 and continues writing new lines. 
+
+When
+.B multilog
+decides that
+.I current
+is big enough, it writes
+.I current
+safely to disk, sets the mode of
+.I current
+to 744, and renames
+.I current
+as an old log file. The action 
+.TP
+.B s\fIsize
+sets the maximum file size for subsequent
+.I dir
+actions.
+.B multilog
+will decide that
+.I current
+is big enough if
+.I current
+has
+.I size
+bytes.
+.RB ( multilog
+will also decide that
+.I current
+is big enough if it sees a newline within 2000 bytes of the maximum file size;
+it tries to finish log files at line boundaries.)
+.I size
+must be between 4096 and 16777215. The default maximum file size is 99999. 
+
+In versions 0.75 and above: If
+.B multilog
+receives an ALRM signal, it immediately decides that
+.I current
+is big enough, if
+.I current
+is nonempty.
+The action 
+.TP
+.B n\fInum
+sets the number of log files for subsequent
+.I dir
+actions. After renaming
+.IR current ,
+if
+.B multilog
+sees
+.I num
+or more old log files, it removes the old log file with the smallest
+timestamp.
+.I num
+must be at least 2. The default number of log files is 10. The action 
+.TP
+.B !\fIprocessor
+sets a
+.I processor
+for subsequent
+.I dir
+actions.
+.B multilog
+will feed
+.I current
+through
+.I processor
+and save the output as an old log file instead of
+.IR current .
+.B multilog
+will also save any output that
+.I processor
+writes to descriptor 5, and make that output readable on descriptor 4 when it
+runs
+.I processor
+on the next log file. For reliability,
+.I processor
+must exit nonzero if it has any trouble creating its output;
+.B multilog
+will then run it again. Note that running
+.I processor
+may block any program feeding input to
+.BR multilog .
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/pgrphack.8
+++ daemontools-0.76/debian/daemontools-man/pgrphack.8
@@ -0,0 +1,30 @@
+.TH pgrphack 8
+.SH NAME
+pgrphack \- runs a program in a separate process group.
+.SH SYNOPSIS
+.B pgrphack
+.I child
+.SH DESCRIPTION
+.B pgrphack
+runs
+.I child
+in a new process group.
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/readproctitle.8
+++ daemontools-0.76/debian/daemontools-man/readproctitle.8
@@ -0,0 +1,77 @@
+.TH readproctitle 8
+.SH NAME
+readproctitle \- maintains an automatically rotated log in memory for
+inspection by
+.BR ps (1).
+
+readproctitle is available in daemontools 0.75 and above.
+.SH SYNOPSIS
+.B readproctitle
+.I L
+.I D
+.SH DESCRIPTION
+.I L
+consists of any number of arguments.
+.I D
+is one argument consisting of at least five dots.
+
+.B readproctitle
+reads data into the end of
+.IR D ,
+shifting
+.I D
+to the left to make room. This means that the most recent data is visible
+to process-listing tools such as
+.BR ps (1).
+.B readproctitle
+always leaves three dots at the left of
+.IR D .
+
+For example, if
+
+ readproctitle io errors: ....................
+
+reads the data
+
+ fatal error xyz
+ warning abc
+
+then its command-line arguments change to
+
+ readproctitle io errors: ... xyz!warning abc!
+
+with a newline character in place of each !. Process-listing tools typically
+show the newline character as ? or \\n.
+
+.B readproctitle
+exits when it reaches the end of input.
+
+Beware that most implementations of
+.BR ps (1)
+have small argument-length limits. These limits apply to the total length
+of
+.B readproctitle
+.I L
+.IR D .
+I have not seen a system with a limit below 512 bytes.
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8),
+ps(1)
+
+ http://cr.yp.to/daemontools.html
+ http://cr.yp.to/slashcommand.html
--- daemontools-0.76.orig/debian/daemontools-man/setlock.8
+++ daemontools-0.76/debian/daemontools-man/setlock.8
@@ -0,0 +1,84 @@
+.TH setlock 8
+.SH NAME
+setlock \- runs another program with a file locked.
+.SH SYNOPSIS
+.B setlock
+[
+.B \-nNxX
+]
+.I fn
+.I child
+.SH DESCRIPTION
+.I fn
+is a single argument.
+.I child
+consists of one or more arguments. 
+
+.B setlock
+opens
+.I fn
+for writing (creating it if it does not exist), obtains an exclusive lock on
+it, and runs
+.IR child .
+
+Normally the lock disappears when
+.I child
+exits. 
+
+Here's the complete story:
+.I child
+is given a descriptor for a locked ofile pointing to the disk file named
+.IR fn .
+The lock disappears when this ofile is 
+.IP o
+closed by all the processes that have descriptors for it or 
+.IP o
+explicitly unlocked. 
+.SH OPTIONS
+.TP
+.B \-n
+No delay. If
+.I fn
+is locked by another process,
+.B setlock
+gives up. 
+.TP
+.B \-N
+(Default.) Delay. If
+.I fn
+is locked by another process,
+.B setlock
+waits until it can obtain a new lock. 
+.TP
+.B \-x
+If
+.I fn
+cannot be opened (or created) or locked,
+.B setlock
+exits zero. 
+.TP
+.B \-X
+(Default.) If
+.I fn
+cannot be opened (or created) or locked,
+.B setlock
+prints an error message and exits nonzero.
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/setuidgid.8
+++ daemontools-0.76/debian/daemontools-man/setuidgid.8
@@ -0,0 +1,48 @@
+.TH setuidgid 8
+.SH NAME
+setuidgid \- runs another program under a specified account's uid and gid.
+.SH SYNOPSIS
+.B setuidgid
+.I account
+.I child
+.SH DESCRIPTION
+.I account
+is a single argument.
+.I child
+consists of one or more arguments. 
+
+.B setuidgid
+sets its uid and gid to
+.IR account 's
+uid and gid, removing all supplementary groups. It then runs
+.IR child .
+
+.B setuidgid
+cannot be run by anyone other than root.
+.SH EXIT CODES
+.B setuidgid
+exits 111 if it cannot find a UNIX account named
+.IB account ,
+if it cannot setgid, if it cannot setuid, or if it cannot run
+.IR child .
+Otherwise its exit code is the same as that of
+.IR child .
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/softlimit.8
+++ daemontools-0.76/debian/daemontools-man/softlimit.8
@@ -0,0 +1,118 @@
+.TH softlimit 8
+.SH NAME
+softlimit \- runs another program with new resource limits.
+.SH SYNOPSIS
+.B softlimit
+[
+.I opts
+]
+.I child
+.SH DESCRIPTION
+.I opts
+is a series of getopt-style options.
+.I child
+consists of one or more arguments. 
+
+.B softlimit
+sets soft resource limits as specified by
+.IR opts .
+It then runs
+.IR child .
+.SH OPTIONS
+In each of the following
+.IB opts ,
+.I n
+may be =, indicating that the soft limit should be set equal to the hard
+limit. 
+
+.I opts
+.B controlling memory use: 
+
+.TP
+.B \-m \fIn
+Same as
+.B \-d
+.I n
+.B \-s
+.I n
+.B \-l
+.I n
+.B \-a
+.IR n .
+.TP
+.B \-d \fIn
+Limit the data segment per process to
+.I n
+bytes.
+.TP
+.B \-s \fIn
+Limit the stack segment per process to
+.I n
+bytes.
+.TP 
+.B \-l \fIn
+Limit the locked physical pages per process to
+.I n
+bytes. This option has no effect on some operating systems.
+.TP
+.B \-a \fIn
+Limit the total of all segments per process to
+.I n
+bytes. This option has no effect on some operating systems. 
+.TP
+.B \-o \fIn
+Limit the number of open file descriptors per process to
+.IR n .
+This option has no effect on some operating systems. 
+.TP
+.B \-p \fIn
+Limit the number of processes per uid to
+.IR n .
+.P
+.I opts
+.B controlling file sizes: 
+.TP
+.B \-f \fIn
+Limit output file sizes to
+.I n
+bytes.
+.TP
+.B \-c \fIn
+Limit core file sizes to
+.I n
+bytes.
+.P
+.B Efficiency
+.I opts:
+.TP
+.B \-r \fIn
+Limit the resident set size to
+.I n
+bytes. This limit is not enforced unless physical memory is full.
+.TP
+.B \-t \fIn
+Limit the CPU time to
+.I n
+seconds. This limit is not enforced except that the process receives a
+SIGXCPU signal after
+.I n
+seconds. 
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/supervise.8
+++ daemontools-0.76/debian/daemontools-man/supervise.8
@@ -0,0 +1,69 @@
+.TH supervise 8
+.SH NAME
+supervise \- starts and monitors a service.
+.SH SYNOPSIS
+.B supervise
+.I s
+.SH DESCRIPTION
+.B supervise
+switches to the directory named
+.I s
+and starts ./run. It restarts ./run if ./run exits. It pauses for a second
+after starting ./run, so that it does not loop too quickly if ./run exits
+immediately. 
+
+If the file
+.IR s /down
+exists,
+.B supervise
+does not start ./run immediately. You can use
+.BR svc (8)
+to start ./run and to give other commands to
+.BR supervise .
+
+.B supervise
+maintains status information in a binary format inside the directory
+.IR s /supervise,
+which must be writable to
+.BR supervise .
+The status information can be read by
+.BR svstat (8).
+
+.B supervise
+may exit immediately after startup if it cannot find the files it needs in
+.I s
+or if another copy of
+.B supervise
+is already running in
+.IR s .
+Once
+.B supervise
+is successfully running, it will not exit unless it is killed or specifically
+asked to exit. You can use
+.BR svok (8)
+to check whether
+.B supervise
+is successfully running. You can use
+.BR svscan (8)
+to reliably start a collection of
+.B supervise
+processes. 
+.SH SEE ALSO
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/svc.8
+++ daemontools-0.76/debian/daemontools-man/svc.8
@@ -0,0 +1,102 @@
+.TH svc 8
+.SH NAME
+svc \- controls services monitored by
+.BR supervise(8).
+.SH SYNOPSIS
+.B svc
+[
+.B \-udopchaitkx
+]
+.I services
+.SH DESCRIPTION
+.I services
+consists of any number of arguments, each argument naming a directory used by
+.BR supervise (8).
+
+.B svc
+applies all the options to each
+.I service
+in turn.
+.SH OPTIONS
+.TP
+.B \-u
+Up. If the
+.I service
+is not running, start it. If the
+.I service
+stops, restart it. 
+.TP
+.B \-d
+Down. If the
+.I service
+is running, send it a TERM signal and then a CONT signal. After it stops, do
+not restart it. 
+.TP
+.B \-o
+Once. If the
+.I service
+is not running, start it. Do not restart it if it stops. 
+.TP
+.B \-p
+Pause. Send the
+.I service
+a STOP signal. 
+.TP
+.B \-c
+Continue. Send the
+.I service
+a CONT signal. 
+.TP
+.B \-h
+Hangup. Send the
+.I service
+a HUP signal. 
+.TP
+.B \-a
+Alarm. Send the
+.I service
+an ALRM signal. 
+.TP
+.B \-i
+Interrupt. Send the
+.I service
+an INT signal. 
+.TP
+.B \-t
+Terminate. Send the
+.I service
+a TERM signal. 
+.TP
+.B \-k
+Kill. Send the
+.I service
+a KILL signal. 
+.TP
+.B \-x
+Exit.
+.BR supervise (8)
+will exit as soon as the
+.I service
+is down. If you use this option on a stable system, you're doing something
+wrong;
+.BR supervise (8)
+is designed to run forever.
+.SH SEE ALSO
+supervise(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/svok.8
+++ daemontools-0.76/debian/daemontools-man/svok.8
@@ -0,0 +1,39 @@
+.TH svok 8
+.SH NAME
+svok \- checks whether
+.BR supervise(8)
+is running.
+.SH SYNOPSIS
+.B svok
+.I service
+.SH DESCRIPTION
+.B svok
+checks whether
+.BR supervise (8)
+is successfully running in the directory named
+.IR service .
+.SH EXIT CODES
+It silently exits 0 if
+.BR supervise (8)
+is successfully running. It silently exits 100 if
+.BR supervise (8)
+is not successfully running.
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/svscan.8
+++ daemontools-0.76/debian/daemontools-man/svscan.8
@@ -0,0 +1,82 @@
+.TH svscan 8
+.SH NAME
+svscan \- starts and monitors a collection of services
+.SH SYNOPSIS
+.B svscan
+[
+.I directory
+]
+.SH DESCRIPTION
+.B svscan
+starts one
+.BR supervise (8)
+process for each subdirectory of the current directory, up to a limit of 1000
+subdirectories.
+.B svscan
+skips subdirectory names starting with dots.
+.BR supervise (8)
+must be in
+.BR svscan 's
+path.
+
+.B svscan
+optionally starts a pair of
+.BR supervise (8)
+processes, one for a subdirectory
+.IR s ,
+one for
+.IR s\fR/\fBlog ,
+with a pipe between them. It does this if the name
+.I s
+is at most 255 bytes long and
+.I s\fR/\fBlog
+exists. (In versions 0.70 and below, it does this if
+.I s
+is sticky.)
+.B svscan
+needs two free descriptors for each pipe.
+
+Every five seconds,
+.B svscan
+checks for subdirectories again. If it sees a new subdirectory, it starts a
+new
+.BR supervise (8)
+process. If it sees an old subdirectory where a
+.BR supervise (8)
+process has exited, it restarts the
+.BR supervise (8)
+process. In the
+.B log
+case it reuses the same pipe so that no data is lost.
+
+.B svscan
+is designed to run forever. If it has trouble creating a pipe or running
+.BR supervise (8),
+it prints a message to stderr; it will try again five seconds later.
+
+If
+.B svscan
+is given a command-line argument
+.IR directory ,
+it switches to that
+.I directory
+when it starts.
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/svscanboot.8
+++ daemontools-0.76/debian/daemontools-man/svscanboot.8
@@ -0,0 +1,55 @@
+.TH svscanboot 8
+.SH NAME
+svscanboot \- starts
+.BR svscan (8)
+in the /service directory, with output and error messages logged through
+.BR readproctitle (8).
+
+svscanboot is available in daemontools 0.75 and above.
+.SH SYNOPSIS
+.B svscanboot
+.SH DESCRIPTION
+.B svscanboot
+runs the pipeline
+
+svscan /service 2>&1 | readproctitle service errors: .....
+
+with 400 dots. The last 400 bytes of error messages from
+.BR svscan (8)
+will be visible to
+.BR ps (1)
+through
+.BR readproctitle (8).
+
+.B svscanboot
+sets $PATH to
+
+ /command:/usr/local/bin:/usr/local/sbin:
+ /bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
+
+(all in one line, no space)
+
+and clears all other environment variables. Program writers are encouraged to
+use globally allocated names in
+.BR /command .
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8),
+ps(1)
+
+ http://cr.yp.to/daemontools.html
+ http://cr.yp.to/slashcommand.html
--- daemontools-0.76.orig/debian/daemontools-man/svstat.8
+++ daemontools-0.76/debian/daemontools-man/svstat.8
@@ -0,0 +1,35 @@
+.TH svstat 8
+.SH NAME
+svstat \- prints the status of services monitored by
+.BR supervise (8).
+.SH SYNOPSIS
+.B svstat
+.I services
+.SH DESCRIPTION
+.I services
+consists of any number of arguments, each argument naming a directory.
+.B svstat
+prints one human-readable line for each directory, saying whether
+.BR supervise (8)
+is successfully running in that directory, and reporting the status
+information maintained by
+.BR supervise (8).
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/tai64n.8
+++ daemontools-0.76/debian/daemontools-man/tai64n.8
@@ -0,0 +1,64 @@
+.TH tai64n 8
+.SH NAME
+tai64n \- puts a precise timestamp on each line.
+.SH SYNOPSIS
+.B tai64n
+.SH DESCRIPTION
+.B tai64n
+reads lines from stdin. For each line, it writes 
+.IP 1
+an @, 
+.IP 2.
+a precise timestamp, 
+.IP 3.
+a space, and 
+.IP 4.
+a copy of the input line 
+
+to stdout. The timestamp indicates the moment that
+.B tai64n
+read the first character of the line. 
+
+.B tai64n
+does not allocate any memory after it starts.
+.SH TIMESTAMPS
+Timestamps used by
+.B tai64n
+are 12-byte TAI64N labels in external TAI64N format, printed as 24 lowercase
+hexadecimal characters. You can use
+.BR tai64nlocal (8)
+to convert the timestamps to a human-readable format. 
+
+For example, the timestamp 4000000037c219bf2ef02e94 refers to the nanosecond
+beginning exactly 935467455.787492500 seconds after the beginning of 1970 TAI;
+37c219bf hexadecimal is 935467455, and 2ef02e94 hexadecimal is 787492500. 
+
+The current implementation of
+.B tai64n
+relies on the UNIX gettimeofday library routine to return the current time as
+the number of TAI seconds since 1970-01-01 00:00:10 TAI. Beware that most
+gettimeofday implementations are not Y2038-compliant. Furthermore, most clocks
+are not set accurately. 
+.SH EXIT CODES
+.B tai64n
+exits 0 when it sees end of input. It exits 111 without an error message if
+it has trouble reading stdin or writing stdout. 
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64nlocal(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/daemontools-man/tai64nlocal.8
+++ daemontools-0.76/debian/daemontools-man/tai64nlocal.8
@@ -0,0 +1,60 @@
+.TH tai64nlocal 8
+.SH NAME
+tai64nlocal \- converts precise TAI64N timestamps to a human-readable format.
+.SH SYNOPSIS
+.B tai64nlocal
+.SH DESCRIPTION
+.B tai64nlocal
+reads lines from stdin. If a line does not begin with @,
+.B tai64nlocal
+writes it to stdout without change. If a line begins with @,
+.B tai64nlocal
+looks for a timestamp after the @, in the format printed by
+.BR tai64n (8),
+and writes the line to stdout with the timestamp converted to local time in
+ISO format: YYYY-MM-DD HH:MM:SS.SSSSSSSSS. 
+
+For example, in the US/Pacific time zone, the input line 
+
+  @4000000037c219bf2ef02e94 mark
+
+should be printed as 
+
+  1999-08-23 21:03:43.787492500 mark
+
+Beware, however, that the current implementation of
+.B tai64nlocal
+relies on the UNIX localtime library routine to find the local time. Some
+localtime implementations use a broken time scale that does not account for
+leap seconds. On systems that use the Olson tz library (with an up-to-date
+leap-second table), you can fix this problem by setting your time zone to,
+e.g, right/US/Pacific instead of US/Pacific.
+
+Beware also that most localtime implementations are not Y2038-compliant.
+
+.B tai64nlocal
+does not allocate any memory after it starts, except possibly
+inside localtime.
+.SH EXIT CODES
+.B tai64nlocal
+exits 0 when it sees end of input. It exits 111 without an error message if it
+has trouble reading stdin or writing stdout. 
+.SH SEE ALSO
+supervise(8),
+svc(8),
+svok(8),
+svstat(8),
+svscanboot(8),
+svscan(8),
+readproctitle(8),
+fghack(8),  
+pgrphack(8),
+multilog(8),
+tai64n(8),
+setuidgid(8),
+envuidgid(8),
+envdir(8),
+softlimit(8),
+setlock(8)
+
+http://cr.yp.to/daemontools.html
--- daemontools-0.76.orig/debian/diff/0001-error.h-include-errno.h-instead-of-extern-int.diff
+++ daemontools-0.76/debian/diff/0001-error.h-include-errno.h-instead-of-extern-int.diff
@@ -0,0 +1,25 @@
+From d3e7651e2f2492dd1031d09a99713644b604cab5 Mon Sep 17 00:00:00 2001
+From: Gerrit Pape <pape@smarden.org>
+Date: Wed, 12 Dec 2007 13:44:15 +0000
+Subject: [PATCH] error.h: '#include <errno.h>' instead of 'extern int errno;'
+
+---
+ daemontools-0.76/src/error.h |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/daemontools-0.76/src/error.h b/daemontools-0.76/src/error.h
+index 086fb55..f7e8273 100644
+--- a/daemontools-0.76/src/error.h
++++ b/daemontools-0.76/src/error.h
+@@ -3,7 +3,7 @@
+ #ifndef ERROR_H
+ #define ERROR_H
+ 
+-extern int errno;
++#include <errno.h>
+ 
+ extern int error_intr;
+ extern int error_nomem;
+-- 
+1.5.4.2
+
--- daemontools-0.76.orig/debian/diff/0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.diff
+++ daemontools-0.76/debian/diff/0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.diff
@@ -0,0 +1,47 @@
+From 7ee585cab1d5b68f804a5601a66ae87799c8a7c3 Mon Sep 17 00:00:00 2001
+From: Gerrit Pape <pape@smarden.org>
+Date: Sun, 24 Feb 2008 10:54:26 +0000
+Subject: [PATCH] supervise.c: ./supervise may be a symlink, if it's dangling, create link target
+
+---
+ daemontools-0.76/src/supervise.c |   17 ++++++++++++++++-
+ 1 files changed, 16 insertions(+), 1 deletions(-)
+
+diff --git a/daemontools-0.76/src/supervise.c b/daemontools-0.76/src/supervise.c
+index 2482ad2..f43cabf 100644
+--- a/daemontools-0.76/src/supervise.c
++++ b/daemontools-0.76/src/supervise.c
+@@ -208,6 +208,8 @@ void doit(void)
+ int main(int argc,char **argv)
+ {
+   struct stat st;
++  int r;
++  char buf[256];
+ 
+   dir = argv[1];
+   if (!dir || argv[2])
+@@ -232,7 +234,20 @@ int main(int argc,char **argv)
+     if (errno != error_noent)
+       strerr_die4sys(111,FATAL,"unable to stat ",dir,"/down: ");
+ 
+-  mkdir("supervise",0700);
++  if (mkdir("supervise",0700) == -1) {
++    if ((r = readlink("supervise", buf, 256)) != -1) {
++      if (r == 256) {
++        errno = EOVERFLOW;
++        strerr_die1sys(111,"unable to readlink ./supervise: ");
++      }
++      buf[r] = 0;
++      mkdir(buf, 0700);
++    }
++    else {
++      if ((errno != ENOENT) && (errno != EINVAL))
++        strerr_die1sys(111, "unable to readlink ./supervise: ");
++    }
++  }
+   fdlock = open_append("supervise/lock");
+   if ((fdlock == -1) || (lock_exnb(fdlock) == -1))
+     strerr_die4sys(111,FATAL,"unable to acquire ",dir,"/supervise/lock: ");
+-- 
+1.5.4.2
+
