Gentoo Archives: gentoo-commits

From: Sebastian Pipping <sping@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:experimental commit in: defaults/
Date: Mon, 07 Feb 2011 03:30:53
Message-Id: cb24bedd073f23ac518bc1c0b79aec4593db2817.sping@gentoo
1 commit: cb24bedd073f23ac518bc1c0b79aec4593db2817
2 Author: Peter Hjalmarsson <xake <AT> rymdraket <DOT> net>
3 AuthorDate: Tue Feb 1 18:34:54 2011 +0000
4 Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 7 03:07:08 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=cb24bedd
7
8 Move dev to chroot
9
10 This can be considered good practice, likely less chance that nodes
11 created in the ramdisk disapperes when switching root.
12 Some applications (mostly debugging/benchmarking) also needs this to
13 survive the switch_root.
14
15 ---
16 defaults/linuxrc | 8 ++++++--
17 1 files changed, 6 insertions(+), 2 deletions(-)
18
19 diff --git a/defaults/linuxrc b/defaults/linuxrc
20 index ee33a35..88eed00 100755
21 --- a/defaults/linuxrc
22 +++ b/defaults/linuxrc
23 @@ -725,10 +725,14 @@ cd "${CHROOT}"
24 mkdir "${CHROOT}/proc" "${CHROOT}/sys" 2>/dev/null
25 echo -ne "${BOLD}.${NORMAL}"
26
27 -# If devtmpfs is mounted assume genkernel mounted it at /dev and try unmounting it
28 +# If devtmpfs is mounted, try move it to the new root
29 +# If that fails, try to unmount all possible mounts of devtmpfs as stuff breaks otherwise
30 if grep -qs devtmpfs /proc/mounts
31 then
32 - umount /dev || echo '*: Failed to unmount the devtmpfs /dev!'
33 + if ! mount --move /dev "${CHROOT}"/dev
34 + then
35 + umount -a -t devtmpfs || echo '*: Failed to move and unmount the devtmpfs /dev!'
36 + fi
37 fi
38
39 umount /sys || echo '*: Failed to unmount the ramdisk /sys!'