This commit is contained in:
Jordan K. Hubbard committed 1997-02-15 15:41:44 +00:00
1 parent f9fc83ddba
commit 9fb6f4bc07
5 files changed
+51 -16
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/2.2/; revision=22758

No files matched your search

+30 -8
View File
@@ -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.51.2.21 1997/02/14 21:24:14 jkh Exp $
* $Id: config.c,v 1.51.2.22 1997/02/15 13:21:17 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");
+11 -1
View File
@@ -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.134.2.27 1997/02/13 00:31:53 jkh Exp $
* $Id: install.c,v 1.134.2.28 1997/02/14 21:24:15 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)
+2 -4
View File
@@ -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.28.2.7 1997/01/29 21:46:11 jkh Exp $
* $Id: main.c,v 1.28.2.8 1997/02/14 21:24:17 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");
+4 -2
View File
@@ -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.82.2.20 1997/02/14 21:24:23 jkh Exp $
* $Id: sysinstall.h,v 1.82.2.21 1997/02/15 13:21:19 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 */
+4 -1
View File
@@ -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);
}