mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-01-05 14:07:27 -08:00
Applied patch from Brian Evans "to use openrc-run more portable and modern format so that different supervisors can be used as the user desires for bugzilla-queue". Closes: https://bugs.gentoo.org/749924 Package-Manager: Portage-3.0.4, Repoman-2.3.23 Signed-off-by: David Denoncin <ddenoncin@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/18040 Signed-off-by: Joonas Niilola <juippis@gentoo.org>
38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
#!/sbin/openrc-run
|
|
# Copyright 1999-2020 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
command=${JOBQUEUE_PATH}
|
|
JOBQUEUE_USER=${JOBQUEUE_USER:-root}
|
|
JOBQUEUE_GROUP=${JOBQUEUE_GROUP:-root}
|
|
command_user="${JOBQUEUE_USER}:${JOBQUEUE_GROUP}"
|
|
pidfile="/var/run/bugzilla/${RC_SVCNAME}.pid"
|
|
command_args="-p ${pidfile} -n ${RC_SVCNAME} start"
|
|
if [ "${supervisor}" = "supervise-daemon" ]; then
|
|
command_args="-f ${command_args}"
|
|
pidfile="/var/run/bugzilla/${RC_SVCNAME}.supervise.pid"
|
|
fi
|
|
|
|
checkconfig() {
|
|
[[ -z "${JOBQUEUE_USER}" || -z "$(getent passwd ${JOBQUEUE_USER})" ]] && { eerror "JOBQUEUE_USER not set or doesn't exist"; return 1; }
|
|
[[ -z "${JOBQUEUE_GROUP}" || -z "$(getent group ${JOBQUEUE_GROUP})" ]] && { eerror "JOBQUEUE_GROUP not set or doesn't exist"; return 1; }
|
|
[[ -z "${JOBQUEUE_PATH}" && ! -x "${JOBQUEUE_PATH}" ]] && { eerror "JOBQUEUE_PATH not set or not executable"; return 1; }
|
|
return 0
|
|
}
|
|
|
|
start_pre() {
|
|
checkconfig || return 1
|
|
|
|
piddir="${pidfile%/*}"
|
|
if [ ! -d "${piddir}" ]; then
|
|
checkpath -q -d -o "${command_user}" -m 0770 "${piddir}" || {
|
|
eend 1
|
|
return 1
|
|
}
|
|
fi
|
|
}
|
|
|
|
stop_pre() {
|
|
checkconfig || return 1
|
|
}
|