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

Contents of /trunk/init.d/netmount

Parent Directory Parent Directory | Revision Log Revision Log


Revision 484 - (show annotations) (download)
Wed Apr 21 17:09:18 2004 UTC (15 years, 1 month ago) by vapier
File size: 2428 byte(s)
update copyright years

1 #!/sbin/runscript
2 # Copyright 1999-2004 Gentoo Technologies, Inc.
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header$
5
6 depend() {
7 local myneed="net"
8 local myuse=""
9
10 #
11 # Only have Portmap as a dependency if there is a nfs mount in fstab
12 # that should be mounted at boot time. Also filter out comments.
13 #
14 local nfsmounts="$(awk '!/^#/ && $3 == "nfs" && $4 !~ /noauto/ { print $0 }' /etc/fstab)"
15
16 if [ -n "${nfsmounts}" ]
17 then
18 local myneed="${myneed} portmap"
19 local myuse="${myuse} nfs"
20 fi
21
22 need ${myneed}
23 use ${myuse}
24 }
25
26 start() {
27 local rcfilesystems=""
28
29 # Only try to mount NFS filesystems if portmap was started.
30 # This is to fix "hang" problems for new users who do not
31 # add portmap to the default runlevel.
32 if [ -L ${svcdir}/started/portmap ]
33 then
34 rcfilesystems="coda,nfs,ncpfs,smbfs"
35 else
36 rcfilesystems="coda,ncpfs,smbfs"
37 fi
38
39 ebegin "Mounting network filesystems"
40 mount -at ${rcfilesystems} >/dev/null
41
42 if [ "$?" -ne 0 ]
43 then
44 ewend 1 "Could not mount all network filesystems!"
45 else
46 eend 0
47 fi
48
49 return 0
50 }
51
52 stop() {
53 # umount -art $fstypes doesn't seem to work, so...
54 # NB: we have to check if any network filesystems is mounted,
55 # else mount do not exit cleanly
56
57 local sig retry
58 local remaining="$(awk '$3 ~ /coda|nfs|ncpfs|smbfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
59
60 # just keep things nice and uniform
61 if [ -z "${remaining}" ]
62 then
63 ebegin "Unmounting network filesystems"
64 eend 0
65 else
66 sig=
67 retry=3
68 while [ -n "${remaining}" -a "${retry}" -gt 0 ]
69 do
70 if [ "${retry}" -lt 3 ]
71 then
72 ebegin "Unmounting network filesystems (retry)"
73 umount ${remaining} &>/dev/null
74 eend $? "Failed to unmount filesystems this retry"
75 else
76 ebegin "Unmounting network filesystems"
77 umount ${remaining} &>/dev/null
78 eend $? "Failed to unmount filesystems"
79 fi
80 remaining="$(awk '$3 ~ /coda|nfs|ncpfs|smbfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
81 [ -z "${remaining}" ] && break
82 /bin/fuser -k -m ${sig} ${remaining} &>/dev/null
83 sleep 5
84 retry=$((${retry} -1))
85 sig=-9
86 done
87 fi
88 }
89
90
91 # vim:ts=4

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20