]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/initscripts/initscripts-1.0/openslug/umountnfs.sh
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / initscripts / initscripts-1.0 / openslug / umountnfs.sh
1 #! /bin/sh
2 #
3 # umountnfs.sh  Unmount all network filesystems.
4 #
5 PATH=/sbin:/bin:/usr/sbin:/usr/bin
6
7 # Write a reboot record to /var/log/wtmp before unmounting
8 halt -w
9
10 # Ensure /proc is mounted
11 test -r /proc/mounts || mount -t proc proc /proc
12
13 echo "Unmounting remote filesystems..."
14
15 #
16 # Read the list of mounted file systems and -f umount the
17 # known network file systems.  -f says umount it even if
18 # the server is unreachable.  Do not attempt to umount
19 # the root file system.  Unmount in reverse order from
20 # that given by /proc/mounts (otherwise it may not work).
21 #
22 unmount() {
23         local dev mp type opts
24         if read dev mp type opts
25         then
26                 # recurse - unmount later items
27                 unmount
28                 # skip /, /proc and /dev
29                 case "$mp" in
30                 /|/proc)return 0;;
31                 /dev)   return 0;;
32                 esac
33                 # then unmount this, if nfs
34                 case "$type" in
35                 nfs|smbfs|ncpfs) umount -f "$mp";;
36                 esac
37         fi
38 }
39
40 unmount </proc/mounts