All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] init-live.sh: allow user to choose the boot action
@ 2013-07-10  7:12 Qi.Chen
  2013-07-10  7:12 ` [PATCH 1/1] init-live.sh: allow users " Qi.Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Qi.Chen @ 2013-07-10  7:12 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

The following changes since commit 4285e856aa073979bf046168a75188ccf5a1e7d4:

  lib/oeqa/runtime: add gcc test (2013-07-09 10:53:45 +0100)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib ChenQi/live-image-user-choice
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/live-image-user-choice

Chen Qi (1):
  init-live.sh: allow users to choose the boot action

 meta/recipes-core/initrdscripts/files/init-live.sh |   39 ++++++++++++++++++++
 1 file changed, 39 insertions(+)

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] init-live.sh: allow users to choose the boot action
  2013-07-10  7:12 [PATCH 0/1] init-live.sh: allow user to choose the boot action Qi.Chen
@ 2013-07-10  7:12 ` Qi.Chen
  2013-07-10  8:32   ` Tomas Frydrych
  0 siblings, 1 reply; 4+ messages in thread
From: Qi.Chen @ 2013-07-10  7:12 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

Previously, the boot action for live images was totally determined
by the LABEL value in the boot parameters (/proc/cmdline).

This behavior is not very convenient for users. The user may just want
to drop to a shell for troubleshooting the live image, or the user may
want to try to install the live image while the LABEL value is 'boot'.

We should provide the users a chance to choose the boot action when
the live image starts up.

This patch starts to implement this behavior by providing three choices
at boot time, 'boot', 'install' and 'shell'.

[YOCTO #4784]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/initrdscripts/files/init-live.sh |   39 ++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 890c562..2300381 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -73,6 +73,39 @@ read_args() {
     done
 }
 
+get_choice_from_user () {
+    # get the choice from user, determine the value of label
+    echo ""
+    echo "Boot options [6 seconds timeout]:"
+    echo "[1] boot: boot the live image"
+    echo "[2] install: install the live image to a local disk"
+    echo "[3] shell: drop to a shell"
+    while true; do
+       echo -n "Please enter your choice number [default action is $label]: "
+       read -t 6 choice
+       case "$choice" in
+           "")
+               break
+               ;;
+           "1")
+               label="boot"
+               break
+               ;;
+           "2")
+               label="install"
+               break
+               ;;
+           "3")
+               label="shell"
+               break
+               ;;
+           *)
+               echo "Invalid input"
+               ;;
+       esac
+    done
+}
+
 boot_live_root() {
     # Watches the udev event queue, and exits if all current events are handled
     udevadm settle --timeout=3 --quiet
@@ -192,6 +225,9 @@ mount_and_boot() {
     boot_live_root
 }
 
+# Get choice from user
+get_choice_from_user
+
 case $label in
     boot)
 	mount_and_boot
@@ -206,4 +242,7 @@ case $label in
 	# If we're getting here, we failed...
 	fatal "Installation image failed"
 	;;
+    shell)
+	exec sh
+	;;
 esac
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] init-live.sh: allow users to choose the boot action
  2013-07-10  7:12 ` [PATCH 1/1] init-live.sh: allow users " Qi.Chen
@ 2013-07-10  8:32   ` Tomas Frydrych
  2013-07-10  8:48     ` ChenQi
  0 siblings, 1 reply; 4+ messages in thread
From: Tomas Frydrych @ 2013-07-10  8:32 UTC (permalink / raw)
  To: openembedded-core

Hi,

On 10/07/13 08:12, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
> 
> Previously, the boot action for live images was totally determined
> by the LABEL value in the boot parameters (/proc/cmdline).
> 
> This behavior is not very convenient for users. The user may just want
> to drop to a shell for troubleshooting the live image, or the user may
> want to try to install the live image while the LABEL value is 'boot'.
> 
> We should provide the users a chance to choose the boot action when
> the live image starts up.

I am not entirely clear on why this is needed, the LABEL kernel cmdline
parameter is set up by syslinux, and its value can be specified by the
user from the syslinux prompt. If what you want is a more user friendly
menu, then I think the correct solution would be to tweak the syslinux
config, rather than to create a duplicate boot menu in the init script.

Tomas


-- 
http://sleepfive.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] init-live.sh: allow users to choose the boot action
  2013-07-10  8:32   ` Tomas Frydrych
@ 2013-07-10  8:48     ` ChenQi
  0 siblings, 0 replies; 4+ messages in thread
From: ChenQi @ 2013-07-10  8:48 UTC (permalink / raw)
  To: openembedded-core

On 07/10/2013 04:32 PM, Tomas Frydrych wrote:
> Hi,
>
> On 10/07/13 08:12, Qi.Chen@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> Previously, the boot action for live images was totally determined
>> by the LABEL value in the boot parameters (/proc/cmdline).
>>
>> This behavior is not very convenient for users. The user may just want
>> to drop to a shell for troubleshooting the live image, or the user may
>> want to try to install the live image while the LABEL value is 'boot'.
>>
>> We should provide the users a chance to choose the boot action when
>> the live image starts up.
> I am not entirely clear on why this is needed, the LABEL kernel cmdline
> parameter is set up by syslinux, and its value can be specified by the
> user from the syslinux prompt. If what you want is a more user friendly
> menu, then I think the correct solution would be to tweak the syslinux
> config, rather than to create a duplicate boot menu in the init script.
>
> Tomas
>
>
I agree.
Thanks for providing this info.

//Chen Qi


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-10  8:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-10  7:12 [PATCH 0/1] init-live.sh: allow user to choose the boot action Qi.Chen
2013-07-10  7:12 ` [PATCH 1/1] init-live.sh: allow users " Qi.Chen
2013-07-10  8:32   ` Tomas Frydrych
2013-07-10  8:48     ` ChenQi

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.