summaryrefslogtreecommitdiff
path: root/meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountnfs.sh
blob: 78616adb53404dcfbf11467adf65e13c30378794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
#
# umountnfs.sh	Unmount all network filesystems.
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin

# Write a reboot record to /var/log/wtmp before unmounting
halt -w

# Ensure /proc is mounted
test -r /proc/mounts || mount -t proc proc /proc

echo "Unmounting remote filesystems..."

#
# Read the list of mounted file systems and -f umount the
# known network file systems.  -f says umount it even if
# the server is unreachable.  Do not attempt to umount
# the root file system.  Unmount in reverse order from
# that given by /proc/mounts (otherwise it may not work).
#
unmount() {
	local dev mp type opts
	if read dev mp type opts
	then
		# recurse - unmount later items
		unmount
		# skip /, /proc and /dev
		case "$mp" in
		/) return 0;;
		esac
		# then unmount this, if nfs
		case "$type" in
		nfs|smbfs|ncpfs|cifs) umount -f -r "$mp";;
		esac
	fi
}

unmount </proc/mounts