On Sun, Nov 09, 2003 at 02:57:20PM +0100, Marc Schoechlin wrote:
> On Sat, Nov 08, 2003 at 11:55:38AM -0500, s-uml@... wrote:
> > I thought I remember a few months ago someone wrote a patch that added a
> > command to mconsole that allowed you to execute commands within the uml. It
> > wasn't accepted into the uml code though. You might want to try looking
> > through the devel list archives for it.
> Do you have some hints for me where to find this patch ?
Here's the thread on the devel archives:
Have a look at the replies for the code/discussion/caveats/bugs...
> > As an alternative maybe you could use rungetty to run a root shell on a
> > virtual console and issue commands from the outside to it that way, or
> > something like that. You'd set this up in one filesystem image and then
> > build the uml's with cow files, as described by BlaisorBlade's response to
> This is also interesting - maybe i can feed screen with
> a complete shell-script with this getty :-)
Actually you don't even need screen, you can just cat > the pty device on
the host that the virtual console within the uml got.
Well, there's one issue there. If you cat a script file into the pty device,
host# cat setupscript.sh > /dev/pts/4
In my experience, that won't work, because cat will exit and close the pty
before the shell inside the uml has finished executing everything (usually,
but not always). The uml kernel sends all processes on that tty a HUP when
the pty is closed on the outside and that causes the shell to immediately
exit. You can't have the shell ignore the HUP, otherwise it will never close
the vc, and the uml kernel will never open a new pty device for it.
I just wrote a little script that immitates cat but sleeps for a bit just
before exiting and used that to feed commands into the uml; that works. A
more robust way would be to watch the output for completion and wait until
it knows the script is done in the uml before exiting and closing the pty
Don't forget to have your script disable the rungetty shell when it is done,
for security reasons.