From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com ([134.134.136.20]) by linuxtogo.org with esmtp (Exim 4.72) (envelope-from ) id 1TYPnY-0005zW-30 for openembedded-core@lists.openembedded.org; Wed, 14 Nov 2012 00:21:40 +0100 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 13 Nov 2012 15:07:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.83,768,1352102400"; d="scan'208";a="219227034" Received: from unknown (HELO [10.255.12.71]) ([10.255.12.71]) by orsmga001.jf.intel.com with ESMTP; 13 Nov 2012 15:07:41 -0800 Message-ID: <50A2D2BD.9090703@linux.intel.com> Date: Tue, 13 Nov 2012 15:07:41 -0800 From: Saul Wold User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Radu Moisan References: <1352841144-31228-1-git-send-email-radu.moisan@intel.com> In-Reply-To: <1352841144-31228-1-git-send-email-radu.moisan@intel.com> Cc: Alexandru Damian , openembedded-core@lists.openembedded.org Subject: Re: [PATCH v2] initrd: add recovery feature X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 23:21:40 -0000 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 11/13/2012 01:12 PM, Radu Moisan wrote: > Allows you to use as root a partition instead of the rootfs.img > for recovering an old install, and fails safe when no rootfs is > found, dropping the user to a shell if something goes wrong. > > Signed-off-by: Radu Moisan > Signed-off-by: Alexandru Damian > --- > meta/recipes-core/initrdscripts/files/init-live.sh | 44 +++++++++++++++++++- > 1 file changed, 42 insertions(+), 2 deletions(-) > > diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh > index 5682fd1..81686b9 100644 > --- a/meta/recipes-core/initrdscripts/files/init-live.sh > +++ b/meta/recipes-core/initrdscripts/files/init-live.sh > @@ -68,13 +68,49 @@ fatal() { > > early_setup > > +# wait for the udevd to settle > +echo "Waiting for udev to settle..." > +udevadm settle --timeout=3 > + Why are you still adding in the timeout? This still could have adverse affects on some machines, just let settle do it's job. Sau! > [ -z "$CONSOLE" ] && CONSOLE="/dev/console" > > read_args > > -echo "Waiting for removable media..." > -while true > +# boot partiton menu, if one or more bootable partitions exist > +BOOTMENU=`ls /media/sd*/sbin/init 2>/dev/null | wc -l` > +if [ $BOOTMENU -gt 0 ]; then > + choice=0 > + while [ $choice -le 0 ]; do > + echo "1). boot live ramfs image" > + count=2 > + for i in `ls /media/sd*/sbin/init 2>/dev/null | cut -d "/" -f 3`; do > + echo $count"). boot /dev/"$i > + choicecmd[$count]=$i > + count=$(( count + 1)) > + done > + echo > + echo -n "Your choice: " > + read choice > + done > + > + if [ $choice -gt 1 ]; then > + #ROOT_MOUNT=/media/${choicecmd[${choice}]} > + ROOT_MOUNT=none #testing > + echo "Booting local root ... $ROOT_MOUNT" > + if [ -d $ROOT_MOUNT ]; then > + boot_live_root > + else > + fatal "Rootfs partition not mounted" > + fi > + fi > +fi > + > +echo -n "Waiting for removable media... " > +CNT=0 > +while [ $CNT -le 3 ]; > do > + echo -n "$CNT " > + CNT=$(( $CNT + 1 )) > for i in `ls /media 2>/dev/null`; do > if [ -f /media/$i/$ROOT_IMAGE ] ; then > found="yes" > @@ -91,6 +127,10 @@ do > sleep 1 > done > > +if [ "$found" != "yes" ]; then > + fatal "...could not mount removable media, drop to shell" > +fi > + > case $label in > boot) > mkdir $ROOT_MOUNT >