]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.d/ldconfig
This commit was generated by cvs2svn to compensate for changes in r161863,
[FreeBSD/FreeBSD.git] / etc / rc.d / ldconfig
1 #!/bin/sh
2 #
3 # $NetBSD: ldconfig,v 1.5 2002/03/22 04:33:58 thorpej Exp $
4 # $FreeBSD$
5 #
6
7 # PROVIDE: ldconfig
8 # REQUIRE: mountcritremote cleanvar
9 # BEFORE:  DAEMON
10
11 . /etc/rc.subr
12
13 name="ldconfig"
14 ldconfig_command="/sbin/ldconfig"
15 start_cmd="ldconfig_start"
16 stop_cmd=":"
17
18 ldconfig_start()
19 {
20         local _files
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                 echo 'ELF ldconfig path:' ${_LDC}
41                 ${ldconfig} -elf ${_ins} ${_LDC}
42
43                 case `sysctl -n hw.machine_arch` in
44                 amd64)
45                         for i in ${ldconfig_local32_dirs}; do
46                                 if [ -d "${i}" ]; then
47                                         _files=`find ${i} -type f`
48                                         if [ -n "${_files}" ]; then
49                                                 ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`"
50                                         fi
51                                 fi
52                         done
53                         echo '32-bit compatibility ldconfig path:' ${ldconfig32_paths}
54                         ${ldconfig} -32 -m ${_ins} ${ldconfig32_paths}
55                         ;;
56                 esac
57
58                 # Legacy aout support for i386 only
59                 case `sysctl -n hw.machine_arch` in
60                 i386)
61                         # Default the a.out ldconfig path.
62                         : ${ldconfig_paths_aout=${ldconfig_paths}}
63                         _LDC=/usr/lib/aout
64                         for i in ${ldconfig_paths_aout} /etc/ld.so.conf; do
65                                 if [ -r "${i}" ]; then
66                                         _LDC="${_LDC} ${i}"
67                                 fi
68                         done
69                         echo 'a.out ldconfig path:' ${_LDC}
70                         ${ldconfig} -aout ${_ins} ${_LDC}
71                         ;;
72                 esac
73         fi
74 }
75
76 load_rc_config $name
77 run_rc_command "$1"