ldconfig revision 119011
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 119011 2003-08-17 07:49:11Z gordon $
5#
6
7# PROVIDE: ldconfig
8# REQUIRE: mountall mountcritremote
9# BEFORE:  DAEMON
10# KEYWORD: FreeBSD NetBSD
11
12. /etc/rc.subr
13
14name="ldconfig"
15ldconfig_command="/sbin/ldconfig"
16start_cmd="ldconfig_start"
17stop_cmd=":"
18
19ldconfig_start()
20{
21	case ${OSTYPE} in
22	FreeBSD)
23		_ins=
24		ldconfig=${ldconfig_command}
25		checkyesno ldconfig_insecure && _ins="-i"
26		if [ -x "${ldconfig_command}" ]; then
27			_LDC="/lib /usr/lib"
28			for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
29				if [ -r "${i}" ]; then
30					_LDC="${_LDC} ${i}"
31				fi
32			done
33			echo 'ELF ldconfig path:' ${_LDC}
34			${ldconfig} -elf ${_ins} ${_LDC}
35
36			# Legacy aout support for i386 only
37			case `sysctl -n hw.machine_arch` in
38			i386)
39				# Default the a.out ldconfig path.
40				: ${ldconfig_paths_aout=${ldconfig_paths}}
41				_LDC=/usr/lib/aout
42				for i in ${ldconfig_paths_aout} /etc/ld.so.conf; do
43					if [ -r "${i}" ]; then
44						_LDC="${_LDC} ${i}"
45					fi
46				done
47				echo 'a.out ldconfig path:' ${_LDC}
48				${ldconfig} -aout ${_ins} ${_LDC}
49				;;
50			esac
51		fi
52		;;
53	NetBSD)
54		if [ -f ${ldconfig_command} ]; then
55			echo "Creating a.out runtime link editor directory cache."
56			${ldconfig_command}
57		fi
58		;;
59	*)
60		;;
61	esac
62}
63
64load_rc_config $name
65run_rc_command "$1"
66