diff options
author | Sergey A. Osokin <osa@FreeBSD.org> | 2008-10-15 07:36:39 +0000 |
---|---|---|
committer | Sergey A. Osokin <osa@FreeBSD.org> | 2008-10-15 07:36:39 +0000 |
commit | 2274af46bc026aaef09eaf91caa1ad28c4cfff75 (patch) | |
tree | bccf261db1201e03a82f951b1e9dd8d445da4e14 /www | |
parent | 715402ff9dd54f52a87fbe8ae8f344b70cac931a (diff) |
Notes
Diffstat (limited to 'www')
-rw-r--r-- | www/nginx/Makefile | 1 | ||||
-rw-r--r-- | www/nginx/files/nginx.sh.in | 87 | ||||
-rw-r--r-- | www/nginx/pkg-plist | 2 |
3 files changed, 67 insertions, 23 deletions
diff --git a/www/nginx/Makefile b/www/nginx/Makefile index 5cd6f41aa211..44416bd78d67 100644 --- a/www/nginx/Makefile +++ b/www/nginx/Makefile @@ -7,6 +7,7 @@ PORTNAME= nginx PORTVERSION= 0.6.32 +PORTREVISION= 1 CATEGORIES= www MASTER_SITES= http://sysoev.ru/nginx/ MASTER_SITES+= ${MASTER_SITE_LOCAL} diff --git a/www/nginx/files/nginx.sh.in b/www/nginx/files/nginx.sh.in index 69e3405162b0..bce190f51ba0 100644 --- a/www/nginx/files/nginx.sh.in +++ b/www/nginx/files/nginx.sh.in @@ -2,43 +2,86 @@ # $FreeBSD$ # PROVIDE: nginx -# REQUIRE: DAEMON -# BEFORE: LOGIN +# REQUIRE: LOGIN cleanvar # KEYWORD: shutdown -# Define these nginx_* variables in one of these files: -# /etc/rc.conf -# /etc/rc.conf.local -# /etc/rc.conf.d/nginx # -# DO NOT CHANGE THESE DEFAULT VALUES HERE -# -nginx_enable=${nginx_enable-"NO"} -nginx_flags=${nginx_flags-""} -nginx_pidfile=${nginx_pidfile-"/var/run/nginx.pid"} +# Add the following lines to /etc/rc.conf to enable nginx: +# nginx_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable nginx +# nginx_profiles (str): Set to "NO" by default. +# Unsupported feature, reserved for future releases. +# nginxlimits_enable (bool): Set to "NO" by default. +# Set it to yes to run `limits $limits_args` +# just before nginx starts. +# nginx_flags (str): Set to "" by default. +# Extra flags passed to start command. +# nginxlimits_args (str): Default to "-e -U %%WWWOWN%%" +# Arguments of pre-start limits run. . %%RC_SUBR%% name="nginx" rcvar=`set_rcvar` + +start_precmd="nginx_precmd" +restart_precmd="nginx_checkconfig" +reload_precmd="nginx_checkconfig" +configtest_cmd="nginx_checkconfig" +upgrade_precmd="nginx_checkconfig" +upgrade_cmd="nginx_upgrade" command="%%PREFIX%%/sbin/nginx" +_pidprefix="/var/run/nginx" +pidfile="${_pidprefix}.pid" +required_files=%%PREFIX%%/etc/nginx/nginx.conf + +[ -z "$nginx_enable" ] && nginx_enable="NO" +[ -z "$nginx_profiles" ] && nginx_profiles="NO" +[ -z "$nginx_flags" ] && nginx_flags="" +[ -z "$nginxlimits_enable" ] && nginxlimits_enable="NO" +[ -z "$nginxlimits_args" ] && nginxlimits_args="-e -U %%WWWOWN%%" load_rc_config $name -pidfile="${nginx_pidfile}" +if [ -n "$2" ]; then + echo "Profiles are unsupported by this version, exit..." + exit 1 +fi -extra_commands="configtest reload" +nginx_checkconfig() +{ + echo "Performing sanity check on nginx configuration:" + eval ${command} ${nginx_flags} -t +} -configtest_cmd="configtest_cmd" -configtest_cmd() { - echo "Configuration syntax test for ${name}." - if ${command} ${nginx_flags} -t; then - : - else - err 8 "FATAL: bad config for ${name}" - fi +nginx_upgrade() +{ + echo "Upgrading nginx binary:" + + reload_precmd="" + sig_reload="USR2" + run_rc_command ${rc_prefix}reload $rc_extra_args || return 1 + + sleep 1 + + echo "Stopping old binary:" + + sig_reload="QUIT" + pidfile="$pidfile.oldbin" + run_rc_command ${rc_prefix}reload $rc_extra_args || return 1 } -start_cmd="echo \"Starting ${name}.\"; /usr/bin/limits -U www ${command} ${nginx_flags}" +nginx_precmd() +{ + nginx_checkconfig + + if checkyesno nginxlimits_enable + then + eval `/usr/bin/limits ${nginxlimits_args}` 2>/dev/null + else + return 0 + fi +} +extra_commands="reload configtest upgrade" run_rc_command "$1" diff --git a/www/nginx/pkg-plist b/www/nginx/pkg-plist index 824c6b9b67bc..a7e17fd87740 100644 --- a/www/nginx/pkg-plist +++ b/www/nginx/pkg-plist @@ -21,4 +21,4 @@ sbin/nginx @exec [ -d %%NGINX_TMPDIR%% ] || mkdir -p %%NGINX_TMPDIR%% @exec chown %%WWWOWN%%:%%WWWGRP%% %%NGINX_TMPDIR%% -@unexec rm -fr %%NGINX_TMPDIR%% +@unexec if [ -z ${UPGRADE_PORT} ] ; then rm -fr %%NGINX_TMPDIR%%; fi |