Home | History | Annotate | Line # | Download | only in rc.d
      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 
     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 ]; then
     32 		modunload zfs
     33 	fi
     34 	return 0;
     35 }
     36 
     37 load_rc_config $name
     38 run_rc_command "$1"
     39