Home | History | Annotate | Line # | Download | only in rc.d
mountall revision 1.7
      1 #!/bin/sh
      2 #
      3 # $NetBSD: mountall,v 1.7 2009/10/05 22:39:27 haad Exp $
      4 #
      5 
      6 # REQUIRE: mountcritremote named ypbind
      7 # PROVIDE: mountall
      8 
      9 $_rc_subr_loaded . /etc/rc.subr
     10 
     11 name="mountall"
     12 start_cmd="mountall_start"
     13 stop_cmd="mountall_stop"
     14 
     15 mountall_start()
     16 {
     17 	echo 'Mounting all filesystems...'
     18 	if [ -f /etc/zfs/zpool.cache ]; then
     19 		# Get ZFS module loaded (and thereby, zvols created).
     20 		zfs list > /dev/null 2>&1
     21 		# Mount file systems noted in fstab.
     22 		mount -a
     23 		# Mount ZFS file systems.
     24 		zfs mount -a
     25 	else
     26 		# Mount file systems noted in fstab.
     27 		mount -a
     28 	fi
     29 }
     30 
     31 mountall_stop()
     32 {
     33 	echo 'Unmounting all filesystems...'
     34 	if [ -f /etc/zfs/zpool.cache ]; then
     35 		# Unmount ZFS file systems.
     36 		zfs unmount -a
     37 		# Unmount file systems noted in fstab.
     38 		umount -a
     39 		# Unload ZFS module, so disk devices are closed.
     40 		modunload zfs
     41 	else
     42 		# Otherwise, just deal with fstab.
     43 		umount -a
     44 	fi
     45 }
     46 
     47 load_rc_config $name
     48 run_rc_command "$1"
     49