Re: cvs commit: src/etc rc rc.shutdown rc.subr src/etc/rc.d localpkg src/sys/sys param.h

From: Doug Barton <dougb_at_FreeBSD.org>
Date: Fri, 02 Dec 2005 17:49:22 -0800
Andrey Chernov wrote:
> On Fri, Dec 02, 2005 at 05:07:02PM -0800, Doug Barton wrote:
>> Yes, I agree that's a problem. However, it's a problem we have to solve, or
>> else we can't include local scripts in the base rcorder. As I wrote in my
> 
> What prevents to include them in the base rcorder AND run in the separate 
> subshell (sort of sandbox) in the same time? Perhaps just few variables 
> need to be added.

Well, unfortunately it's a little more complicated than that. The rc.d
system has some default assumptions about the specialness of scripts that
end in .sh, and while I don't necessarily agree with that, I didn't want to
redo it all.

> Typical problem for porter (like me) is not knowing deeps of rc.d 
> subsystem. To be more specific, personally me can't make 'apache13' port 
> do its limits without damaging main rc shell in the same time. If you can, 
> please look 'apache13' port and feel free to fix rc script there.

I'm sorry if I wasn't clear before, the only thing port authors need to do
for properly functioning rc.d-style scripts is to install them as foo
instead of foo.sh. I have attached an untested patch for apache13 that
should do the trick, or at least show you what I have in mind.

At some point down the road, when we've dropped support for releases prior
to 6.1, this will simply be the way that all such scripts are installed, but
between now and then, there will be some transition pain involved.

> I suspect I am not only one with such problem. Lots of environment things 
> can be damaged not running in the subshell: su, environment variables, 
> limits, etc. etc. What you provide as example is simplest case which cause 
> no problems, but I talk about problem cases, not simplest ones.

*nod* I fully acknowledge that there will be problems, and I am willing to
revisit this approach down the road if it looks like it's causing more pain
than it's worth. At this point though, I think we just have to let it play out.

Doug

Index: Makefile
===================================================================
RCS file: /usr/local/ncvs/ports/www/apache13/Makefile,v
retrieving revision 1.163
diff -u -r1.163 Makefile
--- Makefile	25 Nov 2005 03:17:11 -0000	1.163
+++ Makefile	3 Dec 2005 01:43:07 -0000
_at__at_ -144,6 +144,14 _at__at_
 MAN8=		ab.8 apachectl.8 apxs.8 httpd.8 logresolve.8 rotatelogs.8 \
 		${SUEXEC_MAN}
 
+.if ${OSVERSION} > 700006
+RC_SCRIPT=	apache
+.else
+RC_SCRIPT=	apache.sh
+.endif
+
+PLIST_SUB=	RC_SCRIPT="${RC_SCRIPT}"
+
 post-extract:
 	_at_${SED}	${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
 		${FILESDIR}/apache.sh > ${WRKSRC}/apache.sh
_at__at_ -153,10 +161,10 _at__at_
 	PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
 
 post-install:
-	${INSTALL_SCRIPT} ${WRKSRC}/apache.sh ${PREFIX}/etc/rc.d/apache.sh
+	${INSTALL_SCRIPT} ${WRKSRC}/apache.sh ${PREFIX}/etc/rc.d/${RC_SCRIPT}
 	_at_${TOUCH} ${DOCUMENT_ROOT}-dist/EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING
 	_at_${TOUCH} ${CGIBIN_ROOT}-dist/EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING
 	_at_${CHMOD} a-w ${DOCUMENT_ROOT}-dist ${CGIBIN_ROOT}-dist
 	_at_${CAT} ${PKGMESSAGE}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Index: pkg-plist
===================================================================
RCS file: /usr/local/ncvs/ports/www/apache13/pkg-plist,v
retrieving revision 1.59
diff -u -r1.59 pkg-plist
--- pkg-plist	18 Oct 2005 19:20:27 -0000	1.59
+++ pkg-plist	3 Dec 2005 01:41:13 -0000
_at__at_ -18,7 +18,7 _at__at_
 _at_unexec if cmp -s %D/etc/apache/srm.conf %D/etc/apache/srm.conf-dist; then rm -f %D/etc/apache/srm.conf; fi
 etc/apache/srm.conf-dist
 _at_exec [ -f %B/srm.conf ] || cp %B/%f %B/srm.conf
-etc/rc.d/apache.sh
+etc/rc.d/%%RC_SCRIPT%%
 include/apache/ap.h
 include/apache/ap_alloc.h
 include/apache/ap_compat.h
Received on Sat Dec 03 2005 - 00:49:28 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:48 UTC