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