summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hjalmarsson <xake@rymdraket.net>2011-02-01 19:34:54 +0100
committerSebastian Pipping <sebastian@pipping.org>2011-02-07 04:07:08 +0100
commitcb24bedd073f23ac518bc1c0b79aec4593db2817 (patch)
tree5066295802344656e10c4dc912a525e9079ebf8d
parentUpdate options for devtmpfs (diff)
downloadgenkernel-cb24bedd073f23ac518bc1c0b79aec4593db2817.tar.gz
genkernel-cb24bedd073f23ac518bc1c0b79aec4593db2817.tar.bz2
genkernel-cb24bedd073f23ac518bc1c0b79aec4593db2817.zip
Move dev to chroot
This can be considered good practice, likely less chance that nodes created in the ramdisk disapperes when switching root. Some applications (mostly debugging/benchmarking) also needs this to survive the switch_root.
-rwxr-xr-xdefaults/linuxrc8
1 files changed, 6 insertions, 2 deletions
diff --git a/defaults/linuxrc b/defaults/linuxrc
index ee33a35..88eed00 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -725,10 +725,14 @@ cd "${CHROOT}"
mkdir "${CHROOT}/proc" "${CHROOT}/sys" 2>/dev/null
echo -ne "${BOLD}.${NORMAL}"
-# If devtmpfs is mounted assume genkernel mounted it at /dev and try unmounting it
+# If devtmpfs is mounted, try move it to the new root
+# If that fails, try to unmount all possible mounts of devtmpfs as stuff breaks otherwise
if grep -qs devtmpfs /proc/mounts
then
- umount /dev || echo '*: Failed to unmount the devtmpfs /dev!'
+ if ! mount --move /dev "${CHROOT}"/dev
+ then
+ umount -a -t devtmpfs || echo '*: Failed to move and unmount the devtmpfs /dev!'
+ fi
fi
umount /sys || echo '*: Failed to unmount the ramdisk /sys!'