summaryrefslogtreecommitdiff
path: root/packages/initscripts/initscripts-1.0/slugos/umountfs
diff options
context:
space:
mode:
authorRod Whitby <rod@whitby.id.au>2006-01-07 08:58:44 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-01-07 08:58:44 +0000
commit8fb6b2d3d410ad2badf0c99ed7a66b698aafaa17 (patch)
tree8a700d795bdf33061b8bccc353fe0aaffa044036 /packages/initscripts/initscripts-1.0/slugos/umountfs
parent0b67482ddc4fe571d16fa094627abb447b9a8edb (diff)
slugos: Major rename of common SlugOS files and directories from openslug to slugos.
Diffstat (limited to 'packages/initscripts/initscripts-1.0/slugos/umountfs')
-rw-r--r--packages/initscripts/initscripts-1.0/slugos/umountfs43
1 files changed, 43 insertions, 0 deletions
diff --git a/packages/initscripts/initscripts-1.0/slugos/umountfs b/packages/initscripts/initscripts-1.0/slugos/umountfs
new file mode 100644
index 0000000000..d6f432dbda
--- /dev/null
+++ b/packages/initscripts/initscripts-1.0/slugos/umountfs
@@ -0,0 +1,43 @@
+#! /bin/sh
+#
+# umountfs Turn off swap and unmount all local filesystems.
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+# Ensure /proc is mounted
+test -r /proc/mounts || mount -t proc proc /proc
+
+echo "Deactivating swap..."
+swapoff -a
+
+# We leave /proc mounted, the umount of /dev/devpts seems to fail
+# quite frequently, the busybox umount apparently gives up at the
+# first failure, so it is necessary to go file system by file
+# system. It is necessary to go backward in the /proc list, because
+# later things may have been mounted on earlier mounts.
+devfs=
+unmount() {
+ local dev mp type opts
+ if read dev mp type opts
+ then
+ # recurse - unmount later items
+ unmount
+ # skip /proc and /dev but not the sub-directories
+ case "$mp" in
+ /|/proc)return 0;;
+ /dev) devfs=1
+ return 0;;
+ esac
+ # then unmount this, if possible, otherwise make
+ # it read-only
+ umount -f -r "$mp"
+ fi
+}
+
+echo "Unmounting local filesystems..."
+unmount </proc/mounts
+
+# now /dev and read-only / (halt/reboot may need /proc!)
+test -n "$devfs" && umount -f -r /dev
+mount -o remount,ro /