3
# umountnfs Unmount all network filesystems except the root file system.
5
# Also unmounts all virtual filesystems (proc, devfs,
6
# devpts, usbfs, sysfs) that are not mounted at the
9
# Version: @(#)umountnfs 2.85-23 29-Jul-2004 miquels@cistron.nl
12
PATH=/sbin:/bin:/usr/sbin:/usr/bin
5
# Required-Stop: umountfs
6
# Should-Stop: $network $portmap nfs-common
9
# Short-Description: Unmount all network filesystems except the root fs.
10
# Description: Also unmounts all virtual filesystems (proc, devfs,
11
# devpts, usbfs, sysfs) that are not mounted at the
15
PATH=/sbin:/usr/sbin:/bin:/usr/bin
20
. /lib/lsb/init-functions
17
22
case "${KERNEL}:${RELEASE}" in
18
Linux:[01].*|Linux:2.[01].*)
21
Linux:2.[23].*|Linux:2.4.?|Linux:2.4.?-*|Linux:2.4.10|Linux:2.4.10-*)
23
Linux:[01].*|Linux:2.[01].*)
26
Linux:2.[23].*|Linux:2.4.?|Linux:2.4.?-*|Linux:2.4.10|Linux:2.4.10-*)
29
# Write a reboot record to /var/log/wtmp before unmounting
32
# Remove any .clean files in auto-clean dirs.
33
rm -f /tmp/.clean /var/lock/.clean /var/run/.clean
35
echo -n "Unmounting remote and non-toplevel virtual filesystems..."
38
# Read mtab file and add the directories we want to
39
# unmount in reverse to a list.
43
while read DEV DIR TYPE REST
35
# Write a reboot record to /var/log/wtmp before unmounting
38
# Remove bootclean flag files (precaution against symlink attacks)
39
rm -f /tmp/.clean /var/lock/.clean /var/run/.clean
42
# Make list of points to unmount in reverse order of their creation
48
while read DEV MTPT FSTYPE OPTS REST
46
/|/proc|/dev|/dev/pts|/proc/*|/sys)
51
nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda)
54
proc|procfs|devfs|devpts|usbfs|usbdevfs|sysfs)
51
/|/proc|/dev|/dev/pts|/dev/shm|/proc/*|/sys|/lib/init/rw)
55
if [ yes = "$RAMRUN" ] ; then
60
if [ yes = "$RAMLOCK" ] ; then
66
nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs)
69
proc|procfs|linprocfs|devfs|devpts|usbfs|usbdevfs|sysfs)
74
_netdev|*,_netdev|_netdev,*|*,_netdev,*)
84
[ "$VERBOSE" = no ] || log_action_begin_msg "Unmounting remote and non-toplevel virtual filesystems"
62
85
umount $FLAGS $DIRS
87
[ "$VERBOSE" = no ] || log_action_end_msg $ES
95
restart|reload|force-reload)
96
echo "Error: argument '$1' not supported" >&2
103
echo "Usage: umountnfs.sh [start|stop]" >&2