From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:master commit in: /, defaults/
Date: Thu, 9 Feb 2012 07:42:48 +0000 (UTC) [thread overview]
Message-ID: <1077359d86836accf26f9711f1fde74f8f92b88b.robbat2@gentoo> (raw)
commit: 1077359d86836accf26f9711f1fde74f8f92b88b
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 9 07:40:51 2012 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Thu Feb 9 07:41:53 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=1077359d
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 <robbat2 <AT> 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$
+ 09 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> defaults/initrd.scripts,
+ defaults/linuxrc:
+ 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.
+
06 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> arch/alpha/config.sh,
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
}
-get_mount_options()
+get_mount_fstype()
{
awk -v fs="$1" '
/^[[:blank:]]*#/ { next }
@@ -1207,6 +1207,14 @@ get_mount_options()
' ${NEW_ROOT}/etc/fstab
}
+get_mount_options()
+{
+ awk -v fs="$1" '
+ /^[[:blank:]]*#/ { next }
+ $2 == fs { print $4 }
+ ' ${NEW_ROOT}/etc/fstab
+}
+
get_mount_device()
{
awk -v fs="$1" '
@@ -1215,3 +1223,12 @@ get_mount_device()
' ${NEW_ROOT}/etc/fstab
}
+# 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 leading,
+# 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..."
if [ "${ROOTFSTYPE}" = '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="ro,$(get_mount_options \"$fs\")"
- if ! mount -o ${opts} $dev ${NEW_ROOT}${fs}; then
- rescue_shell "Unable to mount $dev on $fs"
+ fstype=$(get_mount_fstype $fs)
+ # ro must be trailing, and the options will always contain at least 'defaults'
+ opts="$(get_mount_options $fs | strip_mount_options),ro"
+ mnt=${NEW_ROOT}${fs}
+ cmd="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
next reply other threads:[~2012-02-09 7:42 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 7:42 Robin H. Johnson [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-07-23 23:57 [gentoo-commits] proj/genkernel:master commit in: /, defaults/ Thomas Deutschmann
2019-11-26 13:50 Thomas Deutschmann
2019-07-21 16:26 Thomas Deutschmann
2017-09-04 5:36 Robin H. Johnson
2017-01-08 1:57 Robin H. Johnson
2017-01-07 23:50 Robin H. Johnson
2017-01-02 23:25 Robin H. Johnson
2016-05-16 6:55 Robin H. Johnson
2016-01-05 19:39 Robin H. Johnson
2016-01-05 19:39 Robin H. Johnson
2013-06-06 3:36 [gentoo-commits] proj/genkernel:ryao " Richard Yao
2013-06-03 23:49 ` [gentoo-commits] proj/genkernel:master " Richard Yao
2013-04-25 6:22 Fabio Erculiani
2012-10-16 0:03 Robin H. Johnson
2012-10-03 16:24 Sebastian Pipping
2012-08-30 16:20 Fabio Erculiani
2012-08-12 19:04 Sebastian Pipping
2012-07-24 18:01 Robin H. Johnson
2012-07-24 17:29 Robin H. Johnson
2012-07-24 8:29 Robin H. Johnson
2012-07-19 20:12 Richard Yao
2012-07-09 17:51 Sebastian Pipping
2012-07-08 17:05 Sebastian Pipping
2012-05-17 18:34 Sebastian Pipping
2012-03-17 1:27 Sebastian Pipping
2012-03-17 1:27 Sebastian Pipping
2012-03-17 1:27 Sebastian Pipping
2012-03-17 1:27 Sebastian Pipping
2012-02-20 6:58 Robin H. Johnson
2012-02-06 9:35 Robin H. Johnson
2012-02-06 8:19 Robin H. Johnson
2012-01-14 23:22 Sebastian Pipping
2012-01-13 23:19 Sebastian Pipping
2012-01-13 23:19 Sebastian Pipping
2012-01-06 6:37 Robin H. Johnson
2011-11-08 17:21 Sebastian Pipping
2011-10-08 21:22 Fabio Erculiani
2011-09-13 9:54 Fabio Erculiani
2011-09-11 7:40 Fabio Erculiani
2011-08-30 15:34 Sebastian Pipping
2011-07-27 17:38 Sebastian Pipping
2011-05-31 10:58 Sebastian Pipping
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1077359d86836accf26f9711f1fde74f8f92b88b.robbat2@gentoo \
--to=robbat2@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox