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 ) id 1RvOeg-0003h8-4s for garchives@archives.gentoo.org; Thu, 09 Feb 2012 07:42:58 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F1B27E0682; Thu, 9 Feb 2012 07:42:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B445AE0682 for ; Thu, 9 Feb 2012 07:42:50 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C79491B403C for ; Thu, 9 Feb 2012 07:42:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 7ABEDE53FF for ; Thu, 9 Feb 2012 07:42:48 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1077359d86836accf26f9711f1fde74f8f92b88b.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: 1077359d86836accf26f9711f1fde74f8f92b88b Date: Thu, 9 Feb 2012 07:42:48 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 171e400b-233b-4626-90c2-368af23ba174 X-Archives-Hash: 2f4f6ba45d06fd64fbd6c4bcd3815d20 commit: 1077359d86836accf26f9711f1fde74f8f92b88b Author: Robin H. Johnson gentoo org> AuthorDate: Thu Feb 9 07:40:51 2012 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Thu Feb 9 07:41:53 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/genkernel.git= ;a=3Dcommit;h=3D1077359d linuxrc /usr mounting Dogfooding of the /usr mount code with the matching OpenRC change to make the mounts RW revealed some bugs and gotchas in our prior code, now fixed and verified to work. Signed-off-by: Robin H. Johnson gentoo.org> --- ChangeLog | 6 ++++++ defaults/initrd.scripts | 19 ++++++++++++++++++- defaults/linuxrc | 13 +++++++++---- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f52685..f867f22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,12 @@ # Distributed under the GPL v2 # $Id$ =20 + 09 Feb 2012; Robin H. Johnson defaults/initrd.scr= ipts, + defaults/linuxrc: + Dogfooding of the /usr mount code with the matching OpenRC change to m= ake the + mounts RW revealed some bugs and gotchas in our prior code, now fixed = and + verified to work. + 06 Feb 2012; Robin H. Johnson arch/alpha/config.s= h, arch/arm/config.sh, arch/ia64/config.sh, arch/mips/config.sh, arch/parisc/config.sh, arch/parisc64/config.sh, arch/ppc/config.sh, diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 54e7b80..16e1d0d 100755 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1199,7 +1199,7 @@ get_mounts_list() ' ${NEW_ROOT}/etc/initramfs.mounts } =20 -get_mount_options() +get_mount_fstype() { awk -v fs=3D"$1" ' /^[[:blank:]]*#/ { next } @@ -1207,6 +1207,14 @@ get_mount_options() ' ${NEW_ROOT}/etc/fstab } =20 +get_mount_options() +{ + awk -v fs=3D"$1" ' + /^[[:blank:]]*#/ { next } + $2 =3D=3D fs { print $4 } + ' ${NEW_ROOT}/etc/fstab +} + get_mount_device() { awk -v fs=3D"$1" ' @@ -1215,3 +1223,12 @@ get_mount_device() ' ${NEW_ROOT}/etc/fstab } =20 +# If the kernel is handed a mount option is does not recognize, it WILL = fail to +# mount. util-linux handles auto/noauto, but busybox passes it straight = to the kernel +# which then rejects the mount. +# To make like a little easier, busybox mount does not care about leadin= g, +# trailing or duplicate commas. +strip_mount_options() +{ + sed -r 's/(,|^)(no)?auto(,|$)/,/g' +} diff --git a/defaults/linuxrc b/defaults/linuxrc index 0a69a6d..693257f 100755 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -531,7 +531,7 @@ do # there is no isofs filesystem to worry about break else - good_msg "Mounting root..." + good_msg "Mounting $REAL_ROOT as root..." =20 if [ "${ROOTFSTYPE}" =3D 'zfs' ] then @@ -780,9 +780,14 @@ for fs in $fslist; do # 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" + fstype=3D$(get_mount_fstype $fs) + # ro must be trailing, and the options will always contain at least 'de= faults' + opts=3D"$(get_mount_options $fs | strip_mount_options),ro" + mnt=3D${NEW_ROOT}${fs} + cmd=3D"mount -t $fstype -o $opts $dev $mnt" + good_msg "Mounting $dev as ${fs}: $cmd" + if ! $cmd; then + bad_msg "Unable to mount $dev for $fs" fi done =20