/[baselayout]/trunk/init.d/netmount
Gentoo

Contents of /trunk/init.d/netmount

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2763 - (show annotations) (download)
Tue Jul 10 19:09:41 2007 UTC (7 years, 1 month ago) by uberlord
File size: 1963 byte(s)
init scripts and their extra options can now have descriptions, #184327.
1 #!/sbin/runscript
2 # Copyright 1999-2007 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 description="Mounts network shares according to /etc/fstab."
6
7 have_nfs() {
8 local IFS=\n x=
9 set -- $(fstabinfo --fstype nfs,nfs4)
10 for x in "$@" ; do
11 ! fstabinfo --opts "${x}" | grep -q noauto && return 0
12 done
13 return 1
14 }
15
16 depend() {
17 local myneed= myuse= pmap="portmap" nfsmounts= x
18 [ -x /etc/init.d/rpcbind ] && pmap="rpcbind"
19
20 # Only have Portmap as a dependency if there is a nfs mount in fstab that
21 # is set to mount at boot
22 if have_nfs ; then
23 myneed="${myneed} ${pmap}"
24 else
25 myuse="${myuse} ${pmap}"
26 fi
27
28 need net ${myneed}
29 use afc-client amd autofs dns nfs nfsmount ${myuse}
30 }
31
32 start() {
33 local myneed= myuse= pmap="portmap" nfsmounts=
34 [ -x /etc/init.d/rpcbind ] && pmap="rpcbind"
35
36 local x= fs=
37 for x in ${RC_NET_FS_LIST} ; do
38 case "${x}" in
39 nfs|nfs4)
40 # If the nfsmount script took care of the nfs filesystems,
41 # then there's no point in trying them twice
42 service_started nfsmount && continue
43
44 # Only try to mount NFS filesystems if portmap was started.
45 # This is to fix "hang" problems for new users who do not
46 # add portmap to the default runlevel.
47 if have_nfs && ! service_started "${pmap}" ; then
48 continue
49 fi
50 ;;
51 esac
52 fs="${fs}${fs:+,}${x}"
53 done
54
55 ebegin "Mounting network filesystems"
56 mount -at ${fs}
57 ewend $? "Could not mount all network filesystems!"
58 return 0
59 }
60
61 stop() {
62 local x= fs=
63 for x in ${RC_NET_FS_LIST} ; do
64 fs="${fs}${fs:+,}${x}"
65 done
66
67 ebegin "Unmounting network filesystems"
68 umount -at ${fs}
69 local retval=$?
70 eend ${retval} "Failed to simply unmount filesystems"
71
72 if [ ${retval} -ne 0 ] ; then
73 . "${RC_LIBDIR}/sh/rc-mount.sh"
74 eindent
75 fs=
76 for x in ${RC_NET_FS_LIST} ; do
77 fs="${fs:+|}${x}"
78 done
79 do_unmount "umount" "" "" "^(${fs})$"
80 retval=$?
81 eoutdent
82 fi
83
84 return ${retval}
85 }
86
87 # vim: set ts=4 :

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20