xref: /netbsd-src/etc/rc.d/zfs (revision c413ec6508e1c80ddb61bd7133c15e767589759e)
1#!/bin/sh
2#
3# $NetBSD: zfs,v 1.6 2021/08/03 05:15:20 mlelstv Exp $
4#
5
6# PROVIDE: zfs
7# REQUIRE: root devpubd
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