#!/bin/sh
#
# $NetBSD: mountall,v 1.10.4.3 2021/03/09 16:01:24 martin Exp $
#

# REQUIRE: mountcritremote named ypbind
# PROVIDE: mountall

$_rc_subr_loaded . /etc/rc.subr

name="mountall"
start_cmd="mountall_start"
stop_cmd="mountall_stop"

mountall_start()
{
	echo 'Mounting all file systems...'
	# Mount file systems noted in fstab.
	mount -a
	if checkyesno zfs; then
		# Mount ZFS file systems.
		zfs mount -a
	fi
}

mountall_stop()
{
	echo 'Unmounting all file systems...'
	if checkyesno zfs; then
		# Unmount ZFS file systems.
		zfs unmount -a
	fi
	# Unmount file systems noted in fstab.
	umount -a
}

load_rc_config $name
load_rc_config_var zfs zfs
run_rc_command "$1"
