Home | History | Annotate | Line # | Download | only in rc.d
zfs revision 1.1
      1 #!/bin/sh
      2 #
      3 # $NetBSD: zfs,v 1.1 2019/09/15 19:38:09 brad 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 start_cmd="zfs_start"
     14 stop_cmd="zfs_stop"
     15 
     16 zfs_start()
     17 {
     18 	if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
     19 		# Get ZFS module loaded (and thereby, zvols created).
     20 		/sbin/zfs list > /dev/null 2>&1
     21 		if [ $? -ne 0 ]; then
     22 			warn "zfs module may not have loaded, may not be present in the kernel, or /dev/zfs may be missing"
     23 			return 1;
     24 		fi
     25 	fi
     26 }
     27 
     28 zfs_stop()
     29 {
     30 	if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
     31 		zfs unmount -a
     32 		modunload zfs
     33 	fi
     34 	return 0;
     35 }
     36 
     37 load_rc_config $name
     38 run_rc_command "$1"
     39