diff options
author | jkh <jkh@FreeBSD.org> | 2000-10-30 23:46:12 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2000-10-30 23:46:12 +0000 |
commit | 34665aef12ec9a7522c987298e4deef531804fbf (patch) | |
tree | bb158c5d99cec75972f4fa94a63d35e7692a64d2 /usr.sbin/sade/system.c | |
parent | 30183950941770d92e3301fca16411970821cf73 (diff) | |
download | FreeBSD-src-34665aef12ec9a7522c987298e4deef531804fbf.zip FreeBSD-src-34665aef12ec9a7522c987298e4deef531804fbf.tar.gz |
Changes have been made to support a concept of VAR_FIXIT_TTY being
standard or serial. This change needs to be done to the entire system that
depends on this. This way we don't have some code using OnVTY checks
and other doing
strcmp(variable_get(VAR_FIXIT_TTY), "standard") == 0
checks. Also we need to set VAR_FIXIT_TTY to "serial" if we come up on
a serial console.
Also fixed a dialog problem in that dialog was used when dialog was
disabled causing some troubles such as not letting the cursor keys
work when exiting the fixit mode on media (ie. not the fixit shell but
for example fixit on a floppy).
Submitted by: Doug Ambrisko <ambrisko@whistle.com>
PR: 22352
Diffstat (limited to 'usr.sbin/sade/system.c')
-rw-r--r-- | usr.sbin/sade/system.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index 1423405..e2a36eb 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -128,9 +128,10 @@ systemInitialize(int argc, char **argv) setsid(); close(0); fd = open("/dev/ttyv0", O_RDWR); - if (fd == -1) + if (fd == -1) { fd = open("/dev/console", O_RDWR); /* fallback */ - else + variable_set2(VAR_FIXIT_TTY, "serial", 0); /* give fixit a hint */ + } else OnVTY = TRUE; /* * To make _sure_ we're on a VTY and don't have /dev/console switched @@ -143,6 +144,9 @@ systemInitialize(int argc, char **argv) if ((fd2 = open("/dev/console", O_RDWR)) != -1) { if (ioctl(fd2, CONS_CURSORTYPE, &type) == -1) { OnVTY = FALSE; + variable_set2(VAR_FIXIT_TTY, "serial", 0); /* Tell Fixit + the console + type */ close(fd); close(fd2); open("/dev/console", O_RDWR); } @@ -445,7 +449,7 @@ systemCreateHoloshell(void) (void) waitpid(ehs_pid, &pstat, WNOHANG); } - if (!OnVTY) + if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0) systemSuspendDialog(); /* must be before the fork() */ if ((ehs_pid = fork()) == 0) { int i, fd; @@ -455,10 +459,10 @@ systemCreateHoloshell(void) ioctl(0, TIOCNOTTY, NULL); for (i = getdtablesize(); i >= 0; --i) close(i); - if (OnVTY) - fd = open("/dev/ttyv3", O_RDWR); - else + if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0) fd = open("/dev/console", O_RDWR); + else + fd = open("/dev/ttyv3", O_RDWR); ioctl(0, TIOCSCTTY, &fd); dup2(0, 1); dup2(0, 2); @@ -473,7 +477,7 @@ systemCreateHoloshell(void) } else msgDebug("Doctor: I'm unable to get the terminal attributes!\n"); - if (!OnVTY){ + if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0) { printf("Type ``exit'' in this fixit shell to resume sysinstall.\n\n"); fflush(stdout); } @@ -482,15 +486,19 @@ systemCreateHoloshell(void) exit(1); } else { - if (OnVTY) { + if (strcmp(variable_get(VAR_FIXIT_TTY), "standard") == 0) { WINDOW *w = savescr(); msgNotify("Starting an emergency holographic shell on VTY4"); sleep(2); restorescr(w); } - if (!OnVTY){ - (void)waitpid(ehs_pid, &waitstatus, 0); + else { + (void)waitpid(ehs_pid, &waitstatus, 0); /* we only wait for + shell to finish + it serial mode + since there is no + virtual console */ systemResumeDialog(); } } |