Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2005 18:47:25 -0800
From:      Doug Barton <dougb@FreeBSD.org>
To:        freebsd-ports@freebsd.org
Subject:   Proposed patch to update misc/compat5x to rc.d-style boot script
Message-ID:  <43A37C3D.1060700@FreeBSD.org>

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

Howdy,

In going through the list of ports that need updating to rc.d-style boot 
scripts I came across compat5x, which is a port that I actually use, and has 
no maintainer. So, I thought I'd put some work into this. Attached is a 
proposed patch that would convert this to rc.d style, and uses the 
infrastructure in both rc.d and bsd.port.mk to make the script as simple as 
possible.

If no one has any objection, I'll commit this change this weekend, and work 
on a similar change for compat4x. Of course, if anyone has better ideas, 
that's welcome too. :)

BTW, I purposely omitted any possible BEFORE lines, as I think in this case 
it would be much better for any ports that need compat5x to REQUIRE it instead.

Doug

-- 

     This .signature sanitized for your protection


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

Index: Makefile
===================================================================
RCS file: /usr/local/ncvs/ports/misc/compat5x/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- Makefile	25 Oct 2005 12:34:10 -0000	1.3
+++ Makefile	17 Dec 2005 02:16:34 -0000
@@ -28,7 +28,7 @@
 LDCONFIG_DIRS=	%%PREFIX%%/lib/compat
 TARGET_DIR=	${PREFIX}/lib/compat
 TARGET32_DIR=	${PREFIX}/lib32/compat
-RCSCRIPT=	${WRKDIR}/000.compat5x.sh
+USE_RC_SUBR=	${PORTNAME}.sh
 
 .include <bsd.port.pre.mk>
 
@@ -40,6 +40,8 @@
 RUN_DEPENDS=	${LOCALBASE}/share/compat/locale/UTF-8/LC_CTYPE:${PORTSDIR}/misc/localedata
 .endif
 
+SUB_LIST+=	LDCONFIG="${LDCONFIG}"
+
 .if ${ARCH} == alpha
 PLIST_SUB+=	ALPHA=""
 .else
@@ -48,8 +50,10 @@
 .if ${ARCH} == amd64
 PLIST_SUB+=	AMD64=""
 PLIST_SUB+=	LDCONFIG_LIB32="${LDCONFIG} -32"
+SUB_LIST+=	AMD64="" TARGET32_DIR="${TARGET32_DIR}"
 .else
 PLIST_SUB+=	AMD64="@comment "
+SUB_LIST+=	AMD64="@comment "
 .endif
 .if ${ARCH} == i386
 PLIST_SUB+=	I386=""
@@ -62,12 +66,7 @@
 PLIST_SUB+=	SPARC64="@comment "
 .endif
 
-do-build:
-	${ECHO_CMD} '#!/bin/sh' > ${RCSCRIPT}
-	${ECHO_CMD} '${LDCONFIG} -m ${LDCONFIG_RUNLIST}' >> ${RCSCRIPT}
-.if ${ARCH} == amd64
-	${ECHO_CMD} '${LDCONFIG} -32 -m ${TARGET32_DIR}' >> ${RCSCRIPT}
-.endif
+NO_BUILD=	yes
 
 do-install:
 	${MKDIR} ${TARGET_DIR}
@@ -77,6 +76,5 @@
 	(cd ${WRKSRC}/lib32 && ${INSTALL_DATA} *.so.* ${TARGET32_DIR})
 	${LDCONFIG} -32 -m ${TARGET32_DIR}
 .endif
-	${INSTALL_SCRIPT} ${RCSCRIPT} ${PREFIX}/etc/rc.d/
 
 .include <bsd.port.post.mk>
Index: pkg-plist
===================================================================
RCS file: /usr/local/ncvs/ports/misc/compat5x/pkg-plist,v
retrieving revision 1.2
diff -u -r1.2 pkg-plist
--- pkg-plist	6 Oct 2005 23:18:00 -0000	1.2
+++ pkg-plist	17 Dec 2005 02:11:44 -0000
@@ -1,4 +1,3 @@
-etc/rc.d/000.compat5x.sh
 lib/compat/libalias.so.4
 lib/compat/libarchive.so.1
 lib/compat/libasn1.so.7
Index: files/compat5x.sh.in
===================================================================
RCS file: files/compat5x.sh.in
diff -N files/compat5x.sh.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/compat5x.sh.in	17 Dec 2005 02:14:40 -0000
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: compat5x
+# REQUIRE: mountcritremote
+#
+# Add the following to /etc/rc.conf[.local] to enable this service
+#
+# compat5x_enable="YES"
+#
+
+. %%RC_SUBR%%
+
+name=compat5x
+rcvar=`set_rcvar`
+
+command=%%LDCONFIG%%
+command_args='-m %%PREFIX%%/lib/compat'
+%%AMD64%%
+%%AMD64%%start_postcmd=${name}_poststart
+%%AMD64%%compat5x_poststart () {
+%%AMD64%%	%%LDCONFIG%% -32 -m %%TARGET32_DIR%%
+%%AMD64%%}
+
+load_rc_config ${name}
+run_rc_command "$1"

--------------060008070703090908030604--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43A37C3D.1060700>