Subject: Re: sysinst maintainer?
To: Phil Nelson <phil@steelhead.cs.wwu.edu>
From: Tim Rightnour <root@garbled.net>
List: tech-install
Date: 08/17/1998 22:08:41
On 18-Aug-98 Phil Nelson spoke unto us all:
#
# >IMHO sysinst should open up with a menu that says:
# >a) Install/Upgrade
# >b) Post Intstall Maintinence
# >c) help?
#
# By the way, menuc was upgraded recently to allow for full help text
# for every menu. Just type "?" at the prompt and you get the help
# text for the menu in a scrollable window. The help text is also
# specified in the menuc source.
ahh.. much better.. then forget that part..
Right now I'm looking into the "everything is a subwindow" idea.. I must
admit.. I hadn't realized that you had created that menu compiler.. Its quite
nice.. It will take me a few to figure out what is going on in there as far as
windowing parent-child relationships/naming..
Looking at run.c in sysinst:
va_start(ap, cmd);
execstr = va_prog_cmdstr(cmd, ap);
ret = do_system(execstr);
va_end(ap);
(pardon the pseudo-code here)
int in[],out[],err[];
int *pid;
WINDOW *subthing;
va_start(ap, cmd);
execstr = va_prog_cmdstr(cmd,ap);
subthing = subwin(shell_window, stdscr, 24,80,0,0);
{magic here to make pipes connect to window}
if (pipe(out) < 0 || pipe(in) (blah blah))
printf("kaboom");
switch(*pid=fork()) {
case -1: kaboom
case 0:
close(0);
dup(out[0]);
close(1);
dup(in[1]);
close(2);
dup(err[1]);
{close out[01] in[01] err[01]}
exec(execstr);
}
close more stuff here, do the fcntl magic.
this is probably where a while loop goes to wait on the return of the
forked child, and updates the window with the IO from the pipe channels.
}
The idea here is.. once we have all shell activity occurring inside a pipe,
and within the windowing system.. we have complete environmental control over
the tty/curses aspects of it. We can log everything as well.. The most
important point however is.. when the shell exits.. it allows curses to use
it's own internal magic to clean up the screen, and remove any possible screen
artifacts..
The danger with system is.. that the user could unknowingly invoke another
curses application, royally hose his terminal.. and sysinst might get blasted..
I believe this is whats happening currently when we run newfs.. it spews all
that info to the screen, then a repaint occurs and we may or may not clean it
all up.
This also allows us to use a pop-up failure notification after the shell
command returns EXIT_FAILURE of some kind.
---
Tim Rightnour - root@garbled.net
http://www.zynetwc.com/~garbled/garbled.html