ports/152847: buildbot-slave could use a startup script

[ Available lists | Index of freebsd-ports-bugs | Month of Dec 2010 | Week of 5 Dec 2010 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Garrett Wollman <wollman@FreeBSD.org>
Date
5 Dec 2010 04:40:11
Subject
ports/152847: buildbot-slave could use a startup script
Message-ID
201012050430.oB54Ufsq047605@hergotha.csail.mit.edu


[ Hide this part ]
 
>Number: 152847
>Category: ports
>Synopsis: buildbot-slave could use a startup script
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Dec 05 04:40:10 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Garrett Wollman
>Release: FreeBSD 8.1-RELEASE-p1 amd64
>Organization:
FreeBSD Project and MIT
>Environment:
System: FreeBSD hergotha.csail.mit.edu 8.1-RELEASE-p1 FreeBSD 8.1-RELEASE-p1 #1 r215854M: Sat Nov 27 02:07:10 EST 2010 wollman@hergotha.csail.mit.edu:/usr/obj/usr/src/sys/HERGOTHA amd64

devel/buildbot-slave 0.81

>Description:

When one installs buildbot-slave, it is likely that one would like the
daemon start automatically once the software is configured.

>How-To-Repeat:

ls /usr/ports/devel/buildbot-slave/files. Note no rc script.

>Fix:

Here is a very simple one that I am using successfully. It can only
handle one buildslave environment per machine (I am using one virtual
machine per environment). It will need a few generalizations to make
it ${PREFIX}-safe and Python-version-independent. Making buildslave's
startup a bit quieter by default would be a nice addition.

#! /bin/sh
#
# $FreeBSD$
#

# PROVIDE: buildslave
# REQUIRE: LOGIN
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable buildslave:
#
#buildslave_enable="YES"
#buildslave_directory="/home/buildbot/path/to/slave"

. /etc/rc.subr

name="buildslave"
rcvar=`set_rcvar`

load_rc_config $name

: ${buildslave_enable:=NO}
: ${buildslave_directory:=/nonexistent}
: ${buildslave_user:=buildbot}

command="/usr/local/bin/buildslave"
command_interpreter="/usr/local/bin/python2.6"
pidfile="${buildslave_directory}/twistd.pid"
required_dirs="${buildslave_directory}"
flags="${buildslave_flags:-"start ${buildslave_directory}"}"
stop_cmd="buildslave_stop"

buildslave_stop() {
info "Stopping ${name}."
${buildslave_program:-$command} stop ${buildslave_directory}
}

run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:

Elapsed time: 0.193 seconds