ldconfig revision 217073
1178355Ssam#!/bin/sh 2178355Ssam# 3178355Ssam# $FreeBSD: head/etc/rc.d/ldconfig 217073 2011-01-06 21:09:22Z imp $ 4178355Ssam# 5178355Ssam 6178355Ssam# PROVIDE: ldconfig 7178355Ssam# REQUIRE: mountcritremote cleanvar 8178355Ssam# BEFORE: DAEMON 9178355Ssam 10178355Ssam. /etc/rc.subr 11178355Ssam 12178355Ssamname="ldconfig" 13178355Ssamldconfig_command="/sbin/ldconfig" 14178355Ssamstart_cmd="ldconfig_start" 15178355Ssamstop_cmd=":" 16178355Ssam 17178355Ssamldconfig_start() 18178355Ssam{ 19178355Ssam local _files _ins 20178355Ssam 21178355Ssam _ins= 22178355Ssam ldconfig=${ldconfig_command} 23178355Ssam checkyesno ldconfig_insecure && _ins="-i" 24178355Ssam if [ -x "${ldconfig_command}" ]; then 25178355Ssam _LDC="/lib /usr/lib" 26178355Ssam for i in ${ldconfig_local_dirs}; do 27178355Ssam if [ -d "${i}" ]; then 28178355Ssam _files=`find ${i} -type f` 29178355Ssam if [ -n "${_files}" ]; then 30178355Ssam ldconfig_paths="${ldconfig_paths} `cat ${_files} | sort -u`" 31178355Ssam fi 32178355Ssam fi 33178355Ssam done 34178355Ssam for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do 35178355Ssam if [ -r "${i}" ]; then 36178355Ssam _LDC="${_LDC} ${i}" 37178355Ssam fi 38178355Ssam done 39178355Ssam check_startmsgs && echo 'ELF ldconfig path:' ${_LDC} 40178355Ssam ${ldconfig} -elf ${_ins} ${_LDC} 41178355Ssam 42186106Ssam case `sysctl -n hw.machine_arch` in 43178355Ssam amd64) 44178355Ssam for i in ${ldconfig_local32_dirs}; do 45178355Ssam if [ -d "${i}" ]; then 46178355Ssam _files=`find ${i} -type f` 47178355Ssam if [ -n "${_files}" ]; then 48178355Ssam ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`" 49178355Ssam fi 50178355Ssam fi 51178355Ssam done 52178355Ssam _LDC="" 53178355Ssam for i in ${ldconfig32_paths}; do 54178355Ssam if [ -r "${i}" ]; then 55178355Ssam _LDC="${_LDC} ${i}" 56178355Ssam fi 57178355Ssam done 58178355Ssam check_startmsgs && 59178355Ssam echo '32-bit compatibility ldconfig path:' ${_LDC} 60178355Ssam ${ldconfig} -32 -m ${_ins} ${_LDC} 61178355Ssam ;; 62178355Ssam esac 63178355Ssam 64178355Ssam # Legacy aout support for i386 only 65178355Ssam case `sysctl -n hw.machine_arch` in 66178355Ssam i386) 67178355Ssam # Default the a.out ldconfig path. 68178355Ssam : ${ldconfig_paths_aout=${ldconfig_paths}} 69178355Ssam _LDC="" 70178355Ssam for i in /usr/lib/aout ${ldconfig_paths_aout} /etc/ld.so.conf; do 71178355Ssam if [ -r "${i}" ]; then 72178355Ssam _LDC="${_LDC} ${i}" 73178355Ssam fi 74178355Ssam done 75178355Ssam check_startmsgs && echo 'a.out ldconfig path:' ${_LDC} 76178355Ssam ${ldconfig} -aout ${_ins} ${_LDC} 77178355Ssam ;; 78178355Ssam esac 79178355Ssam fi 80178355Ssam} 81178355Ssam 82178355Ssamload_rc_config $name 83178355Ssamrun_rc_command "$1" 84178355Ssam