2013-12-22 02:21:11 +05:30
|
|
|
#!@SBINDIR@/openrc-run
|
2015-12-05 04:22:19 +05:30
|
|
|
# Copyright (c) 2007-2015 The OpenRC Authors.
|
|
|
|
# See the Authors file at the top-level directory of this distribution and
|
|
|
|
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
|
|
|
#
|
|
|
|
# This file is part of OpenRC. It is subject to the license terms in
|
|
|
|
# the LICENSE file found in the top-level directory of this
|
|
|
|
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
|
|
|
# This file may not be copied, modified, propagated, or distributed
|
|
|
|
# except according to the terms contained in the LICENSE file.
|
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()
|
|
|
|
{
|
2015-12-09 03:32:31 +05:30
|
|
|
local opts mywant=""
|
|
|
|
for opts in $(fstabinfo -o -t nfs,nfs4); do
|
|
|
|
case $opts in
|
|
|
|
noauto) ;;
|
|
|
|
*) mywant="$mywant nfsclient"; break ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
config /etc/fstab
|
|
|
|
want $mywant
|
|
|
|
use afc-client amd openvpn
|
2012-09-15 00:59:00 +05:30
|
|
|
use dns
|
2015-04-29 06:33:49 +05:30
|
|
|
keyword -jail -prefix -systemd-nspawn -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=$?
|
2015-10-02 03:46:14 +05:30
|
|
|
if [ "$RC_UNAME" = Linux ]; then
|
|
|
|
mount -a -O _netdev
|
|
|
|
rc=$?
|
|
|
|
fi
|
2010-12-07 23:24:03 +05:30
|
|
|
ewend $rc "Could not mount all network filesystems"
|
2015-08-21 05:31:23 +05:30
|
|
|
if [ "$RC_UNAME" != Linux ]; then
|
|
|
|
rc=0
|
|
|
|
fi
|
|
|
|
return $rc
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
|
|
|
|
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
|
2015-10-02 03:46:14 +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
|
|
|
}
|