Subversion Repositories configs

Rev

Rev 33 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 - 1
#!/bin/bash
2
#
3
# netfs         Mount network filesystems.
4
#
5
# Authors:	Bill Nottingham <notting@redhat.com>
6
#		AJ Lewis <alewis@redhat.com>
7
# 		Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
8
#
9
# chkconfig: 345 25 75
10
# description: Mounts and unmounts all Network File System (NFS), \
11
#	       CIFS (Lan Manager/Windows), and NCP (NetWare) mount points.
12
### BEGIN INIT INFO
13
# Provides: $remote_fs
14
# Short-Description: Mount and unmount network filesystems.
15
# Description: Mount and unmount network filesystems.
16
### END INIT INFO
17
 
18
[ -f /etc/sysconfig/network ] || exit 0
19
. /etc/init.d/functions
20
. /etc/sysconfig/network
21
 
57 - 22
__source_netdevs_fstab
23
__source_netdevs_mtab
3 - 24
 
25
# See how we were called.
26
case "$1" in
27
  start)
28
        [ ! -f /var/lock/subsys/network ] && ! nm-online -x >/dev/null 2>&1 && exit 0
29
        [ "$EUID" != "0" ] && exit 4
30
        [ -n "$NFSFSTAB" ] &&
31
	  {
32
	    [ ! -f /var/lock/subsys/rpcbind ] && service rpcbind start
33
	    echo $"NFS filesystems queued to be mounted"
34
	  }
35
        [ -n "$CIFSFSTAB" ] && echo $"CIFS filesystems queued to be mounted"
36
        [ -n "$NCPFSTAB" ] && echo $"NCP filesystems queued to be mounted"
8 - 37
        [ -n "$GLUSTERFSFSTAB" ] && echo $"GLUSTERFS filesystems queued to be mounted"
3 - 38
        [ -n "$NETDEVFSTAB" ] &&
39
	  {
40
	    if [ -f /etc/mdadm.conf ] && [ -x /sbin/mdadm ]; then
41
		/sbin/mdadm -A -s
42
	    fi
43
	    if [ -f /etc/multipath.conf -a -x /sbin/multipath ]; then
44
	    	modprobe dm-multipath >/dev/null 2>&1
45
		/sbin/multipath -v 0
46
		if [ -x /sbin/kpartx ]; then
47
		       /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p"
48
		fi
49
	    fi
50
	    if [ -x /sbin/lvm ]; then
51
		if /sbin/lvm vgscan > /dev/null 2>&1 ; then
8 - 52
		       action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a ay --ignoreskippedcluster
3 - 53
		fi
54
	    fi
55
 
56
	    if [ -f /etc/crypttab ]; then
57
	        init_crypto 1
58
	    fi
59
 
60
	    STRING=$"Checking network-attached filesystems"
61
 
62
	    echo $STRING
63
	    fsck -A -T -M -a -t opts=_netdev
64
	    rc=$?
65
 
66
	    if [ "$rc" -eq "0" ]; then
67
	    	success "$STRING"
68
		echo
69
	    elif [ "$rc" -eq "1" ]; then
70
	        passed "$STRING"
71
	        echo
72
	    fi
73
 
74
	    if [ "$rc" -gt 1 ]; then
75
		if [ -x /bin/plymouth ] && /bin/plymouth --ping ; then
76
			/bin/plymouth --hide-splash
77
		fi
78
		failure "$STRING"
79
		tty >/dev/null 2>&1 || exit 1
80
		echo
81
		echo
82
		echo $"*** An error occurred during the file system check."
83
		echo $"*** Dropping you to a shell; the system will reboot"
84
		echo $"*** when you leave the shell."
85
 
86
		str=$"(Repair filesystem)"
87
		PS1="$str \# # "; export PS1
88
		[ "$SELINUX" = "1" ] && disable_selinux
89
		sulogin
90
 
91
		shutdown -r now
92
	   fi
93
	  }
94
	touch /var/lock/subsys/netfs
95
	# The 'no' applies to all listed filesystem types. See mount(8).
