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

# PROVIDE: nfsen
# REQUIRE: LOGIN
# KEYWORD: shutdown
#

. /etc/rc.subr

name=nfsen
rcvar=nfsen_enable
load_rc_config $name

nfsen_enable=${nfsen_enable-"NO"}
#nfsen_flags=${nfsen_flags-""}
nfsen_user=${nfsen_user-"%%NFSENOWN%%"}

command="%%PREFIX%%/bin/nfsen"
start_cmd="%%PREFIX%%/bin/nfsen start"
stop_cmd="%%PREFIX%%/bin/nfsen stop"
reload_cmd="%%PREFIX%%/bin/nfsen reconfig"
status_cmd="%%PREFIX%%/bin/nfsen status"
start_precmd=nfsen_start_precmd

extra_commands=reload

nfsen_start_precmd()
{
	# This replicates functionality provided by
	# the perl install script that we're bypassing.
	# It also is better because you don't have to reinstall
	# to get this file back
	if [ ! -e %%PREFIX%%/var/nfsen/profiles-stat/live/profile.dat ]; then
		time=$(/bin/date +%s);
		timeu=$(/bin/expr $time - 300);
		profile_dat=%%PREFIX%%/var/nfsen/profiles-stat/live/profile.dat
		/usr/bin/printf "name = live
		group = .
		tbegin = $time
		tcreate = $time
		tstart = $time
		tend = $time
		updated = $timeu
		expire = 0
		maxsize = 0
		size = 0
		type = 0
		locked = 0
		status = OK
		version = 130" | /usr/bin/tr -d '\011' > ${profile_dat}
		chown ${nfsen_user} ${profile_dat}
	fi
}

run_rc_command "$1"