1#!/bin/sh
2
3#
4# Add the following line to /etc/rc.conf to enable SmbFTPD:
5# smbftpd_enable (bool):	Set to "NO" by default.
6#				Set it to "YES" to enable SmbFTPD.
7
8name="smbftpd"
9command="@PREFIX@/sbin/smbftpd"
10smbftpd_enable=${smbftpd_enable-"NO"}
11smbftpd_flags=${smbftpd_flags-"-D"}
12
13OSRelease=`sysctl -n kern.osrelease`
14case $OSRelease in
15[567].*)
16	. /etc/rc.subr
17
18	rcvar=`set_rcvar`
19	load_rc_config $name
20	run_rc_command "$1"
21	;;
22*)
23	. /etc/rc.conf
24	case $1 in
25	start)
26		case "$smbftpd_enable" in
27		[Nn][Oo])
28			echo "The \"smbftpd_enable\" must be set to \"Yes\" in rc.conf"
29			exit 1
30			;;
31		esac
32		echo "Starting $name"
33		$command $smbftpd_flags
34		;;
35	stop)
36		echo "Stopping $name"
37		killall $name
38		;;
39	restart)
40		$0 stop
41		sleep 1
42		$0 start
43		;;
44	*)
45		echo "Usages: $0 [start|stop|restart]"
46		;;
47	esac
48	;;
49esac
50