summaryrefslogtreecommitdiff
path: root/openembedded/packages/initscripts/initscripts-1.0/openslug/umountnfs.sh
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2005-08-31 10:45:47 +0000
committerRichard Purdie <richard@openedhand.com>2005-08-31 10:45:47 +0000
commit4b46c1f6e891b1ddd5968536440b888661fade3e (patch)
treee0ba2c1f56f61b868bf746da5c4feabb25b800b2 /openembedded/packages/initscripts/initscripts-1.0/openslug/umountnfs.sh
downloadopenembedded-core-4b46c1f6e891b1ddd5968536440b888661fade3e.tar.gz
openembedded-core-4b46c1f6e891b1ddd5968536440b888661fade3e.tar.bz2
openembedded-core-4b46c1f6e891b1ddd5968536440b888661fade3e.tar.xz
openembedded-core-4b46c1f6e891b1ddd5968536440b888661fade3e.zip
Initial population
git-svn-id: https://svn.o-hand.com/repos/poky@1 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'openembedded/packages/initscripts/initscripts-1.0/openslug/umountnfs.sh')
-rw-r--r--openembedded/packages/initscripts/initscripts-1.0/openslug/umountnfs.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/openembedded/packages/initscripts/initscripts-1.0/openslug/umountnfs.sh b/openembedded/packages/initscripts/initscripts-1.0/openslug/umountnfs.sh
new file mode 100644
index 000000000..994a91922
--- /dev/null
+++ b/openembedded/packages/initscripts/initscripts-1.0/openslug/umountnfs.sh
@@ -0,0 +1,40 @@
+#! /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
+ /|/proc)return 0;;
+ /dev) return 0;;
+ esac
+ # then unmount this, if nfs
+ case "$type" in
+ nfs|smbfs|ncpfs) umount -f "$mp";;
+ esac
+ fi
+}
+
+unmount </proc/mounts