Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 Dec 2005 17:49:22 -0800
From:      Doug Barton <dougb@FreeBSD.org>
To:        Andrey Chernov <ache@freebsd.org>,  freebsd-current@FreeBSD.ORG
Subject:   Re: cvs commit: src/etc rc rc.shutdown rc.subr src/etc/rc.d localpkg src/sys/sys param.h
Message-ID:  <4390F9A2.208@FreeBSD.org>
In-Reply-To: <20051203012324.GA34147@nagual.pp.ru>
References:  <200512022006.jB2K67AK078509@repoman.freebsd.org> <20051203004057.GA20872@nagual.pp.ru> <4390EFB6.3090307@FreeBSD.org> <20051203012324.GA34147@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080802060406030009020905
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

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

--------------080802060406030009020905
Content-Type: text/plain;
 name="apache13.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="apache13.diff"

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
@@ -144,6 +144,14 @@
 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:
 	@${SED}	${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
 		${FILESDIR}/apache.sh > ${WRKSRC}/apache.sh
@@ -153,10 +161,10 @@
 	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}
 	@${TOUCH} ${DOCUMENT_ROOT}-dist/EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING
 	@${TOUCH} ${CGIBIN_ROOT}-dist/EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING
 	@${CHMOD} a-w ${DOCUMENT_ROOT}-dist ${CGIBIN_ROOT}-dist
 	@${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
@@ -18,7 +18,7 @@
 @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
 @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

--------------080802060406030009020905--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4390F9A2.208>