Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 65 lines (50 sloc) 1.378 kB
aa90b75 @dnaeon Initial commit of Gerrit port for FreeBSD
authored
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5 # PROVIDE: gerrit
6 # REQUIRE: LOGIN
7 # KEYWORD: shutdown
8
9 #
25b4806 @dnaeon Fix a typo in the comment
authored
10 # Add the following line to /etc/rc.conf to enable the Gerrit daemon:
aa90b75 @dnaeon Initial commit of Gerrit port for FreeBSD
authored
11 #
12 # gerrit_enable="YES"
13 #
14
15 . /etc/rc.subr
16
17 name="gerrit"
18 rcvar=`set_rcvar`
19
20 load_rc_config "${name}"
21
22 : ${gerrit_enable="NO"}
23 : ${gerrit_home="%%GERRIT_HOME%%"}
24 : ${gerrit_args=""}
25 : ${gerrit_java_home="%%JAVA_HOME%%"}
cc9ecea @dnaeon Update with some fixes
authored
26 : ${gerrit_user="%%USERS%%"}
27 : ${gerrit_group="%%GROUPS%%"}
aa90b75 @dnaeon Initial commit of Gerrit port for FreeBSD
authored
28 : ${gerrit_site="%%GERRIT_HOME%%/%%GERRIT_SITE%%"}
29
2642c55 @dnaeon Once initialized Gerrit will start up automatically
authored
30 pidfile="${gerrit_site}/logs/gerrit.pid"
31 procname="GerritCodeReview"
aa90b75 @dnaeon Initial commit of Gerrit port for FreeBSD
authored
32 command="${gerrit_site}/bin/gerrit.sh"
33 java_cmd="${gerrit_java_home}/bin/java"
34 required_files="${java_cmd}"
35
36 start_precmd="gerrit_prestart"
37 start_cmd="gerrit_start"
38 stop_cmd="gerrit_stop"
39
73d888a @dnaeon Add /usr/local/bin to the PATH in gerrit rc.d script
authored
40 PATH="${PATH}:/usr/local/bin"
41
aa90b75 @dnaeon Initial commit of Gerrit port for FreeBSD
authored
42 gerrit_prestart() {
43 if [ ! -d "${gerrit_home}" ]; then
2642c55 @dnaeon Once initialized Gerrit will start up automatically
authored
44 # initialize Gerrit if the home directory is missing
aa90b75 @dnaeon Initial commit of Gerrit port for FreeBSD
authored
45 install -d -o "${gerrit_user}" -g "${gerrit_group}" -m 750 "${gerrit_home}"
2642c55 @dnaeon Once initialized Gerrit will start up automatically
authored
46
aa90b75 @dnaeon Initial commit of Gerrit port for FreeBSD
authored
47 echo "No Gerrit site found. Will initialize Gerrit first..."
48 /usr/bin/su - ${gerrit_user} -c "${java_cmd} -jar %%DATADIR%%/gerrit.war init -d ${gerrit_site}"
2642c55 @dnaeon Once initialized Gerrit will start up automatically
authored
49
50 # once initialized Gerrit will start up automatically
51 rc_pid=`check_pidfile ${pidfile} ${procname}`
52 [ -n "${rc_pid}" ] && return 1 || return 0
aa90b75 @dnaeon Initial commit of Gerrit port for FreeBSD
authored
53 fi
54 }
55
56 gerrit_start() {
57 ${command} start
58 }
59
60 gerrit_stop() {
61 ${command} stop
62 }
63
64 run_rc_command "$1"
Something went wrong with that request. Please try again.