mountall revision 1.9
11.1Slukem#!/bin/sh
21.1Slukem#
31.9Swiz# $NetBSD: mountall,v 1.9 2014/07/22 17:11:09 wiz Exp $
41.1Slukem#
51.1Slukem
61.6Stsutsui# REQUIRE: mountcritremote named ypbind
71.1Slukem# PROVIDE: mountall
81.1Slukem
91.4Smycroft$_rc_subr_loaded . /etc/rc.subr
101.1Slukem
111.1Slukemname="mountall"
121.7Shaadstart_cmd="mountall_start"
131.7Shaadstop_cmd="mountall_stop"
141.7Shaad
151.7Shaadmountall_start()
161.7Shaad{
171.9Swiz	echo 'Mounting all file systems...'
181.7Shaad	if [ -f /etc/zfs/zpool.cache ]; then
191.7Shaad		# Get ZFS module loaded (and thereby, zvols created).
201.7Shaad		zfs list > /dev/null 2>&1
211.8Shaad		# Initialize zvols so they can be mounted 
221.8Shaad		zfs volinit
231.7Shaad		# Mount file systems noted in fstab.
241.7Shaad		mount -a
251.7Shaad		# Mount ZFS file systems.
261.7Shaad		zfs mount -a
271.7Shaad	else
281.7Shaad		# Mount file systems noted in fstab.
291.7Shaad		mount -a
301.7Shaad	fi
311.7Shaad}
321.7Shaad
331.7Shaadmountall_stop()
341.7Shaad{
351.9Swiz	echo 'Unmounting all file systems...'
361.7Shaad	if [ -f /etc/zfs/zpool.cache ]; then
371.7Shaad		# Unmount ZFS file systems.
381.7Shaad		zfs unmount -a
391.7Shaad		# Unmount file systems noted in fstab.
401.7Shaad		umount -a
411.7Shaad		# Unload ZFS module, so disk devices are closed.
421.7Shaad		modunload zfs
431.7Shaad	else
441.7Shaad		# Otherwise, just deal with fstab.
451.7Shaad		umount -a
461.7Shaad	fi
471.7Shaad}
481.1Slukem
491.3Slukemload_rc_config $name
501.1Slukemrun_rc_command "$1"
51