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 1RCeLy-0008Ko-Lg for garchives@archives.gentoo.org; Sat, 08 Oct 2011 21:22:46 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 13ECF21C034; Sat, 8 Oct 2011 21:22:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id AE72A21C02D for ; Sat, 8 Oct 2011 21:22:33 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 037231B4031 for ; Sat, 8 Oct 2011 21:22:33 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4E69880042 for ; Sat, 8 Oct 2011 21:22:32 +0000 (UTC) From: "Fabio Erculiani" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabio Erculiani" Message-ID: <84cc7ccdfba1bde785c6d6116c42dda2c58d9ca7.lxnay@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: /, defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: ChangeLog defaults/initrd.defaults defaults/initrd.scripts defaults/linuxrc X-VCS-Directories: / defaults/ X-VCS-Committer: lxnay X-VCS-Committer-Name: Fabio Erculiani X-VCS-Revision: 84cc7ccdfba1bde785c6d6116c42dda2c58d9ca7 Date: Sat, 8 Oct 2011 21:22:32 +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: X-Archives-Hash: fe3f73d8089f8177f586892e17cc25a5 commit: 84cc7ccdfba1bde785c6d6116c42dda2c58d9ca7 Author: Fabio Erculiani sabayon org> AuthorDate: Sat Oct 8 21:26:51 2011 +0000 Commit: Fabio Erculiani gentoo org> CommitDate: Sat Oct 8 21:26:51 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/genkernel.git= ;a=3Dcommit;h=3D84cc7ccd 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$ =20 + 08 Oct 2011; Fabio Erculiani defaults/initrd.defaul= ts, + 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 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=3D'0' CDROOT_DEV=3D'' CDROOT_TYPE=3D'auto' NEW_ROOT=3D'/newroot' +CDROOT_PATH=3D'/mnt/cdrom' CONSOLE=3D'/dev/console' =20 LOOPS=3D'/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.g= cloop' 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 =3D mount dir name / media name # $2 =3D recognition file # $3 =3D variable to have the device path - # $4 =3D directory before /mnt, like NEW_ROOT + # $4 =3D actual mount dir path (full path) # args remaining are possible devices=20 =20 - local media=3D$1 recon=3D$2 vrbl=3D$3 - local mntdir=3D"${4}/mnt/${media}" + local media=3D$1 recon=3D$2 vrbl=3D$3 mntdir=3D$4 shift 4 =20 good_msg "Looking for the ${media}" ${CRYPT_SILENT} @@ -100,11 +99,6 @@ findmediamount() { fi good_msg "Attempting to mount media:- ${x}" ${CRYPT_SILENT} =20 -# if [ "${media}" =3D "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 [ "$?" =3D '0' ] then @@ -158,7 +152,7 @@ bootstrapCD() { # a bunch of extra devices [ -n "${CDROOT_DEV}" ] && DEVICES=3D"${CDROOT_DEV}" =20 - findmediamount "cdrom" "${SUBDIR}/livecd" "REAL_ROOT" "${NEW_ROOT}" ${D= EVICES} + findmediamount "cdrom" "${SUBDIR}/livecd" "REAL_ROOT" "${CDROOT_PATH}" = ${DEVICES} } =20 bootstrapKey() { @@ -166,7 +160,7 @@ bootstrapKey() { local KEYDEVS=3D`devicelist` eval local keyloc=3D'"${CRYPT_'${1}'_KEY}"' =20 - findmediamount "key" "${keyloc}" "CRYPT_${1}_KEYDEV" "" ${KEYDEVS} + findmediamount "key" "${keyloc}" "CRYPT_${1}_KEYDEV" "/mnt/key" ${KEYDE= VS} } =20 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}" !=3D '0' ] then good_msg "Attempting to mount NFS CD image on ${NFSROOT} with option= s ${NFSOPTIONS}" - mount -t nfs -o ${NFSOPTIONS} ${NFSROOT} ${NEW_ROOT}/mnt/cdrom + mount -t nfs -o ${NFSOPTIONS} ${NFSROOT} ${CDROOT_PATH} if [ "$?" =3D '0' ] then REAL_ROOT=3D"/dev/nfs" @@ -283,7 +277,7 @@ findnfsmount() { } =20 check_loop() { - if [ "${LOOP}" =3D '' -o ! -e "mnt/cdrom/${LOOP}" ] + if [ "${LOOP}" =3D '' -o ! -e "${CDROOT_PATH}/${LOOP}" ] then =09 bad_msg "Invalid loop location: ${LOOP}" @@ -947,10 +941,10 @@ verbose_kmsg() { cdupdate() { if [ "${CDROOT}" =3D '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 [ "$?" !=3D '0' ] then bad_msg "Executing cdupdate.sh failed!" @@ -1065,10 +1059,9 @@ tuxonice_resume() { } =20 find_loop() { - CDROM=3D"${NEW_ROOT}/mnt/cdrom" for loop in ${LOOPS} do - if [ -e "${CDROM}""${loop}" ] + if [ -e "${CDROOT_PATH}""${loop}" ] then LOOP=3D"${loop}" fi @@ -1098,8 +1091,7 @@ setup_squashfs_aufs() { good_msg "Loading aufs" modprobe aufs > /dev/null 2>&1 =20 - cd "${NEW_ROOT}" - mount -t squashfs -o loop,ro "mnt/cdrom${LOOPEXT}${LOOP}" "${static}" + mount -t squashfs -o loop,ro "${CDROOT_PATH}/${LOOPEXT}${LOOP}" "${stat= ic}" mount -t tmpfs none "${overlay}" mount -t aufs -o br:${overlay}:${static} aufs "${NEW_ROOT}" =20 @@ -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 =20 - # 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=3D"${NEW_ROOT}${CDROOT_PATH}" + [ ! -d "${new_cdroot}" ] && mkdir -p "${new_cdroot}" + mount --bind "${CDROOT_PATH}" "${new_cdroot}" ) } =20 @@ -1171,6 +1164,8 @@ setup_unionfs() { bad_msg "Can't setup union mount!" USE_UNIONFS_NORMAL=3D0 fi + [ ! -d "${NEW_ROOT}${CDROOT_PATH}" ] && mkdir -p "${NEW_ROOT}${CDROOT_= PATH}" + mount --bind "${CDROOT_PATH}" "${NEW_ROOT}${CDROOT_PATH}" else USE_UNIONFS_NORMAL=3D0 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}" =20 - for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gento= o 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 =20 @@ -524,11 +525,11 @@ then # If encrypted, find key and mount, otherwise mount as usual if [ -n "${CRYPT_ROOT}" ] then - CRYPT_ROOT_KEY=3D"$(head -n 1 ${NEW_ROOT}/mnt/cdrom/livecd)" + CRYPT_ROOT_KEY=3D"$(head -n 1 "${CDROOT_PATH}"/livecd)" CRYPT_ROOT=3D'/dev/loop0' good_msg 'You booted an encrypted livecd' "${CRYPT_SILENT}" =20 - losetup /dev/loop0 "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}" + losetup /dev/loop0 "${CDROOT_PATH}/${LOOPEXT}${LOOP}" test_success 'Preparing loop filesystem' =20 startLUKS @@ -549,14 +550,14 @@ then if [ "${LOOPTYPE}" =3D '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_RO= OT}/mnt/livecd" test_success 'Mount filesystem' FS_LOCATION=3D'mnt/livecd' elif [ "${LOOPTYPE}" =3D 'squashfs' ] then if [ "${USE_AUFS_NORMAL}" !=3D '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}" "${N= EW_ROOT}/mnt/livecd" else good_msg 'Mounting squashfs & aufs filesystems' setup_squashfs_aufs @@ -566,7 +567,7 @@ then elif [ "${LOOPTYPE}" =3D '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" "${CDRO= OT_PATH}/${LOOPEXT}${LOOP}" test_success 'losetup the loop device' =20 mount -t ext2 -o ro "${NEW_ROOT}/dev/loop0" "${NEW_ROOT}/mnt/livecd" @@ -574,10 +575,10 @@ then FS_LOCATION=3D'mnt/livecd' elif [ "${LOOPTYPE}" =3D 'zisofs' ] then - FS_LOCATION=3D"mnt/cdrom/${LOOPEXT}${LOOP}" + FS_LOCATION=3D"${CDROOT_PATH/\/}/${LOOPEXT}${LOOP}" elif [ "${LOOPTYPE}" =3D 'noloop' ] then - FS_LOCATION=3D'mnt/cdrom' + FS_LOCATION=3D"${CDROOT_PATH/\/}" elif [ "${LOOPTYPE}" =3D '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 wa= nt. if [ "${REAL_ROOT}" =3D '/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=3D$(basename ${targz}) good_msg "Adding additional package ${tarname}" @@ -624,7 +625,7 @@ then =20 if [ "${USE_UNIONFS_NORMAL}" =3D '1' ] then - setup_unionfs ${NEW_ROOT} ${NEW_ROOT}/${FS_LOCATION} + setup_unionfs ${NEW_ROOT} /${FS_LOCATION} CHROOT=3D/union elif [ "${USE_AUFS_NORMAL}" !=3D '1' ]; then =20