diff options
author | Dmitry Bogatov <KAction@gnu.org> | 2016-07-15 09:48:02 +0300 |
---|---|---|
committer | Dmitry Bogatov <KAction@gnu.org> | 2016-07-15 09:48:02 +0300 |
commit | c12f33cb4af4a22584fcaffaf88ffd5abe41eec5 (patch) | |
tree | abc0f4e465cd0826748abc0cbca4a15b2f5ce4bd | |
parent | c125d66cca4cb36c94da0b57a7bc7d653852f943 (diff) |
Support for runlevels
-rw-r--r-- | debian/changelog | 11 | ||||
-rwxr-xr-x | dh_runit | 1 | ||||
-rw-r--r-- | postinst-runit | 5 | ||||
-rw-r--r-- | preinst-runit | 26 |
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 @@ | |||
1 | dh-runit (0.2) UNRELEASED; urgency=medium | 1 | dh-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 | |||
8 | dh-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 | ||
7 | dh-runit (0.1) unstable; urgency=medium | 14 | dh-runit (0.1) unstable; urgency=medium |
8 | 15 | ||
@@ -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 @@ | |||
1 | SV_DIR=/etc/service | 1 | SV_DEFAULT=/etc/runit/runsvdir/default |
2 | ln -sf '/etc/sv/#NAME#' "$SV_DIR/" | 2 | ln -sf '/etc/sv/#NAME#' "$SV_DEFAULT" |
3 | mkdir -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 -*- |
2 | SV_ABS_DIR=/var/lib/runit/service | 2 | SV_CURRENT=/etc/runit/runsvdir/current |
3 | SV_DEFAULT=/etc/runit/runsvdir/default | ||
3 | SV_DIR=/etc/service | 4 | SV_DIR=/etc/service |
4 | mkdir -p "$SV_ABS_DIR" | 5 | |
5 | if [ ! -e "$SV_DIR" ] ; then | 6 | mkdir -p "$SV_DEFAULT" |
6 | ln -s "$SV_ABS_DIR" "$SV_DIR" | 7 | if [ ! -e "$SV_CURRENT" ] ; then |
8 | ln -s default "$SV_CURRENT" | ||
9 | elif [ ! -L "$SV_CURRENT" ] ; then | ||
10 | echo "unsupported: $SV_CURRENT exists, but is not symbolic link" | ||
11 | exit 1 | ||
7 | fi | 12 | fi |
8 | 13 | ||
9 | if [ "$(readlink -f "$SV_DIR")" != "$SV_ABS_DIR" ] ; then | 14 | if [ ! -e "$SV_DIR" ] ; then |
10 | cat <<EOF | 15 | ln -sn "$SV_CURRENT" "$SV_DIR" |
11 | Service directory '$SV_DIR' exists, but is not symbolic link | 16 | fi |
12 | to '$SV_ABS_DIR'. It probably means that it was created by | ||
13 | hand or versions of runit below 2.1.2-4. | ||
14 | 17 | ||
15 | In either case, please remove service directory yourself and | 18 | if [ "$(readlink "$SV_DIR")" != "$SV_CURRENT" ] ; then |
16 | restart installation. | 19 | echo "unsupported: $SV_DIR exists, but does not point to $SV_CURRENT" |
17 | EOF | ||
18 | exit 1 | 20 | exit 1 |
19 | fi | 21 | fi |
20 | 22 | ||