summaryrefslogtreecommitdiff
path: root/devel/p4web/files/p4web.in
blob: b2c3276bf6ecdde9c2381c8387ecb6206da4973b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: p4web
# REQUIRE: LOGIN
# KEYWORD: shutdown

# These variables (and many more) can be set via environment variables. Check
# p4web -h for what you can set.
#
# Add the following line to /etc/rc.conf to enable p4web:
# p4web_enable (bool):	Set to "NO" by default.
#			Set it to "YES" to enable p4web.
# p4web_mode (str):	Default to "viewer-auth".
#			Specifies to mode to startup in. Possible values:
#			viewer-auth, viewer-noauth, standard.
# p4web_listen (int):	Default to "8080".
#			Set to TCP port to bind to.
# p4web_port (str):	Default to "perforce:1666".
#			Set to P4PORT string to bind to.
# p4web_log (str):	Default to "%%P4LOG%%".
#			Log all requests sent to P4Web to the specified file.
# p4web_args (str):	Custom additional arguments to be passed
#			to p4web (default to empty).
#

. /etc/rc.subr

name="p4web"
rcvar=p4web_enable

load_rc_config $name

: ${p4web_enable="NO"}
: ${p4web_mode="viewer-auth"}
: ${p4web_listen="8080"}
: ${p4web_port="perforce:1666"}
: ${p4web_log="%%P4LOG%%"}

case ${p4web_mode} in
viewer-auth)
	p4web_args="${p4web_args} -B"
	;;
viewer-noauth)
	p4web_args="${p4web_args} -b"
	;;
standard)
	;;
*)
	echo "Invalid p4web_mode: ${p4web_mode}"
	return 2
	;;
esac

command="%%PREFIX%%/sbin/p4web"
command_args="-w ${p4web_listen} -p ${p4web_port} -L ${p4web_log} ${p4web_args} > /dev/null 2>&1 &"
p4web_user="p4admin"

run_rc_command "$1"