summaryrefslogtreecommitdiffstats
path: root/release/sysinstall
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-03-19 10:09:28 +0000
committerjkh <jkh@FreeBSD.org>1997-03-19 10:09:28 +0000
commitd3a9bd86865e3c7ed849dc900473a6881ea729d0 (patch)
tree576efe220a8f1ff456854a3785787426f0039ac5 /release/sysinstall
parent73f859e84e05e331692ca97199ad656c3f163946 (diff)
downloadFreeBSD-src-d3a9bd86865e3c7ed849dc900473a6881ea729d0.zip
FreeBSD-src-d3a9bd86865e3c7ed849dc900473a6881ea729d0.tar.gz
Some of my pending merge changes, Paul Traina's more flexible config
file loading code. Submitted by: pst
Diffstat (limited to 'release/sysinstall')
-rw-r--r--release/sysinstall/Makefile2
-rw-r--r--release/sysinstall/attr.c4
-rw-r--r--release/sysinstall/floppy.c6
-rw-r--r--release/sysinstall/main.c28
-rw-r--r--release/sysinstall/media.c4
-rw-r--r--release/sysinstall/menus.c46
-rw-r--r--release/sysinstall/register.c16
-rw-r--r--release/sysinstall/sysinstall.h7
-rw-r--r--release/sysinstall/variable_load.c113
9 files changed, 165 insertions, 61 deletions
diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile
index 0eb723b..0a2440f 100644
--- a/release/sysinstall/Makefile
+++ b/release/sysinstall/Makefile
@@ -13,7 +13,7 @@ SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c devices.c \
msg.c network.c nfs.c options.c package.c register.c samba.c system.c \
tape.c tcpip.c termcap.c ufs.c user.c variable.c wizard.c \
uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c \
- uc_scsi.c keymap.h
+ uc_scsi.c keymap.h variable_load.c
CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog -I${.OBJDIR} -I/sys
CFLAGS+= -DUC_PRIVATE -DKERN_NO_SYMBOLS -DSAVE_USERCONFIG
diff --git a/release/sysinstall/attr.c b/release/sysinstall/attr.c
index e876b4b..ca366bb 100644
--- a/release/sysinstall/attr.c
+++ b/release/sysinstall/attr.c
@@ -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$
+ * $Id: attr.c,v 1.15 1997/02/22 14:11:10 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -85,7 +85,7 @@ attr_parse(Attribs *attr, FILE *fp)
state = NAME;
}
else {
- msgDebug("Parse config: Invalid character '%c' at line %d", ch, lno);
+ msgDebug("Parse config: Invalid character '%c' at line %d\n", ch, lno);
state = COMMENT; /* Ignore the rest of the line */
}
break;
diff --git a/release/sysinstall/floppy.c b/release/sysinstall/floppy.c
index be8fb54..aa45094 100644
--- a/release/sysinstall/floppy.c
+++ b/release/sysinstall/floppy.c
@@ -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$
+ * $Id: floppy.c,v 1.23 1997/02/22 14:11:40 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -129,9 +129,9 @@ mediaInitFloppy(Device *dev)
msgDebug("Init floppy called for %s distribution.\n", distWanted ? distWanted : "some");
if (!distWanted)
- msgConfirm("Please insert floppy for %s", dev->description);
+ msgConfirm("Please insert floppy in %s", dev->description);
else
- msgConfirm("Please insert floppy containing %s for %s", distWanted, dev->description);
+ msgConfirm("Please insert floppy containing %s in %s", distWanted, dev->description);
memset(&dosargs, 0, sizeof dosargs);
dosargs.fspec = dev->devname;
diff --git a/release/sysinstall/main.c b/release/sysinstall/main.c
index bbd6281..2f1f3a2 100644
--- a/release/sysinstall/main.c
+++ b/release/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$
+ * $Id: main.c,v 1.43 1997/02/22 14:11:55 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -118,32 +118,6 @@ main(int argc, char **argv)
}
fclose(fp);
}
-#if defined(LOAD_CONFIG_FILE)
- else {
- /* If we have a compiled-in startup config file name on
- the floppy, look for it and try to load it on startup */
- extern char *distWanted;
-
- /* Tell mediaSetFloppy() to try floppy now */
- distWanted = LOAD_CONFIG_FILE;
-
- /* Try to open the floppy drive if we can do that first */
- if (DITEM_STATUS(mediaSetFloppy(NULL)) != DITEM_FAILURE && mediaDevice->init(mediaDevice)) {
- fp = mediaDevice->get(mediaDevice, LOAD_CONFIG_FILE, TRUE);
- if (fp) {
- msgNotify("Loading %s pre-configuration file", LOAD_CONFIG_FILE);
- while (fgets(buf, sizeof buf, fp)) {
- if (DITEM_STATUS(dispatchCommand(buf)) != DITEM_SUCCESS) {
- msgDebug("Command `%s' failed - rest of script aborted.\n", buf);
- break;
- }
- }
- fclose(fp);
- }
- mediaDevice->shutdown(mediaDevice);
- }
- }
-#endif
}
/* Begin user dialog at outer menu */
diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c
index 2328439..a56e430 100644
--- a/release/sysinstall/media.c
+++ b/release/sysinstall/media.c
@@ -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.81 1997/03/07 16:39:20 jkh Exp $
+ * $Id: media.c,v 1.82 1997/03/11 16:43:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -96,7 +96,7 @@ cpioVerbosity()
return "";
}
-static void
+void
mediaClose(void)
{
if (mediaDevice)
diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c
index c76d345..61837c6 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.125 1997/03/11 16:44:00 jkh Exp $
+ * $Id: menus.c,v 1.126 1997/03/14 05:17:11 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -213,6 +213,7 @@ DMenu MenuIndex = {
{ "Commit", "Commit any pending actions (dangerous!)", NULL, installCustomCommit },
{ "Console settings", "Customize system console behavior.", NULL, dmenuSubmenu, NULL, &MenuSyscons },
{ "Configure", "The system configuration menu.", NULL, dmenuSubmenu, NULL, &MenuConfigure },
+ { "Defaults, Load", "Load default settings.", NULL, variableLoad },
{ "Device, Mouse", "The mouse configuration menu.", NULL, dmenuSubmenu, NULL, &MenuMouse },
{ "Dists, All", "Root of the distribution tree.", NULL, dmenuSubmenu, NULL, &MenuDistributions },
{ "Dists, Basic", "Basic FreeBSD distribution menu.", NULL, dmenuSubmenu, NULL, &MenuSubDistributions },
@@ -303,6 +304,7 @@ DMenu MenuInitial = {
{ "8 Fixit", "Go into repair mode with CDROM or floppy, or start a shell.", NULL, dmenuSubmenu, NULL, &MenuFixit },
{ "9 Upgrade", "Upgrade an existing system", NULL, installUpgrade },
{ "c Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure },
+ { "l Load Config","Load default install configuration", NULL, variableLoad },
{ "0 Index", "Glossary of functions", NULL, dmenuSubmenu, NULL, &MenuIndex },
{ NULL } },
};
@@ -462,6 +464,8 @@ DMenu MenuMediaFTP = {
VAR_FTP_PATH "=ftp://ftp3.au.freebsd.org/pub/FreeBSD/" },
{ "Australia #4", "ftp4.au.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp4.au.freebsd.org/pub/FreeBSD/" },
+ { "Australia #5", "ftp5.au.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp5.au.freebsd.org/pub/FreeBSD/" },
{ "Brazil", "ftp.br.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp.br.freebsd.org/pub/FreeBSD/" },
{ "Brazil #2", "ftp2.br.freebsd.org", NULL, dmenuSetVariable, NULL,
@@ -472,16 +476,22 @@ DMenu MenuMediaFTP = {
VAR_FTP_PATH "=ftp://ftp4.br.freebsd.org/pub/FreeBSD/" },
{ "Brazil #5", "ftp5.br.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp5.br.freebsd.org/pub/FreeBSD/" },
+ { "Brazil #6", "ftp6.br.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp6.br.freebsd.org/pub/FreeBSD/" },
+ { "Brazil #7", "ftp7.br.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp7.br.freebsd.org/pub/FreeBSD/" },
{ "Canada", "ftp.ca.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp.ca.freebsd.org/pub/FreeBSD/" },
- { "Czech Republic", "sunsite.mff.cuni.cz", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://sunsite.mff.cuni.cz/OS/FreeBSD/" },
+ { "Czech Republic", "ftp.cz.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp.cz.freebsd.org/pub/FreeBSD/" },
{ "Estonia", "ftp.ee.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp.ee.freebsd.org/pub/FreeBSD/" },
- { "Finland", "nic.funet.fi", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://nic.funet.fi/pub/unix/FreeBSD/" },
- { "France", "ftp.ibp.fr", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.ibp.fr/pub/FreeBSD/" },
+ { "Finland", "ftp.fi.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp.fi.freebsd.org/pub/FreeBSD/" },
+ { "France", "ftp.fr.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp.fr.freebsd.org/pub/FreeBSD/" },
+ { "France #2", "ftp2.fr.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp2.fr.freebsd.org/pub/FreeBSD/" },
{ "Germany", "ftp.de.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp.de.freebsd.org/pub/FreeBSD/" },
{ "Germany #2", "ftp2.de.freebsd.org", NULL, dmenuSetVariable, NULL,
@@ -496,8 +506,8 @@ DMenu MenuMediaFTP = {
VAR_FTP_PATH "=ftp://ftp6.de.freebsd.org/pub/FreeBSD/" },
{ "Germany #7", "ftp7.de.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp7.de.freebsd.org/pub/FreeBSD/" },
- { "Holland", "ftp.nl.freebsd.ort", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.nl.freebsd.org/pub/os/FreeBSD/cdrom/" },
+ { "Holland", "ftp.nl.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp.nl.freebsd.org/pub/FreeBSD/" },
{ "Hong Kong", "ftp.hk.super.net", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp.hk.super.net/pub/FreeBSD/" },
{ "Ireland", "ftp.ie.freebsd.org", NULL, dmenuSetVariable, NULL,
@@ -522,10 +532,8 @@ DMenu MenuMediaFTP = {
VAR_FTP_PATH "=ftp://ftp.kr.freebsd.org/pub/FreeBSD/" },
{ "Korea #2", "ftp2.kr.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp2.kr.freebsd.org/pub/FreeBSD/" },
- { "Netherlands", "ftp.nl.net", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.nl.net/pub/os/FreeBSD/" },
- { "Poland", "SunSITE.icm.edu.pl", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://SunSITE.icm.edu.pl/pub/FreeBSD/" },
+ { "Poland", "ftp.pl.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp.pl.freebsd.org/pub/FreeBSD/" },
{ "Portugal", "ftp.pt.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp.pt.freebsd.org/pub/misc/FreeBSD/" },
{ "Portugal #2", "ftp2.pt.freebsd.org", NULL, dmenuSetVariable, NULL,
@@ -542,8 +550,14 @@ DMenu MenuMediaFTP = {
VAR_FTP_PATH "=ftp://ftp2.za.freebsd.org/pub/FreeBSD/" },
{ "South Africa #3", "ftp3.za.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp3.za.freebsd.org/pub/FreeBSD/" },
- { "Sweden", "ftp.luth.se", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.luth.se/pub/FreeBSD/" },
+ { "South Africa #4", "ftp4.za.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp4.za.freebsd.org/pub/FreeBSD/" },
+ { "Sweden", "ftp.se.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp.se.freebsd.org/pub/FreeBSD/" },
+ { "Sweden #2", "ftp2.se.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp2.se.freebsd.org/pub/FreeBSD/" },
+ { "Sweden #3", "ftp3.se.freebsd.org", NULL, dmenuSetVariable, NULL,
+ VAR_FTP_PATH "=ftp://ftp3.se.freebsd.org/pub/FreeBSD/" },
{ "Taiwan", "ftp.tw.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp.tw.freebsd.org/pub/FreeBSD" },
{ "Taiwan #2", "ftp2.tw.freebsd.org", NULL, dmenuSetVariable, NULL,
@@ -570,8 +584,6 @@ DMenu MenuMediaFTP = {
VAR_FTP_PATH "=ftp://ftp5.freebsd.org/pub/FreeBSD/" },
{ "USA #6", "ftp6.freebsd.org", NULL, dmenuSetVariable, NULL,
VAR_FTP_PATH "=ftp://ftp6.freebsd.org/pub/FreeBSD/" },
- { "USA #7", "ftp7.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp7.freebsd.org/pub/FreeBSD/" },
{ NULL } }
};
diff --git a/release/sysinstall/register.c b/release/sysinstall/register.c
index 7a783e1..ea41536 100644
--- a/release/sysinstall/register.c
+++ b/release/sysinstall/register.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: register.c,v 1.3 1997/03/14 05:17:12 jkh Exp $
+ * $Id: register.c,v 1.4 1997/03/15 16:24:31 jkh Exp $
*
* Copyright (c) 1997
* Jordan Hubbard. All rights reserved.
@@ -38,7 +38,7 @@
#include <ctype.h>
#define REGISTER_HELPFILE "register"
-#define REGISTRATION_FNAME "/tmp/new-registration"
+#define REGISTRATION_FNAME "/new-registration"
#define REGISTRATION_ADDRESS "register@freebsd.org"
#define MAJORDOMO_ADDRESS "majordomo@freebsd.org"
@@ -64,11 +64,11 @@ static int okbutton, cancelbutton;
static Layout layout[] = {
#define LAYOUT_LASTNAME 0
- { 2, 2, LASTNAME_FIELD_LEN - 1, LASTNAME_FIELD_LEN - 1,
+ { 1, 2, LASTNAME_FIELD_LEN - 1, LASTNAME_FIELD_LEN - 1,
"Last Name:", "Your surname (family name) or company name should go here.",
lastname, STRINGOBJ, NULL },
#define LAYOUT_FIRSTNAME 1
- { 2, 36, FIRSTNAME_FIELD_LEN - 1, FIRSTNAME_FIELD_LEN - 1,
+ { 1, 36, FIRSTNAME_FIELD_LEN - 1, FIRSTNAME_FIELD_LEN - 1,
"First Name:", "Your given name or a contact name if registering for a company.",
firstname, STRINGOBJ, NULL },
#define LAYOUT_EMAIL 2
@@ -112,10 +112,10 @@ static Layout layout[] = {
#define NEWSLETTER 3
static struct { int y, x, sel; char *desc, *allowed; } hotspots[] = {
- { 7, 35, 0, "Do you wish to receive FreeBSD [ONLY!] related commercial mail?", "Y" },
- { 7, 57, 0, "Do you wish to receive FreeBSD [ONLY!] related commercial email?", "Y" },
- { 8, 35, 0, "Sign up (with majordomo@FreeBSD.org) for important announcements?", "Y" },
- { 9, 35, 0, "Sign up for the FreeBSD Newsletter? P = Postal (paper) copy, E = Email", "PE" },
+ { 5, 35, 0, "Do you wish to receive FreeBSD [ONLY!] related commercial mail?", "Y" },
+ { 5, 57, 0, "Do you wish to receive FreeBSD [ONLY!] related commercial email?", "Y" },
+ { 6, 35, 0, "Sign up (with majordomo@FreeBSD.org) for important announcements?", "Y" },
+ { 10, 35, 0, "Sign up for the FreeBSD Newsletter? P = Postal (paper) copy, E = Email", "PE" },
};
/* Check the accuracy of user's choices before letting them move on */
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index 3e8abec..3f52dc4 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.120 1997/03/09 22:25:48 jkh Exp $
+ * $Id: sysinstall.h,v 1.121 1997/03/15 16:24:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -114,6 +114,7 @@
#define VAR_HOSTNAME "hostname"
#define VAR_IFCONFIG "ifconfig_"
#define VAR_INTERFACES "network_interfaces"
+#define VAR_INSTALL_CFG "installConfig"
#define VAR_INSTALL_ROOT "installRoot"
#define VAR_IPADDR "ipaddr"
#define VAR_LABEL "label"
@@ -561,6 +562,7 @@ extern u_char default_scrnmap[];
/* media.c */
extern char *cpioVerbosity(void);
+extern void mediaClose(void);
extern int mediaTimeout(void);
extern int mediaSetCDROM(dialogMenuItem *self);
extern int mediaSetFloppy(dialogMenuItem *self);
@@ -691,6 +693,9 @@ extern char *variable_get(char *var);
extern void variable_unset(char *var);
extern char *variable_get_value(char *var, char *prompt);
+/* variable_load.c */
+extern int variableLoad(dialogMenuItem *self);
+
/* wizard.c */
extern void slice_wizard(Disk *d);
diff --git a/release/sysinstall/variable_load.c b/release/sysinstall/variable_load.c
new file mode 100644
index 0000000..63b0d41
--- /dev/null
+++ b/release/sysinstall/variable_load.c
@@ -0,0 +1,113 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last attempt in the `sysinstall' line, the next
+ * generation being slated for what's essentially a complete rewrite.
+ *
+ * $Id$
+ *
+ * Copyright (c) 1997
+ * Paul Traina. 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 PAUL TRAINA ``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 PAUL TRAINA OR HIS KILLER RATS 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 <sys/signal.h>
+#include <sys/fcntl.h>
+
+int
+variableLoad(dialogMenuItem * self)
+{
+ extern char *distWanted;
+ int what = DITEM_RESTORE;
+ char *cp, *old;
+ char buf[BUFSIZ];
+ FILE *fp;
+
+ mediaClose();
+ dialog_clear_norefresh();
+
+ if ((cp = variable_get(VAR_INSTALL_CFG)) != NULL) {
+ old = strdup(cp);
+ cp = variable_get_value(VAR_INSTALL_CFG,
+ "Specify the name of a configuration file\n"
+ "residing on a MSDOS or UFS floppy.\n\n"
+ "(default: %s)");
+ if (!cp) {
+ free(old);
+ return DITEM_FAILURE | what;
+ }
+ if (!*cp)
+ variable_set2(VAR_INSTALL_CFG, cp);
+
+ free(old);
+
+ } else {
+ cp = variable_get_value(VAR_INSTALL_CFG,
+ "Specify the name of a configuration file\n"
+ "residing on a MSDOS or UFS floppy.");
+ if (!cp || !*cp) {
+ variable_unset(VAR_INSTALL_CFG);
+ return DITEM_FAILURE | what;
+ }
+ }
+
+ distWanted = cp = variable_get(VAR_INSTALL_CFG);
+
+ /* Try to open the floppy drive if we can do that first */
+ if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE ||
+ mediaDevice->init(mediaDevice)) {
+ msgConfirm("Unable to access floppy.");
+ return DITEM_FAILURE | what;
+ }
+
+ fp = mediaDevice->get(mediaDevice, cp, TRUE);
+ if (!fp) {
+ msgConfirm("Configuration file '%s' not found.");
+ variable_unset(VAR_INSTALL_CFG);
+ what |= DITEM_FAILURE;
+ goto terminate_device;
+ }
+
+ msgNotify("Loading %s pre-configuration file", cp);
+
+ while (fgets(buf, sizeof buf, fp)) {
+ if (DITEM_STATUS(dispatchCommand(buf)) != DITEM_SUCCESS) {
+ msgConfirm("Command `%s' failed - rest of script aborted.\n", buf);
+ what |= DITEM_FAILURE;
+ goto terminate_file;
+ }
+ }
+ what |= DITEM_SUCCESS;
+
+terminate_file:
+ fclose(fp);
+
+terminate_device:
+ mediaDevice->shutdown(mediaDevice);
+
+ return what;
+}
OpenPOWER on IntegriCloud