ldconfig revision 103436
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 103436 2002-09-17 01:49:00Z peter $
5#
6
7# PROVIDE: ldconfig
8# REQUIRE: mountall
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		ldconfig=${ldconfig_command}
24		checkyesno ldconfig_insecure && ldconfig="${ldconfig} -i"
25		if [ -x "${ldconfig_command}" ]; then
26			_LDC=/usr/lib
27			for i in ${ldconfig_paths}; do
28				if [ -d "${i}" ]; then
29					_LDC="${_LDC} ${i}"
30				fi
31			done
32			echo 'ELF ldconfig path:' ${_LDC}
33			${ldconfig} -elf ${_LDC}
34
35			# Legacy aout support for i386 only
36			case `sysctl -n hw.machine_arch` in
37			i386)
38				# Default the a.out ldconfig path.
39				: ${ldconfig_paths_aout=${ldconfig_paths}}
40				_LDC=/usr/lib/aout
41				for i in ${ldconfig_paths_aout}; do
42					if [ -d "${i}" ]; then
43						_LDC="${_LDC} ${i}"
44					fi
45				done
46				echo 'a.out ldconfig path:' ${_LDC}
47				${ldconfig} -aout ${_LDC}
48				;;
49			esac
50		fi
51		;;
52	NetBSD)
53		if [ -f ${ldconfig_command} ]; then
54			echo "Creating a.out runtime link editor directory cache."
55			${ldconfig_command}
56		fi
57		;;
58	*)
59		;;
60	esac
61}
62
63load_rc_config $name
64run_rc_command "$1"
65