ports/devel/py-buildbot/files/buildbot.in
Muhammad Moinur Rahman b6471b4391 devel/py-buildbot: Update version 3.5.0=>3.7.0
- Use the existing buildbot users and groups
- Refactor the rc script to run as buildbot user and pointing the
  basedir to the home directory of buildbot user [1]

PR:		248234 [1]
Reported by:	ari@ish.com.au [1]
2022-12-14 08:18:51 -06:00

64 lines
1.5 KiB
Bash

#!/bin/sh
# PROVIDE: buildbot
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable buildbot:
# buildbot_enable (bool): Set to "NO" by default
# buildbot_basedir (path): Set to "/var/www/buildbot" by default
# buildbot_user (str): Set to "buildbot" by default.
. /etc/rc.subr
export PATH=${PATH}:%%PREFIX%%/bin
name="buildbot"
desc="Buildbot Master"
rcvar=buildbot_enable
command="%%PREFIX%%/bin/buildbot-%%PYTHON_VER%%"
load_rc_config $name
: ${buildbot_user:="buildbot"}
: ${buildbot_basedir:="/var/db/buildbot"}
check_cmd="${name}_check"
extra_commands="check reload"
reload_cmd="${name}_reload"
start_precmd="${name}_prestart"
stop_precmd="${name}_prestop"
pidfile="${buildbot_basedir}/twistd.pid"
procname="%%PYTHON_CMD%%"
buildbot_check()
{
echo "Checking BuildBot config"
rc_flags="${buildbot_basedir} ${rc_flags}"
${command} checkconfig ${rc_flags}
}
buildbot_prestart()
{
if [ ! -f "${buildbot_basedir}/${name}.tac" ]; then
su -m ${buildbot_user} -c "exec ${command} create-master ${buildbot_basedir}"
fi
if [ ! -f "${buildbot_basedir}/master.cfg" ]; then
install -o ${buildbot_user} -g ${buildbot_user} -m 750 ${buildbot_basedir}/master.cfg.sample ${buildbot_basedir}/master.cfg
fi
rc_flags="start ${buildbot_basedir} ${rc_flags}"
}
buildbot_prestop()
{
rc_flags="stop ${buildbot_basedir} ${rc_flags}"
}
buildbot_reload()
{
rc_flags="${buildbot_basedir} ${rc_flags}"
${command} sighup ${rc_flags}
}
run_rc_command "$1"