1 1.1 lukem #!/bin/sh 2 1.1 lukem # 3 1.8 haad # $NetBSD: mountall,v 1.8 2009/10/18 21:58:37 haad Exp $ 4 1.1 lukem # 5 1.1 lukem 6 1.6 tsutsui # REQUIRE: mountcritremote named ypbind 7 1.1 lukem # PROVIDE: mountall 8 1.1 lukem 9 1.4 mycroft $_rc_subr_loaded . /etc/rc.subr 10 1.1 lukem 11 1.1 lukem name="mountall" 12 1.7 haad start_cmd="mountall_start" 13 1.7 haad stop_cmd="mountall_stop" 14 1.7 haad 15 1.7 haad mountall_start() 16 1.7 haad { 17 1.7 haad echo 'Mounting all filesystems...' 18 1.7 haad if [ -f /etc/zfs/zpool.cache ]; then 19 1.7 haad # Get ZFS module loaded (and thereby, zvols created). 20 1.7 haad zfs list > /dev/null 2>&1 21 1.8 haad # Initialize zvols so they can be mounted 22 1.8 haad zfs volinit 23 1.7 haad # Mount file systems noted in fstab. 24 1.7 haad mount -a 25 1.7 haad # Mount ZFS file systems. 26 1.7 haad zfs mount -a 27 1.7 haad else 28 1.7 haad # Mount file systems noted in fstab. 29 1.7 haad mount -a 30 1.7 haad fi 31 1.7 haad } 32 1.7 haad 33 1.7 haad mountall_stop() 34 1.7 haad { 35 1.7 haad echo 'Unmounting all filesystems...' 36 1.7 haad if [ -f /etc/zfs/zpool.cache ]; then 37 1.7 haad # Unmount ZFS file systems. 38 1.7 haad zfs unmount -a 39 1.7 haad # Unmount file systems noted in fstab. 40 1.7 haad umount -a 41 1.7 haad # Unload ZFS module, so disk devices are closed. 42 1.7 haad modunload zfs 43 1.7 haad else 44 1.7 haad # Otherwise, just deal with fstab. 45 1.7 haad umount -a 46 1.7 haad fi 47 1.7 haad } 48 1.1 lukem 49 1.3 lukem load_rc_config $name 50 1.1 lukem run_rc_command "$1" 51