summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-23 02:41:18 +0000
committerjkh <jkh@FreeBSD.org>1995-05-23 02:41:18 +0000
commit69df29fff8d1ce7a7a944f0d6431cebb54fca45e (patch)
tree1be6c68d1b91dc89c4abcef6f02b842e08f96593 /usr.sbin
parentc479e492f4696b134bb3a6de2a2b0ac949a5ac63 (diff)
downloadFreeBSD-src-69df29fff8d1ce7a7a944f0d6431cebb54fca45e.zip
FreeBSD-src-69df29fff8d1ce7a7a944f0d6431cebb54fca45e.tar.gz
1. Bring in the first cut of Poul's ftp routines. We still don't
use them yet, but it's close (we're working on the last wrinkles in the CD install for now). 2. Complete the CDROM installation strategy code. 3. Simplify the distribtuion loading code. 4. General error message cleanup. 5. Write the /etc/fstab file now and split those routines into config.c 6. Clean up the menus a little more.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/Makefile16
-rw-r--r--usr.sbin/sade/config.c195
-rw-r--r--usr.sbin/sade/devices.c4
-rw-r--r--usr.sbin/sade/install.c35
-rw-r--r--usr.sbin/sade/label.c44
-rw-r--r--usr.sbin/sade/menus.c29
-rw-r--r--usr.sbin/sade/msg.c42
-rw-r--r--usr.sbin/sade/sade.h39
-rw-r--r--usr.sbin/sade/system.c9
-rw-r--r--usr.sbin/sysinstall/Makefile16
-rw-r--r--usr.sbin/sysinstall/config.c195
-rw-r--r--usr.sbin/sysinstall/devices.c4
-rw-r--r--usr.sbin/sysinstall/dist.c26
-rw-r--r--usr.sbin/sysinstall/dist.h2
-rw-r--r--usr.sbin/sysinstall/ftp.c252
-rw-r--r--usr.sbin/sysinstall/install.c35
-rw-r--r--usr.sbin/sysinstall/label.c44
-rw-r--r--usr.sbin/sysinstall/media.c39
-rw-r--r--usr.sbin/sysinstall/menus.c29
-rw-r--r--usr.sbin/sysinstall/msg.c42
-rw-r--r--usr.sbin/sysinstall/sysinstall.h39
-rw-r--r--usr.sbin/sysinstall/system.c9
22 files changed, 918 insertions, 227 deletions
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
index 15a5197..3f5c46d 100644
--- a/usr.sbin/sade/Makefile
+++ b/usr.sbin/sade/Makefile
@@ -4,14 +4,14 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel
-SRCS= globals.c main.c dmenu.c \
- menus.c misc.c msg.c \
- system.c install.c termcap.c \
- media.c variable.c devices.c \
- dist.c lang.c wizard.c \
- disks.c command.c decode.c \
- label.c tcpip.c media_strategy.c \
- makedevs.c
+SRCS= globals.c main.c dmenu.c \
+ menus.c misc.c msg.c \
+ system.c install.c termcap.c \
+ media.c variable.c devices.c \
+ dist.c lang.c wizard.c \
+ disks.c command.c decode.c \
+ label.c tcpip.c media_strategy.c \
+ makedevs.c ftp.c config.c
CFLAGS+= -Wall -g -I${.CURDIR}/../libdisk \
-I${.CURDIR}/../../gnu/lib/libdialog
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c
new file mode 100644
index 0000000..526f1cc
--- /dev/null
+++ b/usr.sbin/sade/config.c
@@ -0,0 +1,195 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: install.c,v 1.47 1995/05/22 14:10:17 jkh Exp $
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Jordan Hubbard
+ * for the FreeBSD Project.
+ * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * 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 <sys/disklabel.h>
+
+static Chunk *chunk_list[MAX_CHUNKS];
+static int nchunks;
+
+/* arg to sort */
+static int
+chunk_compare(const void *p1, const void *p2)
+{
+ Chunk *c1, *c2;
+
+ c1 = (Chunk *)p1;
+ c2 = (Chunk *)p2;
+ if (!c1->private && !c2->private)
+ return 0;
+ else if (c1->private && !c2->private)
+ return -1;
+ else if (!c1->private && c2->private)
+ return 1;
+ else
+ return strcmp(((PartInfo *)c1->private)->mountpoint, ((PartInfo *)c2->private)->mountpoint);
+}
+
+static char *
+mount_point(Chunk *c1)
+{
+ if (c1->type == PART_FAT || (c1->type == part && c1->subtype != FS_SWAP))
+ return ((PartInfo *)c1->private)->mountpoint;
+ else if (c1->type == part && c1->subtype == FS_SWAP)
+ return "none";
+ return "/bogus";
+}
+
+static char *
+fstype(Chunk *c1)
+{
+ if (c1->type == PART_FAT)
+ return "msdos";
+ else if (c1->type == part) {
+ if (c1->subtype != FS_SWAP)
+ return "ufs";
+ else
+ return "swap";
+ }
+ return "bogfs";
+}
+
+static char *
+fstype_short(Chunk *c1)
+{
+ if (c1->type == part) {
+ if (c1->subtype != FS_SWAP)
+ return "rw";
+ else
+ return "sw";
+ }
+ return "bog";
+}
+
+static int
+seq_num(Chunk *c1)
+{
+ if (c1->type == part) {
+ if (c1->subtype != FS_SWAP)
+ return 1;
+ else
+ return 0;
+ }
+ return -1;
+}
+
+void
+config_fstab(void)
+{
+ Device **devs;
+ Disk *disk;
+ FILE *fstab;
+ int i, cnt;
+ Chunk *c1, *c2;
+
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("No disks found!");
+ return;
+ }
+
+ /* Record all the chunks */
+ for (i = 0; devs[i]; i++) {
+ if (!devs[i]->enabled)
+ continue;
+ disk = (Disk *)devs[i]->private;
+ if (!disk->chunks)
+ msgFatal("No chunk list found for %s!", disk->name);
+ for (c1 = disk->chunks->part; c1; c1 = c1->next)
+ if (c1->type == freebsd)
+ for (c2 = c1->part; c2; c2 = c2->next)
+ if (c2->type == part || c2->type == fat)
+ chunk_list[nchunks++] = c2;
+ }
+
+ /* Sort them puppies! */
+ qsort(chunk_list, nchunks, sizeof(Chunk *), chunk_compare);
+
+ fstab = fopen("/etc/fstab", "w");
+ if (!fstab) {
+ msgConfirm("Unable to create a new /etc/fstab file!\nManual intervention will be required.");
+ return;
+ }
+
+ /* Go for the burn */
+ msgNotify("Generating /etc/fstab file");
+ for (i = 0; i < nchunks; i++) {
+ fprintf(fstab, "/dev/%s\t\t\t%s\t\t%s %s %d %d\n", chunk_list[i]->name, mount_point(chunk_list[i]),
+ fstype(chunk_list[i]), fstype_short(chunk_list[i]), seq_num(chunk_list[i]),
+ seq_num(chunk_list[i]));
+ }
+
+ Mkdir("/proc", NULL);
+ fprintf(fstab, "proc\t\t\t/proc\t\tprocfs rw 0 0\n");
+
+ /* Now look for the CDROMs */
+ devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
+ cnt = deviceCount(devs);
+
+ /* Write the first one out as /cdrom */
+ if (cnt) {
+ Mkdir("/cdrom", NULL);
+ fprintf(fstab, "/dev/%s\t\t\t/cdrom\t\tcd9660 ro 0 0\n", devs[0]->name);
+ }
+
+ /* Write the others out as /cdrom<n> */
+ for (i = 1; i < cnt; i++) {
+ char cdname[10];
+
+ sprintf(cdname, "/cdrom%d", i);
+ Mkdir(cdname, NULL);
+ fprintf(fstab, "/dev/%s\t\t\t%s\t\tcd9660 ro 0 0\n", devs[i]->name, cdname);
+ }
+ fclose(fstab);
+}
+
+void
+config_sysconfig(void)
+{
+}
+
+void
+config_resolv(void)
+{
+}
+
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c
index d39cae2..a1c501c 100644
--- a/usr.sbin/sade/devices.c
+++ b/usr.sbin/sade/devices.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: devices.c,v 1.26 1995/05/21 15:40:46 jkh Exp $
+ * $Id: devices.c,v 1.27 1995/05/21 18:24:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -236,7 +236,7 @@ deviceGetAll(void)
if (fd >= 0) {
close(fd);
/* The only network devices that have fds associated are serial ones */
- deviceRegister("ppp0", device_names[i].description, strdup(try),
+ deviceRegister(device_names[i].name, device_names[i].description, strdup(try),
DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, mediaCloseNetwork, NULL);
msgDebug("Found a device of type network named: %s\n", device_names[i].name);
}
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index a00431a..2253445 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.46 1995/05/21 15:40:48 jkh Exp $
+ * $Id: install.c,v 1.47 1995/05/22 14:10:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -53,7 +53,6 @@ Boolean SystemWasInstalled;
static void make_filesystems(void);
static void copy_self(void);
static void cpio_extract(void);
-static void install_configuration_files(void);
static void do_final_setup(void);
static Disk *rootdisk;
@@ -90,7 +89,7 @@ checkLabels(void)
}
}
- /* Now register the swap devices */
+ /* Now check for swap devices */
for (i = 0; devs[i]; i++) {
disk = (Disk *)devs[i]->private;
msgDebug("Scanning disk %s for swap partitions\n", disk->name);
@@ -208,7 +207,9 @@ installFinal(void)
if (alreadyDone)
return;
- install_configuration_files();
+ config_fstab();
+ config_sysconfig();
+ config_resolv();
do_final_setup();
alreadyDone = TRUE;
}
@@ -331,7 +332,7 @@ copy_self(void)
{
int i;
- msgNotify("Copying the boot floppy to /stand on root filesystem");
+ msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem");
i = vsystem("find -x /stand | cpio -pdmv /mnt");
if (i)
msgConfirm("Copy returned error status of %d!", i);
@@ -341,14 +342,17 @@ static void
cpio_extract(void)
{
int i, j, zpid, cpid, pfd[2];
+ Boolean onCDROM = FALSE;
#if 0
if (mediaDevice && mediaDevice->type == DEVICE_TYPE_CDROM) {
if (mediaDevice->init) {
if ((*mediaDevice->init)(mediaDevice)) {
CpioFD = open("/cdrom/floppies/cpio.flp", O_RDONLY);
- if (CpioFD != -1)
+ if (CpioFD != -1) {
msgNotify("Loading CPIO floppy from CDROM");
+ onCDROM = TRUE;
+ }
}
}
}
@@ -364,7 +368,7 @@ cpio_extract(void)
j = fork();
if (!j) {
chdir("/");
- msgNotify("Extracting contents of CPIO floppy...");
+ msgWeHaveOutput("Extracting contents of CPIO floppy...");
pipe(pfd);
zpid = fork();
if (!zpid) {
@@ -399,22 +403,22 @@ cpio_extract(void)
close(CpioFD);
i = waitpid(zpid, &j, 0);
- if (i < 0 || _WSTATUS(j)) {
+ if (i < 0) { /* Don't check status - gunzip seems to return a bogus one! */
dialog_clear();
- msgConfirm("gunzip returned error status of %d!", _WSTATUS(j));
+ msgConfirm("wait for gunzip returned status of %d!", i);
exit(1);
}
i = waitpid(cpid, &j, 0);
- if (i < 0 || _WSTATUS(j)) {
+ if (i < 0 || WEXITSTATUS(j)) {
dialog_clear();
- msgConfirm("cpio returned error status of %d!", _WSTATUS(j));
+ msgConfirm("cpio returned error status of %d!", WEXITSTATUS(j));
exit(2);
}
exit(0);
}
else
i = wait(&j);
- if (i < 0 || _WSTATUS(j) || access("/OK", R_OK) == -1) {
+ if (i < 0 || WEXITSTATUS(j) || access("/OK", R_OK) == -1) {
dialog_clear();
msgConfirm("CPIO floppy did not extract properly! Please verify\nthat your media is correct and try again.");
close(CpioFD);
@@ -422,11 +426,8 @@ cpio_extract(void)
goto tryagain;
}
unlink("/OK");
-}
-
-static void
-install_configuration_files(void)
-{
+ if (!onCDROM)
+ msgConfirm("Please remove the CPIO floppy from the drive");
}
static void
diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c
index a5d811a..a06649b 100644
--- a/usr.sbin/sade/label.c
+++ b/usr.sbin/sade/label.c
@@ -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.20 1995/05/21 18:24:33 jkh Exp $
+ * $Id: label.c,v 1.21 1995/05/22 14:10:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -52,16 +52,6 @@
/* A nice message we use a lot in the disklabel editor */
#define MSG_NOT_APPLICABLE "That option is not applicable here"
-/*
- * I make some pretty gross assumptions about having a max of 50 chunks
- * total - 8 slices and 42 partitions. I can't easily display many more
- * than that on the screen at once!
- *
- * For 2.1 I'll revisit this and try to make it more dynamic, but since
- * this will catch 99.99% of all possible cases, I'm not too worried.
- */
-#define MAX_CHUNKS 50
-
/* Where to start printing the freebsd slices */
#define CHUNK_SLICE_START_ROW 2
#define CHUNK_PART_START_ROW 11
@@ -348,10 +338,9 @@ print_label_chunks(void)
pcol = PART_OFF;
prow = CHUNK_PART_START_ROW;
}
- memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name,
- strlen(label_chunk_info[i].c->name));
+ memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name, strlen(label_chunk_info[i].c->name));
/* If it's a filesystem, display the mountpoint */
- if (label_chunk_info[i].type == PART_FILESYSTEM) {
+ if (label_chunk_info[i].type == PART_FILESYSTEM || label_chunk_info[i].type == PART_FAT) {
if (label_chunk_info[i].c->private == NULL) {
static int mnt = 0;
char foo[10];
@@ -361,23 +350,21 @@ print_label_chunks(void)
* Fill in a fake mountpoint and register it
*/
sprintf(foo, "/mnt%d", mnt++);
- label_chunk_info[i].c->private =
- new_part(foo, FALSE,label_chunk_info[i].c->size);
+ label_chunk_info[i].c->private = new_part(foo, FALSE, label_chunk_info[i].c->size);
label_chunk_info[i].c->private_free = safe_free;
}
mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
- newfs = ((PartInfo *)label_chunk_info[i].c->private)->newfs ? "Y" : "N";
+ if (label_chunk_info[i].type == PART_FAT)
+ newfs = "DOS";
+ else
+ newfs = ((PartInfo *)label_chunk_info[i].c->private)->newfs ? "Y" : "N";
}
else if (label_chunk_info[i].type == PART_SWAP) {
mountpoint = "swap";
newfs = " ";
}
- else if (label_chunk_info[i].type == PART_FAT) {
- mountpoint = "DOS FAT";
- newfs = "*";
- }
else {
- mountpoint = "<unknown>";
+ mountpoint = "<NONE>";
newfs = "*";
}
for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
@@ -481,13 +468,12 @@ diskLabelEditor(char *str)
break;
}
{
- char *val, *cp, tmpb[20];
+ char *val, *cp;
int size;
struct chunk *tmp;
u_long flags = 0;
- snprintf(tmpb, 20, "%d", sz);
- val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
+ val = msgGetInput(NULL, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).\nSpace free: %d blocks (%dMB)", sz, sz / ONE_MEG);
if (!val || (size = strtol(val, &cp, 0)) <= 0)
break;
@@ -517,10 +503,8 @@ diskLabelEditor(char *str)
msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!");
break;
}
- if (size < ROOT_MIN_SIZE) {
- msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG);
- break;
- }
+ if (size < ROOT_MIN_SIZE)
+ msgConfirm("Warning: This is smaller than the recommended size for a\nroot partition. For a variety of reasons, root\npartitions should usually be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG);
}
tmp = Create_Chunk_DWIM(label_chunk_info[here].d,
label_chunk_info[here].c,
@@ -554,7 +538,7 @@ diskLabelEditor(char *str)
break;
}
else if (label_chunk_info[here].type == PART_FAT) {
- msg = "Use the Disk Partition Editor to delete this";
+ msg = "Use the Disk Partition Editor to delete DOS partitions";
break;
}
Delete_Chunk(label_chunk_info[here].d, label_chunk_info[here].c);
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index d081e3c..c7c99c2 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.23 1995/05/21 15:40:52 jkh Exp $
+ * $Id: menus.c,v 1.24 1995/05/21 18:24:34 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -197,13 +197,16 @@ choice. Also note that not all sites carry every possible distribution!\n\
Distributions other than the basic user set are only guaranteed to be\n\
available from the Primary site.\n\n\
If the first site selected doesn't respond, try one of the alternates.\n\
-You may also wish to investigate the Ftp options menu in case of trouble.",
+You may also wish to investigate the Ftp options menu in case of trouble.\n\
+To specify a URL not in this list, chose \"other\".",
"Select a site that's close!",
"install.hlp",
{ { "Primary Site", "ftp.freebsd.org",
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/..)",
+ 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 },
{ "Finland", "nic.funet.fi",
@@ -326,9 +329,9 @@ type of system in question. If you would prefer to pick and choose\n\
the list of distributions yourself, simply select \"custom\".",
"Press F1 for more information on the various distributions",
"dist_types.hlp",
- { { "Developer", "Full sources, binaries and doc but no games [48MB]",
+ { { "Developer", "Full sources, binaries and doc but no games [171MB]",
DMENU_CALL, (void *)distSetDeveloper, 0, 0 },
- { "X-Developer", "Same as above, but includes XFree86 [73MB]",
+ { "X-Developer", "Same as above, but includes XFree86 [196MB]",
DMENU_CALL, (void *)distSetXDeveloper, 0, 0 },
{ "User", "Average user - binaries and doc but no sources [19MB]",
DMENU_CALL, (void *)distSetUser, 0, 0 },
@@ -336,7 +339,7 @@ the list of distributions yourself, simply select \"custom\".",
DMENU_CALL, (void *)distSetXUser, 0, 0 },
{ "Minimal", "The smallest configuration possible [15MB]",
DMENU_CALL, (void *)distSetMinimum, 0, 0 },
- { "Everything", "All sources, binaries and XFree86 binaries [80MB]",
+ { "Everything", "All sources, binaries and XFree86 binaries [203MB]",
DMENU_CALL, (void *)distSetEverything, 0, 0 },
{ "Custom", "Specify your own distribution set [?]",
DMENU_SUBMENU, (void *)&MenuDistributions, 0, 0 },
@@ -351,7 +354,7 @@ of the most generally useful distributions are already checked, and\n\
selecting OK at this stage will chose them as defaults.",
"Press F1 for a more complete description of these distributions.",
"distribution_types.hlp",
- { { "*bin", "Binary base distribution (required) [15MB]",
+ { { "*bin", "Binary base distribution (required) [36MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_BIN, 0 },
{ "commercial", "Commercial demos and shareware [10MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMMERCIAL, 0 },
@@ -361,17 +364,17 @@ selecting OK at this stage will chose them as defaults.",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMPAT20, 0 },
{ "DES", "DES encryption code and sources [.3MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_DES, 0 },
- { "dict", "Spelling checker disctionary files [1.3MB]",
+ { "dict", "Spelling checker disctionary files [4.2MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_DICT, 0 },
- { "games", "Games and other amusements (non-commercial) [2.8MB]",
+ { "games", "Games and other amusements (non-commercial) [6.4MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_GAMES, 0 },
- { "info", "GNU info files [1.2MB]",
+ { "info", "GNU info files [4.1MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_INFO, 0 },
- { "*man", "System manual pages - strongly recommended [2.8MB]",
+ { "*man", "System manual pages - strongly recommended [3.3MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_MANPAGES, 0 },
- { "proflibs", "Profiled versions of the libraries [.9MB]",
+ { "proflibs", "Profiled versions of the libraries [3.3MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_PROFLIBS, 0 },
- { "src", "Sources for everything but DES [25MB]",
+ { "src", "Sources for everything but DES [120MB]",
DMENU_CALL, (void *)distSetSrc, 0 },
{ "XFree86", "The XFree86 3.1.1L distribution [?]",
DMENU_SUBMENU, (void *)&MenuXF86, 0 },
@@ -641,7 +644,7 @@ an existing one, select \"standard\". If you would prefer your master\n\
boot record to be untouched, then select \"none\".",
"Press F1 to read the installation guide",
"install.hlp",
- { { "BootMgr", "Install the FreeBSD Boot Manager (\"Booteasy\")", /* B */
+ { { "*BootMgr", "Install the FreeBSD Boot Manager (\"Booteasy\")", /* B */
DMENU_SET_VARIABLE, (void *)"bootManager=bteasy", 0, 0 },
{ "Standard", "Use a standard MBR (no boot manager)", /* S */
DMENU_SET_VARIABLE, (void *)"bootManager=mbr", 0, 0 },
diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c
index c78621d..b2f4baf 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.21 1995/05/20 19:12:12 phk Exp $
+ * $Id: msg.c,v 1.22 1995/05/22 14:10:25 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -73,21 +73,32 @@ msgInfo(char *fmt, ...)
{
va_list args;
char *errstr;
- int attrs;
+ int i, attrs;
+ char line[81];
+ attrs = getattrs(stdscr);
/* NULL is a special convention meaning "erase the old stuff" */
if (!fmt) {
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0);
+ attrset(A_REVERSE);
clrtoeol();
+ attrset(attrs);
return;
}
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
- attrs = getattrs(stdscr);
- attrset(A_NORMAL);
- mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
+ memset(line, ' ', 80);
+ for (i = 0; i < 80; i++) {
+ if (errstr[i])
+ line[i] = errstr[i];
+ else
+ break;
+ }
+ line[80] = '\0';
+ attrset(A_REVERSE);
+ mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line);
attrset(attrs);
refresh();
if (OnVTY) {
@@ -303,3 +314,24 @@ msgDebug(char *fmt, ...)
write(DebugFD, dbg, strlen(dbg));
free(dbg);
}
+
+/* Tell the user there's some output to go look at */
+void
+msgWeHaveOutput(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+
+ errstr = (char *)safe_malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ msgDebug("Notify: %s\n", errstr);
+ dialog_clear();
+ dialog_msgbox("Information Dialog", errstr, -1, -1, 0);
+ free(errstr);
+ if (OnVTY)
+ msgInfo("Command output is on debugging screen - type ALT-F2 to see it");
+}
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 4813cae..3c3a0f9 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.25 1995/05/20 20:30:12 jkh Exp $
+ * $Id: sysinstall.h,v 1.26 1995/05/21 15:40:53 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -70,6 +70,15 @@
#define DEV_MAX 200 /* The maximum number of devices we'll deal with */
#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
+/*
+ * I make some pretty gross assumptions about having a max of 50 chunks
+ * total - 8 slices and 42 partitions. I can't easily display many more
+ * than that on the screen at once!
+ *
+ * For 2.1 I'll revisit this and try to make it more dynamic, but since
+ * this will catch 99.99% of all possible cases, I'm not too worried.
+ */
+#define MAX_CHUNKS 50
/* Internal flag variables */
#define DISK_PARTITIONED "_diskPartitioned"
@@ -226,6 +235,11 @@ extern void command_execute(void);
extern void command_shell_add(char *key, char *fmt, ...);
extern void command_func_add(char *key, commandFunc func, void *data);
+/* config.c */
+extern void config_fstab(void);
+extern void config_sysconfig(void);
+extern void config_resolv(void);
+
/* decode.c */
extern DMenuItem *decode(DMenu *menu, char *name);
extern Boolean dispatch(DMenuItem *tmp, char *name);
@@ -302,32 +316,30 @@ extern int mediaSetDOS(char *str);
extern int mediaSetTape(char *str);
extern int mediaSetFTP(char *str);
extern int mediaSetFS(char *str);
-extern int mediaOpen(char *parent, char *me);
extern Boolean mediaGetType(void);
-extern Boolean mediaExtractDist(char *dir, int fd);
+extern Boolean mediaExtractDist(char *distname, char *dir, int fd);
extern Boolean mediaVerify(void);
-extern void mediaClose(void);
/* media_strategy.c */
-extern Boolean mediaInitUFS(Device *dev);
-extern Boolean mediaGetUFS(char *dist);
extern Boolean mediaInitCDROM(Device *dev);
extern Boolean mediaInitDOS(Device *dev);
-extern Boolean mediaGetFloppy(char *dist);
extern Boolean mediaInitFloppy(Device *dev);
-extern Boolean mediaGetCDROM(char *dist);
-extern Boolean mediaGetDOS(char *dist);
-extern Boolean mediaInitTape(Device *dev);
-extern Boolean mediaGetTape(char *dist);
extern Boolean mediaInitFTP(Device *dev);
extern Boolean mediaInitNetwork(Device *dev);
-extern Boolean mediaGetFTP(char *dist);
-extern void mediaCloseTape(Device *dev);
+extern Boolean mediaInitTape(Device *dev);
+extern Boolean mediaInitUFS(Device *dev);
+extern int mediaGetCDROM(char *dist);
+extern int mediaGetDOS(char *dist);
+extern int mediaGetFloppy(char *dist);
+extern int mediaGetFTP(char *dist);
+extern int mediaGetTape(char *dist);
+extern int mediaGetUFS(char *dist);
extern void mediaCloseCDROM(Device *dev);
extern void mediaCloseDOS(Device *dev);
extern void mediaCloseFTP(Device *dev);
extern void mediaCloseFloppy(Device *dev);
extern void mediaCloseNetwork(Device *dev);
+extern void mediaCloseTape(Device *dev);
/* misc.c */
extern Boolean file_readable(char *fname);
@@ -354,6 +366,7 @@ extern void msgError(char *fmt, ...);
extern void msgFatal(char *fmt, ...);
extern void msgConfirm(char *fmt, ...);
extern void msgNotify(char *fmt, ...);
+extern void msgWeHaveOutput(char *fmt, ...);
extern int msgYesNo(char *fmt, ...);
extern char *msgGetInput(char *buf, char *fmt, ...);
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index 8c07585..cd62dd2 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.26 1995/05/21 01:56:03 phk Exp $
+ * $Id: system.c,v 1.28 1995/05/21 06:12:44 phk Exp $
*
* Jordan Hubbard
*
@@ -229,6 +229,7 @@ systemChangeFont(const u_char font[])
if (ioctl(0, PIO_FONT8x16, font) < 0)
msgConfirm("Sorry! Unable to load font for %s", getenv("LANG"));
}
+ dialog_clear();
}
void
@@ -251,7 +252,6 @@ systemChangeTerminal(char *color, const u_char c_term[],
setterm(color);
init_acs();
cbreak(); noecho();
- dialog_clear();
}
else {
setenv("TERM", mono, 1);
@@ -260,8 +260,8 @@ systemChangeTerminal(char *color, const u_char c_term[],
setterm(mono);
init_acs();
cbreak(); noecho();
- dialog_clear();
}
+ dialog_clear();
}
}
@@ -272,9 +272,10 @@ systemChangeScreenmap(const u_char newmap[])
if (ioctl(0, PIO_SCRNMAP, newmap) < 0)
msgConfirm("Sorry! Unable to load the screenmap for %s",
getenv("LANG"));
- dialog_clear();
}
+ dialog_clear();
}
+
int
vsystem(char *fmt, ...)
{
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile
index 15a5197..3f5c46d 100644
--- a/usr.sbin/sysinstall/Makefile
+++ b/usr.sbin/sysinstall/Makefile
@@ -4,14 +4,14 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel
-SRCS= globals.c main.c dmenu.c \
- menus.c misc.c msg.c \
- system.c install.c termcap.c \
- media.c variable.c devices.c \
- dist.c lang.c wizard.c \
- disks.c command.c decode.c \
- label.c tcpip.c media_strategy.c \
- makedevs.c
+SRCS= globals.c main.c dmenu.c \
+ menus.c misc.c msg.c \
+ system.c install.c termcap.c \
+ media.c variable.c devices.c \
+ dist.c lang.c wizard.c \
+ disks.c command.c decode.c \
+ label.c tcpip.c media_strategy.c \
+ makedevs.c ftp.c config.c
CFLAGS+= -Wall -g -I${.CURDIR}/../libdisk \
-I${.CURDIR}/../../gnu/lib/libdialog
diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c
new file mode 100644
index 0000000..526f1cc
--- /dev/null
+++ b/usr.sbin/sysinstall/config.c
@@ -0,0 +1,195 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id: install.c,v 1.47 1995/05/22 14:10:17 jkh Exp $
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Jordan Hubbard
+ * for the FreeBSD Project.
+ * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * 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 <sys/disklabel.h>
+
+static Chunk *chunk_list[MAX_CHUNKS];
+static int nchunks;
+
+/* arg to sort */
+static int
+chunk_compare(const void *p1, const void *p2)
+{
+ Chunk *c1, *c2;
+
+ c1 = (Chunk *)p1;
+ c2 = (Chunk *)p2;
+ if (!c1->private && !c2->private)
+ return 0;
+ else if (c1->private && !c2->private)
+ return -1;
+ else if (!c1->private && c2->private)
+ return 1;
+ else
+ return strcmp(((PartInfo *)c1->private)->mountpoint, ((PartInfo *)c2->private)->mountpoint);
+}
+
+static char *
+mount_point(Chunk *c1)
+{
+ if (c1->type == PART_FAT || (c1->type == part && c1->subtype != FS_SWAP))
+ return ((PartInfo *)c1->private)->mountpoint;
+ else if (c1->type == part && c1->subtype == FS_SWAP)
+ return "none";
+ return "/bogus";
+}
+
+static char *
+fstype(Chunk *c1)
+{
+ if (c1->type == PART_FAT)
+ return "msdos";
+ else if (c1->type == part) {
+ if (c1->subtype != FS_SWAP)
+ return "ufs";
+ else
+ return "swap";
+ }
+ return "bogfs";
+}
+
+static char *
+fstype_short(Chunk *c1)
+{
+ if (c1->type == part) {
+ if (c1->subtype != FS_SWAP)
+ return "rw";
+ else
+ return "sw";
+ }
+ return "bog";
+}
+
+static int
+seq_num(Chunk *c1)
+{
+ if (c1->type == part) {
+ if (c1->subtype != FS_SWAP)
+ return 1;
+ else
+ return 0;
+ }
+ return -1;
+}
+
+void
+config_fstab(void)
+{
+ Device **devs;
+ Disk *disk;
+ FILE *fstab;
+ int i, cnt;
+ Chunk *c1, *c2;
+
+ devs = deviceFind(NULL, DEVICE_TYPE_DISK);
+ if (!devs) {
+ msgConfirm("No disks found!");
+ return;
+ }
+
+ /* Record all the chunks */
+ for (i = 0; devs[i]; i++) {
+ if (!devs[i]->enabled)
+ continue;
+ disk = (Disk *)devs[i]->private;
+ if (!disk->chunks)
+ msgFatal("No chunk list found for %s!", disk->name);
+ for (c1 = disk->chunks->part; c1; c1 = c1->next)
+ if (c1->type == freebsd)
+ for (c2 = c1->part; c2; c2 = c2->next)
+ if (c2->type == part || c2->type == fat)
+ chunk_list[nchunks++] = c2;
+ }
+
+ /* Sort them puppies! */
+ qsort(chunk_list, nchunks, sizeof(Chunk *), chunk_compare);
+
+ fstab = fopen("/etc/fstab", "w");
+ if (!fstab) {
+ msgConfirm("Unable to create a new /etc/fstab file!\nManual intervention will be required.");
+ return;
+ }
+
+ /* Go for the burn */
+ msgNotify("Generating /etc/fstab file");
+ for (i = 0; i < nchunks; i++) {
+ fprintf(fstab, "/dev/%s\t\t\t%s\t\t%s %s %d %d\n", chunk_list[i]->name, mount_point(chunk_list[i]),
+ fstype(chunk_list[i]), fstype_short(chunk_list[i]), seq_num(chunk_list[i]),
+ seq_num(chunk_list[i]));
+ }
+
+ Mkdir("/proc", NULL);
+ fprintf(fstab, "proc\t\t\t/proc\t\tprocfs rw 0 0\n");
+
+ /* Now look for the CDROMs */
+ devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
+ cnt = deviceCount(devs);
+
+ /* Write the first one out as /cdrom */
+ if (cnt) {
+ Mkdir("/cdrom", NULL);
+ fprintf(fstab, "/dev/%s\t\t\t/cdrom\t\tcd9660 ro 0 0\n", devs[0]->name);
+ }
+
+ /* Write the others out as /cdrom<n> */
+ for (i = 1; i < cnt; i++) {
+ char cdname[10];
+
+ sprintf(cdname, "/cdrom%d", i);
+ Mkdir(cdname, NULL);
+ fprintf(fstab, "/dev/%s\t\t\t%s\t\tcd9660 ro 0 0\n", devs[i]->name, cdname);
+ }
+ fclose(fstab);
+}
+
+void
+config_sysconfig(void)
+{
+}
+
+void
+config_resolv(void)
+{
+}
+
diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c
index d39cae2..a1c501c 100644
--- a/usr.sbin/sysinstall/devices.c
+++ b/usr.sbin/sysinstall/devices.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: devices.c,v 1.26 1995/05/21 15:40:46 jkh Exp $
+ * $Id: devices.c,v 1.27 1995/05/21 18:24:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -236,7 +236,7 @@ deviceGetAll(void)
if (fd >= 0) {
close(fd);
/* The only network devices that have fds associated are serial ones */
- deviceRegister("ppp0", device_names[i].description, strdup(try),
+ deviceRegister(device_names[i].name, device_names[i].description, strdup(try),
DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, mediaCloseNetwork, NULL);
msgDebug("Found a device of type network named: %s\n", device_names[i].name);
}
diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c
index 8a15b1b..095bb44 100644
--- a/usr.sbin/sysinstall/dist.c
+++ b/usr.sbin/sysinstall/dist.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dist.c,v 1.15 1995/05/21 15:40:47 jkh Exp $
+ * $Id: dist.c,v 1.16 1995/05/22 14:10:15 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -216,35 +216,39 @@ distExtract(char *parent, Distribution *me)
status = 0;
if (mediaDevice->init)
if ((*mediaDevice->init)(mediaDevice) == FALSE)
- return 0;
+ return 0;
for (i = 0; me[i].my_name; i++) {
if (me[i].my_bit & *(me[i].my_mask)) {
if (me[i].my_dist)
status = distExtract(me[i].my_name, me[i].my_dist);
else {
- fd = mediaOpen(parent, me[i].my_name);
+ char distname[FILENAME_MAX];
+
+ if (parent)
+ snprintf(distname, FILENAME_MAX, "%s%s", parent, me[i].my_name);
+ else
+ snprintf(distname, FILENAME_MAX, "%s/%s", me[i].my_name, me[i].my_name);
+ fd = (*mediaDevice->get)(distname);
if (fd != -1) {
- status = mediaExtractDist(me[i].my_dir, fd);
+ status = mediaExtractDist(distname, me[i].my_dir, fd);
close(fd);
}
else {
if (getenv(NO_CONFIRMATION))
status = 0;
else
- status = !msgYesNo("Unable to transfer the %s%s distribution from %s.\nDo you want to retry this distribution later?", parent ? parent :
-"", me[i].my_name, mediaDevice->name);
+ status = !msgYesNo("Unable to transfer the %s distribution from %s.\nDo you want to retry this distribution later?", distname);
}
}
if (!status) {
- /*
- * Extract was successful, remove ourselves from further
- * consideration
- */
+ /* Extract was successful, remove ourselves from further consideration */
*(me[i].my_mask) &= ~(me[i].my_bit);
}
}
}
- mediaClose();
+ if (mediaDevice->close)
+ (*mediaDevice->close)(mediaDevice);
+ mediaDevice = NULL;
return status;
}
diff --git a/usr.sbin/sysinstall/dist.h b/usr.sbin/sysinstall/dist.h
index 0b37848..79f78af 100644
--- a/usr.sbin/sysinstall/dist.h
+++ b/usr.sbin/sysinstall/dist.h
@@ -46,7 +46,7 @@
#define DIST_SRC_UBIN 0x1000
#define DIST_SRC_USBIN 0x2000
#define DIST_SRC_XF86 0x4000
-#define DIST_SRC_ALL 0xFFFF
+#define DIST_SRC_ALL 0x3FFF /* Don't include XFree86 source by default */
/* Subtypes for XFree86 distribution */
#define DIST_XF86_BIN 0x0001
diff --git a/usr.sbin/sysinstall/ftp.c b/usr.sbin/sysinstall/ftp.c
new file mode 100644
index 0000000..0d0cf17
--- /dev/null
+++ b/usr.sbin/sysinstall/ftp.c
@@ -0,0 +1,252 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <netdb.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include "ftp.h"
+#include "sysinstall.h"
+
+static void
+debug(FTP_t ftp, const char *fmt, ...)
+{
+ char p[BUFSIZ];
+ va_list ap;
+ va_start(ap, fmt);
+ (void) vsnprintf(p, sizeof p, fmt, ap);
+ va_end(ap);
+
+#if 0
+ write(ftp->fd_debug,p,strlen(p));
+#else
+ msgDebug(p);
+#endif
+}
+
+static int
+writes(int fd, char *s)
+{
+ int i = strlen(s);
+ if (i != write(fd,s,i))
+ return errno ? errno : -1;
+ return 0;
+}
+
+static char*
+get_a_line(FTP_t ftp)
+{
+ static char buf[BUFSIZ];
+ int i,j;
+
+ for(i=0;i<BUFSIZ;) {
+ j = read(ftp->fd_ctrl,buf+i,1);
+ if (j != 1)
+ return 0;
+ if (buf[i] == '\r' || buf[i] == '\n') {
+ if (!i)
+ continue;
+ buf[i] = '\0';
+ debug(ftp,"LIBFTP: received <%s>\n",buf);
+ return buf;
+ }
+ i++;
+ }
+}
+
+int
+get_a_number(FTP_t ftp)
+{
+ char *p;
+
+ while(1) {
+ p = get_a_line(ftp);
+ if (p[3] != ' ' && p[3] != ' ')
+ continue;
+ return atoi(p);
+ }
+}
+
+static int
+cmd(FTP_t ftp, const char *fmt, ...)
+{
+ char p[BUFSIZ];
+ int i;
+ va_list ap;
+ va_start(ap, fmt);
+ (void) vsnprintf(p, sizeof p, fmt, ap);
+ va_end(ap);
+ debug(ftp,"LIBFTP: send <%s>\n",p);
+ if (writes(ftp->fd_ctrl,p))
+ return -1;
+ if (writes(ftp->fd_ctrl,"\r\n"))
+ return -1;
+ i = get_a_number(ftp);
+ debug(ftp, "LIBFTP: got %d\n",i);
+ return i;
+}
+
+FTP_t
+FtpInit()
+{
+ FTP_t ftp;
+
+ ftp = malloc(sizeof *ftp);
+ if (!ftp)
+ return ftp;
+ memset(ftp, 0, sizeof *ftp);
+ ftp->fd_ctrl = -1;
+ ftp->fd_debug = -1;
+ return ftp;
+}
+#if 0
+void
+FtpDebug(FTP_t ftp, int i)
+{
+ ftp->fd_debug = i;
+}
+#endif
+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];
+
+ if (!user)
+ user = "ftp";
+
+ if (!passwd)
+ passwd = "??@??(FreeBSD:libftp)"; /* XXX */
+
+ he = gethostbyname(host);
+ if (!he)
+ return ENOENT;
+
+ se = getservbyname("ftp","tcp");
+ if (!se)
+ return ENOENT;
+
+ 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;
+
+ if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+ (void)close(s);
+ return -1;
+ }
+
+ ftp->fd_ctrl = s;
+
+ debug(ftp, "LIBFTP: open (%d)\n",get_a_number(ftp));
+
+ cmd(ftp,"USER %s",user);
+ cmd(ftp,"PASS %s",passwd);
+ return 0;
+
+ fail:
+ close(ftp->fd_ctrl);
+ ftp->fd_ctrl = -1;
+ return -1;
+}
+
+int
+FtpChdir(FTP_t ftp, char *dir)
+{
+ cmd(ftp,"CWD %s",dir);
+ return 0;
+}
+
+int
+FtpGet(FTP_t ftp, char *file)
+{
+ int fd,i,j,s;
+ char p[BUFSIZ],*q;
+ unsigned char addr[6];
+ struct sockaddr_in sin;
+
+ if(ftp->binary) {
+ cmd(ftp,"TYPE I");
+ } else {
+ return -1;
+ }
+ if(ftp->passive) {
+ if (writes(ftp->fd_ctrl,"PASV\r\n"))
+ return -1;
+ q = get_a_line(ftp);
+ if (strncmp(q,"227 ",4))
+ return -1;
+ q = strchr(q,'(');
+ if (!q)
+ return -1;
+ for(i=0;i<6;i++) {
+ q++;
+ addr[i] = strtol(q,&q,10);
+ debug(ftp,"ADDR[%d] = %d (%c)\n",i,addr[i],*q);
+ }
+ if (*q != ')')
+ return -1;
+
+ sin.sin_family = ftp->addrtype;
+ bcopy(addr, (char *)&sin.sin_addr, 4);
+ bcopy(addr+4, (char *)&sin.sin_port, 2);
+ if ((s = socket(ftp->addrtype, SOCK_STREAM, 0)) < 0)
+ return -1;
+ debug(ftp,"Getsocket = %d\n",s);
+
+ if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+ (void)close(s);
+ debug(ftp,"connect, errno = %d\n",errno);
+ return -1;
+ }
+ cmd(ftp,"RETR %s",file);
+ return s;
+ } else {
+ return -1;
+ }
+}
+
+int
+FtpEOF(FTP_t ftp)
+{
+ get_a_number(ftp);
+}
+
+#ifdef STANDALONE_FTP
+
+/* main.c */
+
+int
+main(int argc, char **argv)
+{
+ FTP_t ftp;
+ int i;
+ char c;
+
+ ftp = FtpInit();
+ if (!ftp) err(1,"FtpInit()");
+
+ FtpDebug(ftp,1);
+ i = FtpOpen(ftp, "ref", "ftp", "phk-libftp@");
+ if (i) err(1,"FtpOpen(%d)",i);
+ FtpBinary(ftp,1);
+ FtpPassive(ftp,1);
+ FtpChdir(ftp,"/pub");
+ FtpChdir(ftp,"CTM");
+ i = FtpGet(ftp,"README_CTM_MOVED");
+ while(1 == read(i,&c,1))
+ putchar(c);
+ FtpEOF(ftp);
+ return 0;
+}
+
+#endif /*STANDALONE_FTP*/
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index a00431a..2253445 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.46 1995/05/21 15:40:48 jkh Exp $
+ * $Id: install.c,v 1.47 1995/05/22 14:10:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -53,7 +53,6 @@ Boolean SystemWasInstalled;
static void make_filesystems(void);
static void copy_self(void);
static void cpio_extract(void);
-static void install_configuration_files(void);
static void do_final_setup(void);
static Disk *rootdisk;
@@ -90,7 +89,7 @@ checkLabels(void)
}
}
- /* Now register the swap devices */
+ /* Now check for swap devices */
for (i = 0; devs[i]; i++) {
disk = (Disk *)devs[i]->private;
msgDebug("Scanning disk %s for swap partitions\n", disk->name);
@@ -208,7 +207,9 @@ installFinal(void)
if (alreadyDone)
return;
- install_configuration_files();
+ config_fstab();
+ config_sysconfig();
+ config_resolv();
do_final_setup();
alreadyDone = TRUE;
}
@@ -331,7 +332,7 @@ copy_self(void)
{
int i;
- msgNotify("Copying the boot floppy to /stand on root filesystem");
+ msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem");
i = vsystem("find -x /stand | cpio -pdmv /mnt");
if (i)
msgConfirm("Copy returned error status of %d!", i);
@@ -341,14 +342,17 @@ static void
cpio_extract(void)
{
int i, j, zpid, cpid, pfd[2];
+ Boolean onCDROM = FALSE;
#if 0
if (mediaDevice && mediaDevice->type == DEVICE_TYPE_CDROM) {
if (mediaDevice->init) {
if ((*mediaDevice->init)(mediaDevice)) {
CpioFD = open("/cdrom/floppies/cpio.flp", O_RDONLY);
- if (CpioFD != -1)
+ if (CpioFD != -1) {
msgNotify("Loading CPIO floppy from CDROM");
+ onCDROM = TRUE;
+ }
}
}
}
@@ -364,7 +368,7 @@ cpio_extract(void)
j = fork();
if (!j) {
chdir("/");
- msgNotify("Extracting contents of CPIO floppy...");
+ msgWeHaveOutput("Extracting contents of CPIO floppy...");
pipe(pfd);
zpid = fork();
if (!zpid) {
@@ -399,22 +403,22 @@ cpio_extract(void)
close(CpioFD);
i = waitpid(zpid, &j, 0);
- if (i < 0 || _WSTATUS(j)) {
+ if (i < 0) { /* Don't check status - gunzip seems to return a bogus one! */
dialog_clear();
- msgConfirm("gunzip returned error status of %d!", _WSTATUS(j));
+ msgConfirm("wait for gunzip returned status of %d!", i);
exit(1);
}
i = waitpid(cpid, &j, 0);
- if (i < 0 || _WSTATUS(j)) {
+ if (i < 0 || WEXITSTATUS(j)) {
dialog_clear();
- msgConfirm("cpio returned error status of %d!", _WSTATUS(j));
+ msgConfirm("cpio returned error status of %d!", WEXITSTATUS(j));
exit(2);
}
exit(0);
}
else
i = wait(&j);
- if (i < 0 || _WSTATUS(j) || access("/OK", R_OK) == -1) {
+ if (i < 0 || WEXITSTATUS(j) || access("/OK", R_OK) == -1) {
dialog_clear();
msgConfirm("CPIO floppy did not extract properly! Please verify\nthat your media is correct and try again.");
close(CpioFD);
@@ -422,11 +426,8 @@ cpio_extract(void)
goto tryagain;
}
unlink("/OK");
-}
-
-static void
-install_configuration_files(void)
-{
+ if (!onCDROM)
+ msgConfirm("Please remove the CPIO floppy from the drive");
}
static void
diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c
index a5d811a..a06649b 100644
--- a/usr.sbin/sysinstall/label.c
+++ b/usr.sbin/sysinstall/label.c
@@ -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.20 1995/05/21 18:24:33 jkh Exp $
+ * $Id: label.c,v 1.21 1995/05/22 14:10:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -52,16 +52,6 @@
/* A nice message we use a lot in the disklabel editor */
#define MSG_NOT_APPLICABLE "That option is not applicable here"
-/*
- * I make some pretty gross assumptions about having a max of 50 chunks
- * total - 8 slices and 42 partitions. I can't easily display many more
- * than that on the screen at once!
- *
- * For 2.1 I'll revisit this and try to make it more dynamic, but since
- * this will catch 99.99% of all possible cases, I'm not too worried.
- */
-#define MAX_CHUNKS 50
-
/* Where to start printing the freebsd slices */
#define CHUNK_SLICE_START_ROW 2
#define CHUNK_PART_START_ROW 11
@@ -348,10 +338,9 @@ print_label_chunks(void)
pcol = PART_OFF;
prow = CHUNK_PART_START_ROW;
}
- memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name,
- strlen(label_chunk_info[i].c->name));
+ memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name, strlen(label_chunk_info[i].c->name));
/* If it's a filesystem, display the mountpoint */
- if (label_chunk_info[i].type == PART_FILESYSTEM) {
+ if (label_chunk_info[i].type == PART_FILESYSTEM || label_chunk_info[i].type == PART_FAT) {
if (label_chunk_info[i].c->private == NULL) {
static int mnt = 0;
char foo[10];
@@ -361,23 +350,21 @@ print_label_chunks(void)
* Fill in a fake mountpoint and register it
*/
sprintf(foo, "/mnt%d", mnt++);
- label_chunk_info[i].c->private =
- new_part(foo, FALSE,label_chunk_info[i].c->size);
+ label_chunk_info[i].c->private = new_part(foo, FALSE, label_chunk_info[i].c->size);
label_chunk_info[i].c->private_free = safe_free;
}
mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
- newfs = ((PartInfo *)label_chunk_info[i].c->private)->newfs ? "Y" : "N";
+ if (label_chunk_info[i].type == PART_FAT)
+ newfs = "DOS";
+ else
+ newfs = ((PartInfo *)label_chunk_info[i].c->private)->newfs ? "Y" : "N";
}
else if (label_chunk_info[i].type == PART_SWAP) {
mountpoint = "swap";
newfs = " ";
}
- else if (label_chunk_info[i].type == PART_FAT) {
- mountpoint = "DOS FAT";
- newfs = "*";
- }
else {
- mountpoint = "<unknown>";
+ mountpoint = "<NONE>";
newfs = "*";
}
for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
@@ -481,13 +468,12 @@ diskLabelEditor(char *str)
break;
}
{
- char *val, *cp, tmpb[20];
+ char *val, *cp;
int size;
struct chunk *tmp;
u_long flags = 0;
- snprintf(tmpb, 20, "%d", sz);
- val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
+ val = msgGetInput(NULL, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).\nSpace free: %d blocks (%dMB)", sz, sz / ONE_MEG);
if (!val || (size = strtol(val, &cp, 0)) <= 0)
break;
@@ -517,10 +503,8 @@ diskLabelEditor(char *str)
msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!");
break;
}
- if (size < ROOT_MIN_SIZE) {
- msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG);
- break;
- }
+ if (size < ROOT_MIN_SIZE)
+ msgConfirm("Warning: This is smaller than the recommended size for a\nroot partition. For a variety of reasons, root\npartitions should usually be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG);
}
tmp = Create_Chunk_DWIM(label_chunk_info[here].d,
label_chunk_info[here].c,
@@ -554,7 +538,7 @@ diskLabelEditor(char *str)
break;
}
else if (label_chunk_info[here].type == PART_FAT) {
- msg = "Use the Disk Partition Editor to delete this";
+ msg = "Use the Disk Partition Editor to delete DOS partitions";
break;
}
Delete_Chunk(label_chunk_info[here].d, label_chunk_info[here].c);
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c
index 16bbc33..63a7019 100644
--- a/usr.sbin/sysinstall/media.c
+++ b/usr.sbin/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.13 1995/05/21 19:28:05 jkh Exp $
+ * $Id: media.c,v 1.14 1995/05/22 14:10:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -283,37 +283,15 @@ mediaSetFS(char *str)
return 0;
}
-int
-mediaOpen(char *parent, char *me)
-{
- char distname[FILENAME_MAX];
- int fd;
-
- if (parent)
- snprintf(distname, FILENAME_MAX, "%s%s", parent, me);
- else
- snprintf(distname, FILENAME_MAX, "%s/%s", me, me);
- msgNotify("Attempting to open %s distribution", distname);
- fd = (*mediaDevice->get)(distname);
- return fd;
-}
-
-void
-mediaClose(void)
-{
- if (mediaDevice->close)
- (*mediaDevice->close)(mediaDevice);
- mediaDevice = NULL;
-}
-
Boolean
-mediaExtractDist(char *dir, int fd)
+mediaExtractDist(char *distname, char *dir, int fd)
{
int i, j, zpid, cpid, pfd[2];
if (!dir)
dir = "/";
- msgNotify("Extracting into %s directory..", dir);
+ msgWeHaveOutput("Extracting %s into %s directory..", distname, dir);
+
Mkdir(dir, NULL);
chdir(dir);
pipe(pfd);
@@ -351,18 +329,17 @@ mediaExtractDist(char *dir, int fd)
}
close(pfd[0]);
close(pfd[1]);
- close(fd);
i = waitpid(zpid, &j, 0);
- if (i < 0 || _WSTATUS(j)) {
+ if (i < 0) { /* Don't check status - gunzip seems to return a bogus one! */
dialog_clear();
- msgConfirm("gunzip returned error status of %d!", _WSTATUS(j));
+ msgConfirm("wait for gunzip returned status of %d!", i);
return FALSE;
}
i = waitpid(cpid, &j, 0);
- if (i < 0 || _WSTATUS(j)) {
+ if (i < 0 || WEXITSTATUS(j)) {
dialog_clear();
- msgConfirm("cpio returned error status of %d!", _WSTATUS(j));
+ msgConfirm("cpio returned error status of %d!", WEXITSTATUS(j));
return FALSE;
}
return TRUE;
diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c
index d081e3c..c7c99c2 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.23 1995/05/21 15:40:52 jkh Exp $
+ * $Id: menus.c,v 1.24 1995/05/21 18:24:34 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -197,13 +197,16 @@ choice. Also note that not all sites carry every possible distribution!\n\
Distributions other than the basic user set are only guaranteed to be\n\
available from the Primary site.\n\n\
If the first site selected doesn't respond, try one of the alternates.\n\
-You may also wish to investigate the Ftp options menu in case of trouble.",
+You may also wish to investigate the Ftp options menu in case of trouble.\n\
+To specify a URL not in this list, chose \"other\".",
"Select a site that's close!",
"install.hlp",
{ { "Primary Site", "ftp.freebsd.org",
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/..)",
+ 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 },
{ "Finland", "nic.funet.fi",
@@ -326,9 +329,9 @@ type of system in question. If you would prefer to pick and choose\n\
the list of distributions yourself, simply select \"custom\".",
"Press F1 for more information on the various distributions",
"dist_types.hlp",
- { { "Developer", "Full sources, binaries and doc but no games [48MB]",
+ { { "Developer", "Full sources, binaries and doc but no games [171MB]",
DMENU_CALL, (void *)distSetDeveloper, 0, 0 },
- { "X-Developer", "Same as above, but includes XFree86 [73MB]",
+ { "X-Developer", "Same as above, but includes XFree86 [196MB]",
DMENU_CALL, (void *)distSetXDeveloper, 0, 0 },
{ "User", "Average user - binaries and doc but no sources [19MB]",
DMENU_CALL, (void *)distSetUser, 0, 0 },
@@ -336,7 +339,7 @@ the list of distributions yourself, simply select \"custom\".",
DMENU_CALL, (void *)distSetXUser, 0, 0 },
{ "Minimal", "The smallest configuration possible [15MB]",
DMENU_CALL, (void *)distSetMinimum, 0, 0 },
- { "Everything", "All sources, binaries and XFree86 binaries [80MB]",
+ { "Everything", "All sources, binaries and XFree86 binaries [203MB]",
DMENU_CALL, (void *)distSetEverything, 0, 0 },
{ "Custom", "Specify your own distribution set [?]",
DMENU_SUBMENU, (void *)&MenuDistributions, 0, 0 },
@@ -351,7 +354,7 @@ of the most generally useful distributions are already checked, and\n\
selecting OK at this stage will chose them as defaults.",
"Press F1 for a more complete description of these distributions.",
"distribution_types.hlp",
- { { "*bin", "Binary base distribution (required) [15MB]",
+ { { "*bin", "Binary base distribution (required) [36MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_BIN, 0 },
{ "commercial", "Commercial demos and shareware [10MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMMERCIAL, 0 },
@@ -361,17 +364,17 @@ selecting OK at this stage will chose them as defaults.",
DMENU_SET_FLAG, (void *)&Dists, DIST_COMPAT20, 0 },
{ "DES", "DES encryption code and sources [.3MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_DES, 0 },
- { "dict", "Spelling checker disctionary files [1.3MB]",
+ { "dict", "Spelling checker disctionary files [4.2MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_DICT, 0 },
- { "games", "Games and other amusements (non-commercial) [2.8MB]",
+ { "games", "Games and other amusements (non-commercial) [6.4MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_GAMES, 0 },
- { "info", "GNU info files [1.2MB]",
+ { "info", "GNU info files [4.1MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_INFO, 0 },
- { "*man", "System manual pages - strongly recommended [2.8MB]",
+ { "*man", "System manual pages - strongly recommended [3.3MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_MANPAGES, 0 },
- { "proflibs", "Profiled versions of the libraries [.9MB]",
+ { "proflibs", "Profiled versions of the libraries [3.3MB]",
DMENU_SET_FLAG, (void *)&Dists, DIST_PROFLIBS, 0 },
- { "src", "Sources for everything but DES [25MB]",
+ { "src", "Sources for everything but DES [120MB]",
DMENU_CALL, (void *)distSetSrc, 0 },
{ "XFree86", "The XFree86 3.1.1L distribution [?]",
DMENU_SUBMENU, (void *)&MenuXF86, 0 },
@@ -641,7 +644,7 @@ an existing one, select \"standard\". If you would prefer your master\n\
boot record to be untouched, then select \"none\".",
"Press F1 to read the installation guide",
"install.hlp",
- { { "BootMgr", "Install the FreeBSD Boot Manager (\"Booteasy\")", /* B */
+ { { "*BootMgr", "Install the FreeBSD Boot Manager (\"Booteasy\")", /* B */
DMENU_SET_VARIABLE, (void *)"bootManager=bteasy", 0, 0 },
{ "Standard", "Use a standard MBR (no boot manager)", /* S */
DMENU_SET_VARIABLE, (void *)"bootManager=mbr", 0, 0 },
diff --git a/usr.sbin/sysinstall/msg.c b/usr.sbin/sysinstall/msg.c
index c78621d..b2f4baf 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.21 1995/05/20 19:12:12 phk Exp $
+ * $Id: msg.c,v 1.22 1995/05/22 14:10:25 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -73,21 +73,32 @@ msgInfo(char *fmt, ...)
{
va_list args;
char *errstr;
- int attrs;
+ int i, attrs;
+ char line[81];
+ attrs = getattrs(stdscr);
/* NULL is a special convention meaning "erase the old stuff" */
if (!fmt) {
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0);
+ attrset(A_REVERSE);
clrtoeol();
+ attrset(attrs);
return;
}
errstr = (char *)safe_malloc(FILENAME_MAX);
va_start(args, fmt);
vsnprintf(errstr, FILENAME_MAX, fmt, args);
va_end(args);
- attrs = getattrs(stdscr);
- attrset(A_NORMAL);
- mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
+ memset(line, ' ', 80);
+ for (i = 0; i < 80; i++) {
+ if (errstr[i])
+ line[i] = errstr[i];
+ else
+ break;
+ }
+ line[80] = '\0';
+ attrset(A_REVERSE);
+ mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line);
attrset(attrs);
refresh();
if (OnVTY) {
@@ -303,3 +314,24 @@ msgDebug(char *fmt, ...)
write(DebugFD, dbg, strlen(dbg));
free(dbg);
}
+
+/* Tell the user there's some output to go look at */
+void
+msgWeHaveOutput(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+
+ errstr = (char *)safe_malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ msgDebug("Notify: %s\n", errstr);
+ dialog_clear();
+ dialog_msgbox("Information Dialog", errstr, -1, -1, 0);
+ free(errstr);
+ if (OnVTY)
+ msgInfo("Command output is on debugging screen - type ALT-F2 to see it");
+}
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 4813cae..3c3a0f9 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.25 1995/05/20 20:30:12 jkh Exp $
+ * $Id: sysinstall.h,v 1.26 1995/05/21 15:40:53 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -70,6 +70,15 @@
#define DEV_MAX 200 /* The maximum number of devices we'll deal with */
#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
+/*
+ * I make some pretty gross assumptions about having a max of 50 chunks
+ * total - 8 slices and 42 partitions. I can't easily display many more
+ * than that on the screen at once!
+ *
+ * For 2.1 I'll revisit this and try to make it more dynamic, but since
+ * this will catch 99.99% of all possible cases, I'm not too worried.
+ */
+#define MAX_CHUNKS 50
/* Internal flag variables */
#define DISK_PARTITIONED "_diskPartitioned"
@@ -226,6 +235,11 @@ extern void command_execute(void);
extern void command_shell_add(char *key, char *fmt, ...);
extern void command_func_add(char *key, commandFunc func, void *data);
+/* config.c */
+extern void config_fstab(void);
+extern void config_sysconfig(void);
+extern void config_resolv(void);
+
/* decode.c */
extern DMenuItem *decode(DMenu *menu, char *name);
extern Boolean dispatch(DMenuItem *tmp, char *name);
@@ -302,32 +316,30 @@ extern int mediaSetDOS(char *str);
extern int mediaSetTape(char *str);
extern int mediaSetFTP(char *str);
extern int mediaSetFS(char *str);
-extern int mediaOpen(char *parent, char *me);
extern Boolean mediaGetType(void);
-extern Boolean mediaExtractDist(char *dir, int fd);
+extern Boolean mediaExtractDist(char *distname, char *dir, int fd);
extern Boolean mediaVerify(void);
-extern void mediaClose(void);
/* media_strategy.c */
-extern Boolean mediaInitUFS(Device *dev);
-extern Boolean mediaGetUFS(char *dist);
extern Boolean mediaInitCDROM(Device *dev);
extern Boolean mediaInitDOS(Device *dev);
-extern Boolean mediaGetFloppy(char *dist);
extern Boolean mediaInitFloppy(Device *dev);
-extern Boolean mediaGetCDROM(char *dist);
-extern Boolean mediaGetDOS(char *dist);
-extern Boolean mediaInitTape(Device *dev);
-extern Boolean mediaGetTape(char *dist);
extern Boolean mediaInitFTP(Device *dev);
extern Boolean mediaInitNetwork(Device *dev);
-extern Boolean mediaGetFTP(char *dist);
-extern void mediaCloseTape(Device *dev);
+extern Boolean mediaInitTape(Device *dev);
+extern Boolean mediaInitUFS(Device *dev);
+extern int mediaGetCDROM(char *dist);
+extern int mediaGetDOS(char *dist);
+extern int mediaGetFloppy(char *dist);
+extern int mediaGetFTP(char *dist);
+extern int mediaGetTape(char *dist);
+extern int mediaGetUFS(char *dist);
extern void mediaCloseCDROM(Device *dev);
extern void mediaCloseDOS(Device *dev);
extern void mediaCloseFTP(Device *dev);
extern void mediaCloseFloppy(Device *dev);
extern void mediaCloseNetwork(Device *dev);
+extern void mediaCloseTape(Device *dev);
/* misc.c */
extern Boolean file_readable(char *fname);
@@ -354,6 +366,7 @@ extern void msgError(char *fmt, ...);
extern void msgFatal(char *fmt, ...);
extern void msgConfirm(char *fmt, ...);
extern void msgNotify(char *fmt, ...);
+extern void msgWeHaveOutput(char *fmt, ...);
extern int msgYesNo(char *fmt, ...);
extern char *msgGetInput(char *buf, char *fmt, ...);
diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c
index 8c07585..cd62dd2 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.26 1995/05/21 01:56:03 phk Exp $
+ * $Id: system.c,v 1.28 1995/05/21 06:12:44 phk Exp $
*
* Jordan Hubbard
*
@@ -229,6 +229,7 @@ systemChangeFont(const u_char font[])
if (ioctl(0, PIO_FONT8x16, font) < 0)
msgConfirm("Sorry! Unable to load font for %s", getenv("LANG"));
}
+ dialog_clear();
}
void
@@ -251,7 +252,6 @@ systemChangeTerminal(char *color, const u_char c_term[],
setterm(color);
init_acs();
cbreak(); noecho();
- dialog_clear();
}
else {
setenv("TERM", mono, 1);
@@ -260,8 +260,8 @@ systemChangeTerminal(char *color, const u_char c_term[],
setterm(mono);
init_acs();
cbreak(); noecho();
- dialog_clear();
}
+ dialog_clear();
}
}
@@ -272,9 +272,10 @@ systemChangeScreenmap(const u_char newmap[])
if (ioctl(0, PIO_SCRNMAP, newmap) < 0)
msgConfirm("Sorry! Unable to load the screenmap for %s",
getenv("LANG"));
- dialog_clear();
}
+ dialog_clear();
}
+
int
vsystem(char *fmt, ...)
{
OpenPOWER on IntegriCloud