freebsd-dev/etc/rc.d/ldconfig
Doug Barton dfdae5534f Add a mechanism to include files added by ports which contain
the names of directories to include in the base ldconfig script.
This will eliminate the need for each port to install its own
boot script which does nothing but ldocnfig a given directory.

This code was developed by flz (ports committer), discussed on
freebsd-rc@, and modified slightly by me.

Submitted by:	flz
Reviewed by:	brooks
2006-01-08 10:15:31 +00:00

70 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: ldconfig,v 1.5 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: ldconfig
# REQUIRE: mountcritremote cleanvar
# BEFORE: DAEMON
. /etc/rc.subr
name="ldconfig"
ldconfig_command="/sbin/ldconfig"
start_cmd="ldconfig_start"
stop_cmd=":"
ldconfig_start()
{
_ins=
ldconfig=${ldconfig_command}
checkyesno ldconfig_insecure && _ins="-i"
if [ -x "${ldconfig_command}" ]; then
_LDC="/lib /usr/lib"
for i in ${ldconfig_local_dirs}; do
if [ -d "${i}" ]; then
ldconfig_paths="${ldconfig_paths} `find ${i} -type f`"
fi
done
for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
if [ -r "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_ins} ${_LDC}
case `sysctl -n hw.machine_arch` in
amd64)
for i in ${ldconfig_local32_dirs}; do
if [ -d "${i}" ]; then
ldconfig32_paths="${ldconfig32_paths} `find ${i} -type f`"
fi
done
echo '32-bit compatibility ldconfig path:' ${ldconfig32_paths}
${ldconfig} -32 -m ${_ins} ${ldconfig32_paths}
;;
esac
# Legacy aout support for i386 only
case `sysctl -n hw.machine_arch` in
i386)
# Default the a.out ldconfig path.
: ${ldconfig_paths_aout=${ldconfig_paths}}
_LDC=/usr/lib/aout
for i in ${ldconfig_paths_aout} /etc/ld.so.conf; do
if [ -r "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'a.out ldconfig path:' ${_LDC}
${ldconfig} -aout ${_ins} ${_LDC}
;;
esac
fi
}
load_rc_config $name
run_rc_command "$1"