Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rc.d/ldconfig change



On Mon, 2005-12-19 at 12:33 -0800, Brooks Davis wrote:
> On Sun, Dec 18, 2005 at 06:31:20PM +0100, Florent Thoumie wrote:
> > 	Since we have some ports that want to ldconfig directories early
> > 	in the boot process (actually, early in localpkg sequence), I 
> > 	think it would be a good idee to support 
> > 	${PREFIX}/etc/ld.so.conf.d/ directories (or whatever the name).
> > 
> > 	Here's what I was thinking about (see attached patch).
> > 
> > 	This way, I can imagine a USE_LDCONFIG variable containing 
> > 	directories and bsd.port.mk would just :
> > 
> > 	.if defined(USE_LDCONFIG)
> > 	echo ${USE_LDCONFIG} > ${PREFIX}/etc/ld.so.conf.d/${UNIQUENAME}
> > 	.endif
> > 
> > 	[...] instead of installing 000.${UNIQUENAME}.sh in 
> > 	${PREFIX}/etc/rc.d.
> > 
> > 	I guess it should be ok since /etc/rc.d/ldconfig is launched 
> > 	after /etc/rc.d/mountcritremote. We can assume that local 
> > 	directories will be available (by default local_ldconfig="").
> 
> Sounds good to me.  I'd been thinking we could use something like
> this since all those scripts are ugly.  This nice thing about this
> is that we could use a compatibility port that just installs a
> 000.ldconfig-compat.sh script to shim old versions to allow the hack
> script to die in ports almost immediately.

	Here's the (almost) complete patch. I'll take care of the ports 
	part once we get this in the tree.

	I finally set local_ldconfig to "/usr/local/etc/ld.so.conf.d
	/usr/X11R6/etc/ld.so.conf.d" because we already have 
	local_startup and local_periodic (in etc/defaults/periodic.conf)
	using such directories (and that's one thing less the user has 
	to do).

	I've added an entry in the local mtree file and bumped 
	__FreeBSD_version.

	Someone could argue the directory's name (ld.so.conf.d), I 
	really don't care, I figured it was simple enough so that anyone
	would know what it is for.

-- 
Florent Thoumie
flz@xxxxxxxxxxx
FreeBSD committer
Index: etc/defaults/rc.conf
===================================================================
RCS file: /home/ncvs/src/etc/defaults/rc.conf,v
retrieving revision 1.267
diff -u -r1.267 rc.conf
--- etc/defaults/rc.conf	15 Dec 2005 01:04:48 -0000	1.267
+++ etc/defaults/rc.conf	20 Dec 2005 00:18:21 -0000
@@ -493,6 +493,8 @@
 			# shared library search paths
 ldconfig_paths_aout="/usr/lib/compat/aout /usr/X11R6/lib/aout /usr/local/lib/aout"
 			# a.out shared library search paths
+local_ldconfig="/usr/local/etc/ld.so.conf.d /usr/X11R6/etc/ld.so.conf.d"
+			# Local directories with ldconfig configuration files.
 kern_securelevel_enable="NO"	# kernel security level (see init(8)),
 kern_securelevel="-1"	# range: -1..3 ; `-1' is the most insecure
 			# Note that setting securelevel to 0 will result
Index: etc/rc.d/ldconfig
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/ldconfig,v
retrieving revision 1.14
diff -u -r1.14 ldconfig
--- etc/rc.d/ldconfig	16 Jan 2005 08:34:30 -0000	1.14
+++ etc/rc.d/ldconfig	20 Dec 2005 00:18:21 -0000
@@ -22,6 +22,11 @@
 	checkyesno ldconfig_insecure && _ins="-i"
 	if [ -x "${ldconfig_command}" ]; then
 		_LDC="/lib /usr/lib"
+		for i in ${local_ldconfig}; do
+			if [ -d "${i}" ]; then
+				ldconfig_paths="${ldconfig_paths} `ls ${i}`"
+			fi
+		done
 		for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
 			if [ -r "${i}" ]; then
 				_LDC="${_LDC} ${i}"
Index: share/man/man5/rc.conf.5
===================================================================
RCS file: /home/ncvs/src/share/man/man5/rc.conf.5,v
retrieving revision 1.274
diff -u -r1.274 rc.conf.5
--- share/man/man5/rc.conf.5	19 Dec 2005 10:57:00 -0000	1.274
+++ share/man/man5/rc.conf.5	20 Dec 2005 00:18:22 -0000
@@ -2822,6 +2822,13 @@
 Set this variable to
 .Dq Li YES
 to disable that security check during system startup.
+.It Va local_ldconfig
+.Pq Vt str
+Set to the list of local
+.Xr ldconfig 8
+directories.
+Each file in those directories will be passed as arguments to
+.Xr ldconfig 8 .
 .It Va kern_securelevel_enable
 .Pq Vt bool
 Set to
Index: sys/sys/param.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/param.h,v
retrieving revision 1.257
diff -u -r1.257 param.h
--- sys/sys/param.h	19 Dec 2005 00:13:11 -0000	1.257
+++ sys/sys/param.h	20 Dec 2005 00:18:22 -0000
@@ -57,7 +57,7 @@
  *		is created, otherwise 1.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 700009	/* Master, propagated to newvers */
+#define __FreeBSD_version 700010	/* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include <sys/types.h>
Index: etc/mtree/BSD.local.dist
===================================================================
RCS file: /home/ncvs/src/etc/mtree/BSD.local.dist,v
retrieving revision 1.117
diff -u -r1.117 BSD.local.dist
--- etc/mtree/BSD.local.dist	10 Jun 2005 20:14:38 -0000	1.117
+++ etc/mtree/BSD.local.dist	20 Dec 2005 00:18:22 -0000
@@ -8,6 +8,8 @@
     bin
     ..
     etc
+        ld.so.conf.d
+        ..
         pam.d
         ..
         rc.d

Attachment: signature.asc
Description: This is a digitally signed message part