diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c index 7b0e6f8060a6..5de067c9ac47 100644 --- a/release/sysinstall/config.c +++ b/release/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.33 1996/05/29 01:35:25 jkh Exp $ + * $Id: config.c,v 1.34 1996/06/08 07:02:18 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -327,14 +327,25 @@ configSysconfig(void) int configSaverTimeout(dialogMenuItem *self) { - return variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") ? - DITEM_SUCCESS : DITEM_FAILURE; + if (variable_get(VAR_BLANKTIME)) { + variable_unset(VAR_BLANKTIME); + return DITEM_SUCCESS | DITEM_REDRAW; + } + else + return variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") + ? DITEM_SUCCESS : DITEM_FAILURE; } int configNTP(dialogMenuItem *self) { - return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; + if (variable_get(VAR_NTPDATE)) { + variable_unset(VAR_NTPDATE); + return DITEM_SUCCESS | DITEM_REDRAW; + } + else + return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") + ? DITEM_SUCCESS : DITEM_FAILURE; } int @@ -409,9 +420,14 @@ skip: int configRoutedFlags(dialogMenuItem *self) { - return variable_get_value(VAR_ROUTEDFLAGS, - "Specify the flags for routed; -q is the default, -s is\n" - "a good choice for gateway machines.") ? DITEM_SUCCESS : DITEM_FAILURE; + if (variable_get(VAR_ROUTEDFLAGS)) { + variable_unset(VAR_ROUTEDFLAGS); + return DITEM_SUCCESS | DITEM_REDRAW; + } + else + return variable_get_value(VAR_ROUTEDFLAGS, + "Specify the flags for routed; -q is the default, -s is\n" + "a good choice for gateway machines.") ? DITEM_SUCCESS : DITEM_FAILURE; } int @@ -554,23 +570,31 @@ configPorts(dialogMenuItem *self) int configGated(dialogMenuItem *self) { - int ret; + int ret = DITEM_SUCCESS; - ret = package_add("gated-3.5a11"); - if (DITEM_STATUS(ret) == DITEM_SUCCESS) - variable_set2("gated", "YES"); - return ret; + if (variable_get(VAR_GATED)) + variable_unset(VAR_GATED); + else { + ret = package_add("gated-3.5a11"); + if (DITEM_STATUS(ret) == DITEM_SUCCESS) + variable_set2(VAR_GATED, "YES"); + } + return ret; } /* Load pcnfsd package */ int configPCNFSD(dialogMenuItem *self) { - int ret; + int ret = DITEM_SUCCESS; - ret = package_add("pcnfsd-93.02.16"); - if (DITEM_STATUS(ret) == DITEM_SUCCESS) - variable_set2("pcnfsd", "YES"); + if (variable_get(VAR_PCNFSD)) + variable_unset(VAR_PCNFSD); + else { + ret = package_add("pcnfsd-93.02.16"); + if (DITEM_STATUS(ret) == DITEM_SUCCESS) + variable_set2(VAR_PCNFSD, "YES"); + } return ret; } @@ -600,7 +624,11 @@ configNFSServer(dialogMenuItem *self) dialog_clear(); systemExecute(cmd); restorescr(w); + variable_set2(VAR_NFS_SERVER, "YES"); + } + else if (variable_get(VAR_NFS_SERVER)) { /* We want to turn it off again? */ + unlink("/etc/exports"); + variable_unset(VAR_NFS_SERVER); } - variable_set2("nfs_server", "YES"); return DITEM_SUCCESS; } diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c index d699774decdf..7d91b3185f6d 100644 --- a/release/sysinstall/menus.c +++ b/release/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.63 1996/05/16 13:39:08 jkh Exp $ + * $Id: menus.c,v 1.64 1996/06/12 14:02:12 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -949,11 +949,11 @@ aspects of your system's network configuration.", { { "Interfaces", "Configure additional network interfaces", NULL, tcpMenuSelect }, { "NFS client", "This machine will be an NFS client", - dmenuVarCheck, dmenuSetVariable, NULL, "nfs_client=YES" }, + dmenuVarCheck, dmenuToggleVariable, NULL, "nfs_client=YES" }, { "NFS server", "This machine will be an NFS server", dmenuVarCheck, configNFSServer, NULL, "nfs_server" }, { "Gateway", "This machine will route packets between interfaces", - dmenuVarCheck, dmenuSetVariable, NULL, "gateway=YES" }, + dmenuVarCheck, dmenuToggleVariable, NULL, "gateway=YES" }, { "Gated", "This machine wants to run gated instead of routed", dmenuVarCheck, configGated, NULL, "gated" }, { "Ntpdate", "Select a clock-syncronization server", @@ -961,7 +961,7 @@ aspects of your system's network configuration.", { "Routed", "Set flags for routed (default: -q)", dmenuVarCheck, configRoutedFlags, NULL, "routed" }, { "Rwhod", "This machine wants to run the rwho daemon", - dmenuVarCheck, dmenuSetVariable, NULL, "rwhod=YES" }, + dmenuVarCheck, dmenuToggleVariable, NULL, "rwhod=YES" }, { "Anon FTP", "This machine wishes to allow anonymous FTP.", dmenuVarCheck, configAnonFTP, NULL, "anon_ftp" }, { "WEB Server", "This machine wishes to be a WWW server.", diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index f6027a25775a..b7733f8bd354 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.58 1996/06/08 09:08:49 jkh Exp $ + * $Id: sysinstall.h,v 1.59 1996/06/11 09:47:30 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -110,12 +110,15 @@ #define VAR_NETMASK "netmask" #define VAR_NFS_PATH "nfs" #define VAR_NFS_SECURE "nfsSecure" +#define VAR_NFS_SERVER "nfs_server" #define VAR_NO_CONFIRM "noConfirm" #define VAR_NTPDATE "ntpDate" #define VAR_PORTS_PATH "ports" #define VAR_RELNAME "releaseName" #define VAR_ROOT_SIZE "rootSize" #define VAR_ROUTEDFLAGS "routedflags" +#define VAR_GATED "gated" +#define VAR_PCNFSD "pcnfsd" #define VAR_SLOW_ETHER "slowEthernetCard" #define VAR_SWAP_SIZE "swapSize" #define VAR_TAPE_BLOCKSIZE "tapeBlocksize" @@ -403,6 +406,7 @@ extern int dmenuSystemCommand(dialogMenuItem *tmp); extern int dmenuSystemCommandBox(dialogMenuItem *tmp); extern int dmenuExit(dialogMenuItem *tmp); extern int dmenuSetVariable(dialogMenuItem *tmp); +extern int dmenuToggleVariable(dialogMenuItem *tmp); extern int dmenuSetFlag(dialogMenuItem *tmp); extern int dmenuSetValue(dialogMenuItem *tmp); extern Boolean dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max); diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c index 7b0e6f8060a6..5de067c9ac47 100644 --- a/usr.sbin/sade/config.c +++ b/usr.sbin/sade/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.33 1996/05/29 01:35:25 jkh Exp $ + * $Id: config.c,v 1.34 1996/06/08 07:02:18 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -327,14 +327,25 @@ configSysconfig(void) int configSaverTimeout(dialogMenuItem *self) { - return variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") ? - DITEM_SUCCESS : DITEM_FAILURE; + if (variable_get(VAR_BLANKTIME)) { + variable_unset(VAR_BLANKTIME); + return DITEM_SUCCESS | DITEM_REDRAW; + } + else + return variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") + ? DITEM_SUCCESS : DITEM_FAILURE; } int configNTP(dialogMenuItem *self) { - return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; + if (variable_get(VAR_NTPDATE)) { + variable_unset(VAR_NTPDATE); + return DITEM_SUCCESS | DITEM_REDRAW; + } + else + return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") + ? DITEM_SUCCESS : DITEM_FAILURE; } int @@ -409,9 +420,14 @@ skip: int configRoutedFlags(dialogMenuItem *self) { - return variable_get_value(VAR_ROUTEDFLAGS, - "Specify the flags for routed; -q is the default, -s is\n" - "a good choice for gateway machines.") ? DITEM_SUCCESS : DITEM_FAILURE; + if (variable_get(VAR_ROUTEDFLAGS)) { + variable_unset(VAR_ROUTEDFLAGS); + return DITEM_SUCCESS | DITEM_REDRAW; + } + else + return variable_get_value(VAR_ROUTEDFLAGS, + "Specify the flags for routed; -q is the default, -s is\n" + "a good choice for gateway machines.") ? DITEM_SUCCESS : DITEM_FAILURE; } int @@ -554,23 +570,31 @@ configPorts(dialogMenuItem *self) int configGated(dialogMenuItem *self) { - int ret; + int ret = DITEM_SUCCESS; - ret = package_add("gated-3.5a11"); - if (DITEM_STATUS(ret) == DITEM_SUCCESS) - variable_set2("gated", "YES"); - return ret; + if (variable_get(VAR_GATED)) + variable_unset(VAR_GATED); + else { + ret = package_add("gated-3.5a11"); + if (DITEM_STATUS(ret) == DITEM_SUCCESS) + variable_set2(VAR_GATED, "YES"); + } + return ret; } /* Load pcnfsd package */ int configPCNFSD(dialogMenuItem *self) { - int ret; + int ret = DITEM_SUCCESS; - ret = package_add("pcnfsd-93.02.16"); - if (DITEM_STATUS(ret) == DITEM_SUCCESS) - variable_set2("pcnfsd", "YES"); + if (variable_get(VAR_PCNFSD)) + variable_unset(VAR_PCNFSD); + else { + ret = package_add("pcnfsd-93.02.16"); + if (DITEM_STATUS(ret) == DITEM_SUCCESS) + variable_set2(VAR_PCNFSD, "YES"); + } return ret; } @@ -600,7 +624,11 @@ configNFSServer(dialogMenuItem *self) dialog_clear(); systemExecute(cmd); restorescr(w); + variable_set2(VAR_NFS_SERVER, "YES"); + } + else if (variable_get(VAR_NFS_SERVER)) { /* We want to turn it off again? */ + unlink("/etc/exports"); + variable_unset(VAR_NFS_SERVER); } - variable_set2("nfs_server", "YES"); return DITEM_SUCCESS; } diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c index d699774decdf..7d91b3185f6d 100644 --- a/usr.sbin/sade/menus.c +++ b/usr.sbin/sade/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.63 1996/05/16 13:39:08 jkh Exp $ + * $Id: menus.c,v 1.64 1996/06/12 14:02:12 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -949,11 +949,11 @@ aspects of your system's network configuration.", { { "Interfaces", "Configure additional network interfaces", NULL, tcpMenuSelect }, { "NFS client", "This machine will be an NFS client", - dmenuVarCheck, dmenuSetVariable, NULL, "nfs_client=YES" }, + dmenuVarCheck, dmenuToggleVariable, NULL, "nfs_client=YES" }, { "NFS server", "This machine will be an NFS server", dmenuVarCheck, configNFSServer, NULL, "nfs_server" }, { "Gateway", "This machine will route packets between interfaces", - dmenuVarCheck, dmenuSetVariable, NULL, "gateway=YES" }, + dmenuVarCheck, dmenuToggleVariable, NULL, "gateway=YES" }, { "Gated", "This machine wants to run gated instead of routed", dmenuVarCheck, configGated, NULL, "gated" }, { "Ntpdate", "Select a clock-syncronization server", @@ -961,7 +961,7 @@ aspects of your system's network configuration.", { "Routed", "Set flags for routed (default: -q)", dmenuVarCheck, configRoutedFlags, NULL, "routed" }, { "Rwhod", "This machine wants to run the rwho daemon", - dmenuVarCheck, dmenuSetVariable, NULL, "rwhod=YES" }, + dmenuVarCheck, dmenuToggleVariable, NULL, "rwhod=YES" }, { "Anon FTP", "This machine wishes to allow anonymous FTP.", dmenuVarCheck, configAnonFTP, NULL, "anon_ftp" }, { "WEB Server", "This machine wishes to be a WWW server.", diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index f6027a25775a..b7733f8bd354 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.58 1996/06/08 09:08:49 jkh Exp $ + * $Id: sysinstall.h,v 1.59 1996/06/11 09:47:30 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -110,12 +110,15 @@ #define VAR_NETMASK "netmask" #define VAR_NFS_PATH "nfs" #define VAR_NFS_SECURE "nfsSecure" +#define VAR_NFS_SERVER "nfs_server" #define VAR_NO_CONFIRM "noConfirm" #define VAR_NTPDATE "ntpDate" #define VAR_PORTS_PATH "ports" #define VAR_RELNAME "releaseName" #define VAR_ROOT_SIZE "rootSize" #define VAR_ROUTEDFLAGS "routedflags" +#define VAR_GATED "gated" +#define VAR_PCNFSD "pcnfsd" #define VAR_SLOW_ETHER "slowEthernetCard" #define VAR_SWAP_SIZE "swapSize" #define VAR_TAPE_BLOCKSIZE "tapeBlocksize" @@ -403,6 +406,7 @@ extern int dmenuSystemCommand(dialogMenuItem *tmp); extern int dmenuSystemCommandBox(dialogMenuItem *tmp); extern int dmenuExit(dialogMenuItem *tmp); extern int dmenuSetVariable(dialogMenuItem *tmp); +extern int dmenuToggleVariable(dialogMenuItem *tmp); extern int dmenuSetFlag(dialogMenuItem *tmp); extern int dmenuSetValue(dialogMenuItem *tmp); extern Boolean dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max); diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index 7b0e6f8060a6..5de067c9ac47 100644 --- a/usr.sbin/sysinstall/config.c +++ b/usr.sbin/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.33 1996/05/29 01:35:25 jkh Exp $ + * $Id: config.c,v 1.34 1996/06/08 07:02:18 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -327,14 +327,25 @@ configSysconfig(void) int configSaverTimeout(dialogMenuItem *self) { - return variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") ? - DITEM_SUCCESS : DITEM_FAILURE; + if (variable_get(VAR_BLANKTIME)) { + variable_unset(VAR_BLANKTIME); + return DITEM_SUCCESS | DITEM_REDRAW; + } + else + return variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") + ? DITEM_SUCCESS : DITEM_FAILURE; } int configNTP(dialogMenuItem *self) { - return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; + if (variable_get(VAR_NTPDATE)) { + variable_unset(VAR_NTPDATE); + return DITEM_SUCCESS | DITEM_REDRAW; + } + else + return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") + ? DITEM_SUCCESS : DITEM_FAILURE; } int @@ -409,9 +420,14 @@ skip: int configRoutedFlags(dialogMenuItem *self) { - return variable_get_value(VAR_ROUTEDFLAGS, - "Specify the flags for routed; -q is the default, -s is\n" - "a good choice for gateway machines.") ? DITEM_SUCCESS : DITEM_FAILURE; + if (variable_get(VAR_ROUTEDFLAGS)) { + variable_unset(VAR_ROUTEDFLAGS); + return DITEM_SUCCESS | DITEM_REDRAW; + } + else + return variable_get_value(VAR_ROUTEDFLAGS, + "Specify the flags for routed; -q is the default, -s is\n" + "a good choice for gateway machines.") ? DITEM_SUCCESS : DITEM_FAILURE; } int @@ -554,23 +570,31 @@ configPorts(dialogMenuItem *self) int configGated(dialogMenuItem *self) { - int ret; + int ret = DITEM_SUCCESS; - ret = package_add("gated-3.5a11"); - if (DITEM_STATUS(ret) == DITEM_SUCCESS) - variable_set2("gated", "YES"); - return ret; + if (variable_get(VAR_GATED)) + variable_unset(VAR_GATED); + else { + ret = package_add("gated-3.5a11"); + if (DITEM_STATUS(ret) == DITEM_SUCCESS) + variable_set2(VAR_GATED, "YES"); + } + return ret; } /* Load pcnfsd package */ int configPCNFSD(dialogMenuItem *self) { - int ret; + int ret = DITEM_SUCCESS; - ret = package_add("pcnfsd-93.02.16"); - if (DITEM_STATUS(ret) == DITEM_SUCCESS) - variable_set2("pcnfsd", "YES"); + if (variable_get(VAR_PCNFSD)) + variable_unset(VAR_PCNFSD); + else { + ret = package_add("pcnfsd-93.02.16"); + if (DITEM_STATUS(ret) == DITEM_SUCCESS) + variable_set2(VAR_PCNFSD, "YES"); + } return ret; } @@ -600,7 +624,11 @@ configNFSServer(dialogMenuItem *self) dialog_clear(); systemExecute(cmd); restorescr(w); + variable_set2(VAR_NFS_SERVER, "YES"); + } + else if (variable_get(VAR_NFS_SERVER)) { /* We want to turn it off again? */ + unlink("/etc/exports"); + variable_unset(VAR_NFS_SERVER); } - variable_set2("nfs_server", "YES"); return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index d699774decdf..7d91b3185f6d 100644 --- a/usr.sbin/sysinstall/menus.c +++ b/usr.sbin/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.63 1996/05/16 13:39:08 jkh Exp $ + * $Id: menus.c,v 1.64 1996/06/12 14:02:12 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -949,11 +949,11 @@ aspects of your system's network configuration.", { { "Interfaces", "Configure additional network interfaces", NULL, tcpMenuSelect }, { "NFS client", "This machine will be an NFS client", - dmenuVarCheck, dmenuSetVariable, NULL, "nfs_client=YES" }, + dmenuVarCheck, dmenuToggleVariable, NULL, "nfs_client=YES" }, { "NFS server", "This machine will be an NFS server", dmenuVarCheck, configNFSServer, NULL, "nfs_server" }, { "Gateway", "This machine will route packets between interfaces", - dmenuVarCheck, dmenuSetVariable, NULL, "gateway=YES" }, + dmenuVarCheck, dmenuToggleVariable, NULL, "gateway=YES" }, { "Gated", "This machine wants to run gated instead of routed", dmenuVarCheck, configGated, NULL, "gated" }, { "Ntpdate", "Select a clock-syncronization server", @@ -961,7 +961,7 @@ aspects of your system's network configuration.", { "Routed", "Set flags for routed (default: -q)", dmenuVarCheck, configRoutedFlags, NULL, "routed" }, { "Rwhod", "This machine wants to run the rwho daemon", - dmenuVarCheck, dmenuSetVariable, NULL, "rwhod=YES" }, + dmenuVarCheck, dmenuToggleVariable, NULL, "rwhod=YES" }, { "Anon FTP", "This machine wishes to allow anonymous FTP.", dmenuVarCheck, configAnonFTP, NULL, "anon_ftp" }, { "WEB Server", "This machine wishes to be a WWW server.", diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index f6027a25775a..b7733f8bd354 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.58 1996/06/08 09:08:49 jkh Exp $ + * $Id: sysinstall.h,v 1.59 1996/06/11 09:47:30 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -110,12 +110,15 @@ #define VAR_NETMASK "netmask" #define VAR_NFS_PATH "nfs" #define VAR_NFS_SECURE "nfsSecure" +#define VAR_NFS_SERVER "nfs_server" #define VAR_NO_CONFIRM "noConfirm" #define VAR_NTPDATE "ntpDate" #define VAR_PORTS_PATH "ports" #define VAR_RELNAME "releaseName" #define VAR_ROOT_SIZE "rootSize" #define VAR_ROUTEDFLAGS "routedflags" +#define VAR_GATED "gated" +#define VAR_PCNFSD "pcnfsd" #define VAR_SLOW_ETHER "slowEthernetCard" #define VAR_SWAP_SIZE "swapSize" #define VAR_TAPE_BLOCKSIZE "tapeBlocksize" @@ -403,6 +406,7 @@ extern int dmenuSystemCommand(dialogMenuItem *tmp); extern int dmenuSystemCommandBox(dialogMenuItem *tmp); extern int dmenuExit(dialogMenuItem *tmp); extern int dmenuSetVariable(dialogMenuItem *tmp); +extern int dmenuToggleVariable(dialogMenuItem *tmp); extern int dmenuSetFlag(dialogMenuItem *tmp); extern int dmenuSetValue(dialogMenuItem *tmp); extern Boolean dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max);