]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - libexec/rc/rc.d/ldconfig
Fix issues with various VNC clients.
[FreeBSD/FreeBSD.git] / libexec / rc / rc.d / ldconfig
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5
6 # PROVIDE: ldconfig
7 # REQUIRE: FILESYSTEMS
8 # BEFORE:  DAEMON
9
10 . /etc/rc.subr
11
12 name="ldconfig"
13 desc="Configure the shared library cache"
14 ldconfig_command="/sbin/ldconfig"
15 start_cmd="ldconfig_start"
16 stop_cmd=":"
17
18 ldconfig_start()
19 {
20         local _files _ins
21
22         _ins=
23         ldconfig=${ldconfig_command}
24         checkyesno ldconfig_insecure && _ins="-i"
25         if [ -x "${ldconfig_command}" ]; then
26                 _LDC="/lib /usr/lib"
27                 for i in ${ldconfig_local_dirs}; do
28                         if [ -d "${i}" ]; then
29                                 _files=`find ${i} -type f`
30                                 if [ -n "${_files}" ]; then
31                                         ldconfig_paths="${ldconfig_paths} `cat ${_files} | sort -u`"
32                                 fi
33                         fi
34                 done
35                 for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
36                         if [ -r "${i}" ]; then
37                                 _LDC="${_LDC} ${i}"
38                         fi
39                 done
40                 check_startmsgs && echo 'ELF ldconfig path:' ${_LDC}
41                 ${ldconfig} -elf ${_ins} ${_LDC}
42
43                 machine_arch=$(sysctl -n hw.machine_arch)
44
45                 case ${machine_arch} in
46                 amd64|mips64|powerpc64)
47                         for i in ${ldconfig_local32_dirs}; do
48                                 if [ -d "${i}" ]; then
49                                         _files=`find ${i} -type f`
50                                         if [ -n "${_files}" ]; then
51                                                 ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`"
52                                         fi
53                                 fi
54                         done
55                         _LDC=""
56                         for i in ${ldconfig32_paths}; do
57                                 if [ -r "${i}" ]; then
58                                         _LDC="${_LDC} ${i}"
59                                 fi
60                         done
61                         check_startmsgs &&
62                             echo '32-bit compatibility ldconfig path:' ${_LDC}
63                         ${ldconfig} -32 ${_ins} ${_LDC}
64                         ;;
65                 esac
66
67                 case ${machine_arch} in
68                 armv[67])
69                         for i in ${ldconfig_localsoft_dirs}; do
70                                 if [ -d "${i}" ]; then
71                                         _files=`find ${i} -type f`
72                                         if [ -n "${_files}" ]; then
73                                                 ldconfigsoft_paths="${ldconfigsoft_paths} `cat ${_files} | sort -u`"
74                                         fi
75                                 fi
76                         done
77                         _LDC=""
78                         for i in ${ldconfigsoft_paths}; do
79                                 if [ -r "${i}" ]; then
80                                         _LDC="${_LDC} ${i}"
81                                 fi
82                         done
83                         check_startmsgs &&
84                             echo 'Soft Float compatibility ldconfig path:' ${_LDC}
85                         ${ldconfig} -soft ${_ins} ${_LDC}
86                         ;;
87                 esac
88         fi
89 }
90
91 load_rc_config $name
92 run_rc_command "$1"