shutdown busybox and start another PID1 process

Sam Liddicott sam at liddicott.com
Wed Aug 13 09:00:01 UTC 2014


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 at 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 at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140813/0b7ad488/attachment.html>


More information about the busybox mailing list