aboutsummaryrefslogtreecommitdiff
path: root/release
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1995-05-24 01:27:15 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1995-05-24 01:27:15 +0000
commit9b03310b0c2bec09c28078e1a2d29f745fbf0759 (patch)
tree7e001d70a2e1ec65b4b789b26acd5bcd541a7c0b /release
parent95e34bfc2ef72df7348fbe5dcafa8aeecc463b0a (diff)
downloadsrc-9b03310b0c2bec09c28078e1a2d29f745fbf0759.tar.gz
src-9b03310b0c2bec09c28078e1a2d29f745fbf0759.zip
Add a final configuration menu and the beginnings of the backing code
for it. The ftp installation method is working well enough to test. Many more bug fixes, says Gary.
Notes
Notes: svn path=/head/; revision=8715
Diffstat (limited to 'release')
-rw-r--r--release/sysinstall/config.c15
-rw-r--r--release/sysinstall/ftp.c38
-rw-r--r--release/sysinstall/install.c3
-rw-r--r--release/sysinstall/media_strategy.c100
-rw-r--r--release/sysinstall/menus.c52
-rw-r--r--release/sysinstall/sysinstall.h5
-rw-r--r--release/sysinstall/tcpip.c4
7 files changed, 168 insertions, 49 deletions
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c
index 881d87502c05..c15d364707dc 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.1 1995/05/23 02:40:50 jkh Exp $
+ * $Id: config.c,v 1.2 1995/05/23 18:06:12 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -212,3 +212,16 @@ config_resolv(void)
fclose(fp);
alreadyDone = TRUE;
}
+
+int
+config_packages(char *str)
+{
+ return 0;
+}
+
+int
+config_ports(char *str)
+{
+ return 0;
+}
+
diff --git a/release/sysinstall/ftp.c b/release/sysinstall/ftp.c
index 0d0cf17b8e7b..4a908e5e3e77 100644
--- a/release/sysinstall/ftp.c
+++ b/release/sysinstall/ftp.c
@@ -114,11 +114,12 @@ int
FtpOpen(FTP_t ftp, char *host, char *user, char *passwd)
{
- struct hostent *he, hdef;
- struct servent *se, sdef;
- struct sockaddr_in sin;
- int s;
- char a,*p,buf[BUFSIZ];
+ struct hostent *he, hdef;
+ struct servent *se, sdef;
+ struct sockaddr_in sin;
+ int s;
+ char a,*p,buf[BUFSIZ];
+ unsigned long temp;
if (!user)
user = "ftp";
@@ -126,17 +127,28 @@ FtpOpen(FTP_t ftp, char *host, char *user, char *passwd)
if (!passwd)
passwd = "??@??(FreeBSD:libftp)"; /* XXX */
- he = gethostbyname(host);
- if (!he)
- return ENOENT;
+ msgDebug("FtpOpen(ftp, %s, %s, %s)\n", host, user, passwd);
- se = getservbyname("ftp","tcp");
- if (!se)
+ temp = inet_addr(host);
+ if (temp != INADDR_NONE)
+ {
+ msgDebug("Using dotted IP address `%s'\n", host);
+ ftp->addrtype = sin.sin_family = AF_INET;
+ sin.sin_addr.s_addr = temp;
+ } else {
+ msgDebug("Trying to resolve `%s'\n", host);
+ he = gethostbyname(host);
+ if (!he)
+ {
+ msgDebug("Lookup of `%s' failed!\n", host);
return ENOENT;
+ }
+ ftp->addrtype = sin.sin_family = he->h_addrtype;
+ bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length);
+ }
+
+ sin.sin_port = htons(21);
- ftp->addrtype = sin.sin_family = he->h_addrtype;
- bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length);
- sin.sin_port = se->s_port;
if ((s = socket(he->h_addrtype, SOCK_STREAM, 0)) < 0)
return s;
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index ba2bdfa4329f..8a0f1fe05501 100644
--- a/release/sysinstall/install.c
+++ b/release/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.48 1995/05/23 02:41:05 jkh Exp $
+ * $Id: install.c,v 1.49 1995/05/23 18:06:13 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -435,4 +435,5 @@ cpio_extract(void)
static void
do_final_setup(void)
{
+ dmenuOpenSimple(&MenuConfigure);
}
diff --git a/release/sysinstall/media_strategy.c b/release/sysinstall/media_strategy.c
index f71e9203a2ca..e60d08af031b 100644
--- a/release/sysinstall/media_strategy.c
+++ b/release/sysinstall/media_strategy.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_strategy.c,v 1.12 1995/05/23 02:41:11 jkh Exp $
+ * $Id: media_strategy.c,v 1.13 1995/05/23 18:06:14 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -54,6 +54,9 @@
#include <sys/param.h>
#include <sys/dkbad.h>
#include <sys/mman.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include <netdb.h>
#include "ftp.h"
@@ -400,6 +403,7 @@ Boolean
mediaInitNetwork(Device *dev)
{
int i;
+ char *rp;
if (!strncmp("cuaa", dev->name, 4)) {
if (tcpStartPPP()) {
@@ -413,18 +417,26 @@ mediaInitNetwork(Device *dev)
else {
char *cp, ifconfig[64];
- sprintf(ifconfig, "%s%s", VAR_IFCONFIG, dev->name);
+ snprintf(ifconfig, 64, "%s%s", VAR_IFCONFIG, dev->name);
cp = getenv(ifconfig);
if (!cp) {
msgConfirm("The %s device is not configured. You will need to do so\nin the Networking configuration menu before proceeding.");
return FALSE;
}
- i = vsystem("ifconfig %s", ifconfig);
+ i = vsystem("ifconfig %s %s", dev->name, cp);
if (i) {
- msgConfirm("Unable to configure the %s interface!\nThis installation method cannot be used.");
+ msgConfirm("Unable to configure the %s interface!\nThis installation method cannot be used.", dev->name);
return FALSE;
}
}
+
+ rp = getenv(VAR_GATEWAY);
+ if (!rp)
+ msgConfirm("No gateway has been set. You will not be able to access machines\n
+not on the local network\n");
+ else
+ vsystem("route add default %s", rp);
+
config_resolv();
return TRUE;
}
@@ -455,6 +467,10 @@ mediaInitFTP(Device *dev)
int i;
char *url, *hostname, *dir, *dir_p;
char *my_name, email[BUFSIZ];
+ Device *netDevice = (Device *)dev->private;
+
+ if (netDevice->init)
+ (*netDevice->init)(netDevice);
if ((ftp = FtpInit()) == NULL) {
msgConfirm("FTP initialisation failed!");
@@ -476,18 +492,22 @@ mediaInitFTP(Device *dev)
return FALSE;
}
+ msgDebug("Using URL `%s'\n", url);
hostname = url + 6;
dir = index(hostname, '/');
*(dir++) = '\0';
- if (gethostbyname(hostname) == NULL) {
+ msgDebug("hostname = `%s'\n", hostname);
+ msgDebug("dir = `%s'\n", dir);
+ if ((gethostbyname(hostname) == NULL) && (inet_addr(hostname) == INADDR_NONE)) {
msgConfirm("Cannot resolve hostname `%s'!\n", hostname);
return FALSE;
}
snprintf(email, BUFSIZ, "installer@%s", my_name);
+ msgDebug("Using fake e-mail `%s'\n", email);
if ((i = FtpOpen(ftp, hostname, "anonymous", email)) != 0) {
- msgConfirm("Couldn't open FTP connection to %s (%u)\n", strerror(i), i);
+ msgConfirm("Couldn't open FTP connection to %s: %s (%u)\n", hostname, strerror(i), i);
return FALSE;
}
@@ -506,7 +526,73 @@ mediaInitFTP(Device *dev)
int
mediaGetFTP(char *dist)
{
- return -1;
+ int fd;
+ char buf[512];
+ int pfd[2], pid, numchunks;
+ const char *tmp;
+ struct attribs *dist_attr;
+
+ dist_attr = safe_malloc(sizeof(struct attribs) * MAX_ATTRIBS);
+
+ snprintf(buf, PATH_MAX, "/stand/info/%s.inf", dist);
+
+ if (attr_parse(&dist_attr, buf) == 0)
+ {
+ msgConfirm("Cannot load information file for distribution\n");
+ return -1;
+ }
+
+ tmp = attr_match(dist_attr, "pieces");
+ numchunks = atoi(tmp);
+ msgDebug("Attempting to extract distribution from %u files\n", numchunks);
+
+ if (numchunks == 1)
+ {
+ snprintf(buf, 512, "%s.aa", dist);
+ return(FtpGet(ftp, buf));
+ }
+
+ pipe(pfd);
+ pid = fork();
+ if (!pid)
+ {
+ int chunk = 0;
+ int retval;
+
+ dup2(pfd[1], 1); close(pfd[1]);
+ close(pfd[0]);
+
+ while (chunk < numchunks)
+ {
+ int n;
+ char *buffer;
+
+ buffer = safe_malloc(1024);
+
+ snprintf(buf, 512, "%s.%c%c", dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
+ fd = FtpGet(ftp, buf);
+
+ while ((n = read(fd, buffer, 1024))>0)
+ {
+ retval = write(1, buffer, n);
+ if (retval != n)
+ {
+ msgConfirm("write didn't write out the complete file!\n
+(wrote %d bytes of %d bytes)\n", retval, n);
+ exit(1);
+ }
+
+ close(fd);
+ ++chunk;
+ }
+ FtpEOF(ftp);
+ }
+ close(1);
+ msgDebug("Extract of %s finished!!!\n", dist);
+ exit(0);
+ }
+ close(pfd[1]);
+ return(pfd[0]);
}
void
diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c
index c7c99c274d62..6b4074012c2e 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.24 1995/05/21 18:24:34 jkh Exp $
+ * $Id: menus.c,v 1.25 1995/05/23 02:41:13 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -205,7 +205,7 @@ To specify a URL not in this list, chose \"other\".",
DMENU_SET_VARIABLE, (void *)"ftp=ftp://ftp.freebsd.org/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
{ "Secondary Site", "freefall.cdrom.com",
DMENU_SET_VARIABLE, (void *)"ftp=ftp://freefall.cdrom.com/pub/FreeBSD/2.0.5-ALPHA", 0, 0 },
- { "Other", "Specify another ftp site by URL (e.g. ftp://some.site/pub/FreeBSD/..)",
+ { "Other", "Specify some other ftp site by URL",
DMENU_SET_VARIABLE, (void *)"ftp=other", 0, 0 },
{ "Australia", "ftp.physics.usyd.edu.au",
DMENU_SET_VARIABLE, (void *)"ftp=ftp://ftp.physics.usyd.edu.au/FreeBSD/2.0.5-ALPHA", 0, 0 },
@@ -377,7 +377,7 @@ selecting OK at this stage will chose them as defaults.",
{ "src", "Sources for everything but DES [120MB]",
DMENU_CALL, (void *)distSetSrc, 0 },
{ "XFree86", "The XFree86 3.1.1L distribution [?]",
- DMENU_SUBMENU, (void *)&MenuXF86, 0 },
+ DMENU_SUBMENU, (void *)&MenuXF86Select, 0 },
{ NULL } },
};
@@ -421,26 +421,6 @@ you wish to install.",
{ NULL } },
};
-DMenu MenuXF86 = {
- DMENU_NORMAL_TYPE,
- "XFree86 3.1.1u1 Distribution",
- "Welcome to the XFree86 3.1.1u1 distribution from The XFree86\n\
-Project, Inc. Our recommended sequence is to Select the desired\n\
-release components, Configure XFree86 and then (optionally)\n\
-Start it up!",
- "Press F1 to read the XFree86 release notes for FreeBSD",
- "XFree86.hlp",
- { { "Select", "Select and load components of the XFree86 distribution",
- DMENU_SUBMENU, &MenuXF86Select, 0, 0 },
- { "Configure", "Configure an installed XFree86 distribution",
- DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin xf86config",
- 0, 0 },
- { "Start", "Try to start the server up",
- DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin startx",
- 0, 0 },
- { NULL } }
-};
-
DMenu MenuXF86Select = {
DMENU_NORMAL_TYPE,
"XFree86 3.1.1u1 Distribution",
@@ -652,3 +632,29 @@ boot record to be untouched, then select \"none\".",
DMENU_CALL, (void *)diskPartitionEditor, 0, 0 },
{ NULL } },
};
+
+/* Final configuration menu */
+DMenu MenuConfigure = {
+ DMENU_NORMAL_TYPE,
+ "FreeBSD Configuration Menu", /* title */
+ "Congradulations! If you're seeing this menu, FreeBSD is now\n\
+installed on your hard disk and just about ready to boot. There\n\
+are a last few things you may wish to set up at this point to make\n\
+your FreeBSD system more generally usable and which may be selected\n\
+from the menu below. When you're done, select Cancel.",
+ "Press F1 for more information on these options",
+ "configure.hlp",
+ { { "Time Zone", "Set which time zone you're in",
+ DMENU_SYSTEM_COMMAND, "tzsetup", 0, 0 },
+ { "Add User", "Add users to the system",
+ DMENU_SYSTEM_COMMAND, "adduser", 0, 0 },
+ { "Root Pass", "Set the system manager's password",
+ DMENU_SYSTEM_COMMAND, "passwd root", 0, 0 },
+ { "Packages", "Install extra FreeBSD packaged software",
+ DMENU_CALL, config_packages, 0, 1 },
+ { "Ports", "Enable the FreeBSD Ports Collection from CD",
+ DMENU_CALL, config_ports, 0, 1 },
+ { "XFree86", "Configure XFree86 (if installed)",
+ DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin xf86config", 0, 0 },
+ { NULL } },
+};
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index c735f2251c13..7e9f83e97eb3 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.27 1995/05/23 02:41:16 jkh Exp $
+ * $Id: sysinstall.h,v 1.28 1995/05/23 18:06:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -204,6 +204,7 @@ extern unsigned int XF86FontDists; /* The XFree86 fonts we want */
extern DMenu MenuInitial; /* Initial installation menu */
extern DMenu MenuMBRType; /* Type of MBR to write on the disk */
+extern DMenu MenuConfigure; /* Final configuration menu */
extern DMenu MenuDocumentation; /* Documentation menu */
extern DMenu MenuOptions; /* Installation options */
extern DMenu MenuOptionsLanguage; /* Language options menu */
@@ -240,6 +241,8 @@ extern void command_func_add(char *key, commandFunc func, void *data);
extern void config_fstab(void);
extern void config_sysconfig(void);
extern void config_resolv(void);
+extern int config_ports(char *str);
+extern int config_packages(char *str);
/* decode.c */
extern DMenuItem *decode(DMenu *menu, char *name);
diff --git a/release/sysinstall/tcpip.c b/release/sysinstall/tcpip.c
index 8a876ec055cc..69ecc08210f7 100644
--- a/release/sysinstall/tcpip.c
+++ b/release/sysinstall/tcpip.c
@@ -1,5 +1,5 @@
/*
- * $Id: tcpip.c,v 1.10 1995/05/21 15:40:54 jkh Exp $
+ * $Id: tcpip.c,v 1.11 1995/05/23 18:06:16 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@@ -566,8 +566,6 @@ tcpDeviceSelect(void)
msgFatal("Unable to create network device menu! Argh!");
dmenuOpenSimple(menu);
free(menu);
- if (netDevice->init)
- (*netDevice->init)(netDevice);
return netDevice;
}