ports/ftp/ftpproxy/files/ftpproxy.in
Juraj Lutter 629de3e1aa ftp/ftpproxy: Minor cosmetic changes
Add rc.d script and option to use PID file.
Switch to DISTVERSION.
Add license information.

PR:		269722
Approved by:	maintainer timeout (3+ weeks)
2025-03-13 12:18:09 +01:00

46 lines
1.2 KiB
Bash

#!/bin/sh
# PROVIDE: ftpproxy
# REQUIRE: LOGIN FILESYSTEMS ftp
# KEYWORD: shutdown
#
# ftpproxy_enable (bool): Set to "YES" to enable ftpproxy.
# (default: "NO")
#
# ftpproxy_config (str): Name of ftpproxy config file
# (default: "/usr/local/etc/ftpproxy.conf")
#
# ftpproxy_defaulthost (str): Name of ftp server to connect to.
# (default: "localhost")
#
# ftpproxy_flags (str): Additional flags for ftpproxy
# (default: "")
#
# ftpproxy_user (str): The user to run ftpproxy as
# (default: "root")
#
. /etc/rc.subr
name=ftpproxy
rcvar=ftpproxy_enable
pidfile="/var/run/ftpproxy.pid"
start_cmd="${name}_start"
command="%%PREFIX%%/sbin/ftp.proxy"
load_rc_config $name
: ${ftpproxy_enable="NO"}
: ${ftpproxy_config="%%PREFIX%%/etc/ftpproxy.conf"}
: ${ftpproxy_defaulthost="localhost"}
: ${ftpproxy_flags=""}
: ${ftpproxy_user="root"}
ftpproxy_start()
{
/usr/bin/install -o ${ftpproxy_user} /dev/null ${pidfile}
/usr/bin/su -m ${ftpproxy_user} -c "${command} -f ${ftpproxy_config} \
-P ${pidfile} ${ftpproxy_flags} ${ftpproxy_defaulthost}"
}
run_rc_command "$1"