From 6e0ef550b9284f3bfeb5071cda83f3d6fbbaab21 Mon Sep 17 00:00:00 2001 From: hschang Date: Tue, 29 Jan 2013 17:22:52 +0900 Subject: [PATCH] fix initscripts. --- .../initscripts/initscripts-1.0/umountfs | 38 +++++++++++++++++++++ .../initscripts/initscripts-1.0/umountnfs.sh | 39 ++++++++++++++++++++++ .../initscripts/initscripts_1.0.bbappend | 6 +++- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100755 meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountfs create mode 100755 meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountnfs.sh diff --git a/meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountfs b/meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountfs new file mode 100755 index 0000000..a05d406 --- /dev/null +++ b/meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountfs @@ -0,0 +1,38 @@ +#!/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. +unmount() { + local dev mp type opts + if read dev mp type opts + then + # recurse - unmount later items + unmount + # skip / and needed virtual filesystems + case "$mp" in + /|/dev|/proc|/sys) return 0;; + esac + # then unmount this, if possible, otherwise make + # it read-only + umount -f -r "$mp" + fi +} + +echo "Unmounting local filesystems..." +unmount