summaryrefslogtreecommitdiffstats
path: root/release/sysinstall
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-04-28 10:31:14 +0000
committerjkh <jkh@FreeBSD.org>1997-04-28 10:31:14 +0000
commitb980a85e29b969dcfd9d5fe263bab80066c383fb (patch)
tree2c39d7e1e2c0589d47c08214daaa385e1a1abbe6 /release/sysinstall
parenta82625370f99b33d357ac2754cdb659c8fa8d81c (diff)
downloadFreeBSD-src-b980a85e29b969dcfd9d5fe263bab80066c383fb.zip
FreeBSD-src-b980a85e29b969dcfd9d5fe263bab80066c383fb.tar.gz
Adapt to rc.conf file format.
Diffstat (limited to 'release/sysinstall')
-rw-r--r--release/sysinstall/config.c28
-rw-r--r--release/sysinstall/install.c8
-rw-r--r--release/sysinstall/installUpgrade.c4
-rw-r--r--release/sysinstall/sysinstall.h10
-rw-r--r--release/sysinstall/system.c8
5 files changed, 34 insertions, 24 deletions
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c
index b9abd11..ba04f6a 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.87 1997/04/20 16:46:25 jkh Exp $
+ * $Id: config.c,v 1.88 1997/04/28 06:15:48 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -300,9 +300,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 a sysconfig file */
+/* Load the environment from an rc.conf file */
void
-configEnvironmentSysconfig(char *config)
+configEnvironmentRC_conf(char *config)
{
char *lines[MAX_LINES], *cp, *cp2;
int i, j, nlines;
@@ -320,10 +320,10 @@ configEnvironmentSysconfig(char *config)
*cp++ = '\0';
(void)string_prune(lines[i]);
cp = string_skipwhite(string_prune(cp));
- if ((cp2 = index(cp, '"'))) /* Eliminate leading quote if it's quoted */
+ if ((cp2 = index(cp, '"')) || (cp2 = index(cp, '\047'))) /* Eliminate leading quote if it's quoted */
cp = cp2 + 1;
j = strlen(cp) - 1;
- if (cp[j] == '"') /* And trailing one */
+ if (cp2 && cp[j] == *cp2) /* And trailing one */
cp[j] = '\0';
if (strlen(cp))
variable_set2(lines[i], cp);
@@ -356,11 +356,11 @@ configEnvironmentResolv(char *config)
}
/*
- * This sucks in /etc/sysconfig, substitutes anything needing substitution, then
+ * This sucks in /etc/rc.conf, substitutes anything needing substitution, then
* writes it all back out. It's pretty gross and needs re-writing at some point.
*/
void
-configSysconfig(char *config)
+configRC_conf(char *config)
{
FILE *fp;
char *lines[MAX_LINES], *cp;
@@ -383,9 +383,19 @@ configSysconfig(char *config)
continue;
sstrncpy(line, lines[i], cp - lines[i]);
if (!strcmp(line, v->name)) {
+ char *cp3, *comment = NULL;
+
+ /* If trailing comment, try and preserve it */
+ if ((cp3 = index(lines[i], '#')) != NULL) {
+ comment = alloca(strlen(cp3) + 1);
+ strcpy(comment, cp3);
+ }
free(lines[i]);
- lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 5);
- sprintf(lines[i], "%s=\"%s\"\n", v->name, v->value);
+ lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + (comment ? 0 : strlen(comment)) + 10);
+ if (comment)
+ sprintf(lines[i], "%s=\"%s\"\t\t%s\n", v->name, v->value, comment);
+ else
+ sprintf(lines[i], "%s=\"%s\"\n", v->name, v->value);
}
}
}
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index 7033316..bb8bba9 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.180 1997/04/02 12:07:32 jkh Exp $
+ * $Id: install.c,v 1.181 1997/04/03 13:44:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -565,7 +565,7 @@ installNovice(dialogMenuItem *self)
}
/* Now would be a good time to checkpoint the configuration data */
- configSysconfig("/etc/sysconfig");
+ configRC_conf("/etc/rc.conf");
sync();
if (directory_exists("/usr/X11R6")) {
@@ -994,8 +994,8 @@ installVarDefaults(dialogMenuItem *self)
void
installEnvironment(void)
{
- if (file_readable("/etc/sysconfig"))
- configEnvironmentSysconfig("/etc/sysconfig");
+ if (file_readable("/etc/rc.conf"))
+ configEnvironmentRC_conf("/etc/rc.conf");
if (file_readable("/etc/resolv.conf"))
configEnvironmentResolv("/etc/resolv.conf");
}
diff --git a/release/sysinstall/installUpgrade.c b/release/sysinstall/installUpgrade.c
index ad53514..e5e677e 100644
--- a/release/sysinstall/installUpgrade.c
+++ b/release/sysinstall/installUpgrade.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: installUpgrade.c,v 1.46 1997/03/11 09:29:17 jkh Exp $
+ * $Id: installUpgrade.c,v 1.47 1997/04/02 12:07:37 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -99,6 +99,7 @@ static HitList etc_files [] = {
{ JUST_COPY, "protocols", TRUE, NULL },
{ JUST_COPY, "pwd.db", TRUE, NULL },
{ JUST_COPY, "rc.local", TRUE, NULL },
+ { JUST_COPY, "rc.conf", FALSE, NULL },
{ JUST_COPY, "remote", TRUE, NULL },
{ JUST_COPY, "resolv.conf", TRUE, NULL },
{ JUST_COPY, "rmt", TRUE, NULL },
@@ -109,7 +110,6 @@ static HitList etc_files [] = {
{ JUST_COPY, "skeykeys", TRUE, NULL },
{ JUST_COPY, "spwd.db", TRUE, NULL },
{ JUST_COPY, "supfile", TRUE, NULL },
- { JUST_COPY, "sysconfig", FALSE, NULL },
{ JUST_COPY, "syslog.conf", TRUE, NULL },
{ JUST_COPY, "termcap", TRUE, NULL },
{ JUST_COPY, "ttys", TRUE, NULL },
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index 9aa9320..016ad67 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.123 1997/04/02 12:07:39 jkh Exp $
+ * $Id: sysinstall.h,v 1.124 1997/04/20 16:46:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -180,7 +180,7 @@ typedef struct _dmenu {
dialogMenuItem items[0]; /* Array of menu items */
} DMenu;
-/* A sysconfig variable */
+/* An rc.conf variable */
typedef struct _variable {
struct _variable *next;
char *name;
@@ -406,9 +406,9 @@ extern void command_func_add(char *key, commandFunc func, void *data);
/* config.c */
extern int configFstab(void);
-extern void configEnvironmentSysconfig(char *config);
+extern void configEnvironmentRC_conf(char *config);
extern void configEnvironmentResolv(char *config);
-extern void configSysconfig(char *config);
+extern void configRC_conf(char *config);
extern int configRegister(dialogMenuItem *self);
extern void configResolv(void);
extern int configPackages(dialogMenuItem *self);
@@ -421,7 +421,7 @@ extern int configRouter(dialogMenuItem *self);
extern int configSamba(dialogMenuItem *self);
extern int configPCNFSD(dialogMenuItem *self);
extern int configNFSServer(dialogMenuItem *self);
-extern int configWriteSysconfig(dialogMenuItem *self);
+extern int configWriteRC_conf(dialogMenuItem *self);
#ifdef NETCON_EXTENTIONS
extern int configNovell(dialogMenuItem *self);
#endif
diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c
index b66928b..dfbe453 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.78 1997/04/28 06:15:49 jkh Exp $
+ * $Id: system.c,v 1.79 1997/04/28 09:35:59 jkh Exp $
*
* Jordan Hubbard
*
@@ -118,9 +118,9 @@ systemShutdown(int status)
if (status >=0 && mediaDevice)
mediaDevice->shutdown(mediaDevice);
- /* write out any changes to sysconfig .. */
- if (!status)
- configSysconfig("/etc/sysconfig");
+ /* write out any changes to rc.conf .. */
+ if (status)
+ configRC_conf("/etc/rc.conf");
/* Shut down the dialog library */
if (DialogActive) {
OpenPOWER on IntegriCloud