10696600cSBjoern A. Zeeb#!/bin/sh 20696600cSBjoern A. Zeeb# 30696600cSBjoern A. Zeeb# 40696600cSBjoern A. Zeeb 50696600cSBjoern A. Zeeb# PROVIDE: ldconfig 60696600cSBjoern A. Zeeb# REQUIRE: FILESYSTEMS 70696600cSBjoern A. Zeeb# BEFORE: DAEMON 80696600cSBjoern A. Zeeb 90696600cSBjoern A. Zeeb. /etc/rc.subr 100696600cSBjoern A. Zeeb 110696600cSBjoern A. Zeebname="ldconfig" 120696600cSBjoern A. Zeebdesc="Configure the shared library cache" 130696600cSBjoern A. Zeebldconfig_command="/sbin/ldconfig" 140696600cSBjoern A. Zeebstart_cmd="ldconfig_start" 150696600cSBjoern A. Zeebstop_cmd=":" 160696600cSBjoern A. Zeeb 170696600cSBjoern A. Zeebldconfig_start() 180696600cSBjoern A. Zeeb{ 190696600cSBjoern A. Zeeb local _files _ins 200696600cSBjoern A. Zeeb 210696600cSBjoern A. Zeeb _ins= 220696600cSBjoern A. Zeeb ldconfig=${ldconfig_command} 230696600cSBjoern A. Zeeb checkyesno ldconfig_insecure && _ins="-i" 240696600cSBjoern A. Zeeb if [ -x "${ldconfig_command}" ]; then 2599132dafSJohn W. O'Brien _LDC=$(/libexec/ld-elf.so.1 -v | sed -n -e '/^Default lib path /s///p' | tr : ' ') 260696600cSBjoern A. Zeeb for i in ${ldconfig_local_dirs}; do 270696600cSBjoern A. Zeeb if [ -d "${i}" ]; then 280696600cSBjoern A. Zeeb _files=`find ${i} -type f` 290696600cSBjoern A. Zeeb if [ -n "${_files}" ]; then 300696600cSBjoern A. Zeeb ldconfig_paths="${ldconfig_paths} `cat ${_files} | sort -u`" 310696600cSBjoern A. Zeeb fi 320696600cSBjoern A. Zeeb fi 330696600cSBjoern A. Zeeb done 340696600cSBjoern A. Zeeb for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do 350696600cSBjoern A. Zeeb if [ -r "${i}" ]; then 360696600cSBjoern A. Zeeb _LDC="${_LDC} ${i}" 370696600cSBjoern A. Zeeb fi 380696600cSBjoern A. Zeeb done 39325ebf37SJose Luis Duran startmsg 'ELF ldconfig path:' ${_LDC} 400696600cSBjoern A. Zeeb ${ldconfig} -elf ${_ins} ${_LDC} 410696600cSBjoern A. Zeeb 429da3dfffSMateusz Guzik machine_arch=$(sysctl -n hw.machine_arch) 439da3dfffSMateusz Guzik 449da3dfffSMateusz Guzik case ${machine_arch} in 456f15b7e1SMike Karels aarch64|amd64|powerpc64) 460696600cSBjoern A. Zeeb for i in ${ldconfig_local32_dirs}; do 470696600cSBjoern A. Zeeb if [ -d "${i}" ]; then 480696600cSBjoern A. Zeeb _files=`find ${i} -type f` 490696600cSBjoern A. Zeeb if [ -n "${_files}" ]; then 500696600cSBjoern A. Zeeb ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`" 510696600cSBjoern A. Zeeb fi 520696600cSBjoern A. Zeeb fi 530696600cSBjoern A. Zeeb done 540696600cSBjoern A. Zeeb _LDC="" 5599132dafSJohn W. O'Brien if [ -x /libexec/ld-elf32.so.1 ]; then 56*806e4e32SKonstantin Belousov for x in $(/libexec/ld-elf32.so.1 -v | sed -n -e '/^Default lib path /s///p' | tr : ' '); do 57*806e4e32SKonstantin Belousov if [ -d "${x}" ]; then 58*806e4e32SKonstantin Belousov _LDC="${_LDC} ${x}" 59*806e4e32SKonstantin Belousov fi 60*806e4e32SKonstantin Belousov done 6199132dafSJohn W. O'Brien fi 620696600cSBjoern A. Zeeb for i in ${ldconfig32_paths}; do 630696600cSBjoern A. Zeeb if [ -r "${i}" ]; then 640696600cSBjoern A. Zeeb _LDC="${_LDC} ${i}" 650696600cSBjoern A. Zeeb fi 660696600cSBjoern A. Zeeb done 67325ebf37SJose Luis Duran startmsg '32-bit compatibility ldconfig path:' ${_LDC} 680696600cSBjoern A. Zeeb ${ldconfig} -32 ${_ins} ${_LDC} 690696600cSBjoern A. Zeeb ;; 700696600cSBjoern A. Zeeb esac 710696600cSBjoern A. Zeeb 720696600cSBjoern A. Zeeb fi 730696600cSBjoern A. Zeeb} 740696600cSBjoern A. Zeeb 750696600cSBjoern A. Zeebload_rc_config $name 760696600cSBjoern A. Zeebrun_rc_command "$1" 77