mirror of
https://github.com/opnsense/src.git
synced 2026-04-15 14:29:58 -04:00
72 lines
1.6 KiB
Bash
Executable file
72 lines
1.6 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
#
|
|
|
|
# PROVIDE: ldconfig
|
|
# REQUIRE: FILESYSTEMS
|
|
# BEFORE: DAEMON
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="ldconfig"
|
|
desc="Configure the shared library cache"
|
|
ldconfig_command="/sbin/ldconfig"
|
|
start_cmd="ldconfig_start"
|
|
stop_cmd=":"
|
|
|
|
ldconfig_start()
|
|
{
|
|
local _files _ins
|
|
|
|
_ins=
|
|
ldconfig=${ldconfig_command}
|
|
checkyesno ldconfig_insecure && _ins="-i"
|
|
if [ -x "${ldconfig_command}" ]; then
|
|
_LDC=$(/libexec/ld-elf.so.1 -v | sed -n -e '/^Default lib path /s///p' | tr : ' ')
|
|
for i in ${ldconfig_local_dirs}; do
|
|
if [ -d "${i}" ]; then
|
|
_files=`find ${i} -type f`
|
|
if [ -n "${_files}" ]; then
|
|
ldconfig_paths="${ldconfig_paths} `cat ${_files} | sort -u`"
|
|
fi
|
|
fi
|
|
done
|
|
for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
|
|
if [ -r "${i}" ]; then
|
|
_LDC="${_LDC} ${i}"
|
|
fi
|
|
done
|
|
startmsg 'ELF ldconfig path:' ${_LDC}
|
|
${ldconfig} -elf ${_ins} ${_LDC}
|
|
|
|
if check_kern_features compat_freebsd32; then
|
|
for i in ${ldconfig_local32_dirs}; do
|
|
if [ -d "${i}" ]; then
|
|
_files=`find ${i} -type f`
|
|
if [ -n "${_files}" ]; then
|
|
ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`"
|
|
fi
|
|
fi
|
|
done
|
|
_LDC=""
|
|
if [ -x /libexec/ld-elf32.so.1 ]; then
|
|
for x in $(/libexec/ld-elf32.so.1 -v | sed -n -e '/^Default lib path /s///p' | tr : ' '); do
|
|
if [ -d "${x}" ]; then
|
|
_LDC="${_LDC} ${x}"
|
|
fi
|
|
done
|
|
fi
|
|
for i in ${ldconfig32_paths}; do
|
|
if [ -r "${i}" ]; then
|
|
_LDC="${_LDC} ${i}"
|
|
fi
|
|
done
|
|
startmsg '32-bit compatibility ldconfig path:' ${_LDC}
|
|
${ldconfig} -32 ${_ins} ${_LDC}
|
|
fi
|
|
|
|
fi
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|