diff options
author | hschang <chang@dev3> | 2013-01-29 08:22:52 (GMT) |
---|---|---|
committer | hschang <chang@dev3> | 2013-01-29 08:22:52 (GMT) |
commit | 6e0ef550b9284f3bfeb5071cda83f3d6fbbaab21 (patch) | |
tree | 0c70132a1dc4d8b8a002e361ec0038a29ee4396e | |
parent | 7032b961c5ad671317c74a4ca3d28d8af320860d (diff) |
fix initscripts.
3 files changed, 82 insertions, 1 deletions
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 </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 index 0000000..78616ad --- /dev/null +++ b/meta-openvuplus/recipes-core/initscripts/initscripts-1.0/umountnfs.sh @@ -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 diff --git a/meta-openvuplus/recipes-core/initscripts/initscripts_1.0.bbappend b/meta-openvuplus/recipes-core/initscripts/initscripts_1.0.bbappend index 3dad882..46b30e6 100644 --- a/meta-openvuplus/recipes-core/initscripts/initscripts_1.0.bbappend +++ b/meta-openvuplus/recipes-core/initscripts/initscripts_1.0.bbappend @@ -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}:" |