xref: /netbsd-src/etc/rc.d/zfs (revision 154bfe8e089c1a0a4e9ed8414f08d3da90949162)
1#!/bin/sh
2#
3# $NetBSD: zfs,v 1.5 2019/12/09 00:11:32 sevan Exp $
4#
5
6# PROVIDE: zfs
7# REQUIRE: root
8# BEFORE:  DISKS
9
10$_rc_subr_loaded . /etc/rc.subr
11
12name="zfs"
13rcvar=$name
14start_cmd="zfs_start"
15stop_cmd="zfs_stop"
16
17zfs_start()
18{
19	if [ -x /sbin/zfs ]; then
20		# Get ZFS module loaded (and thereby, zvols created).
21		/sbin/zfs list > /dev/null 2>&1
22		if [ $? -ne 0 ]; then
23			warn "zfs module may not have loaded, may not be present in the kernel, or /dev/zfs may be missing"
24			return 1;
25		fi
26	fi
27}
28
29zfs_stop()
30{
31	if [ -x /sbin/zfs ]; then
32		modunload zfs
33	fi
34	return 0;
35}
36
37load_rc_config $name
38run_rc_command "$1"
39