xref: /freebsd/libexec/rc/rc.d/linux (revision 028af4ae670c3b7757a92a24d663a1d9fe065266)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: linux
7# REQUIRE: archdep
8# KEYWORD: nojail
9
10. /etc/rc.subr
11
12name="linux"
13desc="Enable Linux ABI"
14start_cmd="${name}_start"
15stop_cmd=":"
16
17linux_start()
18{
19	local _tmpdir
20
21	load_kld -e 'linux(aout|elf)' linux
22	case `sysctl -n hw.machine_arch` in
23	amd64)
24		load_kld -e 'linux64elf' linux64
25		;;
26	esac
27	if [ -x /compat/linux/sbin/ldconfigDisabled ]; then
28		_tmpdir=`mktemp -d -t linux-ldconfig`
29		/compat/linux/sbin/ldconfig -C ${_tmpdir}/ld.so.cache
30		if ! cmp -s ${_tmpdir}/ld.so.cache /compat/linux/etc/ld.so.cache; then
31			cat ${_tmpdir}/ld.so.cache > /compat/linux/etc/ld.so.cache
32		fi
33		rm -rf ${_tmpdir}
34	fi
35}
36
37load_rc_config $name
38run_rc_command "$1"
39