96bb3519b09f8d70f0f1a23062a28474651b687d
[dragonfly.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: src/etc/rc.d/ldconfig,v 1.7 2003/06/30 15:02:05 trhodes Exp $
5 # $DragonFly: src/etc/rc.d/ldconfig,v 1.4 2004/01/26 17:21:15 rob Exp $
6 #
7
8 # PROVIDE: ldconfig
9 # REQUIRE: mountall mountcritremote
10 # BEFORE:  DAEMON
11 # KEYWORD: DragonFly
12
13 . /etc/rc.subr
14
15 name="ldconfig"
16 ldconfig_command="/sbin/ldconfig"
17 start_cmd="ldconfig_start"
18 stop_cmd=":"
19
20 ldconfig_start()
21 {
22                 _ins=
23                 ldconfig=${ldconfig_command}
24                 checkyesno ldconfig_insecure && _ins="-i"
25                 if [ -x "${ldconfig_command}" ]; then
26                         _LDC="/usr/lib /usr/lib/gcc*"
27                         for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
28                                 if [ -r "${i}" ]; then
29                                         _LDC="${_LDC} ${i}"
30                                 fi
31                         done
32                         echo 'ELF ldconfig path:' ${_LDC}
33                         ${ldconfig} -elf ${_ins} ${_LDC}
34                         # Legacy aout support for i386 only
35                         case `sysctl -n hw.machine_arch` in
36                         i386)
37                                 # Default the a.out ldconfig path.
38                                 : ${ldconfig_paths_aout=${ldconfig_paths}}
39                                 _LDC=/usr/lib/aout
40                                 for i in ${ldconfig_paths_aout} /etc/ld.so.conf; do
41                                         if [ -r "${i}" ]; then
42                                                 _LDC="${_LDC} ${i}"
43                                         fi
44                                 done
45                                 echo 'a.out ldconfig path:' ${_LDC}
46                                 ${ldconfig} -aout ${_ins} ${_LDC}
47                                 ;;
48                         esac
49                 fi
50 }
51
52 load_rc_config $name
53 run_rc_command "$1"