diff options
author | jkh <jkh@FreeBSD.org> | 1997-09-08 11:09:11 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1997-09-08 11:09:11 +0000 |
commit | 140da238550bc7f41ac21e3cd32cf0b847fe4d50 (patch) | |
tree | e89d834605956319edc985c70f3f5e88f609a9e5 /usr.sbin/sade | |
parent | 4fcbd35c019dc4ad198f15d50a682c6c76e7d614 (diff) | |
download | FreeBSD-src-140da238550bc7f41ac21e3cd32cf0b847fe4d50.zip FreeBSD-src-140da238550bc7f41ac21e3cd32cf0b847fe4d50.tar.gz |
Make upgrade potentially a little less interactive.
Add and document new loadConfig function (sort of like a script #include).
Make TCP/IP setup far less chatty when it doesn't need to be.
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r-- | usr.sbin/sade/dispatch.c | 35 | ||||
-rw-r--r-- | usr.sbin/sade/sade.8 | 11 |
2 files changed, 43 insertions, 3 deletions
diff --git a/usr.sbin/sade/dispatch.c b/usr.sbin/sade/dispatch.c index 1f096a4..fc0f72d 100644 --- a/usr.sbin/sade/dispatch.c +++ b/usr.sbin/sade/dispatch.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dispatch.c,v 1.20 1997/07/16 05:22:40 jkh Exp $ + * $Id: dispatch.c,v 1.21 1997/08/11 13:08:18 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -39,7 +39,8 @@ static int _shutdown(dialogMenuItem *unused); static int _systemExecute(dialogMenuItem *unused); - +static int _loadConfig(dialogMenuItem *unused); + static struct _word { char *name; int (*handler)(dialogMenuItem *self); @@ -82,6 +83,7 @@ static struct _word { { "installFixitFloppy", installFixitFloppy }, { "installFilesystems", installFilesystems }, { "installVarDefaults", installVarDefaults }, + { "loadConfig", _loadConfig }, { "mediaSetCDROM", mediaSetCDROM }, { "mediaSetFloppy", mediaSetFloppy }, { "mediaSetDOS", mediaSetDOS }, @@ -140,6 +142,35 @@ _systemExecute(dialogMenuItem *unused) return DITEM_FAILURE; } +static int +_loadConfig(dialogMenuItem *unused) +{ + FILE *fp; + char *cp, buf[BUFSIZ]; + int i = DITEM_SUCCESS; + + cp = variable_get("file"); + if ((!cp || (fp = fopen(cp, "r")) == NULL) && + (fp = fopen("install.cfg", "r")) == NULL && + (fp = fopen("/stand/install.cfg", "r")) == NULL && + (fp = fopen("/tmp/install.cfg", "r")) == NULL) { + msgConfirm("Unable to locate an install.cfg file in $CWD, /stand or /tmp."); + i = DITEM_FAILURE; + } + else { + variable_set2(VAR_NONINTERACTIVE, "YES"); + while (fgets(buf, sizeof buf, fp)) { + if ((i = DITEM_STATUS(dispatchCommand(buf))) != DITEM_SUCCESS) { + msgDebug("Command `%s' failed - rest of script aborted.\n", buf); + break; + } + } + } + fclose(fp); + variable_unset(VAR_NONINTERACTIVE); + return i; +} + /* For a given string, call it or spit out an undefined command diagnostic */ int dispatchCommand(char *str) diff --git a/usr.sbin/sade/sade.8 b/usr.sbin/sade/sade.8 index 465c719..ba6064a 100644 --- a/usr.sbin/sade/sade.8 +++ b/usr.sbin/sade/sade.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: sysinstall.8,v 1.2 1997/08/11 13:20:38 jkh Exp $ +.\" $Id: sysinstall.8,v 1.3 1997/08/18 21:10:26 jkh Exp $ .\" .Dd August 9, 1997 .Dt SYSINSTALL 8 @@ -608,6 +608,15 @@ Initialize all variables to their defaults, overriding any previous settings. .Pp \fBVariables:\fR None +.It loadConfig +Sort of like an #include statement, it allows you to load one +configuration file from another. +.Pp +\fBVariables:\fR +.Bl -tag -width indent +.It file +The fully pathname of the file to load. +.El .It mediaSetCDROM Select a FreeBSD CDROM as the installation media. .Pp |