summaryrefslogtreecommitdiff
path: root/release/sysinstall
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1997-02-15 15:41:44 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1997-02-15 15:41:44 +0000
commite8170c615e96d01e364aefa90faea347df952592 (patch)
tree114ebc2d058668820dfc786aa018cdf19a0e7ead /release/sysinstall
parent86f0017da62dcb77bf89985dca9bea1c568ab065 (diff)
Notes
Diffstat (limited to 'release/sysinstall')
-rw-r--r--release/sysinstall/config.c38
-rw-r--r--release/sysinstall/install.c12
-rw-r--r--release/sysinstall/main.c6
-rw-r--r--release/sysinstall/sysinstall.h6
-rw-r--r--release/sysinstall/termcap.c5
5 files changed, 51 insertions, 16 deletions
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c
index 2941214abcee..d347c669515b 100644
--- a/release/sysinstall/config.c
+++ b/release/sysinstall/config.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: config.c,v 1.16.2.68 1997/02/14 21:29:20 jkh Exp $
+ * $Id: config.c,v 1.16.2.69 1997/02/15 13:20:11 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -301,9 +301,9 @@ readConfig(char *config, char **lines, int max)
#define MAX_LINES 2000 /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */
-/* Load the environment from /etc/sysconfig, if it exists */
+/* Load the environment from a sysconfig file */
void
-configEnvironment(char *config)
+configEnvironmentSysconfig(char *config)
{
char *lines[MAX_LINES], *cp, *cp2;
int i, j, nlines;
@@ -332,6 +332,30 @@ configEnvironment(char *config)
}
}
+/* Load the environment from a resolv.conf file */
+void
+configEnvironmentResolv(char *config)
+{
+ char *lines[MAX_LINES];
+ int i, nlines;
+
+ nlines = readConfig(config, lines, MAX_LINES);
+ if (nlines == -1)
+ return;
+ for (i = 0; i < nlines; i++) {
+ Boolean name_set = FALSE;
+
+ if (!strncmp(lines[i], "domain", 6))
+ variable_set2(VAR_DOMAINNAME, string_skipwhite(lines[i] + 6));
+ else if (!strncmp(lines[i], "nameserver", 10) && !name_set) {
+ /* Only take the first nameserver setting - we're lame */
+ variable_set2(VAR_NAMESERVER, string_skipwhite(lines[i] + 10));
+ name_set = TRUE;
+ }
+ free(lines[i]);
+ }
+}
+
/*
* This sucks in /etc/sysconfig, substitutes anything needing substitution, then
* writes it all back out. It's pretty gross and needs re-writing at some point.
@@ -360,17 +384,15 @@ configSysconfig(char *config)
free(lines[i]);
lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 5);
sprintf(lines[i], "%s=\"%s\"\n", v->name, v->value);
- msgDebug("Variable substitution on: %s\n", lines[i]);
}
}
}
/* Now write it all back out again */
- msgNotify("Writing configuration changes to %s file..", config);
- if (Fake) {
- msgDebug("Writing %s out to debugging screen..\n", config);
+ if (isDebug())
+ msgDebug("Writing configuration changes to %s file..", config);
+ if (Fake)
fp = fdopen(DebugFD, "w");
- }
else {
(void)vsystem("cp %s %s.previous", config, config);
fp = fopen(config, "w");
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index fc2b2e688677..0071de8467cd 100644
--- a/release/sysinstall/install.c
+++ b/release/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.71.2.113 1997/02/13 00:32:54 jkh Exp $
+ * $Id: install.c,v 1.71.2.114 1997/02/14 21:29:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -973,6 +973,16 @@ installVarDefaults(dialogMenuItem *self)
return DITEM_SUCCESS;
}
+/* Load the environment up from various system configuration files */
+void
+installEnvironment(void)
+{
+ if (file_readable("/etc/sysconfig"))
+ configEnvironmentSysconfig("/etc/sysconfig");
+ if (file_readable("/etc/resolv.conf"))
+ configEnvironmentResolv("/etc/resolv.conf");
+}
+
/* Copy the boot floppy contents into /stand */
Boolean
copySelf(void)
diff --git a/release/sysinstall/main.c b/release/sysinstall/main.c
index 36b044c92231..3853bfcd3336 100644
--- a/release/sysinstall/main.c
+++ b/release/sysinstall/main.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: main.c,v 1.13.2.25 1997/02/07 04:26:23 jkh Exp $
+ * $Id: main.c,v 1.13.2.26 1997/02/14 21:29:23 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -70,9 +70,7 @@ main(int argc, char **argv)
/* Set default flag and variable values */
installVarDefaults(NULL);
-
- if (file_readable("/etc/sysconfig"))
- configEnvironment("/etc/sysconfig");
+ installEnvironment();
if (argc > 1 && !strcmp(argv[1], "-fake")) {
variable_set2(VAR_DEBUG, "YES");
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index dac30da0fd0a..f2e7cce311dd 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.42.2.74 1997/02/14 21:29:24 jkh Exp $
+ * $Id: sysinstall.h,v 1.42.2.75 1997/02/15 13:20:12 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -404,7 +404,8 @@ extern void command_func_add(char *key, commandFunc func, void *data);
/* config.c */
extern int configFstab(void);
-extern void configEnvironment(char *config);
+extern void configEnvironmentSysconfig(char *config);
+extern void configEnvironmentResolv(char *config);
extern void configSysconfig(char *config);
extern void configResolv(void);
extern int configPackages(dialogMenuItem *self);
@@ -530,6 +531,7 @@ extern int installFixup(dialogMenuItem *self);
extern int installUpgrade(dialogMenuItem *self);
extern int installFilesystems(dialogMenuItem *self);
extern int installVarDefaults(dialogMenuItem *self);
+extern void installEnvironment(void);
extern Boolean copySelf(void);
/* keymap.c */
diff --git a/release/sysinstall/termcap.c b/release/sysinstall/termcap.c
index a72c0a4a3fb3..992cb60ee607 100644
--- a/release/sysinstall/termcap.c
+++ b/release/sysinstall/termcap.c
@@ -32,7 +32,10 @@ set_termcap(void)
stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay);
if (getpid() != 1) {
- DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ if (getenv("SYSINSTALL_DEBUG"))
+ DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ else
+ DebugFD = -1;
if (DebugFD < 0)
DebugFD = open("/dev/null", O_RDWR, 0);
}