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.
This commit is contained in:
jkh 1999-02-05 22:15:52 +00:00
parent f506937c2e
commit 28cf43f876
49 changed files with 513 additions and 675 deletions

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: anonFTP.c,v 1.22 1997/03/09 22:25:38 jkh Exp $
* $Id: anonFTP.c,v 1.23 1997/04/02 12:07:18 jkh Exp $
*
* Copyright (c) 1995
* Coranth Gryphon. All rights reserved.
@ -311,6 +311,6 @@ configAnonFTP(dialogMenuItem *self)
i = DITEM_FAILURE;
}
if (DITEM_STATUS(i) == DITEM_SUCCESS)
variable_set2("anon_ftp", "YES");
variable_set2("anon_ftp", "YES", 0);
return i | DITEM_RESTORE;
}

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.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");

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: 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);
}
}

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: 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;

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: 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;
}

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.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 @@ installNovice(dialogMenuItem *self)
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 @@ installNovice(dialogMenuItem *self)
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 @@ installNovice(dialogMenuItem *self)
WINDOW *w = savescr();
if (!systemExecute("passwd root"))
variable_set2("root_password", "YES");
variable_set2("root_password", "YES", 0);
restorescr(w);
}
@ -722,7 +722,7 @@ installCommit(dialogMenuItem *self)
/* 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");
}

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: installUpgrade.c,v 1.60 1998/11/03 03:38:55 jkh Exp $
* $Id: installUpgrade.c,v 1.61 1998/11/15 09:06:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -163,7 +163,7 @@ installUpgrade(dialogMenuItem *self)
if (variable_get(VAR_NONINTERACTIVE))
return installUpgradeNonInteractive(self);
variable_set2(SYSTEM_STATE, "upgrade");
variable_set2(SYSTEM_STATE, "upgrade", 0);
systemDisplayHelp("UPGRADE");
dialog_clear_norefresh();
@ -229,7 +229,7 @@ installUpgrade(dialogMenuItem *self)
}
/* Don't write out MBR info */
variable_set2(DISK_PARTITIONED, "written");
variable_set2(DISK_PARTITIONED, "written", 0);
if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) {
msgConfirm("Not all file systems were properly mounted. Upgrade operation\n"
"aborted.");
@ -362,7 +362,7 @@ installUpgradeNonInteractive(dialogMenuItem *self)
char *saved_etc;
Boolean extractingBin = TRUE;
variable_set2(SYSTEM_STATE, "upgrade");
variable_set2(SYSTEM_STATE, "upgrade", 0);
/* Make sure at least BIN is selected */
Dists |= DIST_BIN;
@ -403,7 +403,7 @@ installUpgradeNonInteractive(dialogMenuItem *self)
}
/* Don't write out MBR info */
variable_set2(DISK_PARTITIONED, "written");
variable_set2(DISK_PARTITIONED, "written", 0);
if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) {
msgConfirm("Not all file systems were properly mounted. Upgrade operation\n"
"aborted.");

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: 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;
}

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.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?");
}

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: media.c,v 1.93 1998/12/02 03:27:37 jkh Exp $
* $Id: media.c,v 1.94 1998/12/22 12:31:25 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -333,7 +333,7 @@ mediaSetFTP(dialogMenuItem *self)
if (!cp)
return DITEM_FAILURE | what;
else if (!strcmp(cp, "other")) {
variable_set2(VAR_FTP_PATH, "ftp://");
variable_set2(VAR_FTP_PATH, "ftp://", 0);
dialog_clear_norefresh();
cp = variable_get_value(VAR_FTP_PATH, "Please specify the URL of a FreeBSD distribution on a\n"
"remote ftp site. This site must accept either anonymous\n"
@ -341,7 +341,7 @@ mediaSetFTP(dialogMenuItem *self)
"in the Options screen.\n\n"
"A URL looks like this: ftp://<hostname>/<path>\n"
"Where <path> is relative to the anonymous ftp directory or the\n"
"home directory of the user being logged in as.");
"home directory of the user being logged in as.", 0);
if (!cp || !*cp || !strcmp(cp, "ftp://")) {
variable_unset(VAR_FTP_PATH);
return DITEM_FAILURE | what;
@ -408,9 +408,9 @@ mediaSetFTP(dialogMenuItem *self)
}
msgDebug("Found DNS entry for %s successfully..\n", hostname);
}
variable_set2(VAR_FTP_HOST, hostname);
variable_set2(VAR_FTP_DIR, dir ? dir : "/");
variable_set2(VAR_FTP_PORT, itoa(FtpPort));
variable_set2(VAR_FTP_HOST, hostname, 0);
variable_set2(VAR_FTP_DIR, dir ? dir : "/", 0);
variable_set2(VAR_FTP_PORT, itoa(FtpPort), 0);
ftpDevice.type = DEVICE_TYPE_FTP;
ftpDevice.init = mediaInitFTP;
ftpDevice.get = mediaGetFTP;
@ -423,14 +423,14 @@ mediaSetFTP(dialogMenuItem *self)
int
mediaSetFTPActive(dialogMenuItem *self)
{
variable_set2(VAR_FTP_STATE, "active");
variable_set2(VAR_FTP_STATE, "active", 0);
return mediaSetFTP(self);
}
int
mediaSetFTPPassive(dialogMenuItem *self)
{
variable_set2(VAR_FTP_STATE, "passive");
variable_set2(VAR_FTP_STATE, "passive", 0);
return mediaSetFTP(self);
}
@ -443,7 +443,7 @@ mediaSetUFS(dialogMenuItem *self)
mediaClose();
dialog_clear_norefresh();
cp = variable_get_value(VAR_UFS_PATH, "Enter a fully qualified pathname for the directory\n"
"containing the FreeBSD distribution files:");
"containing the FreeBSD distribution files:", 0);
if (!cp)
return DITEM_FAILURE;
strcpy(ufsDevice.name, "ufs");
@ -467,7 +467,7 @@ mediaSetNFS(dialogMenuItem *self)
dialog_clear_norefresh();
cp = variable_get_value(VAR_NFS_PATH, "Please enter the full NFS file specification for the remote\n"
"host and directory containing the FreeBSD distribution files.\n"
"This should be in the format: hostname:/some/freebsd/dir");
"This should be in the format: hostname:/some/freebsd/dir", 0);
if (!cp)
return DITEM_FAILURE;
SAFE_STRCPY(hostname, cp);
@ -503,7 +503,7 @@ mediaSetNFS(dialogMenuItem *self)
else
msgDebug("Found DNS entry for %s successfully..", hostname);
}
variable_set2(VAR_NFS_HOST, hostname);
variable_set2(VAR_NFS_HOST, hostname, 0);
nfsDevice.type = DEVICE_TYPE_NFS;
nfsDevice.init = mediaInitNFS;
nfsDevice.get = mediaGetNFS;
@ -731,10 +731,10 @@ mediaSetFTPUserPass(dialogMenuItem *self)
char *pass;
dialog_clear_norefresh();
if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:")) {
if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:", 0)) {
dialog_clear_norefresh();
DialogInputAttrs |= DITEM_NO_ECHO;
pass = variable_get_value(VAR_FTP_PASS, "Please enter the password for this user:");
pass = variable_get_value(VAR_FTP_PASS, "Please enter the password for this user:", 0);
DialogInputAttrs &= ~DITEM_NO_ECHO;
}
else
@ -754,11 +754,11 @@ mediaSetCPIOVerbosity(dialogMenuItem *self)
}
else {
if (!strcmp(cp, "low"))
variable_set2(VAR_CPIO_VERBOSITY, "medium");
variable_set2(VAR_CPIO_VERBOSITY, "medium", 0);
else if (!strcmp(cp, "medium"))
variable_set2(VAR_CPIO_VERBOSITY, "high");
variable_set2(VAR_CPIO_VERBOSITY, "high", 0);
else /* must be "high" - wrap around */
variable_set2(VAR_CPIO_VERBOSITY, "low");
variable_set2(VAR_CPIO_VERBOSITY, "low", 0);
}
return DITEM_SUCCESS;
}

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: 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 },

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mouse.c,v 1.3 1998/03/23 05:59:18 jkh Exp $
* $Id: mouse.c,v 1.4 1998/03/23 06:08:47 yokota Exp $
*/
#include "sysinstall.h"
@ -61,9 +61,9 @@ mousedTest(dialogMenuItem *self)
if (ret) {
if (file_readable("/var/run/moused.pid"))
vsystem("kill `cat /var/run/moused.pid`");
variable_set2(VAR_MOUSED, "NO");
variable_set2(VAR_MOUSED, "NO", 1);
} else {
variable_set2(VAR_MOUSED, "YES");
variable_set2(VAR_MOUSED, "YES", 1);
vsystem("ln -fs /dev/sysmouse /dev/mouse"); /* backwards compat */
}
@ -75,8 +75,8 @@ mousedDisable(dialogMenuItem *self)
{
if (file_readable("/var/run/moused.pid"))
vsystem("kill `cat /var/run/moused.pid`");
variable_set2(VAR_MOUSED, "NO");
variable_set2(VAR_MOUSED_TYPE, "NO");
variable_set2(VAR_MOUSED, "NO", 1);
variable_set2(VAR_MOUSED_TYPE, "NO", 1);
variable_unset(VAR_MOUSED_PORT);
msgConfirm("The mouse daemon is disabled.");
return DITEM_SUCCESS;

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: network.c,v 1.32 1998/10/01 19:26:02 msmith Exp $
* $Id: network.c,v 1.33 1998/11/15 09:06:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -200,13 +200,13 @@ startPPP(Device *devp)
dialog_clear_norefresh();
if (!variable_get(VAR_SERIAL_SPEED))
variable_set2(VAR_SERIAL_SPEED, "115200");
variable_set2(VAR_SERIAL_SPEED, "115200", 0);
/* Get any important user values */
val = variable_get_value(VAR_SERIAL_SPEED,
"Enter the baud rate for your modem - this can be higher than the actual\n"
"maximum data rate since most modems can talk at one speed to the\n"
"computer and at another speed to the remote end.\n\n"
"If you're not sure what to put here, just select the default.");
"If you're not sure what to put here, just select the default.", 0);
SAFE_STRCPY(speed, (val && *val) ? val : "115200");
val = variable_get(VAR_GATEWAY);

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: options.c,v 1.55 1997/06/18 05:11:37 jkh Exp $
* $Id: options.c,v 1.56 1997/07/16 05:22:42 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -189,13 +189,13 @@ fire(Option opt)
}
else if (opt.type == OPT_IS_VAR) {
if (opt.data) {
(void)variable_get_value(opt.aux, opt.data);
(void)variable_get_value(opt.aux, opt.data, 1);
status = 1;
}
else if (variable_get(opt.aux))
variable_unset(opt.aux);
else
variable_set2(opt.aux, "YES");
variable_set2(opt.aux, "YES", 1);
}
if (opt.check)
opt.check(opt);

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: package.c,v 1.64 1997/09/17 16:18:16 pst Exp $
* $Id: package.c,v 1.65 1997/10/15 04:37:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -117,7 +117,7 @@ package_extract(Device *dev, char *name, Boolean depended)
/* Make a couple of paranoid locations for temp files to live if user specified none */
if (!variable_get(VAR_PKG_TMPDIR)) {
/* Set it to a location with as much space as possible */
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp");
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp", 0);
}
Mkdir(variable_get(VAR_PKG_TMPDIR));
vsystem("chmod 1777 %s", variable_get(VAR_PKG_TMPDIR));

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.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);

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: 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) {

View File

@ -1,5 +1,5 @@
/*
* $Id: tcpip.c,v 1.73 1998/08/31 09:02:03 jkh Exp $
* $Id: tcpip.c,v 1.74 1998/11/15 09:06:20 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@ -282,14 +282,14 @@ tcpOpenDialog(Device *devp)
char temp[512], ifn[255];
char *ifaces;
variable_set2(VAR_HOSTNAME, hostname);
variable_set2(VAR_HOSTNAME, hostname, 1);
sethostname(hostname, strlen(hostname));
if (domainname[0])
variable_set2(VAR_DOMAINNAME, domainname);
variable_set2(VAR_DOMAINNAME, domainname, 0);
if (gateway[0])
variable_set2(VAR_GATEWAY, gateway);
variable_set2(VAR_GATEWAY, gateway, 1);
if (nameserver[0])
variable_set2(VAR_NAMESERVER, nameserver);
variable_set2(VAR_NAMESERVER, nameserver, 0);
if (!devp->private)
devp->private = (DevInfo *)safe_malloc(sizeof(DevInfo));
@ -300,17 +300,17 @@ tcpOpenDialog(Device *devp)
sprintf(temp, "inet %s %s netmask %s", ipaddr, extras, netmask);
sprintf(ifn, "%s%s", VAR_IFCONFIG, devp->name);
variable_set2(ifn, temp);
variable_set2(ifn, temp, 1);
ifaces = variable_get(VAR_INTERFACES);
if (!ifaces)
variable_set2(VAR_INTERFACES, ifaces = "lo0");
variable_set2(VAR_INTERFACES, ifaces = "lo0", 1);
/* Only add it if it's not there already */
if (!strstr(ifaces, devp->name)) {
sprintf(ifn, "%s %s", devp->name, ifaces);
variable_set2(VAR_INTERFACES, ifn);
variable_set2(VAR_INTERFACES, ifn, 1);
}
if (ipaddr[0])
variable_set2(VAR_IPADDR, ipaddr);
variable_set2(VAR_IPADDR, ipaddr, 0);
configResolv(NULL); /* XXX this will do it on the MFS copy XXX */
ret = DITEM_SUCCESS;
}

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: 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);

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.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");

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: 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);
}
}

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: 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;

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: 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;
}

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.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 @@ installNovice(dialogMenuItem *self)
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 @@ installNovice(dialogMenuItem *self)
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 @@ installNovice(dialogMenuItem *self)
WINDOW *w = savescr();
if (!systemExecute("passwd root"))
variable_set2("root_password", "YES");
variable_set2("root_password", "YES", 0);
restorescr(w);
}
@ -722,7 +722,7 @@ installCommit(dialogMenuItem *self)
/* 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");
}

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: 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;
}

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.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?");
}

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: 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 },

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.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);

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: 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) {

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: 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);

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: anonFTP.c,v 1.22 1997/03/09 22:25:38 jkh Exp $
* $Id: anonFTP.c,v 1.23 1997/04/02 12:07:18 jkh Exp $
*
* Copyright (c) 1995
* Coranth Gryphon. All rights reserved.
@ -311,6 +311,6 @@ configAnonFTP(dialogMenuItem *self)
i = DITEM_FAILURE;
}
if (DITEM_STATUS(i) == DITEM_SUCCESS)
variable_set2("anon_ftp", "YES");
variable_set2("anon_ftp", "YES", 0);
return i | DITEM_RESTORE;
}

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.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");

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: 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);
}
}

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: 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;

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: 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;
}

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.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 @@ installNovice(dialogMenuItem *self)
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 @@ installNovice(dialogMenuItem *self)
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 @@ installNovice(dialogMenuItem *self)
WINDOW *w = savescr();
if (!systemExecute("passwd root"))
variable_set2("root_password", "YES");
variable_set2("root_password", "YES", 0);
restorescr(w);
}
@ -722,7 +722,7 @@ installCommit(dialogMenuItem *self)
/* 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");
}

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: installUpgrade.c,v 1.60 1998/11/03 03:38:55 jkh Exp $
* $Id: installUpgrade.c,v 1.61 1998/11/15 09:06:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -163,7 +163,7 @@ installUpgrade(dialogMenuItem *self)
if (variable_get(VAR_NONINTERACTIVE))
return installUpgradeNonInteractive(self);
variable_set2(SYSTEM_STATE, "upgrade");
variable_set2(SYSTEM_STATE, "upgrade", 0);
systemDisplayHelp("UPGRADE");
dialog_clear_norefresh();
@ -229,7 +229,7 @@ installUpgrade(dialogMenuItem *self)
}
/* Don't write out MBR info */
variable_set2(DISK_PARTITIONED, "written");
variable_set2(DISK_PARTITIONED, "written", 0);
if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) {
msgConfirm("Not all file systems were properly mounted. Upgrade operation\n"
"aborted.");
@ -362,7 +362,7 @@ installUpgradeNonInteractive(dialogMenuItem *self)
char *saved_etc;
Boolean extractingBin = TRUE;
variable_set2(SYSTEM_STATE, "upgrade");
variable_set2(SYSTEM_STATE, "upgrade", 0);
/* Make sure at least BIN is selected */
Dists |= DIST_BIN;
@ -403,7 +403,7 @@ installUpgradeNonInteractive(dialogMenuItem *self)
}
/* Don't write out MBR info */
variable_set2(DISK_PARTITIONED, "written");
variable_set2(DISK_PARTITIONED, "written", 0);
if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) {
msgConfirm("Not all file systems were properly mounted. Upgrade operation\n"
"aborted.");

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: 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;
}

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.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?");
}

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: media.c,v 1.93 1998/12/02 03:27:37 jkh Exp $
* $Id: media.c,v 1.94 1998/12/22 12:31:25 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -333,7 +333,7 @@ mediaSetFTP(dialogMenuItem *self)
if (!cp)
return DITEM_FAILURE | what;
else if (!strcmp(cp, "other")) {
variable_set2(VAR_FTP_PATH, "ftp://");
variable_set2(VAR_FTP_PATH, "ftp://", 0);
dialog_clear_norefresh();
cp = variable_get_value(VAR_FTP_PATH, "Please specify the URL of a FreeBSD distribution on a\n"
"remote ftp site. This site must accept either anonymous\n"
@ -341,7 +341,7 @@ mediaSetFTP(dialogMenuItem *self)
"in the Options screen.\n\n"
"A URL looks like this: ftp://<hostname>/<path>\n"
"Where <path> is relative to the anonymous ftp directory or the\n"
"home directory of the user being logged in as.");
"home directory of the user being logged in as.", 0);
if (!cp || !*cp || !strcmp(cp, "ftp://")) {
variable_unset(VAR_FTP_PATH);
return DITEM_FAILURE | what;
@ -408,9 +408,9 @@ mediaSetFTP(dialogMenuItem *self)
}
msgDebug("Found DNS entry for %s successfully..\n", hostname);
}
variable_set2(VAR_FTP_HOST, hostname);
variable_set2(VAR_FTP_DIR, dir ? dir : "/");
variable_set2(VAR_FTP_PORT, itoa(FtpPort));
variable_set2(VAR_FTP_HOST, hostname, 0);
variable_set2(VAR_FTP_DIR, dir ? dir : "/", 0);
variable_set2(VAR_FTP_PORT, itoa(FtpPort), 0);
ftpDevice.type = DEVICE_TYPE_FTP;
ftpDevice.init = mediaInitFTP;
ftpDevice.get = mediaGetFTP;
@ -423,14 +423,14 @@ mediaSetFTP(dialogMenuItem *self)
int
mediaSetFTPActive(dialogMenuItem *self)
{
variable_set2(VAR_FTP_STATE, "active");
variable_set2(VAR_FTP_STATE, "active", 0);
return mediaSetFTP(self);
}
int
mediaSetFTPPassive(dialogMenuItem *self)
{
variable_set2(VAR_FTP_STATE, "passive");
variable_set2(VAR_FTP_STATE, "passive", 0);
return mediaSetFTP(self);
}
@ -443,7 +443,7 @@ mediaSetUFS(dialogMenuItem *self)
mediaClose();
dialog_clear_norefresh();
cp = variable_get_value(VAR_UFS_PATH, "Enter a fully qualified pathname for the directory\n"
"containing the FreeBSD distribution files:");
"containing the FreeBSD distribution files:", 0);
if (!cp)
return DITEM_FAILURE;
strcpy(ufsDevice.name, "ufs");
@ -467,7 +467,7 @@ mediaSetNFS(dialogMenuItem *self)
dialog_clear_norefresh();
cp = variable_get_value(VAR_NFS_PATH, "Please enter the full NFS file specification for the remote\n"
"host and directory containing the FreeBSD distribution files.\n"
"This should be in the format: hostname:/some/freebsd/dir");
"This should be in the format: hostname:/some/freebsd/dir", 0);
if (!cp)
return DITEM_FAILURE;
SAFE_STRCPY(hostname, cp);
@ -503,7 +503,7 @@ mediaSetNFS(dialogMenuItem *self)
else
msgDebug("Found DNS entry for %s successfully..", hostname);
}
variable_set2(VAR_NFS_HOST, hostname);
variable_set2(VAR_NFS_HOST, hostname, 0);
nfsDevice.type = DEVICE_TYPE_NFS;
nfsDevice.init = mediaInitNFS;
nfsDevice.get = mediaGetNFS;
@ -731,10 +731,10 @@ mediaSetFTPUserPass(dialogMenuItem *self)
char *pass;
dialog_clear_norefresh();
if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:")) {
if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:", 0)) {
dialog_clear_norefresh();
DialogInputAttrs |= DITEM_NO_ECHO;
pass = variable_get_value(VAR_FTP_PASS, "Please enter the password for this user:");
pass = variable_get_value(VAR_FTP_PASS, "Please enter the password for this user:", 0);
DialogInputAttrs &= ~DITEM_NO_ECHO;
}
else
@ -754,11 +754,11 @@ mediaSetCPIOVerbosity(dialogMenuItem *self)
}
else {
if (!strcmp(cp, "low"))
variable_set2(VAR_CPIO_VERBOSITY, "medium");
variable_set2(VAR_CPIO_VERBOSITY, "medium", 0);
else if (!strcmp(cp, "medium"))
variable_set2(VAR_CPIO_VERBOSITY, "high");
variable_set2(VAR_CPIO_VERBOSITY, "high", 0);
else /* must be "high" - wrap around */
variable_set2(VAR_CPIO_VERBOSITY, "low");
variable_set2(VAR_CPIO_VERBOSITY, "low", 0);
}
return DITEM_SUCCESS;
}

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: 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 },

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mouse.c,v 1.3 1998/03/23 05:59:18 jkh Exp $
* $Id: mouse.c,v 1.4 1998/03/23 06:08:47 yokota Exp $
*/
#include "sysinstall.h"
@ -61,9 +61,9 @@ mousedTest(dialogMenuItem *self)
if (ret) {
if (file_readable("/var/run/moused.pid"))
vsystem("kill `cat /var/run/moused.pid`");
variable_set2(VAR_MOUSED, "NO");
variable_set2(VAR_MOUSED, "NO", 1);
} else {
variable_set2(VAR_MOUSED, "YES");
variable_set2(VAR_MOUSED, "YES", 1);
vsystem("ln -fs /dev/sysmouse /dev/mouse"); /* backwards compat */
}
@ -75,8 +75,8 @@ mousedDisable(dialogMenuItem *self)
{
if (file_readable("/var/run/moused.pid"))
vsystem("kill `cat /var/run/moused.pid`");
variable_set2(VAR_MOUSED, "NO");
variable_set2(VAR_MOUSED_TYPE, "NO");
variable_set2(VAR_MOUSED, "NO", 1);
variable_set2(VAR_MOUSED_TYPE, "NO", 1);
variable_unset(VAR_MOUSED_PORT);
msgConfirm("The mouse daemon is disabled.");
return DITEM_SUCCESS;

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: network.c,v 1.32 1998/10/01 19:26:02 msmith Exp $
* $Id: network.c,v 1.33 1998/11/15 09:06:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -200,13 +200,13 @@ startPPP(Device *devp)
dialog_clear_norefresh();
if (!variable_get(VAR_SERIAL_SPEED))
variable_set2(VAR_SERIAL_SPEED, "115200");
variable_set2(VAR_SERIAL_SPEED, "115200", 0);
/* Get any important user values */
val = variable_get_value(VAR_SERIAL_SPEED,
"Enter the baud rate for your modem - this can be higher than the actual\n"
"maximum data rate since most modems can talk at one speed to the\n"
"computer and at another speed to the remote end.\n\n"
"If you're not sure what to put here, just select the default.");
"If you're not sure what to put here, just select the default.", 0);
SAFE_STRCPY(speed, (val && *val) ? val : "115200");
val = variable_get(VAR_GATEWAY);

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: options.c,v 1.55 1997/06/18 05:11:37 jkh Exp $
* $Id: options.c,v 1.56 1997/07/16 05:22:42 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -189,13 +189,13 @@ fire(Option opt)
}
else if (opt.type == OPT_IS_VAR) {
if (opt.data) {
(void)variable_get_value(opt.aux, opt.data);
(void)variable_get_value(opt.aux, opt.data, 1);
status = 1;
}
else if (variable_get(opt.aux))
variable_unset(opt.aux);
else
variable_set2(opt.aux, "YES");
variable_set2(opt.aux, "YES", 1);
}
if (opt.check)
opt.check(opt);

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: package.c,v 1.64 1997/09/17 16:18:16 pst Exp $
* $Id: package.c,v 1.65 1997/10/15 04:37:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -117,7 +117,7 @@ package_extract(Device *dev, char *name, Boolean depended)
/* Make a couple of paranoid locations for temp files to live if user specified none */
if (!variable_get(VAR_PKG_TMPDIR)) {
/* Set it to a location with as much space as possible */
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp");
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp", 0);
}
Mkdir(variable_get(VAR_PKG_TMPDIR));
vsystem("chmod 1777 %s", variable_get(VAR_PKG_TMPDIR));

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.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);

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: 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) {

View File

@ -1,5 +1,5 @@
/*
* $Id: tcpip.c,v 1.73 1998/08/31 09:02:03 jkh Exp $
* $Id: tcpip.c,v 1.74 1998/11/15 09:06:20 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@ -282,14 +282,14 @@ tcpOpenDialog(Device *devp)
char temp[512], ifn[255];
char *ifaces;
variable_set2(VAR_HOSTNAME, hostname);
variable_set2(VAR_HOSTNAME, hostname, 1);
sethostname(hostname, strlen(hostname));
if (domainname[0])
variable_set2(VAR_DOMAINNAME, domainname);
variable_set2(VAR_DOMAINNAME, domainname, 0);
if (gateway[0])
variable_set2(VAR_GATEWAY, gateway);
variable_set2(VAR_GATEWAY, gateway, 1);
if (nameserver[0])
variable_set2(VAR_NAMESERVER, nameserver);
variable_set2(VAR_NAMESERVER, nameserver, 0);
if (!devp->private)
devp->private = (DevInfo *)safe_malloc(sizeof(DevInfo));
@ -300,17 +300,17 @@ tcpOpenDialog(Device *devp)
sprintf(temp, "inet %s %s netmask %s", ipaddr, extras, netmask);
sprintf(ifn, "%s%s", VAR_IFCONFIG, devp->name);
variable_set2(ifn, temp);
variable_set2(ifn, temp, 1);
ifaces = variable_get(VAR_INTERFACES);
if (!ifaces)
variable_set2(VAR_INTERFACES, ifaces = "lo0");
variable_set2(VAR_INTERFACES, ifaces = "lo0", 1);
/* Only add it if it's not there already */
if (!strstr(ifaces, devp->name)) {
sprintf(ifn, "%s %s", devp->name, ifaces);
variable_set2(VAR_INTERFACES, ifn);
variable_set2(VAR_INTERFACES, ifn, 1);
}
if (ipaddr[0])
variable_set2(VAR_IPADDR, ipaddr);
variable_set2(VAR_IPADDR, ipaddr, 0);
configResolv(NULL); /* XXX this will do it on the MFS copy XXX */
ret = DITEM_SUCCESS;
}

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: 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);