From 4b46c1f6e891b1ddd5968536440b888661fade3e Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 31 Aug 2005 10:45:47 +0000 Subject: Initial population git-svn-id: https://svn.o-hand.com/repos/poky@1 311d38ba-8fff-0310-9ca6-ca027cbcb966 --- .../initscripts/initscripts-1.0/openslug/umountfs | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 openembedded/packages/initscripts/initscripts-1.0/openslug/umountfs (limited to 'openembedded/packages/initscripts/initscripts-1.0/openslug/umountfs') diff --git a/openembedded/packages/initscripts/initscripts-1.0/openslug/umountfs b/openembedded/packages/initscripts/initscripts-1.0/openslug/umountfs new file mode 100644 index 000000000..d6f432dbd --- /dev/null +++ b/openembedded/packages/initscripts/initscripts-1.0/openslug/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