mountall revision 1.10
1#!/bin/sh
2#
3# $NetBSD: mountall,v 1.10 2018/06/08 14:44:21 sevan Exp $
4#
5
6# REQUIRE: mountcritremote named ypbind
7# PROVIDE: mountall
8
9$_rc_subr_loaded . /etc/rc.subr
10
11name="mountall"
12start_cmd="mountall_start"
13stop_cmd="mountall_stop"
14
15mountall_start()
16{
17	echo 'Mounting all file systems...'
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
31mountall_stop()
32{
33	echo 'Unmounting all file systems...'
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
47load_rc_config $name
48run_rc_command "$1"
49