Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 9cdb64bd40
Fetching contributors…

Cannot retrieve contributors at this time

65 lines (50 sloc) 1.378 kB
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: gerrit
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable the Gerrit daemon:
#
# gerrit_enable="YES"
#
. /etc/rc.subr
name="gerrit"
rcvar=`set_rcvar`
load_rc_config "${name}"
: ${gerrit_enable="NO"}
: ${gerrit_home="%%GERRIT_HOME%%"}
: ${gerrit_args=""}
: ${gerrit_java_home="%%JAVA_HOME%%"}
: ${gerrit_user="%%USERS%%"}
: ${gerrit_group="%%GROUPS%%"}
: ${gerrit_site="%%GERRIT_HOME%%/%%GERRIT_SITE%%"}
pidfile="${gerrit_site}/logs/gerrit.pid"
procname="GerritCodeReview"
command="${gerrit_site}/bin/gerrit.sh"
java_cmd="${gerrit_java_home}/bin/java"
required_files="${java_cmd}"
start_precmd="gerrit_prestart"
start_cmd="gerrit_start"
stop_cmd="gerrit_stop"
PATH="${PATH}:/usr/local/bin"
gerrit_prestart() {
if [ ! -d "${gerrit_home}" ]; then
# initialize Gerrit if the home directory is missing
install -d -o "${gerrit_user}" -g "${gerrit_group}" -m 750 "${gerrit_home}"
echo "No Gerrit site found. Will initialize Gerrit first..."
/usr/bin/su - ${gerrit_user} -c "${java_cmd} -jar %%DATADIR%%/gerrit.war init -d ${gerrit_site}"
# once initialized Gerrit will start up automatically
rc_pid=`check_pidfile ${pidfile} ${procname}`
[ -n "${rc_pid}" ] && return 1 || return 0
fi
}
gerrit_start() {
${command} start
}
gerrit_stop() {
${command} stop
}
run_rc_command "$1"
Jump to Line
Something went wrong with that request. Please try again.