On Mon, Nov 2, 2009 at 11:18 AM, ladislav klenovic <[email protected]> wrote: > 2009/11/1 Denys Vlasenko <[email protected]> >> >> On Thursday 29 October 2009 15:55, ladislav klenovic wrote: >> > As Detlef said I don't know have to specify that in inittab thus I run >> > the >> > shell regardless whether there is or not a debug console. >> > I choose the tty0 according to busybox 1.2.2 which works fine for me. So >> > maybe some kind of configuration option which could >> > specify which device to use if no console is available would make sense. >> >> I don't like this. A configuration option is not flehible. It would be a >> hack. > > What is hackish on it if I know that the shell can run on e.g. tty0 if the > debug console is missing?
It's a hack because it makes an arbitrary device, /dev/tty0, special. Why /dev/tty0? What is it about /dev/tty0 which makes it better than /dev/ttyS0, or /dev/lp0, or any other char device in /dev? Yes, in YOUR situation /dev/tty0 makes sense. But general tools, and init is one, should not make such arbitrary exceptions if at all possible. It's a bad design. >> I proposed a solution, and get no response. This is it: >> >> >> ::respawn:/bin/run_sh_if_tty.sh >> >> where run_sh_if_tty.sh is >> >> #!/bin/sh >> while ! tty >/dev/null 2>&1; do sleep 3600; done >> exec sh "$@" >> >> >> >> In console=ttyS0 case, stdin will be /dev/ttyS0, >> "tty" command exits with 0, and you fall into exec sh. >> >> In console= case, stdin will be /dev/null, >> "tty" command exits with 1, and you sleep. >> >> >> Is it ok for you? If not, why? > > Thnx for this. It works fine and I will probably use it. Maybe It would be > good to FAQ it. But to be honest this script looks a bit hackish too No, it is not hackish, it's _customized to your needs_. init is a general tool, and therefore should not have special knowledge about /dev/tty0, while shell scripts you start from it may very well be your own scripts, with whatever customizations your situation (or your design ideas) asks for. -- vda _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
