summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sade
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1999-02-05 22:15:52 +0000
committerjkh <jkh@FreeBSD.org>1999-02-05 22:15:52 +0000
commit75fb26219bd4805540359fb346c1c92a31926b61 (patch)
tree8b4fe6025e7aa70a6be932e3c42fb3d989e4533e /usr.sbin/sade
parent8bd29729fb349a7454431e101ad436a191653e5e (diff)
downloadFreeBSD-src-75fb26219bd4805540359fb346c1c92a31926b61.zip
FreeBSD-src-75fb26219bd4805540359fb346c1c92a31926b61.tar.gz
Totally change the way variables are accounted for in sysinstall.
Now we know which variables are internal and which need to be backed to /etc/rc.conf.site. rc.conf is not touched now. Also kget kernel change information back properly and set up a loader.rc file to use it.
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r--usr.sbin/sade/config.c133
-rw-r--r--usr.sbin/sade/disks.c20
-rw-r--r--usr.sbin/sade/dispatch.c10
-rw-r--r--usr.sbin/sade/dmenu.c14
-rw-r--r--usr.sbin/sade/install.c85
-rw-r--r--usr.sbin/sade/label.c22
-rw-r--r--usr.sbin/sade/main.c4
-rw-r--r--usr.sbin/sade/menus.c3
-rw-r--r--usr.sbin/sade/sade.h11
-rw-r--r--usr.sbin/sade/system.c4
-rw-r--r--usr.sbin/sade/variable.c30
11 files changed, 141 insertions, 195 deletions
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c
index 368bfa4..2ab6fae 100644
--- a/usr.sbin/sade/config.c
+++ b/usr.sbin/sade/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.118 1999/02/01 16:35:40 jkh Exp $
+ * $Id: config.c,v 1.119 1999/02/02 15:57:13 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -288,7 +288,7 @@ 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 */
static void
-configReadRC_conf(char *config)
+readConfigFile(char *config, int marked)
{
char *lines[MAX_LINES], *cp, *cp2;
int i, nlines;
@@ -312,9 +312,9 @@ configReadRC_conf(char *config)
/* If valid quotes, use it */
if (cp2) {
*cp2 = '\0';
- /* If we have a legit value and it's not already set, set it */
- if (strlen(cp) && !variable_get(lines[i]))
- variable_set2(lines[i], cp);
+ /* If we have a legit value, set it */
+ if (strlen(cp))
+ variable_set2(lines[i], cp, marked);
}
free(lines[i]);
}
@@ -324,17 +324,20 @@ configReadRC_conf(char *config)
void
configEnvironmentRC_conf(void)
{
- static char *configs[] = {
- "/etc/rc.conf",
- "/etc/rc.conf.site",
- "/etc/rc.conf.local",
- NULL
+ static struct {
+ char *fname;
+ int marked;
+ } configs[] = {
+ { "/etc/rc.conf", 0 },
+ { "/etc/rc.conf.site", 1 },
+ { "/etc/rc.conf.local", 0 },
+ { NULL, 0 },
};
int i;
- for (i = 0; configs[i]; i++) {
- if (file_readable(configs[i]))
- configReadRC_conf(configs[i]);
+ for (i = 0; configs[i].fname; i++) {
+ if (file_readable(configs[i].fname))
+ readConfigFile(configs[i].fname, configs[i].marked);
}
}
@@ -352,10 +355,10 @@ configEnvironmentResolv(char *config)
Boolean name_set = (Boolean)variable_get(VAR_NAMESERVER);
if (!strncmp(lines[i], "domain", 6) && !variable_get(VAR_DOMAINNAME))
- variable_set2(VAR_DOMAINNAME, string_skipwhite(string_prune(lines[i] + 6)));
+ variable_set2(VAR_DOMAINNAME, string_skipwhite(string_prune(lines[i] + 6)), 0);
else if (!name_set && !strncmp(lines[i], "nameserver", 10)) {
/* Only take the first nameserver setting - we're lame */
- variable_set2(VAR_NAMESERVER, string_skipwhite(string_prune(lines[i] + 10)));
+ variable_set2(VAR_NAMESERVER, string_skipwhite(string_prune(lines[i] + 10)), 0);
}
free(lines[i]);
}
@@ -369,102 +372,32 @@ configRC(dialogMenuItem *unused)
return DITEM_SUCCESS;
}
-/*
- * 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
configRC_conf(char *config)
{
FILE *rcSite;
- char *lines[MAX_LINES], *cp;
Variable *v;
- int i, nlines, len;
- if (file_readable("/etc/rc.conf.site"))
- system("cp /etc/rc.conf.site /etc/rc.conf.site.previous");
rcSite = fopen("/etc/rc.conf.site", "w");
if (!rcSite)
return;
- nlines = readConfig(config, lines, MAX_LINES);
- if (nlines == -1)
- return;
-
/* Now do variable substitutions */
for (v = VarHead; v; v = v->next) {
- for (i = 0; i < nlines; i++) {
- /* Skip the comments & non-variable settings */
- if (lines[i][0] == '#' || !(cp = index(lines[i], '=')))
- continue;
-
- len = strlen(v->name);
- if (!strncmp(lines[i], v->name, cp - lines[i]) && (cp - lines[i]) == len && strcmp(cp + 1, v->value)) {
- char *cp2, *comment = NULL;
-
- /* If trailing comment, try and preserve it */
- if ((index(lines[i], '#')) != NULL) {
- /* Find quotes */
- if ((cp2 = index(cp, '"')) || (cp2 = index(cp, '\047')))
- cp2 = index(cp2 + 1, *cp2);
- if (cp2 && strlen(cp2 + 1)) {
- comment = alloca(strlen(cp2));
- strcpy(comment, cp2 + 1);
- }
- }
- free(lines[i]);
- lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + (comment ? strlen(comment) : 0) + 10);
- if (comment)
- sprintf(lines[i], "%s=\"%s\"%s", v->name, v->value, comment);
- else
- sprintf(lines[i], "%s=\"%s\"\n", v->name, v->value);
- fputs(lines[i], rcSite);
- /* Stand by for bogus special case handling;
- * we try to dump the interface specs here
- */
- if (!strncmp(lines[i], VAR_INTERFACES,
- strlen(VAR_INTERFACES))) {
- Device **devp;
- int j, cnt;
-
- devp = deviceFind(NULL, DEVICE_TYPE_NETWORK);
- cnt = deviceCount(devp);
- for (j = 0; j < cnt; j++) {
- char iname[255], toadd[512];
- int k, addit = TRUE;
-
- if (!strncmp(devp[j]->name, "ppp", 3) ||
- !strncmp(devp[j]->name, "tun", 3))
- continue;
-
- snprintf(iname, 255, "%s%s", VAR_IFCONFIG, devp[j]->name);
- if ((cp = variable_get(iname))) {
- snprintf(toadd, sizeof toadd, "%s=\"%s\"\n", iname, cp);
- for (k = 0; k < nlines; k++) {
- if (!strcmp(lines[k], toadd)) {
- addit = FALSE;
- break;
- }
- }
- if (addit)
- fputs(toadd, rcSite);
- }
- }
- }
- }
+ if (v->dirty) {
+ fprintf(rcSite, "%s=\"%s\"\n", v->name, v->value);
+ v->dirty = 0;
}
}
- for (i = 0; i < nlines; i++)
- free(lines[i]);
fclose(rcSite);
}
int
configSaver(dialogMenuItem *self)
{
- variable_set((char *)self->data);
+ variable_set((char *)self->data, 1);
if (!variable_get(VAR_BLANKTIME))
- variable_set2(VAR_BLANKTIME, "300");
+ variable_set2(VAR_BLANKTIME, "300", 1);
return DITEM_SUCCESS;
}
@@ -472,7 +405,7 @@ int
configSaverTimeout(dialogMenuItem *self)
{
return (variable_get_value(VAR_BLANKTIME,
- "Enter time-out period in seconds for screen saver") ?
+ "Enter time-out period in seconds for screen saver", 1) ?
DITEM_SUCCESS : DITEM_FAILURE) | DITEM_RESTORE;
}
@@ -488,7 +421,7 @@ configNTP(dialogMenuItem *self)
int status;
status = variable_get_value(VAR_NTPDATE_FLAGS,
- "Enter the name of an NTP server")
+ "Enter the name of an NTP server", 1)
? DITEM_SUCCESS : DITEM_FAILURE;
if (status == DITEM_SUCCESS) {
static char tmp[255];
@@ -625,20 +558,20 @@ configRouter(dialogMenuItem *self)
"will attempt to load if you select gated. Any other\n"
"choice of routing daemon will be assumed to be something\n"
"the user intends to install themselves before rebooting\n"
- "the system. If you don't want any routing daemon, choose NO")
+ "the system. If you don't want any routing daemon, choose NO", 1)
? DITEM_SUCCESS : DITEM_FAILURE;
if (ret == DITEM_SUCCESS) {
char *cp = variable_get(VAR_ROUTER);
if (cp && strcmp(cp, "NO")) {
- variable_set2(VAR_ROUTER_ENABLE, "YES");
+ variable_set2(VAR_ROUTER_ENABLE, "YES", 1);
if (!strcmp(cp, "gated")) {
if (package_add(variable_get(VAR_GATED_PKG)) != DITEM_SUCCESS) {
msgConfirm("Unable to load gated package. Falling back to no router.");
variable_unset(VAR_ROUTER);
variable_unset(VAR_ROUTERFLAGS);
- variable_set2(VAR_ROUTER_ENABLE, "NO");
+ variable_set2(VAR_ROUTER_ENABLE, "NO", 1);
cp = NULL;
}
}
@@ -646,7 +579,7 @@ configRouter(dialogMenuItem *self)
/* Now get the flags, if they chose a router */
ret = variable_get_value(VAR_ROUTERFLAGS,
"Please Specify the routing daemon flags; if you're running routed\n"
- "then -q is the right choice for nodes and -s for gateway hosts.\n")
+ "then -q is the right choice for nodes and -s for gateway hosts.\n", 1)
? DITEM_SUCCESS : DITEM_FAILURE;
if (ret != DITEM_SUCCESS)
variable_unset(VAR_ROUTERFLAGS);
@@ -654,7 +587,7 @@ configRouter(dialogMenuItem *self)
}
else {
/* No router case */
- variable_set2(VAR_ROUTER_ENABLE, "NO");
+ variable_set2(VAR_ROUTER_ENABLE, "NO", 1);
variable_unset(VAR_ROUTERFLAGS);
variable_unset(VAR_ROUTER);
}
@@ -749,8 +682,8 @@ configPCNFSD(dialogMenuItem *self)
else {
ret = package_add(variable_get(VAR_PCNFSD_PKG));
if (DITEM_STATUS(ret) == DITEM_SUCCESS) {
- variable_set2(VAR_PCNFSD, "YES");
- variable_set2("mountd_flags", "-n");
+ variable_set2(VAR_PCNFSD, "YES", 0);
+ variable_set2("mountd_flags", "-n", 1);
}
}
return ret;
@@ -787,7 +720,7 @@ configNFSServer(dialogMenuItem *self)
systemExecute(cmd);
restorescr(w);
}
- variable_set2(VAR_NFS_SERVER, "YES");
+ variable_set2(VAR_NFS_SERVER, "YES", 1);
}
else if (variable_get(VAR_NFS_SERVER)) { /* We want to turn it off again? */
vsystem("mv -f /etc/exports /etc/exports.disabled");
diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c
index 6c6b501..11b6470a 100644
--- a/usr.sbin/sade/disks.c
+++ b/usr.sbin/sade/disks.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: disks.c,v 1.107 1999/01/02 07:23:37 jkh Exp $
+ * $Id: disks.c,v 1.108 1999/01/08 00:14:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -290,7 +290,7 @@ diskPartition(Device *dev)
}
#endif
All_FreeBSD(d, rv);
- variable_set2(DISK_PARTITIONED, "yes");
+ variable_set2(DISK_PARTITIONED, "yes", 0);
record_chunks(d);
clear();
break;
@@ -347,7 +347,7 @@ diskPartition(Device *dev)
#endif
Create_Chunk(d, chunk_info[current_chunk]->offset, size, partitiontype, subtype,
(chunk_info[current_chunk]->flags & CHUNK_ALIGN));
- variable_set2(DISK_PARTITIONED, "yes");
+ variable_set2(DISK_PARTITIONED, "yes", 0);
record_chunks(d);
}
}
@@ -361,7 +361,7 @@ diskPartition(Device *dev)
msg = "Slice is already unused!";
else {
Delete_Chunk(d, chunk_info[current_chunk]);
- variable_set2(DISK_PARTITIONED, "yes");
+ variable_set2(DISK_PARTITIONED, "yes", 0);
record_chunks(d);
}
break;
@@ -449,7 +449,7 @@ diskPartition(Device *dev)
"these questions. If you're adding a disk, you should NOT write\n"
"from this screen, you should do it from the label editor.\n\n"
"Are you absolutely sure you want to do this now?")) {
- variable_set2(DISK_PARTITIONED, "yes");
+ variable_set2(DISK_PARTITIONED, "yes", 0);
/* Don't trash the MBR if the first (and therefore only) chunk is marked for a truly dedicated
* disk (i.e., the disklabel starts at sector 0), even in cases where the user has requested
@@ -483,7 +483,7 @@ diskPartition(Device *dev)
clear();
refresh();
slice_wizard(d);
- variable_set2(DISK_PARTITIONED, "yes");
+ variable_set2(DISK_PARTITIONED, "yes", 0);
record_chunks(d);
}
else
@@ -717,7 +717,7 @@ diskPartitionWrite(dialogMenuItem *self)
}
}
/* Now it's not "yes", but "written" */
- variable_set2(DISK_PARTITIONED, "written");
+ variable_set2(DISK_PARTITIONED, "written", 0);
return DITEM_SUCCESS;
}
@@ -748,7 +748,7 @@ diskPartitionNonInteractive(Device *dev)
if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size, freebsd, 3,
(chunk_info[i]->flags & CHUNK_ALIGN));
- variable_set2(DISK_PARTITIONED, "yes");
+ variable_set2(DISK_PARTITIONED, "yes", 0);
break;
}
}
@@ -778,7 +778,7 @@ diskPartitionNonInteractive(Device *dev)
/* If a chunk is at least sz MB, use it. */
if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3, (chunk_info[i]->flags & CHUNK_ALIGN));
- variable_set2(DISK_PARTITIONED, "yes");
+ variable_set2(DISK_PARTITIONED, "yes", 0);
break;
}
}
@@ -809,6 +809,6 @@ diskPartitionNonInteractive(Device *dev)
mbrContents = getBootMgr(d->name);
Set_Boot_Mgr(d, mbrContents);
}
- variable_set2(DISK_PARTITIONED, "yes");
+ variable_set2(DISK_PARTITIONED, "yes", 0);
}
}
diff --git a/usr.sbin/sade/dispatch.c b/usr.sbin/sade/dispatch.c
index 5e1668a..8d289e4 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.25 1998/07/18 09:41:58 jkh Exp $
+ * $Id: dispatch.c,v 1.26 1998/11/15 09:06:19 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -237,7 +237,7 @@ dispatchCommand(char *str)
if (index(str, '=')) {
if (isDebug())
msgDebug("dispatch: setting variable `%s'\n", str);
- variable_set(str);
+ variable_set(str, 0);
i = DITEM_SUCCESS;
}
else {
@@ -302,7 +302,7 @@ dispatch_execute(qelement *head)
old_interactive = strdup(old_interactive); /* save copy */
/* Hint to others that we're running from a script, should they care */
- variable_set2(VAR_NONINTERACTIVE, "yes");
+ variable_set2(VAR_NONINTERACTIVE, "yes", 0);
while (!EMPTYQUE(*head)) {
item = (command_buffer *) head->q_forw;
@@ -329,7 +329,7 @@ dispatch_execute(qelement *head)
if (!old_interactive)
variable_unset(VAR_NONINTERACTIVE);
else {
- variable_set2(VAR_NONINTERACTIVE, old_interactive);
+ variable_set2(VAR_NONINTERACTIVE, old_interactive, 0);
free(old_interactive);
}
@@ -392,7 +392,7 @@ dispatch_load_floppy(dialogMenuItem *self)
cp = variable_get_value(VAR_INSTALL_CFG,
"Specify the name of a configuration file\n"
- "residing on a MSDOS or UFS floppy.");
+ "residing on a MSDOS or UFS floppy.", 0);
if (!cp || !*cp) {
variable_unset(VAR_INSTALL_CFG);
what |= DITEM_FAILURE;
diff --git a/usr.sbin/sade/dmenu.c b/usr.sbin/sade/dmenu.c
index 11c369b..3b253e4 100644
--- a/usr.sbin/sade/dmenu.c
+++ b/usr.sbin/sade/dmenu.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: dmenu.c,v 1.36 1998/03/10 17:24:07 jkh Exp $
+ * $Id: dmenu.c,v 1.37 1998/03/15 19:30:46 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -88,7 +88,7 @@ dmenuExit(dialogMenuItem *tmp)
int
dmenuSetVariable(dialogMenuItem *tmp)
{
- variable_set((char *)tmp->data);
+ variable_set((char *)tmp->data, 1);
return DITEM_SUCCESS;
}
@@ -101,7 +101,7 @@ dmenuSetVariables(dialogMenuItem *tmp)
for (cp1 = copy; cp1 != NULL;) {
cp2 = index(cp1, ',');
if (cp2 != NULL) *cp2++ = '\0';
- variable_set(cp1);
+ variable_set(cp1, 1);
cp1 = cp2;
}
free(copy);
@@ -114,7 +114,7 @@ dmenuSetKmapVariable(dialogMenuItem *tmp)
char *lang;
int err;
- variable_set((char *)tmp->data);
+ variable_set((char *)tmp->data, 1);
lang = variable_get(VAR_KEYMAP);
if (lang != NULL)
{
@@ -137,7 +137,7 @@ dmenuToggleVariable(dialogMenuItem *tmp)
return DITEM_FAILURE;
}
if (!variable_check(var))
- variable_set(var);
+ variable_set(var, 1);
else
variable_unset(var);
return DITEM_SUCCESS;
@@ -154,14 +154,14 @@ dmenuISetVariable(dialogMenuItem *tmp)
return DITEM_FAILURE;
}
w = savescr();
- ans = msgGetInput(variable_get(var), tmp->title);
+ ans = msgGetInput(variable_get(var), tmp->title, 1);
restorescr(w);
if (!ans)
return DITEM_FAILURE;
else if (!*ans)
variable_unset(var);
else
- variable_set2(var, ans);
+ variable_set2(var, ans, 1);
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index cdd7eeb..03512d3 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/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.224 1999/01/27 02:32:47 jkh Exp $
+ * $Id: install.c,v 1.225 1999/01/29 11:39:04 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -206,7 +206,7 @@ installInitial(void)
}
/* If it's labelled, assume it's also partitioned */
if (!variable_get(DISK_PARTITIONED))
- variable_set2(DISK_PARTITIONED, "yes");
+ variable_set2(DISK_PARTITIONED, "yes", 0);
/* If we refuse to proceed, bail. */
dialog_clear_norefresh();
@@ -237,7 +237,7 @@ installInitial(void)
}
chdir("/");
- variable_set2(RUNNING_ON_ROOT, "yes");
+ variable_set2(RUNNING_ON_ROOT, "yes", 0);
/* Configure various files in /etc */
if (DITEM_STATUS(configResolv(NULL)) == DITEM_FAILURE)
@@ -267,7 +267,7 @@ installFixitCDROM(dialogMenuItem *self)
if (!RunningAsInit)
return DITEM_SUCCESS;
- variable_set2(SYSTEM_STATE, "fixit");
+ variable_set2(SYSTEM_STATE, "fixit", 0);
(void)unlink("/mnt2");
(void)rmdir("/mnt2");
@@ -341,7 +341,7 @@ installFixitFloppy(dialogMenuItem *self)
if (!RunningAsInit)
return DITEM_SUCCESS;
- variable_set2(SYSTEM_STATE, "fixit");
+ variable_set2(SYSTEM_STATE, "fixit", 0);
Mkdir("/mnt2");
/* Try to open the floppy drive */
@@ -450,7 +450,7 @@ installExpress(dialogMenuItem *self)
{
int i;
- variable_set2(SYSTEM_STATE, "express");
+ variable_set2(SYSTEM_STATE, "express", 0);
#ifndef __alpha__
if (DITEM_STATUS((i = diskPartitionEditor(self))) == DITEM_FAILURE)
return i;
@@ -475,7 +475,7 @@ installNovice(dialogMenuItem *self)
int i, tries = 0;
Device **devs;
- variable_set2(SYSTEM_STATE, "novice");
+ variable_set2(SYSTEM_STATE, "novice", 0);
#ifndef __alpha__
dialog_clear_norefresh();
msgConfirm("In the next menu, you will need to set up a DOS-style (\"fdisk\") partitioning\n"
@@ -553,7 +553,7 @@ nodisks:
dialog_clear_norefresh();
if (!msgYesNo("Will this machine be an IP gateway (e.g. will it forward packets\n"
"between interfaces)?"))
- variable_set2("gateway_enable", "YES");
+ variable_set2("gateway_enable", "YES", 1);
dialog_clear_norefresh();
if (!msgYesNo("Do you want to allow anonymous FTP connections to this machine?"))
@@ -565,7 +565,7 @@ nodisks:
dialog_clear_norefresh();
if (!msgYesNo("Do you want to configure this machine as an NFS client?"))
- variable_set2("nfs_client_enable", "YES");
+ variable_set2("nfs_client_enable", "YES", 1);
dialog_clear_norefresh();
if (!msgYesNo("Would you like to customize your system console settings?")) {
@@ -622,7 +622,7 @@ nodisks:
WINDOW *w = savescr();
if (!systemExecute("passwd root"))
- variable_set2("root_password", "YES");
+ variable_set2("root_password", "YES", 0);
restorescr(w);
}
@@ -722,7 +722,7 @@ try_media:
/* When running as init, *now* it's safe to grab the rc.foo vars */
installEnvironment();
- variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install");
+ variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install", 0);
return i | DITEM_RESTORE;
}
@@ -760,10 +760,28 @@ installFixupBin(dialogMenuItem *self)
}
#ifndef __alpha__
/* Snapshot any boot -c changes back to the new kernel */
- if (kget("/kernel.config")) {
+ if (kget("/boot/kernel.conf")) {
msgConfirm("Kernel copied OK, but unable to save boot -c changes\n"
"to it. See the debug screen (ALT-F2) for details.");
}
+ else {
+ if (!file_readable("/boot/loader.rc")) {
+ FILE *fp;
+
+ if ((fp = fopen("/boot/loader.rc", "w")) != NULL) {
+ fprintf(fp, "load /kernel\n");
+ fprintf(fp, "load -t userconfig_script /boot/kernel.conf\n");
+ fprintf(fp, "autoboot 5\n");
+ fclose(fp);
+ }
+ }
+ else {
+ msgConfirm("You already have a /boot/loader.rc file so I won't touch it.\n"
+ "You will need to add a: load -t userconfig_script /boot/kernel.conf\n"
+ "line to your /boot/loader.rc before your saved kernel changes\n"
+ "(if any) can go into effect.");
+ }
+ }
#endif
}
else {
@@ -820,12 +838,6 @@ installFixupBin(dialogMenuItem *self)
/* BOGON #5: aliases database not build for bin */
vsystem("newaliases");
- /* BOGON #6: deal with new boot files */
- vsystem("touch /kernel.config");
- vsystem("touch /boot.config");
- if (file_readable("/stand/boot.help") && !file_readable("/boot.help"))
- vsystem("mv /stand/boot.help /");
-
/* Now run all the mtree stuff to fix things up */
vsystem("mtree -deU -f /etc/mtree/BSD.root.dist -p /");
vsystem("mtree -deU -f /etc/mtree/BSD.var.dist -p /var");
@@ -1037,28 +1049,28 @@ installVarDefaults(dialogMenuItem *self)
char *cp;
/* Set default startup options */
- variable_set2(VAR_RELNAME, getRelname());
- variable_set2(VAR_CPIO_VERBOSITY, "high");
- variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE);
- variable_set2(VAR_INSTALL_ROOT, "/");
- variable_set2(VAR_INSTALL_CFG, "install.cfg");
+ variable_set2(VAR_RELNAME, getRelname(), 0);
+ variable_set2(VAR_CPIO_VERBOSITY, "high", 0);
+ variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE, 0);
+ variable_set2(VAR_INSTALL_ROOT, "/", 0);
+ variable_set2(VAR_INSTALL_CFG, "install.cfg", 0);
cp = getenv("EDITOR");
if (!cp)
cp = "/usr/bin/ee";
- variable_set2(VAR_EDITOR, cp);
- variable_set2(VAR_FTP_USER, "ftp");
- variable_set2(VAR_BROWSER_PACKAGE, "lynx");
- variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
- variable_set2(VAR_FTP_STATE, "passive");
- variable_set2(VAR_NFS_SECURE, "YES");
- variable_set2(VAR_PKG_TMPDIR, "/usr/tmp");
- variable_set2(VAR_GATED_PKG, "gated");
- variable_set2(VAR_PCNFSD_PKG, "pcnfsd");
- variable_set2(VAR_MEDIA_TIMEOUT, itoa(MEDIA_TIMEOUT));
+ variable_set2(VAR_EDITOR, cp, 0);
+ variable_set2(VAR_FTP_USER, "ftp", 0);
+ variable_set2(VAR_BROWSER_PACKAGE, "lynx", 0);
+ variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx", 0);
+ variable_set2(VAR_FTP_STATE, "passive", 0);
+ variable_set2(VAR_NFS_SECURE, "YES", 1);
+ variable_set2(VAR_PKG_TMPDIR, "/usr/tmp", 0);
+ variable_set2(VAR_GATED_PKG, "gated", 0);
+ variable_set2(VAR_PCNFSD_PKG, "pcnfsd", 0);
+ variable_set2(VAR_MEDIA_TIMEOUT, itoa(MEDIA_TIMEOUT), 0);
if (getpid() != 1)
- variable_set2(SYSTEM_STATE, "update");
+ variable_set2(SYSTEM_STATE, "update", 0);
else
- variable_set2(SYSTEM_STATE, "init");
+ variable_set2(SYSTEM_STATE, "init", 0);
return DITEM_SUCCESS;
}
@@ -1066,8 +1078,7 @@ installVarDefaults(dialogMenuItem *self)
void
installEnvironment(void)
{
- if (file_readable("/etc/rc.conf"))
- configEnvironmentRC_conf();
+ configEnvironmentRC_conf();
if (file_readable("/etc/resolv.conf"))
configEnvironmentResolv("/etc/resolv.conf");
}
diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c
index c43c5f6..3677caf 100644
--- a/usr.sbin/sade/label.c
+++ b/usr.sbin/sade/label.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: label.c,v 1.84 1999/01/08 00:14:21 jkh Exp $
+ * $Id: label.c,v 1.85 1999/01/29 11:39:04 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -167,7 +167,7 @@ diskLabelEditor(dialogMenuItem *self)
char *cp;
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
- variable_set2(DISK_LABELLED, "yes");
+ variable_set2(DISK_LABELLED, "yes", 0);
}
return i;
}
@@ -192,7 +192,7 @@ diskLabelCommit(dialogMenuItem *self)
i = DITEM_FAILURE;
else {
msgInfo("All filesystem information written successfully.");
- variable_set2(DISK_LABELLED, "written");
+ variable_set2(DISK_LABELLED, "written", 0);
i = DITEM_SUCCESS;
}
return i;
@@ -870,7 +870,7 @@ diskLabel(Device *dev)
/* At this point, we're reasonably "labelled" */
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
- variable_set2(DISK_LABELLED, "yes");
+ variable_set2(DISK_LABELLED, "yes", 0);
}
break;
@@ -979,7 +979,7 @@ diskLabel(Device *dev)
tmp->private_data = p;
tmp->private_free = safe_free;
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
- variable_set2(DISK_LABELLED, "yes");
+ variable_set2(DISK_LABELLED, "yes", 0);
record_label_chunks(devs, dev);
clear_wins();
/*** This is where we assign focus to new label so it shows ***/
@@ -1010,7 +1010,7 @@ diskLabel(Device *dev)
}
Delete_Chunk(label_chunk_info[here].c->disk, label_chunk_info[here].c);
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
- variable_set2(DISK_LABELLED, "yes");
+ variable_set2(DISK_LABELLED, "yes", 0);
record_label_chunks(devs, dev);
break;
@@ -1039,7 +1039,7 @@ diskLabel(Device *dev)
}
}
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
- variable_set2(DISK_LABELLED, "yes");
+ variable_set2(DISK_LABELLED, "yes", 0);
record_label_chunks(devs, dev);
clear_wins();
break;
@@ -1067,7 +1067,7 @@ diskLabel(Device *dev)
safe_free(pi);
label_chunk_info[here].c->private_free = safe_free;
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
- variable_set2(DISK_LABELLED, "yes");
+ variable_set2(DISK_LABELLED, "yes", 0);
}
else
msg = MSG_NOT_APPLICABLE;
@@ -1110,7 +1110,7 @@ diskLabel(Device *dev)
"changes will be committed in one batch automatically at the end of\n"
"these questions.\n\n"
"Are you absolutely sure you want to do this now?")) {
- variable_set2(DISK_LABELLED, "yes");
+ variable_set2(DISK_LABELLED, "yes", 0);
diskLabelCommit(NULL);
}
clear_wins();
@@ -1136,7 +1136,7 @@ diskLabel(Device *dev)
slice_wizard(((Disk *)devs[i]->private));
}
if (((cp = variable_get(DISK_LABELLED)) == NULL) || (strcmp(cp, "written")))
- variable_set2(DISK_LABELLED, "yes");
+ variable_set2(DISK_LABELLED, "yes", 0);
DialogActive = TRUE;
record_label_chunks(devs, dev);
clear_wins();
@@ -1287,6 +1287,6 @@ diskLabelNonInteractive(Device *dev)
}
}
if (status == DITEM_SUCCESS)
- variable_set2(DISK_LABELLED, "yes");
+ variable_set2(DISK_LABELLED, "yes", 0);
return status;
}
diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c
index 5840896..9f6c812 100644
--- a/usr.sbin/sade/main.c
+++ b/usr.sbin/sade/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.49 1998/03/10 13:42:02 jkh Exp $
+ * $Id: main.c,v 1.50 1999/01/08 00:14:22 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -72,7 +72,7 @@ main(int argc, char **argv)
installEnvironment();
if (argc > 1 && !strcmp(argv[1], "-fake")) {
- variable_set2(VAR_DEBUG, "YES");
+ variable_set2(VAR_DEBUG, "YES", 0);
Fake = TRUE;
msgConfirm("I'll be just faking it from here on out, OK?");
}
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index 34b9c0d..fe75fa0 100644
--- a/usr.sbin/sade/menus.c
+++ b/usr.sbin/sade/menus.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: menus.c,v 1.183 1999/02/05 09:28:15 jkh Exp $
+ * $Id: menus.c,v 1.184 1999/02/05 09:54:59 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -243,6 +243,7 @@ DMenu MenuIndex = {
{ "Fdisk", "The disk Partition Editor", NULL, diskPartitionEditor },
{ "Fixit", "Repair mode with CDROM or fixit floppy.", NULL, dmenuSubmenu, NULL, &MenuFixit },
{ "FTP sites", "The FTP mirror site listing.", NULL, dmenuSubmenu, NULL, &MenuMediaFTP },
+ { "Dump Vars", "(debugging) dump out internal variables.", NULL, dump_variables },
{ "Gateway", "Set flag to route packets between interfaces.", dmenuVarCheck, dmenuToggleVariable, NULL, "gateway=YES" },
{ "HTML Docs", "The HTML documentation menu", NULL, docBrowser },
{ "Install, Novice", "A novice system installation.", NULL, installNovice },
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index c17a6e6..922eb07 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.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.154 1999/01/27 02:32:47 jkh Exp $
+ * $Id: sysinstall.h,v 1.155 1999/02/02 15:57:13 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -132,7 +132,7 @@
#define VAR_NETWORK_DEVICE "netDev"
#define VAR_NFS_PATH "nfs"
#define VAR_NFS_HOST "nfsHost"
-#define VAR_NFS_SECURE "nfsSecure"
+#define VAR_NFS_SECURE "nfs_reserved_port_only"
#define VAR_NFS_SERVER "nfs_server_enable"
#define VAR_NO_CONFIRM "noConfirm"
#define VAR_NO_ERROR "noError"
@@ -198,6 +198,7 @@ typedef struct _variable {
struct _variable *next;
char *name;
char *value;
+ int dirty;
} Variable;
#define NO_ECHO_OBJ(type) ((type) | (DITEM_NO_ECHO << 16))
@@ -702,12 +703,12 @@ extern int userAddGroup(dialogMenuItem *self);
extern int userAddUser(dialogMenuItem *self);
/* variable.c */
-extern void variable_set(char *var);
-extern void variable_set2(char *name, char *value);
+extern void variable_set(char *var, int dirty);
+extern void variable_set2(char *name, char *value, int dirty);
extern char *variable_get(char *var);
extern int variable_cmp(char *var, char *value);
extern void variable_unset(char *var);
-extern char *variable_get_value(char *var, char *prompt);
+extern char *variable_get_value(char *var, char *prompt, int dirty);
extern int variable_check(char *data);
extern int dump_variables(dialogMenuItem *self);
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index 97b7d57..b34664c 100644
--- a/usr.sbin/sade/system.c
+++ b/usr.sbin/sade/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.86 1999/01/08 00:14:22 jkh Exp $
+ * $Id: system.c,v 1.87 1999/01/08 09:13:00 jkh Exp $
*
* Jordan Hubbard
*
@@ -120,7 +120,7 @@ systemInitialize(int argc, char **argv)
/* Initalize various things for a multi-user environment */
if (!gethostname(hname, sizeof hname))
- variable_set2(VAR_HOSTNAME, hname);
+ variable_set2(VAR_HOSTNAME, hname, 1);
}
if (set_termcap() == -1) {
diff --git a/usr.sbin/sade/variable.c b/usr.sbin/sade/variable.c
index 2dc227a..ab39a47 100644
--- a/usr.sbin/sade/variable.c
+++ b/usr.sbin/sade/variable.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: variable.c,v 1.23 1998/03/15 17:10:17 jkh Exp $
+ * $Id: variable.c,v 1.24 1998/07/18 09:42:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -39,7 +39,7 @@
/* Routines for dealing with variable lists */
static void
-make_variable(char *var, char *value)
+make_variable(char *var, char *value, int dirty)
{
Variable *vp;
@@ -49,32 +49,32 @@ make_variable(char *var, char *value)
if (!var || !*var)
return;
- /* Put it in the environment in any case */
- setenv(var, value, 1);
/* Now search to see if it's already in the list */
for (vp = VarHead; vp; vp = vp->next) {
if (!strcmp(vp->name, var)) {
- if (isDebug())
- msgDebug("variable %s was %s, now %s\n", vp->name, vp->value, value);
+ if (vp->dirty && !dirty)
+ return;
+ setenv(var, value, 1);
free(vp->value);
vp->value = strdup(value);
+ vp->dirty = dirty;
return;
}
}
+ setenv(var, value, 1);
/* No? Create a new one */
vp = (Variable *)safe_malloc(sizeof(Variable));
vp->name = strdup(var);
vp->value = strdup(value);
+ vp->dirty = dirty;
vp->next = VarHead;
VarHead = vp;
- if (isDebug())
- msgDebug("Setting variable %s to %s\n", vp->name, vp->value);
}
void
-variable_set(char *var)
+variable_set(char *var, int dirty)
{
char tmp[1024], *cp;
@@ -86,17 +86,17 @@ variable_set(char *var)
if ((cp = index(tmp, '=')) == NULL)
msgFatal("Invalid variable format: %s", var);
*(cp++) = '\0';
- make_variable(tmp, string_skipwhite(cp));
+ make_variable(tmp, string_skipwhite(cp), dirty);
}
void
-variable_set2(char *var, char *value)
+variable_set2(char *var, char *value, int dirty)
{
if (!var || !value)
msgFatal("Null name or value passed to set_variable2!");
else if (!*var || !*value)
msgDebug("Warning: Zero length name or value passed to variable_set2()\n");
- make_variable(var, value);
+ make_variable(var, value, dirty);
}
char *
@@ -152,7 +152,7 @@ variable_unset(char *var)
/* Prompt user for the name of a variable */
char *
-variable_get_value(char *var, char *prompt)
+variable_get_value(char *var, char *prompt, int dirty)
{
char *cp;
@@ -160,7 +160,7 @@ variable_get_value(char *var, char *prompt)
if (cp && variable_get(VAR_NONINTERACTIVE))
return cp;
else if ((cp = msgGetInput(cp, prompt)) != NULL)
- variable_set2(var, cp);
+ variable_set2(var, cp, dirty);
else
cp = NULL;
return cp;
@@ -216,7 +216,7 @@ dump_variables(dialogMenuItem *unused)
}
for (vp = VarHead; vp; vp = vp->next)
- fprintf(fp, "%s=\"%s\"\n", vp->name, vp->value);
+ fprintf(fp, "%s=\"%s\" (%d)\n", vp->name, vp->value, vp->dirty);
fclose(fp);
OpenPOWER on IntegriCloud