diff options
author | jkh <jkh@FreeBSD.org> | 1995-05-24 22:37:44 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-05-24 22:37:44 +0000 |
commit | f12325f10506a028f4908783cd3ee6224ed86bbf (patch) | |
tree | 2126dd375a22d9a5509cad1e3f4982b216d40218 | |
parent | 2f34e0b4e61258aab1d6085f83a3a74ceff943d5 (diff) | |
download | FreeBSD-src-f12325f10506a028f4908783cd3ee6224ed86bbf.zip FreeBSD-src-f12325f10506a028f4908783cd3ee6224ed86bbf.tar.gz |
1. Spawn a shell on VTY4 and leave it lying around.
2. Bring in Gary's prompt stuff in extractGeneric.
3. Add another global for telling when we're running as init.
-rw-r--r-- | release/sysinstall/globals.c | 4 | ||||
-rw-r--r-- | release/sysinstall/media_strategy.c | 12 | ||||
-rw-r--r-- | release/sysinstall/sysinstall.h | 3 | ||||
-rw-r--r-- | release/sysinstall/system.c | 14 | ||||
-rw-r--r-- | release/sysinstall/termcap.c | 2 | ||||
-rw-r--r-- | usr.sbin/sade/globals.c | 4 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 3 | ||||
-rw-r--r-- | usr.sbin/sade/system.c | 14 | ||||
-rw-r--r-- | usr.sbin/sade/termcap.c | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/globals.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 3 | ||||
-rw-r--r-- | usr.sbin/sysinstall/system.c | 14 | ||||
-rw-r--r-- | usr.sbin/sysinstall/termcap.c | 2 |
13 files changed, 67 insertions, 14 deletions
diff --git a/release/sysinstall/globals.c b/release/sysinstall/globals.c index 15a346e..daac658 100644 --- a/release/sysinstall/globals.c +++ b/release/sysinstall/globals.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: globals.c,v 1.5 1995/05/16 11:37:12 jkh Exp $ + * $Id: globals.c,v 1.6 1995/05/20 00:13:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -52,6 +52,7 @@ int CpioFD; /* The file descriptor for our CPIO floppy */ int DebugFD; /* Where diagnostic output goes */ Boolean OnCDROM; /* Are we running off of a CDROM? */ Boolean OnSerial; /* Are we on a serial console? */ +Boolean RunningAsInit; /* Are we running as init? */ Boolean DialogActive; Boolean ColorDisplay; Boolean OnVTY; @@ -74,4 +75,5 @@ globalsInit(void) DialogActive = FALSE; VarHead = NULL; mediaDevice = NULL; + RunningAsInit = FALSE; } diff --git a/release/sysinstall/media_strategy.c b/release/sysinstall/media_strategy.c index 0b87dc5..b3c0c6f 100644 --- a/release/sysinstall/media_strategy.c +++ b/release/sysinstall/media_strategy.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: media_strategy.c,v 1.18 1995/05/24 18:21:49 jkh Exp $ + * $Id: media_strategy.c,v 1.19 1995/05/24 18:56:03 gpalmer Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -201,7 +201,7 @@ attr_match(struct attribs *attr, char *name) static pid_t getDistpid = 0; static int -genericGetDist(char *path, struct attribs *dist_attrib) +genericGetDist(char *path, struct attribs *dist_attrib, Boolean prompt) { int fd; char buf[512]; @@ -239,6 +239,7 @@ genericGetDist(char *path, struct attribs *dist_attrib) } getDistpid = 0; } + msgDebug("Attempting to extract distribution from %u files\n", numchunks); pipe(pfd); getDistpid = fork(); @@ -266,7 +267,8 @@ genericGetDist(char *path, struct attribs *dist_attrib) retval = write(1, memory, sb.st_size); if (retval != sb.st_size) { - msgConfirm("write didn't write out the complete file!\n(wrote %d bytes of %d bytes)", retval, sb.st_size); + msgConfirm("write didn't write out the complete file!\n(wrote %d bytes of %d bytes)", retval, + sb.st_size); exit(1); } @@ -350,7 +352,7 @@ mediaGetCDROM(char *dist) snprintf(buf, PATH_MAX, "/cdrom/dists/%s", dist); - retval = genericGetDist(buf, dist_attr); + retval = genericGetDist(buf, dist_attr, FALSE); free(dist_attr); return retval; } @@ -403,7 +405,7 @@ mediaGetFloppy(char *dist) snprintf(buf, PATH_MAX, "/mnt/%s", dist); - retval = genericGetDist(buf, dist_attr); + retval = genericGetDist(buf, dist_attr, TRUE); free(dist_attr); return retval; } diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index b8ea33a..3c5ac0d 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.29 1995/05/24 01:27:14 jkh Exp $ + * $Id: sysinstall.h,v 1.30 1995/05/24 09:00:58 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -192,6 +192,7 @@ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean OnCDROM; /* Are we running off of a CDROM? */ extern Boolean OnSerial; /* Are we on a serial console? */ extern Boolean SystemWasInstalled; /* Did we install it? */ +extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c index cd62dd2..e5b685b 100644 --- a/release/sysinstall/system.c +++ b/release/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.28 1995/05/21 06:12:44 phk Exp $ + * $Id: system.c,v 1.29 1995/05/23 02:41:18 jkh Exp $ * * Jordan Hubbard * @@ -85,6 +85,18 @@ systemInitialize(int argc, char **argv) exit(-1); } + /* If we're running as init, stick a shell over on the 4th VTY */ + if (RunningAsInit && !fork()) { + int i; + + for (i = 0; i < 64; i++) + close(i); + open("/dev/ttyv3", O_RDWR); + ioctl(0, TIOCSCTTY, (char *)NULL); + dup2(0, 1); + dup2(0, 2); + } + /* XXX - libdialog has particularly bad return value checking */ init_dialog(); /* If we haven't crashed I guess dialog is running ! */ diff --git a/release/sysinstall/termcap.c b/release/sysinstall/termcap.c index 2cd8158..69522c6 100644 --- a/release/sysinstall/termcap.c +++ b/release/sysinstall/termcap.c @@ -31,6 +31,8 @@ set_termcap(void) OnVTY = OnSerial = FALSE; if (getpid() != 1) DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); + else + RunningAsInit = TRUE; term = getenv("TERM"); stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); if (stat < 0) { diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c index 15a346e..daac658 100644 --- a/usr.sbin/sade/globals.c +++ b/usr.sbin/sade/globals.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: globals.c,v 1.5 1995/05/16 11:37:12 jkh Exp $ + * $Id: globals.c,v 1.6 1995/05/20 00:13:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -52,6 +52,7 @@ int CpioFD; /* The file descriptor for our CPIO floppy */ int DebugFD; /* Where diagnostic output goes */ Boolean OnCDROM; /* Are we running off of a CDROM? */ Boolean OnSerial; /* Are we on a serial console? */ +Boolean RunningAsInit; /* Are we running as init? */ Boolean DialogActive; Boolean ColorDisplay; Boolean OnVTY; @@ -74,4 +75,5 @@ globalsInit(void) DialogActive = FALSE; VarHead = NULL; mediaDevice = NULL; + RunningAsInit = FALSE; } diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index b8ea33a..3c5ac0d 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.29 1995/05/24 01:27:14 jkh Exp $ + * $Id: sysinstall.h,v 1.30 1995/05/24 09:00:58 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -192,6 +192,7 @@ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean OnCDROM; /* Are we running off of a CDROM? */ extern Boolean OnSerial; /* Are we on a serial console? */ extern Boolean SystemWasInstalled; /* Did we install it? */ +extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index cd62dd2..e5b685b 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.28 1995/05/21 06:12:44 phk Exp $ + * $Id: system.c,v 1.29 1995/05/23 02:41:18 jkh Exp $ * * Jordan Hubbard * @@ -85,6 +85,18 @@ systemInitialize(int argc, char **argv) exit(-1); } + /* If we're running as init, stick a shell over on the 4th VTY */ + if (RunningAsInit && !fork()) { + int i; + + for (i = 0; i < 64; i++) + close(i); + open("/dev/ttyv3", O_RDWR); + ioctl(0, TIOCSCTTY, (char *)NULL); + dup2(0, 1); + dup2(0, 2); + } + /* XXX - libdialog has particularly bad return value checking */ init_dialog(); /* If we haven't crashed I guess dialog is running ! */ diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c index 2cd8158..69522c6 100644 --- a/usr.sbin/sade/termcap.c +++ b/usr.sbin/sade/termcap.c @@ -31,6 +31,8 @@ set_termcap(void) OnVTY = OnSerial = FALSE; if (getpid() != 1) DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); + else + RunningAsInit = TRUE; term = getenv("TERM"); stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); if (stat < 0) { diff --git a/usr.sbin/sysinstall/globals.c b/usr.sbin/sysinstall/globals.c index 15a346e..daac658 100644 --- a/usr.sbin/sysinstall/globals.c +++ b/usr.sbin/sysinstall/globals.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: globals.c,v 1.5 1995/05/16 11:37:12 jkh Exp $ + * $Id: globals.c,v 1.6 1995/05/20 00:13:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -52,6 +52,7 @@ int CpioFD; /* The file descriptor for our CPIO floppy */ int DebugFD; /* Where diagnostic output goes */ Boolean OnCDROM; /* Are we running off of a CDROM? */ Boolean OnSerial; /* Are we on a serial console? */ +Boolean RunningAsInit; /* Are we running as init? */ Boolean DialogActive; Boolean ColorDisplay; Boolean OnVTY; @@ -74,4 +75,5 @@ globalsInit(void) DialogActive = FALSE; VarHead = NULL; mediaDevice = NULL; + RunningAsInit = FALSE; } diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index b8ea33a..3c5ac0d 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.29 1995/05/24 01:27:14 jkh Exp $ + * $Id: sysinstall.h,v 1.30 1995/05/24 09:00:58 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -192,6 +192,7 @@ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean OnCDROM; /* Are we running off of a CDROM? */ extern Boolean OnSerial; /* Are we on a serial console? */ extern Boolean SystemWasInstalled; /* Did we install it? */ +extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index cd62dd2..e5b685b 100644 --- a/usr.sbin/sysinstall/system.c +++ b/usr.sbin/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.28 1995/05/21 06:12:44 phk Exp $ + * $Id: system.c,v 1.29 1995/05/23 02:41:18 jkh Exp $ * * Jordan Hubbard * @@ -85,6 +85,18 @@ systemInitialize(int argc, char **argv) exit(-1); } + /* If we're running as init, stick a shell over on the 4th VTY */ + if (RunningAsInit && !fork()) { + int i; + + for (i = 0; i < 64; i++) + close(i); + open("/dev/ttyv3", O_RDWR); + ioctl(0, TIOCSCTTY, (char *)NULL); + dup2(0, 1); + dup2(0, 2); + } + /* XXX - libdialog has particularly bad return value checking */ init_dialog(); /* If we haven't crashed I guess dialog is running ! */ diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c index 2cd8158..69522c6 100644 --- a/usr.sbin/sysinstall/termcap.c +++ b/usr.sbin/sysinstall/termcap.c @@ -31,6 +31,8 @@ set_termcap(void) OnVTY = OnSerial = FALSE; if (getpid() != 1) DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); + else + RunningAsInit = TRUE; term = getenv("TERM"); stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); if (stat < 0) { |