summaryrefslogtreecommitdiff
path: root/net/spoofdpi/files/spoofdpi.in
blob: 7c2beb0fc533c3c2081bd1a843849cda90d8db15 (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
#!/bin/sh

# PROVIDE: spoofdpi
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf or /etc/rc.conf.local to
# enable spoofdpi:
# spoofdpi_args (str):	Custom additional arguments to be passed
#			spoofdpi (default empty).
# spoofdpi_user (str):	User to run spoofdpi as. Default
#			to "%%USER%%" created by the port.
# spoofdpi_log (path):	Console log file (default /dev/null).

. /etc/rc.subr

case $0 in
/etc/rc*)
	# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
	# so get the name of the script from $_file
	name=$_file
	;;
*)
	name=$0
	;;
esac

name=${name##*/}
rcvar="${name}_enable"

load_rc_config "${name}"

eval "${rcvar}=\${${rcvar}:-'NO'}"
eval "_args=\${${name}_args:-''}"
eval "_user=\${${name}_user:-'%%USER%%'}"
eval "_log=\${${name}_log:-/dev/null}"

pidfile="/var/run/${name}.pid"

command="/usr/sbin/daemon"
command_args="-P ${pidfile} -u ${_user} -f -H -o ${_log} -m 3 %%PREFIX%%/bin/spoofdpi ${_args}"

run_rc_command "$1"