aboutsummaryrefslogtreecommitdiff
path: root/net-p2p/gift/files/giftd.in
blob: 6a2d822f0c7f165b136672bd211f2673180c8049 (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
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: giftd
# REQUIRE: DAEMON
# KEYWORD: shutdown

# Define these giftd_* variables in one of these files:
#       /etc/rc.conf
#       /etc/rc.conf.local
#       /etc/rc.conf.d/giftd
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE

giftd_enable="${giftd_enable-NO}"
giftd_flags="-d -q"
# giftd_user
# giftd_local_dir

. /etc/rc.subr

name=giftd
rcvar=`set_rcvar`
command=%%PREFIX%%/bin/giftd

required_dirs=${giftd_local_dir}
start_precmd=giftd_check_vars

giftd_check_vars() 
{
	if [ -z ${giftd_user} ]; then
		giftd_user=$(whoami)
	fi

	if [ $giftd_user = 'root' ]; then
		warn "You should set giftd_user to a non-root user for security reasons"
	fi

	if [ -z ${giftd_local_dir} ]; then
		giftd_local_dir="$(pw usershow $giftd_user | awk -F : '{ print $9 }')/.giFT"
	fi

	rc_flags="${giftd_flags} --local-dir=${giftd_local_dir}"
}

load_rc_config $name
run_rc_command "$1"