aboutsummaryrefslogtreecommitdiff
path: root/emulators/kqemu-kmod-devel/files/kqemu.in
blob: 7662ca3cccd1afc9b3a0bef8e985c39c7c804eef (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
52
53
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: kqemu
# KEYWORD: nojail
#
# Add the following line to /etc/rc.conf[.local] to enable kqemu
#
# kqemu_enable="YES"
#

. /etc/rc.subr

name="kqemu"
rcvar=${name}_enable

load_rc_config $name

: ${kqemu_enable="NO"}

start_cmd=kqemu_start
stop_cmd=kqemu_stop

kqemu_start()
{
	# load aio if needed
	if ! kldstat -qm aio; then
		if kldload aio; then
			info 'aio module loaded.'
		else
			warn 'aio module failed to load.'
			return 1
		fi
	fi
	if ! kldstat -qm kqemu; then
		if kldload kqemu; then
			echo 'kqemu module loaded.'
		else
			warn 'kqemu module failed to load.'
			return 1
		fi
	fi
	return 0
}

kqemu_stop()
{
	if kldstat -qm kqemu && kldunload kqemu; then
		echo 'kqemu module unloaded.'
	fi
}

run_rc_command "$1"