summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Bogatov <KAction@gnu.org>2016-07-15 09:48:02 +0300
committerDmitry Bogatov <KAction@gnu.org>2016-07-15 09:48:02 +0300
commitc12f33cb4af4a22584fcaffaf88ffd5abe41eec5 (patch)
treeabc0f4e465cd0826748abc0cbca4a15b2f5ce4bd
parentc125d66cca4cb36c94da0b57a7bc7d653852f943 (diff)
Support for runlevels
-rw-r--r--debian/changelog11
-rwxr-xr-xdh_runit1
-rw-r--r--postinst-runit5
-rw-r--r--preinst-runit26
4 files changed, 26 insertions, 17 deletions
diff --git a/debian/changelog b/debian/changelog
index 079282d..a859bac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,15 @@
1dh-runit (0.2) UNRELEASED; urgency=medium 1dh-runit (0.3) UNRELEASED; urgency=medium
2
3 * Support for `runlevels'. Now, runscripts are installed for
4 `runlevel' default, but system adminstrator can create more.
5
6 -- Dmitry Bogatov <KAction@gnu.org> Fri, 15 Jul 2016 09:45:08 +0300
7
8dh-runit (0.2) unstable; urgency=medium
2 9
3 * Change arch:any to arch:all. Perl script is arch-independent. 10 * Change arch:any to arch:all. Perl script is arch-independent.
4 11
5 -- Dmitry Bogatov <KAction@gnu.org> Wed, 15 Jun 2016 09:51:46 +0300 12 -- Dmitry Bogatov <KAction@gnu.org> Fri, 15 Jul 2016 09:45:04 +0300
6 13
7dh-runit (0.1) unstable; urgency=medium 14dh-runit (0.1) unstable; urgency=medium
8 15
diff --git a/dh_runit b/dh_runit
index fa19763..01bbf67 100755
--- a/dh_runit
+++ b/dh_runit
@@ -89,6 +89,7 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) {
89 } 89 }
90 make_symlink("/etc/sv/$name/supervise", 90 make_symlink("/etc/sv/$name/supervise",
91 "/var/lib/runit/supervise/$name", $tmp); 91 "/var/lib/runit/supervise/$name", $tmp);
92 install_dir("/var/lib/runit/supervise/$name");
92 93
93 if ($enable eq 'enable' && !$dh{NO_ENABLE}) { 94 if ($enable eq 'enable' && !$dh{NO_ENABLE}) {
94 runit_autoscript($pkg, 'postinst', "s/#NAME#/$name/"); 95 runit_autoscript($pkg, 'postinst', "s/#NAME#/$name/");
diff --git a/postinst-runit b/postinst-runit
index 1955857..8b5887c 100644
--- a/postinst-runit
+++ b/postinst-runit
@@ -1,3 +1,2 @@
1SV_DIR=/etc/service 1SV_DEFAULT=/etc/runit/runsvdir/default
2ln -sf '/etc/sv/#NAME#' "$SV_DIR/" 2ln -sf '/etc/sv/#NAME#' "$SV_DEFAULT"
3mkdir -p '/var/lib/runit/supervise/#NAME#'
diff --git a/preinst-runit b/preinst-runit
index 19f959b..62feed4 100644
--- a/preinst-runit
+++ b/preinst-runit
@@ -1,20 +1,22 @@
1# -*- shell-script -*- 1# -*- shell-script -*-
2SV_ABS_DIR=/var/lib/runit/service 2SV_CURRENT=/etc/runit/runsvdir/current
3SV_DEFAULT=/etc/runit/runsvdir/default
3SV_DIR=/etc/service 4SV_DIR=/etc/service
4mkdir -p "$SV_ABS_DIR" 5
5if [ ! -e "$SV_DIR" ] ; then 6mkdir -p "$SV_DEFAULT"
6 ln -s "$SV_ABS_DIR" "$SV_DIR" 7if [ ! -e "$SV_CURRENT" ] ; then
8 ln -s default "$SV_CURRENT"
9elif [ ! -L "$SV_CURRENT" ] ; then
10 echo "unsupported: $SV_CURRENT exists, but is not symbolic link"
11 exit 1
7fi 12fi
8 13
9if [ "$(readlink -f "$SV_DIR")" != "$SV_ABS_DIR" ] ; then 14if [ ! -e "$SV_DIR" ] ; then
10 cat <<EOF 15 ln -sn "$SV_CURRENT" "$SV_DIR"
11Service directory '$SV_DIR' exists, but is not symbolic link 16fi
12to '$SV_ABS_DIR'. It probably means that it was created by
13hand or versions of runit below 2.1.2-4.
14 17
15In either case, please remove service directory yourself and 18if [ "$(readlink "$SV_DIR")" != "$SV_CURRENT" ] ; then
16restart installation. 19 echo "unsupported: $SV_DIR exists, but does not point to $SV_CURRENT"
17EOF
18 exit 1 20 exit 1
19fi 21fi
20 22