1 #!/bin/sh 2 # 3 # $NetBSD: zfs,v 1.3 2019/12/04 16:46:50 jmcneill Exp $ 4 # 5 6 # PROVIDE: zfs 7 # REQUIRE: root 8 # BEFORE: DISKS 9 10 $_rc_subr_loaded . /etc/rc.subr 11 12 name="zfs" 13 rcvar=$name 14 start_cmd="zfs_start" 15 stop_cmd="zfs_stop" 16 17 zfs_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 29 zfs_stop() 30 { 31 if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then 32 zfs unmount -a 33 modunload zfs 34 fi 35 return 0; 36 } 37 38 load_rc_config $name 39 run_rc_command "$1" 40