2016-02-11 11:17:28 +01:00
|
|
|
#!/sbin/openrc-run
|
2018-11-12 03:04:42 +01:00
|
|
|
# Copyright 1999-2018 Gentoo Authors
|
2014-03-18 11:00:56 +01:00
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
|
2019-01-12 04:05:59 +01:00
|
|
|
command="/usr/bin/spectrum2_manager"
|
2018-11-12 03:04:42 +01:00
|
|
|
command_group="spectrum"
|
|
|
|
command_user="spectrum"
|
|
|
|
name="Spectrum2 Transport"
|
2019-01-12 04:05:59 +01:00
|
|
|
shell="/bin/sh"
|
|
|
|
su="/bin/su"
|
2014-03-18 11:00:56 +01:00
|
|
|
|
|
|
|
depend() {
|
|
|
|
need net
|
|
|
|
}
|
|
|
|
|
2019-01-12 04:05:59 +01:00
|
|
|
start() {
|
|
|
|
ebegin "Starting ${name}"
|
|
|
|
"${su}" "${command_user}" -c "${command} start" -s "${shell}"
|
|
|
|
eend $?
|
|
|
|
}
|
|
|
|
|
2018-09-20 12:17:02 +02:00
|
|
|
start_pre() {
|
2019-01-12 04:05:59 +01:00
|
|
|
# Ensure /run/spectrum2 dir is owned by spectrum user.
|
|
|
|
# spectrum2_manager stores pidfiles of individual services here.
|
|
|
|
# See security related comment at the bottom.
|
|
|
|
checkpath -d -o "${command_user}:${command_group}" -q "/run/spectrum2"
|
2018-09-20 12:17:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
status() {
|
2019-01-12 04:05:59 +01:00
|
|
|
ebegin "Status ${name}"
|
|
|
|
"${su}" "${command_user}" -c "${command} status" -s "${shell}"
|
2014-03-18 11:00:56 +01:00
|
|
|
eend $?
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2019-01-12 04:05:59 +01:00
|
|
|
ebegin "Stopping ${name}"
|
|
|
|
"${su}" "${command_user}" -c "${command} stop" -s "${shell}"
|
2014-03-18 11:00:56 +01:00
|
|
|
eend $?
|
|
|
|
}
|
2019-01-12 04:05:59 +01:00
|
|
|
|
|
|
|
# Andrey Utkin <andrey_utkin@gentoo.org> (24 Nov 2018)
|
|
|
|
# Conrad Kostecki <conrad@kostecki.com> (24 Nov 2018)
|
|
|
|
# We are aware of many security issues caused by careless chowning, see
|
|
|
|
# http://michael.orlitzky.com/articles/end_root_chowning_now_(make_etc-init.d_great_again).xhtml
|
|
|
|
# We believe none of these issues apply.
|
|
|
|
# These pidfiles are not read by any privileged process.
|
|
|
|
# checkpath here chowns only the dir itself and doesn't act recursively.
|