[__runit*] Add support for Debian/Devuan

Apparently these types were only supporting FreeBSD, this brings in support for
Debian and Devuan by taking advantage of
https://packages.debian.org/bullseye/runit-run
This commit is contained in:
evilham 2021-10-30 10:40:01 +02:00
parent 30c72c1033
commit 2038244ec4
6 changed files with 52 additions and 8 deletions

View file

@ -1,5 +1,12 @@
#!/bin/sh -e
os="$(cat "${__global}/explorer/os")"
if [ "${os}" != "freebsd" ]; then
exit
fi
# FreeBSD-specific
svdir="/var/service"
svdir_exists="$(cat "${__object}/explorer/svdir-exists")"
runit_etc="$(cat "${__object}/explorer/runit-etc")"

View file

@ -2,9 +2,22 @@
__package "runit"
__key_value \
--file "/etc/rc.conf" \
--key "runsvdir_enable" \
--delimiter "=" \
--value "yes" \
"runsvdir_enable"
os="$(cat "${__global}/explorer/os")"
case "${os}" in
debian|devuan)
# zero-config sysvinit and systemd compatibility
__package runit-run
;;
freebsd)
__key_value \
--file "/etc/rc.conf" \
--key "runsvdir_enable" \
--delimiter "=" \
--value "yes" \
"runsvdir_enable"
;;
*)
echo "Your OS '${os}' is currently not supported." >&2
exit 1
;;
esac

View file

@ -27,6 +27,11 @@ BOOLEAN PARAMETERS
log
Setup logging with `svlogd -tt ./main`.
OPTIONAL PARAMETERS
-------------------
state
Whether this service is to be 'present' (default) or 'absent'.
EXAMPLES
--------

View file

@ -1,8 +1,21 @@
#!/bin/sh -e
svdir="/var/service"
os="$(cat "${__global}/explorer/os")"
case "${os}" in
debian|devuan)
svdir="/etc/service"
;;
*bsd)
svdir="/var/service"
;;
*)
echo "Your OS '${OS}' is currently not supported." >&2
exit 1
;;
esac
sv="${__object_id}"
state="present"
state="$(cat "${__object}/parameter/state")"
run_file="${svdir}/${sv}/run"
source="$(cat "$__object/parameter/source")"
@ -15,6 +28,10 @@ __directory --state "${state}" "${svdir}/${sv}"
export require="__directory${svdir}/${sv}"
if [ "${state}" != "present" ]; then
# We are done here, the service gets removed
exit
fi
if [ -f "${__object}/parameter/log" ]; then
# Setup logger if requested

View file

@ -0,0 +1 @@
present

View file

@ -0,0 +1 @@
state