NetBSD/etc/rc.d/mountall

51 lines
992 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: mountall,v 1.9 2014/07/22 17:11:09 wiz 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...'
if [ -f /etc/zfs/zpool.cache ]; then
# Get ZFS module loaded (and thereby, zvols created).
zfs list > /dev/null 2>&1
# Initialize zvols so they can be mounted
zfs volinit
# Mount file systems noted in fstab.
mount -a
# Mount ZFS file systems.
zfs mount -a
else
# Mount file systems noted in fstab.
mount -a
fi
}
mountall_stop()
{
echo 'Unmounting all file systems...'
if [ -f /etc/zfs/zpool.cache ]; then
# Unmount ZFS file systems.
zfs unmount -a
# Unmount file systems noted in fstab.
umount -a
# Unload ZFS module, so disk devices are closed.
modunload zfs
else
# Otherwise, just deal with fstab.
umount -a
fi
}
load_rc_config $name
run_rc_command "$1"