2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: ldconfig
|
2016-05-30 19:59:51 +00:00
|
|
|
# REQUIRE: FILESYSTEMS
|
2002-06-13 22:14:37 +00:00
|
|
|
# BEFORE: DAEMON
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="ldconfig"
|
2016-04-23 16:10:54 +00:00
|
|
|
desc="Configure the shared library cache"
|
2002-06-13 22:14:37 +00:00
|
|
|
ldconfig_command="/sbin/ldconfig"
|
2001-06-16 07:16:14 +00:00
|
|
|
start_cmd="ldconfig_start"
|
|
|
|
stop_cmd=":"
|
|
|
|
|
|
|
|
ldconfig_start()
|
|
|
|
{
|
2006-12-30 22:53:20 +00:00
|
|
|
local _files _ins
|
2006-06-21 10:22:44 +00:00
|
|
|
|
2004-01-17 10:40:45 +00:00
|
|
|
_ins=
|
|
|
|
ldconfig=${ldconfig_command}
|
|
|
|
checkyesno ldconfig_insecure && _ins="-i"
|
|
|
|
if [ -x "${ldconfig_command}" ]; then
|
|
|
|
_LDC="/lib /usr/lib"
|
2006-01-08 10:15:31 +00:00
|
|
|
for i in ${ldconfig_local_dirs}; do
|
|
|
|
if [ -d "${i}" ]; then
|
2006-06-21 10:22:44 +00:00
|
|
|
_files=`find ${i} -type f`
|
|
|
|
if [ -n "${_files}" ]; then
|
|
|
|
ldconfig_paths="${ldconfig_paths} `cat ${_files} | sort -u`"
|
|
|
|
fi
|
2006-01-08 10:15:31 +00:00
|
|
|
fi
|
|
|
|
done
|
2004-01-17 10:40:45 +00:00
|
|
|
for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
|
|
|
|
if [ -r "${i}" ]; then
|
|
|
|
_LDC="${_LDC} ${i}"
|
|
|
|
fi
|
|
|
|
done
|
2009-10-10 22:17:03 +00:00
|
|
|
check_startmsgs && echo 'ELF ldconfig path:' ${_LDC}
|
2004-01-17 10:40:45 +00:00
|
|
|
${ldconfig} -elf ${_ins} ${_LDC}
|
|
|
|
|
2006-01-08 10:15:31 +00:00
|
|
|
case `sysctl -n hw.machine_arch` in
|
2017-04-18 03:40:36 +00:00
|
|
|
amd64|powerpc64)
|
2006-01-08 10:15:31 +00:00
|
|
|
for i in ${ldconfig_local32_dirs}; do
|
|
|
|
if [ -d "${i}" ]; then
|
2006-06-21 10:22:44 +00:00
|
|
|
_files=`find ${i} -type f`
|
|
|
|
if [ -n "${_files}" ]; then
|
|
|
|
ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`"
|
|
|
|
fi
|
2006-01-08 10:15:31 +00:00
|
|
|
fi
|
|
|
|
done
|
2007-12-13 00:51:01 +00:00
|
|
|
_LDC=""
|
|
|
|
for i in ${ldconfig32_paths}; do
|
|
|
|
if [ -r "${i}" ]; then
|
|
|
|
_LDC="${_LDC} ${i}"
|
|
|
|
fi
|
|
|
|
done
|
2009-10-10 22:17:03 +00:00
|
|
|
check_startmsgs &&
|
2008-06-23 04:46:54 +00:00
|
|
|
echo '32-bit compatibility ldconfig path:' ${_LDC}
|
2007-12-13 00:51:01 +00:00
|
|
|
${ldconfig} -32 -m ${_ins} ${_LDC}
|
2006-01-08 10:15:31 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-01-18 21:40:18 +00:00
|
|
|
case `sysctl -n hw.machine_arch` in
|
|
|
|
armv6)
|
|
|
|
for i in ${ldconfig_localsoft_dirs}; do
|
|
|
|
if [ -d "${i}" ]; then
|
|
|
|
_files=`find ${i} -type f`
|
|
|
|
if [ -n "${_files}" ]; then
|
|
|
|
ldconfigsoft_paths="${ldconfigsoft_paths} `cat ${_files} | sort -u`"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
_LDC=""
|
|
|
|
for i in ${ldconfigsoft_paths}; do
|
|
|
|
if [ -r "${i}" ]; then
|
|
|
|
_LDC="${_LDC} ${i}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
check_startmsgs &&
|
|
|
|
echo 'Soft Float compatibility ldconfig path:' ${_LDC}
|
|
|
|
${ldconfig} -soft -m ${_ins} ${_LDC}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2004-01-17 10:40:45 +00:00
|
|
|
# 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}}
|
2011-01-06 21:09:22 +00:00
|
|
|
_LDC=""
|
|
|
|
for i in /usr/lib/aout ${ldconfig_paths_aout} /etc/ld.so.conf; do
|
2003-06-30 15:02:05 +00:00
|
|
|
if [ -r "${i}" ]; then
|
2002-09-17 01:49:00 +00:00
|
|
|
_LDC="${_LDC} ${i}"
|
|
|
|
fi
|
|
|
|
done
|
2009-10-10 22:17:03 +00:00
|
|
|
check_startmsgs && echo 'a.out ldconfig path:' ${_LDC}
|
2004-01-17 10:40:45 +00:00
|
|
|
${ldconfig} -aout ${_ins} ${_LDC}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2001-06-16 07:16:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|