nginx-devel: let the RC script work unprivileged

This takes advantage of the introduction of the SYSCONFBASE variable.
Tested on NetBSD/amd64.

While there, add support for the "configtest" command in the RC script.

Bumps PKGREVISION.
This commit is contained in:
khorben 2021-11-08 01:07:37 +00:00
parent 0add14dca1
commit 550c057338
2 changed files with 19 additions and 4 deletions

View file

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.65 2021/09/15 12:37:33 adam Exp $
# $NetBSD: Makefile,v 1.66 2021/11/08 01:07:37 khorben Exp $
DISTNAME= nginx-1.21.3
PKGREVISION= 1
MAINTAINER= imil@NetBSD.org

View file

@ -1,11 +1,15 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: nginx.sh,v 1.1 2013/02/22 17:06:54 imil Exp $
# $NetBSD: nginx.sh,v 1.2 2021/11/08 01:07:37 khorben Exp $
#
# PROVIDE: nginx
# REQUIRE: DAEMON
#
# You will need to set some variables in @SYSCONFBASE@/rc.conf to start nginx:
#
# nginx=YES
. /etc/rc.subr
$_rc_subr_loaded . @SYSCONFBASE@/rc.subr
name="nginx"
rcvar=${name}
@ -13,7 +17,17 @@ command="@PREFIX@/sbin/${name}"
required_files="@PKG_SYSCONFDIR@/${name}.conf"
pidfile="@VARBASE@/run/${name}.pid"
start_precmd="ulimit -n 2048"
extra_commands="reload"
extra_commands="configtest reload"
configtest_cmd="nginx_configtest"
nginx_configtest()
{
if [ ! -f ${required_files} ]; then
warn "${required_files} does not exist."
return 1;
fi
${command} -t -c ${required_files}
}
load_rc_config $name
run_rc_command "$1"