summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/dispatch.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-09-08 11:09:11 +0000
committerjkh <jkh@FreeBSD.org>1997-09-08 11:09:11 +0000
commit140da238550bc7f41ac21e3cd32cf0b847fe4d50 (patch)
treee89d834605956319edc985c70f3f5e88f609a9e5 /usr.sbin/sysinstall/dispatch.c
parent4fcbd35c019dc4ad198f15d50a682c6c76e7d614 (diff)
downloadFreeBSD-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/sysinstall/dispatch.c')
-rw-r--r--usr.sbin/sysinstall/dispatch.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/usr.sbin/sysinstall/dispatch.c b/usr.sbin/sysinstall/dispatch.c
index 1f096a4..fc0f72d 100644
--- a/usr.sbin/sysinstall/dispatch.c
+++ b/usr.sbin/sysinstall/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)
OpenPOWER on IntegriCloud