Index: security/stunnel/Makefile =================================================================== --- security/stunnel/Makefile (revision 552077) +++ security/stunnel/Makefile (working copy) @@ -36,6 +36,10 @@ CONFIGURE_ARGS= --localstatedir=/var/tmp --enable-static --disable-systemd \ --with-ssl="${OPENSSLBASE}" SHEBANG_FILES= src/stunnel3.in +SUB_FILES= pid.conf +SUB_LIST= STUNNEL_PIDFILE=${STUNNEL_PIDFILE} \ + STUNNEL_USER=${STUNNEL_USER} \ + STUNNEL_GROUP=${STUNNEL_GROUP} OPTIONS_DEFINE= DOCS EXAMPLES FIPS IPV6 LIBWRAP OPTIONS_SINGLE= THREAD @@ -51,6 +55,7 @@ PTHREAD_DESC= Use the pthread(3) threading model UCONTEXT_DESC= Use the ucontext(3) threading model +STUNNEL_PIDFILE= /var/run/stunnel/stunnel.pid STUNNEL_USER?= stunnel STUNNEL_GROUP?= stunnel @@ -110,7 +115,7 @@ post-install: ${MKDIR} ${STAGEDIR}${ETCDIR}/conf.d/ - ${INSTALL_DATA} ${FILESDIR}/pid.conf ${STAGEDIR}${ETCDIR}/conf.d/00-pid.conf + ${INSTALL_DATA} ${WRKDIR}/pid.conf ${STAGEDIR}${ETCDIR}/conf.d/00-pid.conf cert: @${ECHO} "" Index: security/stunnel/files/pid.conf =================================================================== --- security/stunnel/files/pid.conf (revision 552077) +++ security/stunnel/files/pid.conf (nonexistent) @@ -1 +0,0 @@ -pid = /var/run/stunnel.pid Index: security/stunnel/files/pid.conf.in =================================================================== --- security/stunnel/files/pid.conf.in (nonexistent) +++ security/stunnel/files/pid.conf.in (working copy) @@ -0,0 +1 @@ +pid = %%STUNNEL_PIDFILE%% Index: security/stunnel/files/stunnel.in =================================================================== --- security/stunnel/files/stunnel.in (revision 552077) +++ security/stunnel/files/stunnel.in (working copy) @@ -16,9 +16,11 @@ # Set it to the full path to the config file # that stunnel will use during the automated # start-up. -# stunnel_pidfile (str): Default "%%PREFIX%%/var/stunnel/stunnel.pid" +# stunnel_pidfile (str): Default "%%STUNNEL_PIDFILE%%" # Set it to the value of 'pid' in # the stunnel.conf file. +# stunnel_uid (str): Default "%%STUNNEL_USER%%" +# stunnel_gid (str): Default "%%STUNNEL_GROUP%%" # . /etc/rc.subr @@ -30,7 +32,9 @@ : ${stunnel_enable="NO"} : ${stunnel_config="%%ETCDIR%%/${name}.conf"} -: ${stunnel_pidfile="/var/run/${name}.pid"} +: ${stunnel_pidfile="%%STUNNEL_PIDFILE%%"} +: ${stunnel_uid="%%STUNNEL_USER%%"} +: ${stunnel_gid="%%STUNNEL_GROUP%%"} command="%%PREFIX%%/bin/stunnel" command_args=${stunnel_config} @@ -38,4 +42,15 @@ required_files="${stunnel_config}" +start_precmd=stunnel_start_precmd + +stunnel_start_precmd () +{ + local piddir + piddir=`/usr/bin/dirname "${pidfile}"` + if [ ! -d "${piddir}" ] ; then + /usr/bin/install -d -o "${stunnel_uid}" -g "${stunnel_gid}" "${piddir}" + fi +} + run_rc_command "$1"