[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: shutdown busybox and start another PID1 process
From:       Sam Liddicott <sam () liddicott ! com>
Date:       2014-08-13 9:00:01
Message-ID: CAOj-5WCsVCiNMZDfcZO1i52YBEYb=y-KNLuW-veL+_SowJ2tmQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


This works in busybox ash

getch() {
  read -t 1 -n 1 $1
}


getch key
echo $key

you probably also want stty -echo before you start

Sam


On Tue, Aug 12, 2014 at 5:44 AM, James Bowlin <bitjam@gmail.com> wrote:

> On Mon, Aug 11, 2014 at 07:35 PM, Harald Becker said:
> > Did I get it right?
>
> This is very close to what I'm doing now.  The two changes are:
>
>   1) I boot into Debian so I switch_root into their /sbin/init
>      and I use "telinit u" to get back pid 1.
>
>   2) I copy busybox et al. into the new root before switching
>      so I don't need to unpack.  I suppose unpacking is slightly
>      safer but I have things I need to communicate to the booted
>      systems anyway.  This is partly a holdover from Knoppix
>      design I started with that used symlinks instead of a
>      switch_root.  Then I moved to bind mounts which were much
>      better but eventually a few programs were unhappy with them
>      so I ended up with the switch_root and I copied the BB stuff
>      over so programs on the booted system that I communicated to
>      didn't need to be changed.
>
>      I also like the consistency of having my busybox stuff almost
>      always under /live even though I have to copy things around
>      to make it so.
>
> BTW: I wrote a space invaders game in busybox-shell, although I
> cheated a little and wrote a tiny C program called getch that
> gives me non-blocking input.  Maybe there is already a way to
> do that built in.  If not, a getch applet might be very handy.
> It is a small thing but it is all that is needed to write
> truly interactive scripts with just busybox.  IMO it would
> open the door to some really neat things.
>
>
> Peace, James
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>

[Attachment #5 (text/html)]

<div dir="ltr"><div>This works in busybox ash<br></div><div><br>getch() {<br></div>   \
read -t 1 -n 1 $1<br><div>}<br><br><br></div><div>getch key<br>echo \
$key<br><br></div><div>you probably also want stty -echo before you start<br> \
<br>Sam<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On \
Tue, Aug 12, 2014 at 5:44 AM, James Bowlin <span dir="ltr">&lt;<a \
href="mailto:bitjam@gmail.com" target="_blank">bitjam@gmail.com</a>&gt;</span> \
wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div class="">On Mon, Aug 11, 2014 at 07:35 PM, Harald \
Becker said:<br> &gt; Did I get it right?<br>
<br>
</div>This is very close to what I&#39;m doing now.   The two changes are:<br>
<br>
   1) I boot into Debian so I switch_root into their /sbin/init<br>
        and I use &quot;telinit u&quot; to get back pid 1.<br>
<br>
   2) I copy busybox et al. into the new root before switching<br>
        so I don&#39;t need to unpack.   I suppose unpacking is slightly<br>
        safer but I have things I need to communicate to the booted<br>
        systems anyway.   This is partly a holdover from Knoppix<br>
        design I started with that used symlinks instead of a<br>
        switch_root.   Then I moved to bind mounts which were much<br>
        better but eventually a few programs were unhappy with them<br>
        so I ended up with the switch_root and I copied the BB stuff<br>
        over so programs on the booted system that I communicated to<br>
        didn&#39;t need to be changed.<br>
<br>
        I also like the consistency of having my busybox stuff almost<br>
        always under /live even though I have to copy things around<br>
        to make it so.<br>
<br>
BTW: I wrote a space invaders game in busybox-shell, although I<br>
cheated a little and wrote a tiny C program called getch that<br>
gives me non-blocking input.   Maybe there is already a way to<br>
do that built in.   If not, a getch applet might be very handy.<br>
It is a small thing but it is all that is needed to write<br>
truly interactive scripts with just busybox.   IMO it would<br>
open the door to some really neat things.<br>
<br>
<br>
Peace, James<br>
<div class="HOEnZb"><div \
class="h5">_______________________________________________<br> busybox mailing \
list<br> <a href="mailto:busybox@busybox.net">busybox@busybox.net</a><br>
<a href="http://lists.busybox.net/mailman/listinfo/busybox" \
target="_blank">http://lists.busybox.net/mailman/listinfo/busybox</a><br> \
</div></div></blockquote></div><br></div>



_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic