83eb2c3700
literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
67 lines
1.6 KiB
Bash
67 lines
1.6 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: gatling
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
|
|
# Set "gatling_enable=yes" in either /etc/rc.conf, /etc/rc.conf.local or
|
|
# /etc/rc.conf.d/gatling to enable gatling.
|
|
#
|
|
# Set gatling_root if you want to serve files from other locations than
|
|
# the default (%%PREFIX%%/www/data).
|
|
#
|
|
# Set gatling_ftp_enable=yes to make gatling serve files via FTP, too.
|
|
#
|
|
# Set gatling_ssl_enable=yes to serve files via HTTPS/SSL (needs tlsgatling).
|
|
#
|
|
# Additionally, you can set gatling_effective_user and gatling_flags; please
|
|
# see gatling(8) for further information about possible gatling_flags.
|
|
|
|
check_user() {
|
|
/usr/sbin/pw usershow -n ${gatling_effective_user} -q >/dev/null
|
|
}
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=gatling
|
|
rcvar=gatling_enable
|
|
|
|
load_rc_config ${name}
|
|
|
|
gatling_enable=${gatling_enable-"NO"}
|
|
gatling_root=${gatling_root:-%%PREFIX%%/www/data}
|
|
# needed to bind privileged ports at startup:
|
|
gatling_user=root
|
|
gatling_effective_user=${gatling_effective_user:-www}
|
|
gatling_flags="-u ${gatling_effective_user} -c ${gatling_root} ${gatling_flags}"
|
|
case "${gatling_ftp_enable}" in
|
|
[Yy][Ee][Ss])
|
|
gatling_flags="-f ${gatling_flags}"
|
|
;;
|
|
*)
|
|
gatling_flags="-F ${gatling_flags}"
|
|
;;
|
|
esac
|
|
|
|
case "${gatling_ssl_enable}" in
|
|
[Yy][Ee][Ss])
|
|
which_gatling="%%PREFIX%%/sbin/tlsgatling"
|
|
;;
|
|
*)
|
|
which_gatling="%%PREFIX%%/sbin/gatling"
|
|
;;
|
|
esac
|
|
|
|
gatling_flags="${which_gatling} ${gatling_flags} &"
|
|
command="%%PREFIX%%/sbin/gatling_wrapper"
|
|
command_interpreter="/bin/sh -T"
|
|
pidfile=/var/run/gatling_wrapper.pid
|
|
required_dirs="${gatling_root}"
|
|
required_files="${which_gatling}"
|
|
|
|
start_precmd=check_user
|
|
run_rc_command "$1"
|
|
|