178344Sobrien#!/bin/sh 278344Sobrien# 398184Sgordon# $FreeBSD: releng/10.2/etc/rc.d/ldconfig 240336 2012-09-11 05:04:59Z obrien $ 478344Sobrien# 578344Sobrien 678344Sobrien# PROVIDE: ldconfig 7240336Sobrien# REQUIRE: mountcritremote FILESYSTEMS 898184Sgordon# BEFORE: DAEMON 978344Sobrien 1078344Sobrien. /etc/rc.subr 1178344Sobrien 1278344Sobrienname="ldconfig" 1398184Sgordonldconfig_command="/sbin/ldconfig" 1478344Sobrienstart_cmd="ldconfig_start" 1578344Sobrienstop_cmd=":" 1678344Sobrien 1778344Sobrienldconfig_start() 1878344Sobrien{ 19165664Syar local _files _ins 20159833Sflz 21124618Smtm _ins= 22124618Smtm ldconfig=${ldconfig_command} 23124618Smtm checkyesno ldconfig_insecure && _ins="-i" 24124618Smtm if [ -x "${ldconfig_command}" ]; then 25124618Smtm _LDC="/lib /usr/lib" 26154114Sdougb for i in ${ldconfig_local_dirs}; do 27154114Sdougb if [ -d "${i}" ]; then 28159833Sflz _files=`find ${i} -type f` 29159833Sflz if [ -n "${_files}" ]; then 30159833Sflz ldconfig_paths="${ldconfig_paths} `cat ${_files} | sort -u`" 31159833Sflz fi 32154114Sdougb fi 33154114Sdougb done 34124618Smtm for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do 35124618Smtm if [ -r "${i}" ]; then 36124618Smtm _LDC="${_LDC} ${i}" 37124618Smtm fi 38124618Smtm done 39197947Sdougb check_startmsgs && echo 'ELF ldconfig path:' ${_LDC} 40124618Smtm ${ldconfig} -elf ${_ins} ${_LDC} 41124618Smtm 42154114Sdougb case `sysctl -n hw.machine_arch` in 43154114Sdougb amd64) 44154114Sdougb for i in ${ldconfig_local32_dirs}; do 45154114Sdougb if [ -d "${i}" ]; then 46159833Sflz _files=`find ${i} -type f` 47159833Sflz if [ -n "${_files}" ]; then 48159833Sflz ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`" 49159833Sflz fi 50154114Sdougb fi 51154114Sdougb done 52174567Sjhb _LDC="" 53174567Sjhb for i in ${ldconfig32_paths}; do 54174567Sjhb if [ -r "${i}" ]; then 55174567Sjhb _LDC="${_LDC} ${i}" 56174567Sjhb fi 57174567Sjhb done 58197947Sdougb check_startmsgs && 59179945Smtm echo '32-bit compatibility ldconfig path:' ${_LDC} 60174567Sjhb ${ldconfig} -32 -m ${_ins} ${_LDC} 61154114Sdougb ;; 62154114Sdougb esac 63154114Sdougb 64124618Smtm # Legacy aout support for i386 only 65124618Smtm case `sysctl -n hw.machine_arch` in 66124618Smtm i386) 67124618Smtm # Default the a.out ldconfig path. 68124618Smtm : ${ldconfig_paths_aout=${ldconfig_paths}} 69217073Simp _LDC="" 70217073Simp for i in /usr/lib/aout ${ldconfig_paths_aout} /etc/ld.so.conf; do 71117077Strhodes if [ -r "${i}" ]; then 72103436Speter _LDC="${_LDC} ${i}" 73103436Speter fi 74103436Speter done 75197947Sdougb check_startmsgs && echo 'a.out ldconfig path:' ${_LDC} 76124618Smtm ${ldconfig} -aout ${_ins} ${_LDC} 77124618Smtm ;; 78124618Smtm esac 79124618Smtm fi 8078344Sobrien} 8178344Sobrien 8278344Sobrienload_rc_config $name 8378344Sobrienrun_rc_command "$1" 84