summaryrefslogtreecommitdiff
path: root/etc/rc.d/zfs
blob: c32ec6fec9ad6b0a2bb5a71aaa65560ea5717d27 (plain)
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
#!/bin/sh
#
# $NetBSD: zfs,v 1.6 2021/08/03 05:15:20 mlelstv Exp $
#

# PROVIDE: zfs
# REQUIRE: root devpubd
# BEFORE:  DISKS

$_rc_subr_loaded . /etc/rc.subr

name="zfs"
rcvar=$name
start_cmd="zfs_start"
stop_cmd="zfs_stop"

zfs_start()
{
	if [ -x /sbin/zfs ]; then
		# Get ZFS module loaded (and thereby, zvols created).
		/sbin/zfs list > /dev/null 2>&1
		if [ $? -ne 0 ]; then
			warn "zfs module may not have loaded, may not be present in the kernel, or /dev/zfs may be missing"
			return 1;
		fi
	fi
}

zfs_stop()
{
	if [ -x /sbin/zfs ]; then
		modunload zfs
	fi
	return 0;
}

load_rc_config $name
run_rc_command "$1"