summaryrefslogtreecommitdiff
path: root/ftp/vsftpd/files/vsftpd.in
blob: e4a6c28c652627f4f767743229eb19fa69ec7232 (plain)
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
#
# $FreeBSD$
#
# PROVIDE: vsftpd
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# To enable 'vsftpd' in standalone mode, you need to edit two files.
# 1. add the following line(s) to /etc/rc.conf to enable `vsftpd':
#
# vsftpd_enable="YES"
# vsftpd_flags="-ooption=value" # Not required
# vsftpd_config="/some/path/conf.file" # Not required
#
# 2. tell vsftpd about standalone mode
# Edit %%PREFIX%%/etc/vsftpd.conf (or /some/path/conf.file) to contain
#
# listen=YES
# background=YES
#
# Samples are provided at the end of the configuration file.

. /etc/rc.subr

name="vsftpd"
desc="Vsftpd FTP Server"
rcvar="vsftpd_enable"

load_rc_config "$name"

: ${vsftpd_enable:="NO"}
: ${vsftpd_config:="%%PREFIX%%/etc/$name.conf"}
command="%%PREFIX%%/libexec/$name"
required_files="${vsftpd_config}"
start_precmd="vsftpd_check"
extra_commands="reload"

vsftpd_check()
{
	if grep -q "^ftp[ 	]" /etc/inetd.conf
	then
		err 1 "ftp is already activated in /etc/inetd.conf"
	fi
	if ! egrep -q -i -E "^listen.*=.*YES$" ${vsftpd_config}
	then
		err 1 'vsftpd script need "listen=YES" in config file'
	fi
	if ! egrep -q -i -E "^background.*=.*YES$" ${vsftpd_config}
	then
		err 1 'vsftpd script need "background=YES" in config file'
	fi
}

run_rc_command "$1"