]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - etc/rc.d/ldconfig
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / etc / rc.d / ldconfig
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5
6 # PROVIDE: ldconfig
7 # REQUIRE: mountcritremote cleanvar
8 # BEFORE:  DAEMON
9
10 . /etc/rc.subr
11
12 name="ldconfig"
13 ldconfig_command="/sbin/ldconfig"
14 start_cmd="ldconfig_start"
15 stop_cmd=":"
16
17 ldconfig_start()
18 {
19         local _files _ins
20
21         _ins=
22         ldconfig=${ldconfig_command}
23         checkyesno ldconfig_insecure && _ins="-i"
24         if [ -x "${ldconfig_command}" ]; then
25                 _LDC="/lib /usr/lib"
26                 for i in ${ldconfig_local_dirs}; do
27                         if [ -d "${i}" ]; then
28                                 _files=`find ${i} -type f`
29                                 if [ -n "${_files}" ]; then
30                                         ldconfig_paths="${ldconfig_paths} `cat ${_files} | sort -u`"
31                                 fi
32                         fi
33                 done
34                 for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
35                         if [ -r "${i}" ]; then
36                                 _LDC="${_LDC} ${i}"
37                         fi
38                 done
39                 echo 'ELF ldconfig path:' ${_LDC}
40                 ${ldconfig} -elf ${_ins} ${_LDC}
41
42                 case `sysctl -n hw.machine_arch` in
43                 amd64)
44                         for i in ${ldconfig_local32_dirs}; do
45                                 if [ -d "${i}" ]; then
46                                         _files=`find ${i} -type f`
47                                         if [ -n "${_files}" ]; then
48                                                 ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`"
49                                         fi
50                                 fi
51                         done
52                         _LDC=""
53                         for i in ${ldconfig32_paths}; do
54                                 if [ -r "${i}" ]; then
55                                         _LDC="${_LDC} ${i}"
56                                 fi
57                         done
58                         echo '32-bit compatibility ldconfig path:' ${_LDC}
59                         ${ldconfig} -32 -m ${_ins} ${_LDC}
60                         ;;
61                 esac
62
63                 # Legacy aout support for i386 only
64                 case `sysctl -n hw.machine_arch` in
65                 i386)
66                         # Default the a.out ldconfig path.
67                         : ${ldconfig_paths_aout=${ldconfig_paths}}
68                         _LDC=/usr/lib/aout
69                         for i in ${ldconfig_paths_aout} /etc/ld.so.conf; do
70                                 if [ -r "${i}" ]; then
71                                         _LDC="${_LDC} ${i}"
72                                 fi
73                         done
74                         echo 'a.out ldconfig path:' ${_LDC}
75                         ${ldconfig} -aout ${_ins} ${_LDC}
76                         ;;
77                 esac
78         fi
79 }
80
81 load_rc_config $name
82 run_rc_command "$1"