From: "Fabio Erculiani" <lxnay@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:master commit in: /, defaults/
Date: Sat, 8 Oct 2011 21:22:32 +0000 (UTC) [thread overview]
Message-ID: <84cc7ccdfba1bde785c6d6116c42dda2c58d9ca7.lxnay@gentoo> (raw)
commit: 84cc7ccdfba1bde785c6d6116c42dda2c58d9ca7
Author: Fabio Erculiani <lxnay <AT> sabayon <DOT> org>
AuthorDate: Sat Oct 8 21:26:51 2011 +0000
Commit: Fabio Erculiani <lxnay <AT> gentoo <DOT> org>
CommitDate: Sat Oct 8 21:26:51 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=84cc7ccd
Do not hardcode /mnt/cdrom path across the whole code, use CDROOT_PATH
instead. At the same time, mount cdrom into /mnt/cdrom instead of
/newroot/mnt/cdrom (which is now just a bind mount), this avoids
losetup to expose unavailable paths inside the live system, breaking
mkfs.btrfs (next upstream version, which does silly things with
/proc/mounts).
---
ChangeLog | 9 +++++++++
defaults/initrd.defaults | 1 +
defaults/initrd.scripts | 39 +++++++++++++++++----------------------
defaults/linuxrc | 23 ++++++++++++-----------
4 files changed, 39 insertions(+), 33 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3bf74d0..78a722f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,15 @@
# Distributed under the GPL v2
# $Id$
+ 08 Oct 2011; Fabio Erculiani <lxnay@gentoo.org> defaults/initrd.defaults,
+ defaults/initrd.scripts, defaults/linuxrc:
+ Do not hardcode /mnt/cdrom path across the whole code, use CDROOT_PATH
+ instead. At the same time, mount cdrom into /mnt/cdrom instead of
+ /newroot/mnt/cdrom (which is now just a bind mount), this avoids
+ losetup to expose unavailable paths inside the live system, breaking
+ mkfs.btrfs (next upstream version, which does silly things with
+ /proc/mounts).
+
07 Oct 2011; Robin H. Johnson <robbat2@gentoo.org>
patches/busybox/1.18.1/1.18.1-mdstart.diff:
Fix patch typo that broke compile.
diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index 76d72a7..8be54a9 100755
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -71,6 +71,7 @@ CDROOT='0'
CDROOT_DEV=''
CDROOT_TYPE='auto'
NEW_ROOT='/newroot'
+CDROOT_PATH='/mnt/cdrom'
CONSOLE='/dev/console'
LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop'
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index b6b01ca..d706c1a 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -53,11 +53,10 @@ findmediamount() {
# $1 = mount dir name / media name
# $2 = recognition file
# $3 = variable to have the device path
- # $4 = directory before /mnt, like NEW_ROOT
+ # $4 = actual mount dir path (full path)
# args remaining are possible devices
- local media=$1 recon=$2 vrbl=$3
- local mntdir="${4}/mnt/${media}"
+ local media=$1 recon=$2 vrbl=$3 mntdir=$4
shift 4
good_msg "Looking for the ${media}" ${CRYPT_SILENT}
@@ -100,11 +99,6 @@ findmediamount() {
fi
good_msg "Attempting to mount media:- ${x}" ${CRYPT_SILENT}
-# if [ "${media}" = "cdrom" ]; then
-# mount -r -t iso9660 ${x} ${mntdir} &>/dev/null
-# else
-# mount -r -t auto ${x} ${mntdir} &>/dev/null
-# fi
mount -r -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1
if [ "$?" = '0' ]
then
@@ -158,7 +152,7 @@ bootstrapCD() {
# a bunch of extra devices
[ -n "${CDROOT_DEV}" ] && DEVICES="${CDROOT_DEV}"
- findmediamount "cdrom" "${SUBDIR}/livecd" "REAL_ROOT" "${NEW_ROOT}" ${DEVICES}
+ findmediamount "cdrom" "${SUBDIR}/livecd" "REAL_ROOT" "${CDROOT_PATH}" ${DEVICES}
}
bootstrapKey() {
@@ -166,7 +160,7 @@ bootstrapKey() {
local KEYDEVS=`devicelist`
eval local keyloc='"${CRYPT_'${1}'_KEY}"'
- findmediamount "key" "${keyloc}" "CRYPT_${1}_KEYDEV" "" ${KEYDEVS}
+ findmediamount "key" "${keyloc}" "CRYPT_${1}_KEYDEV" "/mnt/key" ${KEYDEVS}
}
cache_cd_contents() {
@@ -187,7 +181,7 @@ cache_cd_contents() {
good_msg "Copying loop file for caching..."
# Verify that the needed directory exists
mkdir -p "$(dirname ${NEW_ROOT}/mnt/${LOOP})"
- cp -a ${NEW_ROOT}/mnt/cdrom/${LOOP} ${NEW_ROOT}/mnt/${LOOP}
+ cp -a ${CDROOT_PATH}/${LOOP} ${NEW_ROOT}/mnt/${LOOP}
if [ $? -ne 0 ]
then
bad_msg "Failed to cache the loop file! Lack of space?"
@@ -258,7 +252,7 @@ findnfsmount() {
if [ "${CDROOT}" != '0' ]
then
good_msg "Attempting to mount NFS CD image on ${NFSROOT} with options ${NFSOPTIONS}"
- mount -t nfs -o ${NFSOPTIONS} ${NFSROOT} ${NEW_ROOT}/mnt/cdrom
+ mount -t nfs -o ${NFSOPTIONS} ${NFSROOT} ${CDROOT_PATH}
if [ "$?" = '0' ]
then
REAL_ROOT="/dev/nfs"
@@ -283,7 +277,7 @@ findnfsmount() {
}
check_loop() {
- if [ "${LOOP}" = '' -o ! -e "mnt/cdrom/${LOOP}" ]
+ if [ "${LOOP}" = '' -o ! -e "${CDROOT_PATH}/${LOOP}" ]
then
bad_msg "Invalid loop location: ${LOOP}"
@@ -947,10 +941,10 @@ verbose_kmsg() {
cdupdate() {
if [ "${CDROOT}" = '1' ]
then
- if [ -x /${NEW_ROOT}/mnt/cdrom/cdupdate.sh ]
+ if [ -x /${CDROOT_PATH}/cdupdate.sh ]
then
good_msg "Running cdupdate.sh"
- ${NEW_ROOT}/mnt/cdrom/cdupdate.sh
+ ${CDROOT_PATH}/cdupdate.sh
if [ "$?" != '0' ]
then
bad_msg "Executing cdupdate.sh failed!"
@@ -1065,10 +1059,9 @@ tuxonice_resume() {
}
find_loop() {
- CDROM="${NEW_ROOT}/mnt/cdrom"
for loop in ${LOOPS}
do
- if [ -e "${CDROM}""${loop}" ]
+ if [ -e "${CDROOT_PATH}""${loop}" ]
then
LOOP="${loop}"
fi
@@ -1098,8 +1091,7 @@ setup_squashfs_aufs() {
good_msg "Loading aufs"
modprobe aufs > /dev/null 2>&1
- cd "${NEW_ROOT}"
- mount -t squashfs -o loop,ro "mnt/cdrom${LOOPEXT}${LOOP}" "${static}"
+ mount -t squashfs -o loop,ro "${CDROOT_PATH}/${LOOPEXT}${LOOP}" "${static}"
mount -t tmpfs none "${overlay}"
mount -t aufs -o br:${overlay}:${static} aufs "${NEW_ROOT}"
@@ -1108,9 +1100,10 @@ setup_squashfs_aufs() {
echo "aufs / aufs defaults 0 0" > "${NEW_ROOT}"/etc/fstab
for i in "${overlay}" "${static}"; do mount --move "${i}" "${NEW_ROOT}${i}"; done
- # have handy /mnt/cdrom as well
- [ ! -d "${NEW_ROOT}/mnt/cdrom" ] && mkdir -p "${NEW_ROOT}/mnt/cdrom"
- mount --bind mnt/cdrom "${NEW_ROOT}/mnt/cdrom"
+ # have handy /mnt/cdrom (CDROOT_PATH) as well
+ local new_cdroot="${NEW_ROOT}${CDROOT_PATH}"
+ [ ! -d "${new_cdroot}" ] && mkdir -p "${new_cdroot}"
+ mount --bind "${CDROOT_PATH}" "${new_cdroot}"
)
}
@@ -1171,6 +1164,8 @@ setup_unionfs() {
bad_msg "Can't setup union mount!"
USE_UNIONFS_NORMAL=0
fi
+ [ ! -d "${NEW_ROOT}${CDROOT_PATH}" ] && mkdir -p "${NEW_ROOT}${CDROOT_PATH}"
+ mount --bind "${CDROOT_PATH}" "${NEW_ROOT}${CDROOT_PATH}"
else
USE_UNIONFS_NORMAL=0
fi
diff --git a/defaults/linuxrc b/defaults/linuxrc
index f58bbb5..63366bd 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -345,11 +345,12 @@ then
good_msg "Making tmpfs for ${NEW_ROOT}"
mount -n -t tmpfs tmpfs "${NEW_ROOT}"
- for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+ for i in dev mnt mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
do
mkdir -p "${NEW_ROOT}/${i}"
chmod 755 "${NEW_ROOT}/${i}"
done
+ [ ! -d "${CDROOT_PATH}" ] && mkdir -p "${CDROOT_PATH}"
[ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
[ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
@@ -524,11 +525,11 @@ then
# If encrypted, find key and mount, otherwise mount as usual
if [ -n "${CRYPT_ROOT}" ]
then
- CRYPT_ROOT_KEY="$(head -n 1 ${NEW_ROOT}/mnt/cdrom/livecd)"
+ CRYPT_ROOT_KEY="$(head -n 1 "${CDROOT_PATH}"/livecd)"
CRYPT_ROOT='/dev/loop0'
good_msg 'You booted an encrypted livecd' "${CRYPT_SILENT}"
- losetup /dev/loop0 "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}"
+ losetup /dev/loop0 "${CDROOT_PATH}/${LOOPEXT}${LOOP}"
test_success 'Preparing loop filesystem'
startLUKS
@@ -549,14 +550,14 @@ then
if [ "${LOOPTYPE}" = 'normal' ]
then
good_msg 'Mounting loop filesystem'
- mount -t ext2 -o loop,ro "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
+ mount -t ext2 -o loop,ro "${CDROOT_PATH}/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
test_success 'Mount filesystem'
FS_LOCATION='mnt/livecd'
elif [ "${LOOPTYPE}" = 'squashfs' ]
then
if [ "${USE_AUFS_NORMAL}" != '1' ]; then
good_msg 'Mounting squashfs filesystem'
- mount -t squashfs -o loop,ro "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
+ mount -t squashfs -o loop,ro "${CDROOT_PATH}/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
else
good_msg 'Mounting squashfs & aufs filesystems'
setup_squashfs_aufs
@@ -566,7 +567,7 @@ then
elif [ "${LOOPTYPE}" = 'gcloop' ]
then
good_msg 'Mounting gcloop filesystem'
- echo ' ' | losetup -E 19 -e ucl-0 -p0 "${NEW_ROOT}/dev/loop0" "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}"
+ echo ' ' | losetup -E 19 -e ucl-0 -p0 "${NEW_ROOT}/dev/loop0" "${CDROOT_PATH}/${LOOPEXT}${LOOP}"
test_success 'losetup the loop device'
mount -t ext2 -o ro "${NEW_ROOT}/dev/loop0" "${NEW_ROOT}/mnt/livecd"
@@ -574,10 +575,10 @@ then
FS_LOCATION='mnt/livecd'
elif [ "${LOOPTYPE}" = 'zisofs' ]
then
- FS_LOCATION="mnt/cdrom/${LOOPEXT}${LOOP}"
+ FS_LOCATION="${CDROOT_PATH/\/}/${LOOPEXT}${LOOP}"
elif [ "${LOOPTYPE}" = 'noloop' ]
then
- FS_LOCATION='mnt/cdrom'
+ FS_LOCATION="${CDROOT_PATH/\/}"
elif [ "${LOOPTYPE}" = 'sgimips' ]
then
# getdvhoff finds the starting offset (in bytes) of the squashfs
@@ -610,9 +611,9 @@ then
# We do this now, so that additional packages can add whereever they want.
if [ "${REAL_ROOT}" = '/dev/nfs' ]
then
- if [ -e "${NEW_ROOT}/mnt/cdrom/add" ]
+ if [ -e "${CDROOT_PATH}/add" ]
then
- for targz in $(ls ${NEW_ROOT}/mnt/cdrom/add/*.tar.gz)
+ for targz in $(ls ${CDROOT_PATH}/add/*.tar.gz)
do
tarname=$(basename ${targz})
good_msg "Adding additional package ${tarname}"
@@ -624,7 +625,7 @@ then
if [ "${USE_UNIONFS_NORMAL}" = '1' ]
then
- setup_unionfs ${NEW_ROOT} ${NEW_ROOT}/${FS_LOCATION}
+ setup_unionfs ${NEW_ROOT} /${FS_LOCATION}
CHROOT=/union
elif [ "${USE_AUFS_NORMAL}" != '1' ]; then
next reply other threads:[~2011-10-08 21:22 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-08 21:22 Fabio Erculiani [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-09 7:42 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-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=84cc7ccdfba1bde785c6d6116c42dda2c58d9ca7.lxnay@gentoo \
--to=lxnay@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