aboutsummaryrefslogtreecommitdiff
path: root/misc/ldconfig_compat/files/ldconfig_compat.sh.in
blob: 1c6f4a450586bee2ba19a363f20556c2f787c1d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: ldconfig_compat
# REQUIRE: mountcritremote ldconfig
# BEFORE:  DAEMON

. "%%RC_SUBR%%"

name="ldconfig"
ldconfig_command="/sbin/ldconfig"
start_cmd="ldconfig_start"
stop_cmd=":"

load_rc_config $name
: ${ldconfig_local_dirs="%%PREFIX%%/%%LDCONFIG_DIR%% %%X11BASE%%/%%LDCONFIG_DIR%%"}
: ${ldconfig_local32_dirs="%%PREFIX%%/%%LDCONFIG32_DIR%% %%X11BASE%%/%%LDCONFIG32_DIR%%"}

ldconfig_start()
{
	_ins=
	ldconfig=${ldconfig_command}
	checkyesno ldconfig_insecure && _ins="-i"
	if [ -x "${ldconfig_command}" ]; then
		ldconfig_paths=""
		for i in ${ldconfig_local_dirs}; do
			if [ -d "${i}" ]; then
				ldconfig_paths="${ldconfig_paths} `find ${i} -type f`"
			fi
		done
		echo 'Local ldconfig path:' ${ldconfig_paths}
		${ldconfig} -m ${_ins} ${ldconfig_paths}

		case `sysctl -n hw.machine_arch` in
		amd64)
			ldconfig32_paths=""
			for i in ${ldconfig_local32_dirs}; do
				if [ -d "${i}" ]; then
					ldconfig32_paths="${ldconfig32_paths} `find ${i} -type f`"
				fi
			done
			echo 'Local 32-bits ldconfig path:' ${ldconfig32_paths}
			${ldconfig} -32 -m ${_ins} ${ldconfig32_paths}
			;;
		esac
	fi
}

run_rc_command "$1"