All of lore.kernel.org
 help / color / mirror / Atom feed
From: Radu Moisan <radu.moisan@intel.com>
To: poky@yoctoproject.org
Subject: Re: [PATCH] initrd: add recovery feature
Date: Mon, 12 Nov 2012 21:48:54 +0200	[thread overview]
Message-ID: <50A152A6.60802@intel.com> (raw)
In-Reply-To: <1352749878-10645-1-git-send-email-radu.moisan@intel.com>

Ops, wrong address, resending on openembedded-core@lists.openembedded.org

Radu

On 11/12/2012 09:51 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 <radu.moisan@intel.com>
> Signed-off-by: Alexandru Damian <alexandru.damian@intel.com>
> ---
>   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..0ef30ea 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..."
> +sleep 3
> +
>   [ -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



  reply	other threads:[~2012-11-12 19:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-12 19:51 [PATCH] initrd: add recovery feature Radu Moisan
2012-11-12 19:48 ` Radu Moisan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-11-12 19:52 Radu Moisan
2012-11-13 16:36 ` Burton, Ross
2012-11-13 16:42 ` Otavio Salvador

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=50A152A6.60802@intel.com \
    --to=radu.moisan@intel.com \
    --cc=poky@yoctoproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.