commit 7e3cf3d0c93446fac74f55df9c301e4d0a3b6682
parent 0ad6610cb225cc91c22dd07fa60b9c6b221528cd
Author: Gerrit Pape <pape@smarden.org>
Date: Mon, 22 Sep 2003 09:58:29 +0000
* debian/diff/readlink.diff: new; create link target if ./supervise is
a dangling symbolic link.
* debian/rules: apply patches in debian/diff/; install stage 2 as
/usr/sbin/runsvdir-start for the use with /etc/inittab; enable dh_link.
* debian/runit.dirs: add /var/service, /var/run/getty-5.
* debian/README.Debian: adapt; package now automatically enables service
supervision when used with sysvinit.
* debian/diff/doc-useinit.diff: new; document runsvdir-start usage.
* debian/runit.links: new; create symlink for getty-5 service supervise
directory to /var/run/.
* debian/runit.postinst: new; add SV entry to /etc/inittab if not present
on install and upgrade; barf on fresh install if SV entry is present.
* debian/runit.postrm: new; remove SV inittab entry on de-install; force
remove /var/run/getty-5/ on purge.
Diffstat:
9 files changed, 235 insertions(+), 24 deletions(-)
diff --git a/debian/README.Debian b/debian/README.Debian
@@ -1,26 +1,16 @@
runit for Debian
----------------
-This package provides the runit programs and an example getty service only.
-It does not replace the /sbin/init program, and so does not enable runit to
-run as process no 1. To do so, you need to follow the documentation[0] or
-install the package runit-run.
+This package provides the runit programs, an example getty service, and
+adds an entry with the name SV to /etc/inittab in order to provide runit's
+service supervision on systems running sysvinit as init scheme.
-runit's default directory for services is /var/service.
-
-It is possible to use runit's service supervision with sysvinit's init
-running as process no 1. If you want this, create the /var/service directory,
-install the example stage 2 script in /etc/runit/, and add a line to the end
-of /etc/inittab like this:
-
- # mkdir -p /var/service
- # install -m0755 /usr/share/doc/runit/doc/debian/2 /etc/runit/2
- # echo 'SV:123456:respawn:/etc/runit/2' >>/etc/inittab
+The package does not replace the /sbin/init program, and so does not
+enable runit to run as process no 1. To do so, you need to follow the
+documentation[0] or install the package runit-run.
-Then tell sysvinit about the change:
-
- # init q
+runit's default directory for services is /var/service.
[0] http://smarden.org/runit/replaceinit.html
- -- Gerrit Pape <pape@smarden.org>, Wed, 16 Oct 2002 13:24:32 +0200
+ -- Gerrit Pape <pape@smarden.org>, Mon, 22 Sep 2003 10:34:51 +0200
diff --git a/debian/changelog b/debian/changelog
@@ -1,8 +1,22 @@
-runit (0.11.1-0) unstable; urgency=low
+runit (0.11.1-1) unstable; urgency=low
* new upstream version.
-
- -- Gerrit Pape <pape@smarden.org> Mon, 1 Sep 2003 13:04:20 +0200
+ * debian/diff/readlink.diff: new; create link target if ./supervise is
+ a dangling symbolic link.
+ * debian/rules: apply patches in debian/diff/; install stage 2 as
+ /usr/sbin/runsvdir-start for the use with /etc/inittab; enable dh_link.
+ * debian/runit.dirs: add /var/service, /var/run/getty-5.
+ * debian/README.Debian: adapt; package now automatically enables service
+ supervision when used with sysvinit.
+ * debian/diff/doc-useinit.diff: new; document runsvdir-start usage.
+ * debian/runit.links: new; create symlink for getty-5 service supervise
+ directory to /var/run/.
+ * debian/runit.postinst: new; add SV entry to /etc/inittab if not present
+ on install and upgrade; barf on fresh install if SV entry is present.
+ * debian/runit.postrm: new; remove SV inittab entry on de-install; force
+ remove /var/run/getty-5/ on purge.
+
+ -- Gerrit Pape <pape@smarden.org> Mon, 22 Sep 2003 09:36:59 +0000
runit (0.11.0-1) unstable; urgency=low
diff --git a/debian/diff/doc-useinit.diff b/debian/diff/doc-useinit.diff
@@ -0,0 +1,38 @@
+Index: doc/useinit.html
+===================================================================
+RCS file: /var/lib/cvs/runit/doc/useinit.html,v
+retrieving revision 1.3
+diff -u -r1.3 useinit.html
+--- doc/useinit.html 22 Jun 2003 18:25:31 -0000 1.3
++++ doc/useinit.html 22 Sep 2003 09:50:34 -0000
+@@ -20,10 +20,9 @@
+ <tt>StartupItems</tt>.
+ <p>
+ In any case, you first need to copy the <i>stage 2</i> script to
+-<tt>/etc/runit/2</tt>:
++<tt>/sbin/runsvdir-start</tt>:
+ <pre>
+- # mkdir -p /etc/runit
+- # cp -p /package/admin/runit/etc/2 /etc/runit/
++ # install -m0750 /package/admin/runit/etc/2 /sbin/runsvdir-start
+ </pre>
+ <hr>
+ <a href="#sysv">How to use with sysvinit</a><br>
+@@ -35,7 +34,7 @@
+ file, do:
+ <pre>
+ # cat >>/etc/inittab <<EOT
+- SV:123456:respawn:/etc/runit/2
++ SV:123456:respawn:/sbin/runsvdir-start
+ EOT
+ </pre>
+ and tell <i>init</i> to reread its configuration, e.g.:
+@@ -48,7 +47,7 @@
+ script, do:
+ <pre>
+ # cat >>/etc/rc.local <<EOT
+- csh -cf '/etc/runit/2 &'
++ csh -cf '/sbin/runsvdir-start &'
+ EOT
+ </pre>
+ and reboot your system.
diff --git a/debian/diff/readlink.diff b/debian/diff/readlink.diff
@@ -0,0 +1,44 @@
+? ANN
+? changeversion
+? manpagehtml.diff
+? runit-0.9.6.tar.gz
+? debian/readlink.diff
+? src/test
+Index: src/runsv.c
+===================================================================
+RCS file: /var/lib/cvs/runit/src/runsv.c,v
+retrieving revision 1.11
+diff -u -r1.11 runsv.c
+--- src/runsv.c 9 Mar 2003 14:05:49 -0000 1.11
++++ src/runsv.c 4 Sep 2003 09:43:32 -0000
+@@ -318,6 +318,7 @@
+ int main(int argc, char **argv) {
+ struct stat s;
+ int fd;
++ char buf[256];
+
+ progname =argv[0];
+ if (! argv[1] || argv[2]) usage();
+@@ -367,7 +368,21 @@
+ }
+ }
+
+- mkdir("supervise", 0700);
++ if (mkdir("supervise", 0700) == -1) {
++ if ((fd =readlink("supervise", buf, 256)) != -1) {
++ if (fd == 256) {
++ errno =EOVERFLOW;
++ fatal("unable to readlink ./supervise");
++ }
++ buf[fd] =0;
++ mkdir(buf, 0700);
++ }
++ else {
++ if ((errno != ENOENT) && (errno != EINVAL))
++ fatal("unable to readlink ./supervise");
++ }
++ }
++
+ if ((svd[0].fdlock =open_append("supervise/lock")) == -1)
+ fatal("unable to open lock");
+ if (lock_exnb(svd[0].fdlock) == -1) fatal("unable to lock");
diff --git a/debian/rules b/debian/rules
@@ -37,11 +37,14 @@ configure-stamp:
touch configure-stamp
-build-arch: configure-stamp build-arch-stamp
+build-arch: configure-stamp build-arch-stamp
build-arch-stamp:
dh_testdir
tar xfzvp runit-0.11.1.tar.gz
+ for i in debian/diff/*.diff; do \
+ cat $$i | ( cd admin/runit-0.11.1 && patch -p0 ); \
+ done
-gcc -v
( \
@@ -55,7 +58,7 @@ build-arch-stamp:
touch build-arch-stamp
-build-indep: configure-stamp build-indep-stamp
+build-indep: configure-stamp build-indep-stamp
build-indep-stamp:
dh_testdir
@@ -104,6 +107,10 @@ install: build
install -m0755 admin/runit-0.11.1/src/chpst \
$(CURDIR)/debian/runit/usr/bin/chpst
+ # runsvdir-start to be used from /etc/inittab
+ install -m0755 debian/2 \
+ $(CURDIR)/debian/runit/usr/sbin/runsvdir-start
+
# temporary?
( cd $(CURDIR)/debian/runit/usr/sbin/ && ln -s ../bin/chpst setuidgid )
@@ -150,7 +157,7 @@ binary-arch: build install
dh_installman -a admin/runit/man/*.8
dh_installchangelogs -a admin/runit-0.11.1/package/CHANGES
dh_strip -a
-# dh_link -a
+ dh_link -a
dh_compress -a
dh_fixperms -a -X/sbin
# dh_makeshlibs -a
diff --git a/debian/runit.dirs b/debian/runit.dirs
@@ -1,4 +1,6 @@
sbin
usr/sbin
usr/bin
+var/service
etc/runit/getty-5
+var/run/getty-5
diff --git a/debian/runit.links b/debian/runit.links
@@ -0,0 +1 @@
+/var/run/getty-5 /etc/runit/getty-5/supervise
diff --git a/debian/runit.postinst b/debian/runit.postinst
@@ -0,0 +1,68 @@
+#! /bin/sh
+# postinst script for runit
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+# quoting from the policy:
+# Any necessary prompting should almost always be confined to the
+# post-installation script, and should be protected with a conditional
+# so that unnecessary prompting doesn't happen if a package's
+# installation fails and the `postinst' is called with `abort-upgrade',
+# `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+ configure)
+ 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 runit's service supervision started
+by 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
+#-- runit begin
+SV:123456:respawn:/usr/sbin/runsvdir-start
+#-- runit end
+EOT
+ mv -f /etc/inittab'{new}' /etc/inittab
+ kill -HUP 1
+ fi
+ ;;
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/runit.postrm b/debian/runit.postrm
@@ -0,0 +1,47 @@
+#! /bin/sh
+# postrm script for runit
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+case "$1" in
+ remove)
+ if grep -q "#-- runit begin" /etc/inittab; then
+ echo 'Removing SV inittab entry...'
+ rm -f /etc/inittab'{new}'
+ sed -e '/#-- runit begin/,/#-- runit end/d' \
+ /etc/inittab > /etc/inittab'{new}'
+ mv -f /etc/inittab'{new}' /etc/inittab
+ kill -HUP 1
+ fi
+ ;;
+ purge)
+ rm -rf /var/run/getty-5
+ ;;
+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0