2013-12-21 14:51:11 -06:00
|
|
|
#!@SBINDIR@/openrc-run
|
2009-05-01 15:11:40 +01:00
|
|
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
2011-06-29 19:46:31 -04:00
|
|
|
# Released under the 2-clause BSD license.
|
2007-11-14 15:22:04 +00:00
|
|
|
|
2014-10-01 17:14:25 -05:00
|
|
|
description="Mounts network shares according to /etc/fstab."
|
2012-09-10 15:43:42 -05:00
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
depend()
|
|
|
|
{
|
2007-08-15 14:49:41 +00:00
|
|
|
config /etc/fstab
|
2015-02-03 10:53:48 -06:00
|
|
|
use afc-client amd nfsclient autofs openvpn
|
2012-09-14 14:29:00 -05:00
|
|
|
use dns
|
2013-10-08 10:34:45 -05:00
|
|
|
keyword -jail -prefix -vserver -lxc
|
2007-04-05 11:18:42 +00:00
|
|
|
}
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
start()
|
2011-01-17 04:49:07 -05:00
|
|
|
{
|
2010-12-07 11:54:03 -06:00
|
|
|
local x= fs= rc=
|
2011-07-05 14:33:21 -05:00
|
|
|
for x in $net_fs_list $extra_net_fs_list; do
|
2009-04-27 07:51:18 +00:00
|
|
|
fs="$fs${fs:+,}$x"
|
2007-04-05 11:18:42 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
ebegin "Mounting network filesystems"
|
2009-04-27 07:51:18 +00:00
|
|
|
mount -at $fs
|
2010-12-07 11:54:03 -06:00
|
|
|
rc=$?
|
|
|
|
if [ "$RC_UNAME" = Linux ]; then
|
|
|
|
mount -a -O _netdev
|
|
|
|
rc=$?
|
|
|
|
fi
|
|
|
|
ewend $rc "Could not mount all network filesystems"
|
2007-04-05 11:18:42 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
stop()
|
|
|
|
{
|
2007-04-05 11:18:42 +00:00
|
|
|
local x= fs=
|
|
|
|
|
|
|
|
ebegin "Unmounting network filesystems"
|
2009-05-23 20:38:12 +01:00
|
|
|
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
2007-04-05 11:18:42 +00:00
|
|
|
|
2011-07-05 14:33:21 -05:00
|
|
|
for x in $net_fs_list $extra_net_fs_list; do
|
2014-10-01 17:14:25 -05:00
|
|
|
fs="$fs${fs:+,}$x"
|
2007-10-09 15:33:05 +00:00
|
|
|
done
|
2009-04-27 07:51:18 +00:00
|
|
|
if [ -n "$fs" ]; then
|
|
|
|
umount -at $fs || eerror "Failed to simply unmount filesystems"
|
2007-04-05 11:18:42 +00:00
|
|
|
fi
|
|
|
|
|
2007-10-09 15:33:05 +00:00
|
|
|
eindent
|
|
|
|
fs=
|
2011-07-05 14:33:21 -05:00
|
|
|
for x in $net_fs_list $extra_net_fs_list; do
|
2014-11-06 14:38:17 -06:00
|
|
|
fs="$fs${fs:+|}$x"
|
2007-10-09 15:33:05 +00:00
|
|
|
done
|
2009-04-27 07:51:18 +00:00
|
|
|
[ -n "$fs" ] && fs="^($fs)$"
|
|
|
|
do_unmount umount ${fs:+--fstype-regex} $fs --netdev
|
2007-10-09 15:33:05 +00:00
|
|
|
retval=$?
|
|
|
|
|
|
|
|
eoutdent
|
2010-12-07 11:54:03 -06:00
|
|
|
if [ "$RC_UNAME" = Linux ]; then
|
|
|
|
umount -a -O _netdev
|
|
|
|
retval=$?
|
|
|
|
fi
|
2009-04-27 07:51:18 +00:00
|
|
|
eend $retval "Failed to unmount network filesystems"
|
2007-04-05 11:18:42 +00:00
|
|
|
}
|