NetBSD/etc/rc.d/zfs
sevan a8ffec0052 This script just makes sure that the ZFS module loads and unloads, mountall
script takes care of mounting filesystems.
Don't try to unmount all file systems before unloading the ZFS module, leave
that to the operator in preperation or the mountall script to take care
of. Module will of course fail to unload then if file systems are still
mounted.
2019-12-09 00:11:32 +00:00

39 lines
614 B
Bash

#!/bin/sh
#
# $NetBSD: zfs,v 1.5 2019/12/09 00:11:32 sevan Exp $
#
# PROVIDE: zfs
# REQUIRE: root
# 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"