aboutsummaryrefslogtreecommitdiff
path: root/www/lighttpd
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2010-08-31 10:11:59 +0000
committerMartin Matuska <mm@FreeBSD.org>2010-08-31 10:11:59 +0000
commitcc1e730e87f14061f85dc69be3c13f44f25a9fc5 (patch)
tree7b761cc73458fa703c22d73b4786b902babd888b /www/lighttpd
parent54f88c5e1f706915062cd7b2a4a92c8f388a3b50 (diff)
downloadports-cc1e730e87f14061f85dc69be3c13f44f25a9fc5.tar.gz
ports-cc1e730e87f14061f85dc69be3c13f44f25a9fc5.zip
Notes
Diffstat (limited to 'www/lighttpd')
-rw-r--r--www/lighttpd/Makefile2
-rw-r--r--www/lighttpd/files/lighttpd.sh.in62
2 files changed, 57 insertions, 7 deletions
diff --git a/www/lighttpd/Makefile b/www/lighttpd/Makefile
index e1453f9a452c..6999872abe80 100644
--- a/www/lighttpd/Makefile
+++ b/www/lighttpd/Makefile
@@ -7,7 +7,7 @@
PORTNAME?= lighttpd
PORTVERSION= 1.4.28
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES?= www
MASTER_SITES?= http://download.lighttpd.net/lighttpd/releases-1.4.x/
diff --git a/www/lighttpd/files/lighttpd.sh.in b/www/lighttpd/files/lighttpd.sh.in
index f87920716dee..6f12a3ef2a35 100644
--- a/www/lighttpd/files/lighttpd.sh.in
+++ b/www/lighttpd/files/lighttpd.sh.in
@@ -10,11 +10,21 @@
#
# lighttpd_enable (bool): Set it to "YES" to enable lighttpd
# Default is "NO".
-# lighttpd_conf (path): Set full path to config file.
+# lighttpd_conf (path): Set full path to configuration file.
# Default is "%%PREFIX%%/etc/lighttpd/lighttpd.conf".
# lighttpd_pidfile (path): Set full path to pid file.
# Default is "/var/run/lighttpd.pid".
#
+# Add the following lines to /etc/rc.conf for multiple instances:
+# (overrides lighttpd_conf and lighttpd_pidfile from above)
+#
+# lighttpd_instances (string): Instances of lighttpd
+# Default is "" (no instances).
+# lighttpd_${i}_conf (path): Set full path to instance configuration file.
+# Default is "%%PREFIX%%/etc/lighttpd/${i}.conf".
+# lighttpd_${i}_pidfile (path): Set full path to instance pid file
+# Default is "/var/run/lighttpd_${i}.pid".
+#
. /etc/rc.subr
@@ -26,6 +36,7 @@ load_rc_config $name
: ${lighttpd_enable="NO"}
: ${lighttpd_conf=""}
: ${lighttpd_pidfile="/var/run/${name}.pid"}
+: ${lighttpd_instances=""}
# Compatibility for old configuration file location
deprecated_conf=
@@ -39,10 +50,6 @@ if [ -z "${lighttpd_conf}" ]; then
fi
command=%%PREFIX%%/sbin/lighttpd
-command_args="-f ${lighttpd_conf}"
-pidfile=${lighttpd_pidfile}
-required_files=${lighttpd_conf}
-start_precmd="check_deprecated"
stop_postcmd=stop_postcmd
restart_precmd="checkconfig"
reload_precmd=reload_precmd
@@ -50,6 +57,9 @@ reload_postcmd=reload_postcmd
sig_reload="INT"
check_cmd="checkconfig"
extra_commands="reload check"
+command_args="-f ${lighttpd_conf}"
+pidfile=${lighttpd_pidfile}
+required_files=${lighttpd_conf}
check_deprecated()
{
@@ -88,4 +98,44 @@ reload_postcmd()
run_rc_command start
}
-run_rc_command "$1"
+run_instance()
+{
+ _i="$1"
+ _rcmd="$2"
+ name=${_orig_name}_${_i}
+ eval ${name}_enable=${lighttpd_enable}
+ eval lighttpd_conf=\"\${lighttpd_${_i}_conf:-"%%PREFIX%%/etc/lighttpd/${_i}.conf"}\"
+ eval lighttpd_pidfile=\"\${lighttpd_${_i}_pidfile:-"/var/run/lighttpd_${_i}.pid"}\"
+ command_args="-f ${lighttpd_conf}"
+ pidfile=${lighttpd_pidfile}
+ required_files=${lighttpd_conf}
+ run_rc_command ${_rcmd}
+}
+
+if [ -n "${lighttpd_instances}" ]; then
+ _orig_name="${name}"
+ _run_cmd="$1"
+ if [ $# -gt 0 ]; then
+ shift
+ fi
+ if [ -n "$*" ]; then
+ _run_instances="$*"
+ fi
+ if [ -n "${_run_instances}" ]; then
+ for _a in $_run_instances; do
+ for _in in ${lighttpd_instances}; do
+ if [ "$_a" = "$_in" ]; then
+ _runlist="${_runlist} ${_a}"
+ fi
+ done
+ done
+ else
+ _runlist="${lighttpd_instances}"
+ fi
+ for _in in ${_runlist}; do
+ run_instance $_in $_run_cmd
+ done
+else
+ start_precmd="check_deprecated"
+ run_rc_command "$1"
+fi