[__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:
parent
30c72c1033
commit
2038244ec4
6 changed files with 52 additions and 8 deletions
|
@ -1,5 +1,12 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
|
||||||
|
os="$(cat "${__global}/explorer/os")"
|
||||||
|
if [ "${os}" != "freebsd" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# FreeBSD-specific
|
||||||
svdir="/var/service"
|
svdir="/var/service"
|
||||||
svdir_exists="$(cat "${__object}/explorer/svdir-exists")"
|
svdir_exists="$(cat "${__object}/explorer/svdir-exists")"
|
||||||
runit_etc="$(cat "${__object}/explorer/runit-etc")"
|
runit_etc="$(cat "${__object}/explorer/runit-etc")"
|
||||||
|
|
|
@ -2,9 +2,22 @@
|
||||||
|
|
||||||
__package "runit"
|
__package "runit"
|
||||||
|
|
||||||
|
os="$(cat "${__global}/explorer/os")"
|
||||||
|
case "${os}" in
|
||||||
|
debian|devuan)
|
||||||
|
# zero-config sysvinit and systemd compatibility
|
||||||
|
__package runit-run
|
||||||
|
;;
|
||||||
|
freebsd)
|
||||||
__key_value \
|
__key_value \
|
||||||
--file "/etc/rc.conf" \
|
--file "/etc/rc.conf" \
|
||||||
--key "runsvdir_enable" \
|
--key "runsvdir_enable" \
|
||||||
--delimiter "=" \
|
--delimiter "=" \
|
||||||
--value "yes" \
|
--value "yes" \
|
||||||
"runsvdir_enable"
|
"runsvdir_enable"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Your OS '${os}' is currently not supported." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -27,6 +27,11 @@ BOOLEAN PARAMETERS
|
||||||
log
|
log
|
||||||
Setup logging with `svlogd -tt ./main`.
|
Setup logging with `svlogd -tt ./main`.
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
state
|
||||||
|
Whether this service is to be 'present' (default) or 'absent'.
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -1,8 +1,21 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
os="$(cat "${__global}/explorer/os")"
|
||||||
|
case "${os}" in
|
||||||
|
debian|devuan)
|
||||||
|
svdir="/etc/service"
|
||||||
|
;;
|
||||||
|
*bsd)
|
||||||
svdir="/var/service"
|
svdir="/var/service"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Your OS '${OS}' is currently not supported." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
sv="${__object_id}"
|
sv="${__object_id}"
|
||||||
state="present"
|
state="$(cat "${__object}/parameter/state")"
|
||||||
run_file="${svdir}/${sv}/run"
|
run_file="${svdir}/${sv}/run"
|
||||||
|
|
||||||
source="$(cat "$__object/parameter/source")"
|
source="$(cat "$__object/parameter/source")"
|
||||||
|
@ -15,6 +28,10 @@ __directory --state "${state}" "${svdir}/${sv}"
|
||||||
|
|
||||||
export require="__directory${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
|
if [ -f "${__object}/parameter/log" ]; then
|
||||||
# Setup logger if requested
|
# Setup logger if requested
|
||||||
|
|
1
type/__runit_service/parameter/default/state
Normal file
1
type/__runit_service/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
||||||
|
present
|
1
type/__runit_service/parameter/optional
Normal file
1
type/__runit_service/parameter/optional
Normal file
|
@ -0,0 +1 @@
|
||||||
|
state
|
Loading…
Reference in a new issue