summaryrefslogtreecommitdiff
path: root/packages/initscripts/initscripts-1.0/openprotium/umountfs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/initscripts/initscripts-1.0/openprotium/umountfs')
-rwxr-xr-xpackages/initscripts/initscripts-1.0/openprotium/umountfs27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/initscripts/initscripts-1.0/openprotium/umountfs b/packages/initscripts/initscripts-1.0/openprotium/umountfs
new file mode 100755
index 0000000000..e489c4c1cd
--- /dev/null
+++ b/packages/initscripts/initscripts-1.0/openprotium/umountfs
@@ -0,0 +1,27 @@
+#! /bin/sh
+#
+# umountfs Turn off swap and unmount all local filesystems.
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+echo "Deactivating swap..."
+swapoff -a
+
+# We leave /proc mounted.
+echo "Unmounting local filesystems..."
+# umount anything not a pseudo file system, and not root
+# doesn't work for nested mounts at a non-root mount point
+while read device mountpt fstype options
+do
+ echo "$device" | grep -q "^/"
+ if [ $? -eq 0 ]; then
+ if [ "$mountpt" != "/" ] && [ "$mountpt" != "/dev/" ]; then
+ umount $mountpt
+ fi
+ fi
+done</proc/mounts
+
+mount -o remount,ro /
+
+: exit 0