xref: /netbsd/etc/rc.d/mountall (revision 64bf20b8)
1#!/bin/sh
2#
3# $NetBSD: mountall,v 1.15 2021/03/09 12:42:46 sborrill 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
19	# Mount ZFS filesystems first because fstab
20	# may try and null mount paths on ZFS.
21	if checkyesno zfs; then
22		zfs mount -a
23		zfs share -a
24	fi
25
26	# Mount file systems noted in fstab.
27	mount -a
28}
29
30mountall_stop()
31{
32	echo 'Unmounting all file systems...'
33	# Unmount file systems noted in fstab.
34	umount -a
35
36	# Unmount ZFS file systems.
37	if checkyesno zfs; then
38		zfs unshare -a
39		zfs unmount -a
40	fi
41}
42
43load_rc_config $name
44load_rc_config_var zfs zfs
45run_rc_command "$1"
46