From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-commits+bounces-415015-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1Rj3QS-0000Rg-8b
	for garchives@archives.gentoo.org; Fri, 06 Jan 2012 06:37:16 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 2EF4621C09B;
	Fri,  6 Jan 2012 06:37:07 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id E31C221C068
	for <gentoo-commits@lists.gentoo.org>; Fri,  6 Jan 2012 06:37:06 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 642DB1B4011
	for <gentoo-commits@lists.gentoo.org>; Fri,  6 Jan 2012 06:37:06 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id A354F80042
	for <gentoo-commits@lists.gentoo.org>; Fri,  6 Jan 2012 06:37:05 +0000 (UTC)
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" <robbat2@gentoo.org>
Message-ID: <603a1978393aaf4e872dbcf0691a8272e0a3dc5d.robbat2@gentoo>
Subject: [gentoo-commits] proj/genkernel:master commit in: /, defaults/
X-VCS-Repository: proj/genkernel
X-VCS-Files: ChangeLog defaults/initrd.scripts defaults/linuxrc
X-VCS-Directories: / defaults/
X-VCS-Committer: robbat2
X-VCS-Committer-Name: Robin H. Johnson
X-VCS-Revision: 603a1978393aaf4e872dbcf0691a8272e0a3dc5d
Date: Fri,  6 Jan 2012 06:37:05 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: bcb1aa58-6397-4672-b571-c91d5c76afd2
X-Archives-Hash: d972323f3063bb15d22bf89547c7fda7

commit:     603a1978393aaf4e872dbcf0691a8272e0a3dc5d
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  6 04:18:37 2012 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Fri Jan  6 06:27:17 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/genkernel.git=
;a=3Dcommit;h=3D603a1978

Code to mount /usr and other filesystems as needed for new udev and syste=
md.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 ChangeLog               |    4 ++++
 defaults/initrd.scripts |   25 +++++++++++++++++++++++++
 defaults/linuxrc        |   23 +++++++++++++++++++++--
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 48843ec..01598db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
 # Distributed under the GPL v2
 # $Id$
=20
+  06 Jan 2012; Robin H. Johnson <robbat2@gentoo.org> defaults/initrd.scr=
ipts,
+  defaults/linuxrc:
+  Code to mount /usr and other filesystems as needed for new udev and sy=
stemd.
+
   06 Jan 2012; Robin H. Johnson <robbat2@gentoo.org> genkernel:
   Bump version to 3.4.21.2. Stock configuration of 3.4.21.1 generates
   unbootable initramfs!

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index b7b42ab..89629e9 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1178,3 +1178,28 @@ setup_unionfs() {
 		USE_UNIONFS_NORMAL=3D0
 	fi
 }
+
+get_mounts_list()
+{
+	awk '
+		/^[[:blank:]]*#/ { next }
+		{ print $1 }
+		' ${NEW_ROOT}/etc/initramfs.mounts
+}
+
+get_mount_options()
+{
+	awk -v fs=3D"$1" '
+		/^[[:blank:]]*#/ { next }
+		$2 =3D=3D fs { print $3 }
+		' ${NEW_ROOT}/etc/fstab
+}
+
+get_mount_device()
+{
+	awk -v fs=3D"$1" '
+		/^[[:blank:]]*#/ { next }
+		$2 =3D=3D fs { print $1 }
+		' ${NEW_ROOT}/etc/fstab
+}
+

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 28d204e..599c0d1 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -701,6 +701,24 @@ else
 	fi
 fi
=20
+# Mount the additional things as required by udev & systemd
+if [ ! -f ${NEW_ROOT}/etc/initramfs.mounts ]; then
+	fslist=3D"/usr"
+else
+	fslist=3D$(get_mounts_list)
+fi
+
+for fs in $fslist; do
+	dev=3D$(get_mount_device $fs)
+	# In this case, it's probably part of the filesystem
+	# and not a mountpoint
+	[ -z "$dev" ] && continue
+	opts=3D"ro,$(get_mount_options \"$fs\")"
+	if ! mount -o ${opts} $dev ${NEW_ROOT}${fs}; then
+		rescue_shell "Unable to mount $dev on $fs"
+	fi
+done
+
 # Execute script on the cdrom just before boot to update things if neces=
sary
 cdupdate
=20
@@ -746,10 +764,11 @@ exec /sbin/switch_root -c "/dev/console" "${CHROOT}=
" "${REAL_INIT:-/sbin/init}"
 # If we get here, something bad has happened
 splash 'verbose'
=20
-echo 'A fatal error has probably occured since /sbin/init did not'
-echo 'boot correctly. Trying to open a shell...'
+echo "A fatal error has probably occured since ${REAL_INIT:-/sbin/init} =
did not"
+echo "boot correctly. Trying to open a shell..."
 echo
 exec /bin/bash
 exec /bin/sh
 exec /bin/ash
+exec /bin/dash
 exec sh