The '-/bin/sh' permanently restarts

ladislav klenovic lklenovic at gmail.com
Mon Nov 2 10:18:34 UTC 2009


2009/11/1 Denys Vlasenko <vda.linux at googlemail.com>

> 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? Maybe I can "patch" the cttyhack
which can make a setup too:

*diff --git a/shell/cttyhack.c b/shell/cttyhack.c
index 572a3af..c284af1 100644
--- a/shell/cttyhack.c
+++ b/shell/cttyhack.c
@@ -60,6 +60,11 @@ int cttyhack_main(int argc UNUSED_PARAM, char **argv)
                /* this is linux virtual tty */
                sprintf(console + 8, "S%d" + 1, u.vt.v_active);
        }
+#ifdef CONFIG_CTTY_SPECIFIED_BY_USER
+       else {
+               sprintf(console, "%s", CTTY_SPECIFIED_BY_USER);
+       }
+#endif

        if (console[8]) {
                fd = xopen(console, O_RDWR);

*

>
> 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 and it
requires some additional work instead of let user specify the solution if
she/he _knows_ it.

---
Ladislav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20091102/a48df229/attachment.htm>


More information about the busybox mailing list