ldconfig revision 124618
1#!/bin/sh
2#
3# $NetBSD: ldconfig,v 1.5 2002/03/22 04:33:58 thorpej Exp $
4# $FreeBSD: head/etc/rc.d/ldconfig 124618 2004-01-17 10:40:45Z mtm $
5#
6
7# PROVIDE: ldconfig
8# REQUIRE: mountall mountcritremote
9# BEFORE:  DAEMON
10# KEYWORD: FreeBSD
11
12. /etc/rc.subr
13
14name="ldconfig"
15ldconfig_command="/sbin/ldconfig"
16start_cmd="ldconfig_start"
17stop_cmd=":"
18
19ldconfig_start()
20{
21	_ins=
22	ldconfig=${ldconfig_command}
23	checkyesno ldconfig_insecure && _ins="-i"
24	if [ -x "${ldconfig_command}" ]; then
25		_LDC="/lib /usr/lib"
26		for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
27			if [ -r "${i}" ]; then
28				_LDC="${_LDC} ${i}"
29			fi
30		done
31		echo 'ELF ldconfig path:' ${_LDC}
32		${ldconfig} -elf ${_ins} ${_LDC}
33
34		# Legacy aout support for i386 only
35		case `sysctl -n hw.machine_arch` in
36		i386)
37			# Default the a.out ldconfig path.
38			: ${ldconfig_paths_aout=${ldconfig_paths}}
39			_LDC=/usr/lib/aout
40			for i in ${ldconfig_paths_aout} /etc/ld.so.conf; do
41				if [ -r "${i}" ]; then
42					_LDC="${_LDC} ${i}"
43				fi
44			done
45			echo 'a.out ldconfig path:' ${_LDC}
46			${ldconfig} -aout ${_ins} ${_LDC}
47			;;
48		esac
49	fi
50}
51
52load_rc_config $name
53run_rc_command "$1"
54