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
|
|
|
|
2012-09-15 00:59:00 +05:30
|
|
|
description="Mounts network shares, other than NFS, according to /etc/fstab."
|
|
|
|
# We skip all NFS shares in this script because they require extra
|
|
|
|
# daemons to be running on the client in order to work correctly.
|
|
|
|
# It is best to allow nfs-utils to handle all nfs shares.
|
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
|
2008-05-10 16:39:52 +05:30
|
|
|
use afc-client amd 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
|
|
|
case "$x" in
|
2007-04-05 16:48:42 +05:30
|
|
|
nfs|nfs4)
|
2012-09-15 00:59:00 +05:30
|
|
|
continue
|
2008-01-11 17:43:46 +05:30
|
|
|
;;
|
2007-04-05 16:48:42 +05:30
|
|
|
esac
|
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
|
2012-09-15 00:59:00 +05:30
|
|
|
case "$x" in
|
|
|
|
nfs|nfs4)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
fs="$fs${fs:+,}$x"
|
|
|
|
;;
|
|
|
|
esac
|
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
|
2012-09-15 00:59:00 +05:30
|
|
|
case "$x" in
|
|
|
|
nfs|nfs4)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
fs="$fs${fs:+|}$x"
|
|
|
|
;;
|
|
|
|
esac
|
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
|
|
|
}
|