summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/Makefile4
-rw-r--r--usr.sbin/sade/config.c5
-rw-r--r--usr.sbin/sade/dispatch.c125
-rw-r--r--usr.sbin/sade/install.c51
-rw-r--r--usr.sbin/sade/main.c18
-rw-r--r--usr.sbin/sade/menus.c4
-rw-r--r--usr.sbin/sade/msg.c4
-rw-r--r--usr.sbin/sade/sade.h21
-rw-r--r--usr.sbin/sade/system.c20
-rw-r--r--usr.sbin/sysinstall/Makefile4
-rw-r--r--usr.sbin/sysinstall/config.c5
-rw-r--r--usr.sbin/sysinstall/dispatch.c125
-rw-r--r--usr.sbin/sysinstall/doc.c20
-rw-r--r--usr.sbin/sysinstall/index.c10
-rw-r--r--usr.sbin/sysinstall/install.c51
-rw-r--r--usr.sbin/sysinstall/installUpgrade.c21
-rw-r--r--usr.sbin/sysinstall/main.c18
-rw-r--r--usr.sbin/sysinstall/menus.c4
-rw-r--r--usr.sbin/sysinstall/msg.c4
-rw-r--r--usr.sbin/sysinstall/package.c18
-rw-r--r--usr.sbin/sysinstall/sysinstall.h21
-rw-r--r--usr.sbin/sysinstall/system.c20
22 files changed, 465 insertions, 108 deletions
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
index a333685..f2d4189 100644
--- a/usr.sbin/sade/Makefile
+++ b/usr.sbin/sade/Makefile
@@ -5,8 +5,8 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum
-SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c \
- devices.c disks.c dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
+SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c devices.c \
+ disks.c dispatch dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
ftp_strat.c globals.c index.c install.c installUpgrade.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
msg.c network.c nfs.c options.c package.c samba.c system.c \
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c
index d462636..fd9a274 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.29 1996/04/28 22:54:15 jkh Exp $
+ * $Id: config.c,v 1.30 1996/04/29 18:06:06 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -476,7 +476,7 @@ configPackages(dialogMenuItem *self)
break;
}
}
- tmp = &plist;
+ tmp = plist.kids;
while (tmp) {
PkgNodePtr tmp2 = tmp->next;
@@ -484,7 +484,6 @@ configPackages(dialogMenuItem *self)
tmp = tmp2;
}
index_init(NULL, &plist);
- mediaDevice->shutdown(mediaDevice);
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sade/dispatch.c b/usr.sbin/sade/dispatch.c
new file mode 100644
index 0000000..886165b
--- /dev/null
+++ b/usr.sbin/sade/dispatch.c
@@ -0,0 +1,125 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id$
+ *
+ * Copyright (c) 1995
+ * Jordan Hubbard. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * verbatim and that no modifications are made prior to this
+ * point in the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "sysinstall.h"
+#include <ctype.h>
+
+static struct _word {
+ char *name;
+ int (*handler)(dialogMenuItem *self);
+} resWords[] = {
+ { "configAnonFTP", configAnonFTP },
+ { "configApache", configApache },
+ { "configGated", configGated },
+ { "configNFSServer", configNFSServer },
+ { "configSamba", configSamba },
+ { "configPackages", configPackages },
+ { "diskPartitionEditor", diskPartitionEditor },
+ { "diskPartitionWrite", diskPartitionWrite },
+ { "diskLabelEditor", diskLabelEditor },
+ { "diskLabelCommit", diskLabelCommit },
+ { "distReset", distReset },
+ { "distSetDeveloper", distSetDeveloper },
+ { "distSetXDeveloper", distSetXDeveloper },
+ { "distSetKernDeveloper", distSetKernDeveloper },
+ { "distSetUser", distSetUser },
+ { "distSetXUser", distSetXUser },
+ { "distSetMinimum", distSetMinimum },
+ { "distSetEverything", distSetEverything },
+ { "distSetDES", distSetDES },
+ { "distSetSrc", distSetSrc },
+ { "distSetXF86", distSetXF86 },
+ { "distExtractAll", distExtractAll },
+ { "docBrowser", docBrowser },
+ { "docShowDocument", docShowDocument },
+ { "installCommit", installCommit },
+ { "installExpress", installExpress },
+ { "installUpgrade", installUpgrade },
+ { "installFixup", installFixup },
+ { "installFilesystems", installFilesystems },
+ { "mediaSetCDROM", mediaSetCDROM },
+ { "mediaSetFloppy", mediaSetFloppy },
+ { "mediaSetDOS", mediaSetDOS },
+ { "mediaSetTape", mediaSetTape },
+ { "mediaSetFTP", mediaSetFTP },
+ { "mediaSetFTPActive", mediaSetFTPActive },
+ { "mediaSetFTPPassive", mediaSetFTPPassive },
+ { "mediaSetUFS", mediaSetUFS },
+ { "mediaSetNFS", mediaSetNFS },
+ { "mediaSetFtpUserPass", mediaSetFtpUserPass },
+ { "mediaSetCPIOVerbosity", mediaSetCPIOVerbosity },
+ { "mediaGetType", mediaGetType },
+ { NULL, NULL },
+};
+
+static int
+call_possible_resword(char *name, dialogMenuItem *value, int *status)
+{
+ int i, rval;
+
+ rval = 0;
+ for (i = 0; resWords[i].name; i++) {
+ if (!strcmp(name, resWords[i].name)) {
+ *status = resWords[i].handler(value);
+ rval = 1;
+ break;
+ }
+ }
+ return rval;
+}
+
+/* For a given string, call it or spit out an undefined command diagnostic */
+int
+dispatchCommand(char *str)
+{
+ int i;
+
+ if (!str || !*str) {
+ msgConfirm("Null or zero-length string passed to dispatchCommand");
+ return DITEM_FAILURE;
+ }
+ else if (index(str, '=')) {
+ variable_set(str);
+ return DITEM_SUCCESS;
+ }
+ else if (!call_possible_resword(str, NULL, &i)) {
+ msgConfirm("No such command: %s", str);
+ return DITEM_FAILURE;
+ }
+ else if (DITEM_STATUS(i) != DITEM_SUCCESS)
+ msgConfirm("Command `%s' returned an error status.");
+ return i;
+}
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index c978c0c..82f91c98 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.95 1996/04/30 06:02:51 jkh Exp $
+ * $Id: install.c,v 1.96 1996/05/02 10:09:45 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -310,8 +310,12 @@ installExpress(dialogMenuItem *self)
if (DITEM_STATUS((i = installCommit(self))) == DITEM_SUCCESS) {
i |= DITEM_LEAVE_MENU;
- /* Give user the option of one last configuration spree, then write changes */
+ /* Give user the option of one last configuration spree */
installConfigure();
+
+ /* Now write out any changes .. */
+ configResolv();
+ configSysconfig();
}
return i | DITEM_RESTORE | DITEM_RECREATE;
}
@@ -458,19 +462,46 @@ installNovice(dialogMenuItem *self)
/* XXX Put whatever other nice configuration questions you'd like to ask the user here XXX */
- /* Give user the option of one last configuration spree, then write changes */
+ /* Give user the option of one last configuration spree */
installConfigure();
+ /* Now write out any changes .. */
+ configResolv();
+ configSysconfig();
+
return DITEM_LEAVE_MENU | DITEM_RESTORE | DITEM_RECREATE;
}
+/* The version of commit we call from the Install Custom menu */
+int
+installCustomCommit(dialogMenuItem *self)
+{
+ int i;
+
+ i = installCommit(self);
+ if (DITEM_STATUS(i) == DITEM_SUCCESS) {
+ /* Give user the option of one last configuration spree */
+ installConfigure();
+
+ /* Now write out any changes .. */
+ configResolv();
+ configSysconfig();
+ return i;
+ }
+ else
+ msgConfirm("The commit operation completed with errors. Not\n"
+ "updating /etc files.");
+ return i;
+}
+
/*
- * What happens when we finally "Commit" to going ahead with the installation.
+ * What happens when we finally decide to going ahead with the installation.
*
- * This is broken into multiple stages so that the user can do a full installation but come back here
- * again to load more distributions, perhaps from a different media type. This would allow, for
- * example, the user to load the majority of the system from CDROM and then use ftp to load just the
- * DES dist.
+ * This is broken into multiple stages so that the user can do a full
+ * installation but come back here again to load more distributions,
+ * perhaps from a different media type. This would allow, for
+ * example, the user to load the majority of the system from CDROM and
+ * then use ftp to load just the DES dist.
*/
int
installCommit(dialogMenuItem *self)
@@ -530,10 +561,6 @@ installConfigure(void)
dmenuOpenSimple(&MenuConfigure);
restorescr(w);
}
-
- /* Write out any changes .. */
- configResolv();
- configSysconfig();
}
int
diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c
index deb8524..c729158 100644
--- a/usr.sbin/sade/main.c
+++ b/usr.sbin/sade/main.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: main.c,v 1.17 1996/04/13 13:31:51 jkh Exp $
+ * $Id: main.c,v 1.18 1996/04/28 20:54:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -72,6 +72,7 @@ main(int argc, char **argv)
variable_set2(VAR_DEBUG, "YES");
Fake = TRUE;
msgConfirm("I'll be just faking it from here on out, OK?");
+ --argc, ++argv;
}
/* Try to preserve our scroll-back buffer */
@@ -82,6 +83,16 @@ main(int argc, char **argv)
/* Probe for all relevant devices on the system */
deviceGetAll();
+ if (argc > 1) {
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ if (DITEM_STATUS(dispatchCommand(argv[i])) != DITEM_SUCCESS)
+ systemShutdown(1);
+ }
+ systemShutdown(0);
+ }
+
/* Begin user dialog at outer menu */
while (1) {
choice = scroll = curr = max = 0;
@@ -92,8 +103,7 @@ main(int argc, char **argv)
}
/* Say goodnight, Gracie */
- systemShutdown();
+ systemShutdown(0);
- /* If we're running as init, we should never get here */
- return 0;
+ return 0; /* We should never get here */
}
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index 9706286..ce452ce 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.59 1996/05/05 21:54:23 jkh Exp $
+ * $Id: menus.c,v 1.60 1996/05/09 09:42:15 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -864,7 +864,7 @@ to install it from and how you wish to allocate disk storage to FreeBSD.",
{ "3 Label", "Label allocated disk partitions", NULL, diskLabelEditor },
{ "4 Distributions", "Select distribution(s) to extract", NULL, dmenuSubmenu, NULL, &MenuDistributions },
{ "5 Media", "Choose the installation media type", NULL, dmenuSubmenu, NULL, &MenuMedia },
- { "6 Commit", "Perform any pending Partition/Label/Extract actions", NULL, installCommit },
+ { "6 Commit", "Perform any pending Partition/Label/Extract actions", NULL, installCustomCommit },
{ "7 Extract", "Just do distribution extract step", NULL, distExtractAll },
{ "0 Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
{ NULL } },
diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c
index b148c1a..ef1d79b 100644
--- a/usr.sbin/sade/msg.c
+++ b/usr.sbin/sade/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: msg.c,v 1.31 1996/04/13 13:32:02 jkh Exp $
+ * $Id: msg.c,v 1.32 1996/04/28 00:37:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -185,7 +185,7 @@ msgFatal(char *fmt, ...)
if (OnVTY)
msgDebug("Fatal error `%s'!\n", errstr);
getch();
- systemShutdown();
+ systemShutdown(1);
}
/* Put up a message in a popup confirmation box */
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 0ae5544..8034493 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.54 1996/04/28 01:07:26 jkh Exp $
+ * $Id: sysinstall.h,v 1.55 1996/04/28 20:54:07 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -71,12 +71,12 @@
#define MAX_CHUNKS 40
/* Internal environment variable names */
-#define DISK_PARTITIONED "_diskPartitioned"
-#define DISK_LABELLED "_diskLabelled"
-#define DISK_SELECTED "_diskSelected"
-#define SYSTEM_STATE "_systemState"
-#define RUNNING_ON_ROOT "_runningOnRoot"
-#define TCP_CONFIGURED "_tcpConfigured"
+#define DISK_PARTITIONED "_diskPartitioned"
+#define DISK_LABELLED "_diskLabelled"
+#define DISK_SELECTED "_diskSelected"
+#define SYSTEM_STATE "_systemState"
+#define RUNNING_ON_ROOT "_runningOnRoot"
+#define TCP_CONFIGURED "_tcpConfigured"
/* Ones that can be tweaked from config files */
#define VAR_BLANKTIME "blanktime"
@@ -377,6 +377,9 @@ extern int diskPartitionEditor(dialogMenuItem *self);
extern int diskPartitionWrite(dialogMenuItem *self);
extern void diskPartition(Device *dev, Disk *d);
+/* dispatch.c */
+extern int dispatchCommand(char *command);
+
/* dist.c */
extern int distReset(dialogMenuItem *self);
extern int distSetCustom(char *str);
@@ -443,6 +446,7 @@ int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist);
/* install.c */
extern int installCommit(dialogMenuItem *self);
+extern int installCustomCommit(dialogMenuItem *self);
extern int installExpress(dialogMenuItem *self);
extern int installNovice(dialogMenuItem *self);
extern int installFixitCDROM(dialogMenuItem *self);
@@ -556,10 +560,11 @@ extern int optionsEditor(dialogMenuItem *self);
/* package.c */
extern int package_add(char *name);
extern int package_extract(Device *dev, char *name, Boolean depended);
+extern Boolean package_exists(char *name);
/* system.c */
extern void systemInitialize(int argc, char **argv);
-extern void systemShutdown(void);
+extern void systemShutdown(int status);
extern int execExecute(char *cmd, char *name);
extern int systemExecute(char *cmd);
extern int systemDisplayHelp(char *file);
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index 46d664b..b826f3e 100644
--- a/usr.sbin/sade/system.c
+++ b/usr.sbin/sade/system.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: system.c,v 1.57 1996/04/29 21:15:44 jkh Exp $
+ * $Id: system.c,v 1.58 1996/05/01 03:31:08 jkh Exp $
*
* Jordan Hubbard
*
@@ -33,7 +33,7 @@ static void
handle_intr(int sig)
{
if (!msgYesNo("Are you sure you want to abort the installation?"))
- systemShutdown();
+ systemShutdown(1);
}
/* Initialize system defaults */
@@ -79,12 +79,21 @@ systemInitialize(int argc, char **argv)
/* Close down and prepare to exit */
void
-systemShutdown(void)
+systemShutdown(int status)
{
+ /* If some media is open, close it down */
+ if (mediaDevice)
+ mediaDevice->shutdown(mediaDevice);
+
+ /* Shut down the dialog library */
if (DialogActive) {
end_dialog();
DialogActive = FALSE;
}
+
+ /* Shut down curses */
+ endwin();
+
/* REALLY exit! */
if (RunningAsInit) {
/* Put the console back */
@@ -92,7 +101,7 @@ systemShutdown(void)
reboot(0);
}
else
- exit(1);
+ exit(status);
}
/* Run some general command */
@@ -154,6 +163,9 @@ systemHelpFile(char *file, char *buf)
snprintf(buf, FILENAME_MAX, "/stand/help/%s.hlp", file);
if (file_readable(buf))
return buf;
+ snprintf(buf, FILENAME_MAX, "/usr/src/release/sysinstall/help/%s.hlp", file);
+ if (file_readable(buf))
+ return buf;
return NULL;
}
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile
index a333685..f2d4189 100644
--- a/usr.sbin/sysinstall/Makefile
+++ b/usr.sbin/sysinstall/Makefile
@@ -5,8 +5,8 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum
-SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c \
- devices.c disks.c dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
+SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c devices.c \
+ disks.c dispatch dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
ftp_strat.c globals.c index.c install.c installUpgrade.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
msg.c network.c nfs.c options.c package.c samba.c system.c \
diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c
index d462636..fd9a274 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.29 1996/04/28 22:54:15 jkh Exp $
+ * $Id: config.c,v 1.30 1996/04/29 18:06:06 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -476,7 +476,7 @@ configPackages(dialogMenuItem *self)
break;
}
}
- tmp = &plist;
+ tmp = plist.kids;
while (tmp) {
PkgNodePtr tmp2 = tmp->next;
@@ -484,7 +484,6 @@ configPackages(dialogMenuItem *self)
tmp = tmp2;
}
index_init(NULL, &plist);
- mediaDevice->shutdown(mediaDevice);
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sysinstall/dispatch.c b/usr.sbin/sysinstall/dispatch.c
new file mode 100644
index 0000000..886165b
--- /dev/null
+++ b/usr.sbin/sysinstall/dispatch.c
@@ -0,0 +1,125 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id$
+ *
+ * Copyright (c) 1995
+ * Jordan Hubbard. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * verbatim and that no modifications are made prior to this
+ * point in the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "sysinstall.h"
+#include <ctype.h>
+
+static struct _word {
+ char *name;
+ int (*handler)(dialogMenuItem *self);
+} resWords[] = {
+ { "configAnonFTP", configAnonFTP },
+ { "configApache", configApache },
+ { "configGated", configGated },
+ { "configNFSServer", configNFSServer },
+ { "configSamba", configSamba },
+ { "configPackages", configPackages },
+ { "diskPartitionEditor", diskPartitionEditor },
+ { "diskPartitionWrite", diskPartitionWrite },
+ { "diskLabelEditor", diskLabelEditor },
+ { "diskLabelCommit", diskLabelCommit },
+ { "distReset", distReset },
+ { "distSetDeveloper", distSetDeveloper },
+ { "distSetXDeveloper", distSetXDeveloper },
+ { "distSetKernDeveloper", distSetKernDeveloper },
+ { "distSetUser", distSetUser },
+ { "distSetXUser", distSetXUser },
+ { "distSetMinimum", distSetMinimum },
+ { "distSetEverything", distSetEverything },
+ { "distSetDES", distSetDES },
+ { "distSetSrc", distSetSrc },
+ { "distSetXF86", distSetXF86 },
+ { "distExtractAll", distExtractAll },
+ { "docBrowser", docBrowser },
+ { "docShowDocument", docShowDocument },
+ { "installCommit", installCommit },
+ { "installExpress", installExpress },
+ { "installUpgrade", installUpgrade },
+ { "installFixup", installFixup },
+ { "installFilesystems", installFilesystems },
+ { "mediaSetCDROM", mediaSetCDROM },
+ { "mediaSetFloppy", mediaSetFloppy },
+ { "mediaSetDOS", mediaSetDOS },
+ { "mediaSetTape", mediaSetTape },
+ { "mediaSetFTP", mediaSetFTP },
+ { "mediaSetFTPActive", mediaSetFTPActive },
+ { "mediaSetFTPPassive", mediaSetFTPPassive },
+ { "mediaSetUFS", mediaSetUFS },
+ { "mediaSetNFS", mediaSetNFS },
+ { "mediaSetFtpUserPass", mediaSetFtpUserPass },
+ { "mediaSetCPIOVerbosity", mediaSetCPIOVerbosity },
+ { "mediaGetType", mediaGetType },
+ { NULL, NULL },
+};
+
+static int
+call_possible_resword(char *name, dialogMenuItem *value, int *status)
+{
+ int i, rval;
+
+ rval = 0;
+ for (i = 0; resWords[i].name; i++) {
+ if (!strcmp(name, resWords[i].name)) {
+ *status = resWords[i].handler(value);
+ rval = 1;
+ break;
+ }
+ }
+ return rval;
+}
+
+/* For a given string, call it or spit out an undefined command diagnostic */
+int
+dispatchCommand(char *str)
+{
+ int i;
+
+ if (!str || !*str) {
+ msgConfirm("Null or zero-length string passed to dispatchCommand");
+ return DITEM_FAILURE;
+ }
+ else if (index(str, '=')) {
+ variable_set(str);
+ return DITEM_SUCCESS;
+ }
+ else if (!call_possible_resword(str, NULL, &i)) {
+ msgConfirm("No such command: %s", str);
+ return DITEM_FAILURE;
+ }
+ else if (DITEM_STATUS(i) != DITEM_SUCCESS)
+ msgConfirm("Command `%s' returned an error status.");
+ return i;
+}
diff --git a/usr.sbin/sysinstall/doc.c b/usr.sbin/sysinstall/doc.c
index 069e145..68e9e71 100644
--- a/usr.sbin/sysinstall/doc.c
+++ b/usr.sbin/sysinstall/doc.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: doc.c,v 1.14 1996/04/25 17:31:17 jkh Exp $
+ * $Id: doc.c,v 1.15 1996/04/28 03:26:52 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -52,17 +52,15 @@ docBrowser(dialogMenuItem *self)
return DITEM_FAILURE;
}
- /* Make sure we have media available */
- if (!mediaVerify())
- return DITEM_FAILURE;
-
/* First, make sure we have whatever browser we've chosen is here */
- ret = package_add(browser);
- if (DITEM_STATUS(ret) != DITEM_SUCCESS) {
- msgConfirm("Unable to install the %s HTML browser package. You may\n"
- "wish to verify that your media is configured correctly and\n"
- "try again.", browser);
- return ret;
+ if (!package_exists(browser)) {
+ ret = package_add(browser);
+ if (DITEM_STATUS(ret) != DITEM_SUCCESS) {
+ msgConfirm("Unable to install the %s HTML browser package. You may\n"
+ "wish to verify that your media is configured correctly and\n"
+ "try again.", browser);
+ return ret;
+ }
}
if (!file_executable(variable_get(VAR_BROWSER_BINARY))) {
diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c
index b494581..2ca5a1b 100644
--- a/usr.sbin/sysinstall/index.c
+++ b/usr.sbin/sysinstall/index.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: index.c,v 1.27 1996/04/30 21:22:29 jkh Exp $
+ * $Id: index.c,v 1.28 1996/05/01 09:31:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -331,12 +331,16 @@ index_sort(PkgNodePtr top)
}
}
-/* Delete an entry out of the index */
+/* Delete an entry out of the list it's in (only the plist, at present) */
void
index_delete(PkgNodePtr n)
{
- if (n->next)
+ if (n->next) {
+ PkgNodePtr p = n->next;
+
*n = *(n->next);
+ safe_free(p);
+ }
else /* Kludgy end sentinal */
n->name = NULL;
}
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index c978c0c..82f91c98 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.95 1996/04/30 06:02:51 jkh Exp $
+ * $Id: install.c,v 1.96 1996/05/02 10:09:45 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -310,8 +310,12 @@ installExpress(dialogMenuItem *self)
if (DITEM_STATUS((i = installCommit(self))) == DITEM_SUCCESS) {
i |= DITEM_LEAVE_MENU;
- /* Give user the option of one last configuration spree, then write changes */
+ /* Give user the option of one last configuration spree */
installConfigure();
+
+ /* Now write out any changes .. */
+ configResolv();
+ configSysconfig();
}
return i | DITEM_RESTORE | DITEM_RECREATE;
}
@@ -458,19 +462,46 @@ installNovice(dialogMenuItem *self)
/* XXX Put whatever other nice configuration questions you'd like to ask the user here XXX */
- /* Give user the option of one last configuration spree, then write changes */
+ /* Give user the option of one last configuration spree */
installConfigure();
+ /* Now write out any changes .. */
+ configResolv();
+ configSysconfig();
+
return DITEM_LEAVE_MENU | DITEM_RESTORE | DITEM_RECREATE;
}
+/* The version of commit we call from the Install Custom menu */
+int
+installCustomCommit(dialogMenuItem *self)
+{
+ int i;
+
+ i = installCommit(self);
+ if (DITEM_STATUS(i) == DITEM_SUCCESS) {
+ /* Give user the option of one last configuration spree */
+ installConfigure();
+
+ /* Now write out any changes .. */
+ configResolv();
+ configSysconfig();
+ return i;
+ }
+ else
+ msgConfirm("The commit operation completed with errors. Not\n"
+ "updating /etc files.");
+ return i;
+}
+
/*
- * What happens when we finally "Commit" to going ahead with the installation.
+ * What happens when we finally decide to going ahead with the installation.
*
- * This is broken into multiple stages so that the user can do a full installation but come back here
- * again to load more distributions, perhaps from a different media type. This would allow, for
- * example, the user to load the majority of the system from CDROM and then use ftp to load just the
- * DES dist.
+ * This is broken into multiple stages so that the user can do a full
+ * installation but come back here again to load more distributions,
+ * perhaps from a different media type. This would allow, for
+ * example, the user to load the majority of the system from CDROM and
+ * then use ftp to load just the DES dist.
*/
int
installCommit(dialogMenuItem *self)
@@ -530,10 +561,6 @@ installConfigure(void)
dmenuOpenSimple(&MenuConfigure);
restorescr(w);
}
-
- /* Write out any changes .. */
- configResolv();
- configSysconfig();
}
int
diff --git a/usr.sbin/sysinstall/installUpgrade.c b/usr.sbin/sysinstall/installUpgrade.c
index 8d15c82..a1b94e9 100644
--- a/usr.sbin/sysinstall/installUpgrade.c
+++ b/usr.sbin/sysinstall/installUpgrade.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: installUpgrade.c,v 1.23 1996/04/28 03:27:05 jkh Exp $
+ * $Id: installUpgrade.c,v 1.24 1996/04/28 20:54:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -264,10 +264,7 @@ installUpgrade(dialogMenuItem *self)
if (!rootExtract()) {
msgConfirm("Failed to load the ROOT distribution. Please correct\n"
"this problem and try again (the system will now reboot).");
- if (RunningAsInit)
- reboot(0);
- else
- exit(1);
+ systemShutdown(1);
}
if (extractingBin) {
@@ -292,12 +289,8 @@ installUpgrade(dialogMenuItem *self)
if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n"
"treat this as a big problem and abort the upgrade? Due to the\n"
"way that this upgrade process works, you will have to reboot\n"
- "and start over from the beginning. Select Yes to reboot now")) {
- if (RunningAsInit)
- reboot(0);
- else
- exit(1);
- }
+ "and start over from the beginning. Select Yes to reboot now"))
+ systemShutdown(1);
}
}
}
@@ -309,10 +302,7 @@ installUpgrade(dialogMenuItem *self)
"should be considered a failure and started from the beginning, sorry!\n"
"The system will reboot now.");
dialog_clear();
- if (RunningAsInit)
- reboot(0);
- else
- exit(1);
+ systemShutdown(1);
}
msgConfirm("The extraction process seems to have had some problems, but we got most\n"
"of the essentials. We'll treat this as a warning since it may have been\n"
@@ -357,6 +347,7 @@ installUpgrade(dialogMenuItem *self)
dialog_update();
end_dialog();
DialogActive = FALSE;
+ endwin();
signal(SIGTTOU, SIG_IGN);
if (tcgetattr(0, &foo) != -1) {
diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c
index deb8524..c729158 100644
--- a/usr.sbin/sysinstall/main.c
+++ b/usr.sbin/sysinstall/main.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: main.c,v 1.17 1996/04/13 13:31:51 jkh Exp $
+ * $Id: main.c,v 1.18 1996/04/28 20:54:03 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -72,6 +72,7 @@ main(int argc, char **argv)
variable_set2(VAR_DEBUG, "YES");
Fake = TRUE;
msgConfirm("I'll be just faking it from here on out, OK?");
+ --argc, ++argv;
}
/* Try to preserve our scroll-back buffer */
@@ -82,6 +83,16 @@ main(int argc, char **argv)
/* Probe for all relevant devices on the system */
deviceGetAll();
+ if (argc > 1) {
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ if (DITEM_STATUS(dispatchCommand(argv[i])) != DITEM_SUCCESS)
+ systemShutdown(1);
+ }
+ systemShutdown(0);
+ }
+
/* Begin user dialog at outer menu */
while (1) {
choice = scroll = curr = max = 0;
@@ -92,8 +103,7 @@ main(int argc, char **argv)
}
/* Say goodnight, Gracie */
- systemShutdown();
+ systemShutdown(0);
- /* If we're running as init, we should never get here */
- return 0;
+ return 0; /* We should never get here */
}
diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c
index 9706286..ce452ce 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.59 1996/05/05 21:54:23 jkh Exp $
+ * $Id: menus.c,v 1.60 1996/05/09 09:42:15 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -864,7 +864,7 @@ to install it from and how you wish to allocate disk storage to FreeBSD.",
{ "3 Label", "Label allocated disk partitions", NULL, diskLabelEditor },
{ "4 Distributions", "Select distribution(s) to extract", NULL, dmenuSubmenu, NULL, &MenuDistributions },
{ "5 Media", "Choose the installation media type", NULL, dmenuSubmenu, NULL, &MenuMedia },
- { "6 Commit", "Perform any pending Partition/Label/Extract actions", NULL, installCommit },
+ { "6 Commit", "Perform any pending Partition/Label/Extract actions", NULL, installCustomCommit },
{ "7 Extract", "Just do distribution extract step", NULL, distExtractAll },
{ "0 Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
{ NULL } },
diff --git a/usr.sbin/sysinstall/msg.c b/usr.sbin/sysinstall/msg.c
index b148c1a..ef1d79b 100644
--- a/usr.sbin/sysinstall/msg.c
+++ b/usr.sbin/sysinstall/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: msg.c,v 1.31 1996/04/13 13:32:02 jkh Exp $
+ * $Id: msg.c,v 1.32 1996/04/28 00:37:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -185,7 +185,7 @@ msgFatal(char *fmt, ...)
if (OnVTY)
msgDebug("Fatal error `%s'!\n", errstr);
getch();
- systemShutdown();
+ systemShutdown(1);
}
/* Put up a message in a popup confirmation box */
diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c
index ce7f1a6..390733c 100644
--- a/usr.sbin/sysinstall/package.c
+++ b/usr.sbin/sysinstall/package.c
@@ -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.34 1996/04/30 05:40:15 jkh Exp $
+ * $Id: package.c,v 1.35 1996/04/30 06:13:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -52,6 +52,16 @@ package_add(char *name)
return package_extract(mediaDevice, name, FALSE);
}
+Boolean
+package_exists(char *name)
+{
+ int status = vsystem("pkg_info -e %s", name);
+
+ msgDebug("package check for %s returns %s.\n", name,
+ status ? "failure" : "success");
+ return !status;
+}
+
/* Extract a package based on a namespec and a media device */
int
package_extract(Device *dev, char *name, Boolean depended)
@@ -63,12 +73,10 @@ package_extract(Device *dev, char *name, Boolean depended)
if (!file_readable("/var/run/ld.so.hints"))
vsystem("ldconfig /usr/lib /usr/local/lib /usr/X11R6/lib");
- msgNotify("Checking for existence of %s package", name);
/* Check to make sure it's not already there */
- if (!vsystem("pkg_info -e %s", name)) {
- msgDebug("package %s marked as already installed - return SUCCESS.\n", name);
+ msgNotify("Checking for existence of %s package", name);
+ if (package_exists(name))
return DITEM_SUCCESS;
- }
if (!dev->init(dev)) {
msgConfirm("Unable to initialize media type for package extract.");
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 0ae5544..8034493 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.54 1996/04/28 01:07:26 jkh Exp $
+ * $Id: sysinstall.h,v 1.55 1996/04/28 20:54:07 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -71,12 +71,12 @@
#define MAX_CHUNKS 40
/* Internal environment variable names */
-#define DISK_PARTITIONED "_diskPartitioned"
-#define DISK_LABELLED "_diskLabelled"
-#define DISK_SELECTED "_diskSelected"
-#define SYSTEM_STATE "_systemState"
-#define RUNNING_ON_ROOT "_runningOnRoot"
-#define TCP_CONFIGURED "_tcpConfigured"
+#define DISK_PARTITIONED "_diskPartitioned"
+#define DISK_LABELLED "_diskLabelled"
+#define DISK_SELECTED "_diskSelected"
+#define SYSTEM_STATE "_systemState"
+#define RUNNING_ON_ROOT "_runningOnRoot"
+#define TCP_CONFIGURED "_tcpConfigured"
/* Ones that can be tweaked from config files */
#define VAR_BLANKTIME "blanktime"
@@ -377,6 +377,9 @@ extern int diskPartitionEditor(dialogMenuItem *self);
extern int diskPartitionWrite(dialogMenuItem *self);
extern void diskPartition(Device *dev, Disk *d);
+/* dispatch.c */
+extern int dispatchCommand(char *command);
+
/* dist.c */
extern int distReset(dialogMenuItem *self);
extern int distSetCustom(char *str);
@@ -443,6 +446,7 @@ int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist);
/* install.c */
extern int installCommit(dialogMenuItem *self);
+extern int installCustomCommit(dialogMenuItem *self);
extern int installExpress(dialogMenuItem *self);
extern int installNovice(dialogMenuItem *self);
extern int installFixitCDROM(dialogMenuItem *self);
@@ -556,10 +560,11 @@ extern int optionsEditor(dialogMenuItem *self);
/* package.c */
extern int package_add(char *name);
extern int package_extract(Device *dev, char *name, Boolean depended);
+extern Boolean package_exists(char *name);
/* system.c */
extern void systemInitialize(int argc, char **argv);
-extern void systemShutdown(void);
+extern void systemShutdown(int status);
extern int execExecute(char *cmd, char *name);
extern int systemExecute(char *cmd);
extern int systemDisplayHelp(char *file);
diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c
index 46d664b..b826f3e 100644
--- a/usr.sbin/sysinstall/system.c
+++ b/usr.sbin/sysinstall/system.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: system.c,v 1.57 1996/04/29 21:15:44 jkh Exp $
+ * $Id: system.c,v 1.58 1996/05/01 03:31:08 jkh Exp $
*
* Jordan Hubbard
*
@@ -33,7 +33,7 @@ static void
handle_intr(int sig)
{
if (!msgYesNo("Are you sure you want to abort the installation?"))
- systemShutdown();
+ systemShutdown(1);
}
/* Initialize system defaults */
@@ -79,12 +79,21 @@ systemInitialize(int argc, char **argv)
/* Close down and prepare to exit */
void
-systemShutdown(void)
+systemShutdown(int status)
{
+ /* If some media is open, close it down */
+ if (mediaDevice)
+ mediaDevice->shutdown(mediaDevice);
+
+ /* Shut down the dialog library */
if (DialogActive) {
end_dialog();
DialogActive = FALSE;
}
+
+ /* Shut down curses */
+ endwin();
+
/* REALLY exit! */
if (RunningAsInit) {
/* Put the console back */
@@ -92,7 +101,7 @@ systemShutdown(void)
reboot(0);
}
else
- exit(1);
+ exit(status);
}
/* Run some general command */
@@ -154,6 +163,9 @@ systemHelpFile(char *file, char *buf)
snprintf(buf, FILENAME_MAX, "/stand/help/%s.hlp", file);
if (file_readable(buf))
return buf;
+ snprintf(buf, FILENAME_MAX, "/usr/src/release/sysinstall/help/%s.hlp", file);
+ if (file_readable(buf))
+ return buf;
return NULL;
}
OpenPOWER on IntegriCloud