96
	action $"Mounting filesystems: " mount -a -t nogfs2
97
	;;
98
  stop)
99
        # Unmount loopback stuff first
100
        [ "$EUID" != "0" ] && exit 4
57 - 101
	__umount_loopback_loop --netdev
3 - 102
  	if [ -n "$NETDEVMTAB" ]; then
103
		__umount_loop '$4 ~ /_netdev/ && $2 != "/" {print $2}' \
104
			/etc/mtab \
105
			$"Unmounting network block filesystems: " \
106
			$"Unmounting network block filesystems (retry): "
107
	fi
8 - 108
	if [ -n "$GLUSTERFSMTAB" ]; then
109
		__umount_loop '$3 ~ /^glusterfs/ {print $2}' \
110
			/etc/mtab \
111
			$"Unmounting GLUSTERFS filesystems: " \
112
			$"Unmounting GLUSTERFS filesystems (retry): "
113
	fi
3 - 114
  	if [ -n "$NFSMTAB" ]; then
57 - 115
               __umount_loop_2 '$3 ~ /^nfs/ && $3 != "nfsd" && $2 != "/" {print $2}' \
116
                       /proc/mounts \
117
                       $"Unmounting NFS filesystems: " \
118
                       $"Unmounting NFS filesystems (retry): "
119
    fi
3 - 120
	[ -n "$CIFSMTAB" ] && action $"Unmounting CIFS filesystems: " umount -a -t cifs
121
	[ -n "$NCPMTAB" ] && action $"Unmounting NCP filesystems: " umount -a -t ncp,ncpfs
122
	rm -f /var/lock/subsys/netfs
123
	;;
124
  status)
125
	if [ -f /proc/mounts ] ; then
126
	        [ -n "$NFSFSTAB" ] && {
127
		     echo $"Configured NFS mountpoints: "
128
		     for fs in $NFSFSTAB; do echo $fs ; done
129
		}
130
	        [ -n "$CIFSFSTAB" ] && {
131
		     echo $"Configured CIFS mountpoints: "
132
		     for fs in $CIFSFSTAB; do echo $fs ; done
133
		}
134
	        [ -n "$NCPFSTAB" ] && {
135
		     echo $"Configured NCP mountpoints: "
136
		     for fs in $NCPFSTAB; do echo $fs ; done
137
		}
138
		[ -n "$NETDEVFSTAB" ] && {
139
		      echo $"Configured network block devices: "
140
		      for fs in $NETDEVFSTAB; do echo $fs ; done
141
		}
142
		[ -n "$NFSMTAB" ] && {
143
                      echo $"Active NFS mountpoints: "
144
		      for fs in $NFSMTAB; do echo $fs ; done
145
		}
146
		[ -n "$CIFSMTAB" ] && {
147
                      echo $"Active CIFS mountpoints: "
148
		      for fs in $CIFSMTAB; do echo $fs ; done
149
		}
150
		[ -n "$NCPMTAB" ] && {
151
                      echo $"Active NCP mountpoints: "
152
		      for fs in $NCPMTAB; do echo $fs ; done
153
		}
8 - 154
		[ -n "$GLUSTERFSMTAB" ] && {
155
                      echo $"Active GLUSTERFS mountpoints: "
156
		      for fs in $GLUSTERFSMTAB; do echo $fs ; done
157
		}
3 - 158
		[ -n "$NETDEVMTAB" ] && {
159
		      echo $"Active network block devices: "
160
		      for fs in $NETDEVMTAB; do echo $fs ; done
161
		}
162
	else
163
		echo $"/proc filesystem unavailable"
164
	fi
165
	[ -r /var/lock/subsys/netfs ] || exit 3
166
	;;
167
  restart)
168
	$0 stop
169
	$0 start
170
	exit $?
171
	;;
172
  reload)
173
        $0 start
174
	exit $?
175
	;;
176
  *)
177
	echo $"Usage: $0 {start|stop|restart|reload|status}"
178
	exit 2
179
esac
180
 
181
exit 0