fix initscripts.
authorhschang <chang@dev3>
Tue, 29 Jan 2013 08:22:52 +0000 (17:22 +0900)
committerhschang <chang@dev3>
Tue, 29 Jan 2013 08:22:52 +0000 (17:22 +0900)
meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountfs [new file with mode: 0755]
meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountnfs.sh [new file with mode: 0755]
meta-openvuplus/recipes-core/initscripts/initscripts_1.0.bbappend

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 (executable)
index 0000000..a05d406
--- /dev/null
@@ -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 </proc/mounts
+
+mount -o remount,ro /
diff --git a/meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountnfs.sh b/meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountnfs.sh
new file mode 100755 (executable)
index 0000000..78616ad
--- /dev/null
@@ -0,0 +1,39 @@
+#!/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
+               /) return 0;;
+               esac
+               # then unmount this, if nfs
+               case "$type" in
+               nfs|smbfs|ncpfs|cifs) umount -f -r "$mp";;
+               esac
+       fi
+}
+
+unmount </proc/mounts
index 3dad882..46b30e6 100644 (file)
@@ -1,4 +1,4 @@
-PR .= "-vuplus3"
+PR .= "-vuplus4"
 
 BOOTUP = "bootup_3.1" 
 
@@ -18,6 +18,10 @@ do_install_append() {
        install -m 0755 ${WORKDIR}/make_mac_sector   ${D}/usr/bin
        install -m 0755 ${WORKDIR}/${BOOTUP}         ${D}${sysconfdir}/init.d/bootup
        ln      -sf     ../init.d/bootup             ${D}${sysconfdir}/rcS.d/S05bootup
+
+       # rename umountnfs script because it should run before network is disabled
+        mv ${D}${sysconfdir}/rc0.d/S31umountnfs.sh ${D}${sysconfdir}/rc0.d/K31umountnfs.sh || /bin/true
+        mv ${D}${sysconfdir}/rc6.d/S31umountnfs.sh ${D}${sysconfdir}/rc6.d/K31umountnfs.sh || /bin/true
 }
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/${P}:"