Totally revamp the TCP/IP dialog; now network selection makes a bit more sense.
Root floppy (which actually may be able to go completely away at some point soon!) is now loadable from ftp/nfs/dos as well as CDROM and (of course) floppy. Fix more problems on Poul's Gripe List.
This commit is contained in:
parent
a7acf629b6
commit
223705ba7e
@ -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.5 1995/05/24 18:52:47 jkh Exp $
|
||||
* $Id: config.c,v 1.6 1995/05/25 18:48:22 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -82,7 +82,7 @@ nameof(Chunk *c1)
|
||||
static char *
|
||||
mount_point(Chunk *c1)
|
||||
{
|
||||
if (c1->type == PART_FAT || (c1->type == part && c1->subtype != FS_SWAP))
|
||||
if (c1->type == fat || (c1->type == part && c1->subtype != FS_SWAP))
|
||||
return ((PartInfo *)c1->private)->mountpoint;
|
||||
else if (c1->type == part && c1->subtype == FS_SWAP)
|
||||
return "none";
|
||||
@ -92,7 +92,7 @@ mount_point(Chunk *c1)
|
||||
static char *
|
||||
fstype(Chunk *c1)
|
||||
{
|
||||
if (c1->type == PART_FAT)
|
||||
if (c1->type == fat)
|
||||
return "msdos";
|
||||
else if (c1->type == part) {
|
||||
if (c1->subtype != FS_SWAP)
|
||||
@ -209,7 +209,6 @@ configFstab(void)
|
||||
void
|
||||
configSysconfig(void)
|
||||
{
|
||||
#if 0
|
||||
FILE *fp;
|
||||
char *lines[5001]; /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */
|
||||
char line[256];
|
||||
@ -222,16 +221,39 @@ configSysconfig(void)
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < 5000; i++) {
|
||||
if (!fgets(line, 256, fp))
|
||||
if (!fgets(line, 255, fp))
|
||||
break;
|
||||
lines[nlines++] = strdup(line);
|
||||
}
|
||||
lines[nlines] = NULL;
|
||||
fclose(fp);
|
||||
for (v = VarHead; v; v = v->next) {
|
||||
for (i = 0; i < nlines; i++) {
|
||||
char modify[256], *cp;
|
||||
|
||||
if (lines[i][0] == '#' || lines[i][0] == ';')
|
||||
continue;
|
||||
strncpy(modify, lines[i], 255);
|
||||
cp = index(modify, '=');
|
||||
if (!cp)
|
||||
continue;
|
||||
*(cp++) = '\0';
|
||||
if (!strcmp(modify, v->name)) {
|
||||
free(lines[i]);
|
||||
lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 3);
|
||||
sprintf(lines[i], "%s=%s\n", v->name, v->value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fp = fopen("/etc/sysconfig", "w");
|
||||
if (!fp) {
|
||||
msgConfirm("Unable to re-write /etc/sysconfig file! Things may work\nrather strangely as a result of this.");
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < nlines; i++)
|
||||
fprintf(fp, lines[i]);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -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.29 1995/05/24 09:00:11 jkh Exp $
|
||||
* $Id: devices.c,v 1.30 1995/05/24 17:49:11 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -145,7 +145,7 @@ deviceDiskFree(Device *dev)
|
||||
/* Register a new device in the devices array */
|
||||
Device *
|
||||
deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled,
|
||||
Boolean (*init)(Device *), int (*get)(char *), Boolean (*close)(Device *, int),
|
||||
Boolean (*init)(Device *), int (*get)(char *, char *), Boolean (*close)(Device *, int),
|
||||
void (*shutdown)(Device *), void *private)
|
||||
{
|
||||
Device *newdev;
|
||||
|
@ -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.19 1995/05/24 17:49:12 jkh Exp $
|
||||
* $Id: dist.c,v 1.20 1995/05/25 18:48:24 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -233,15 +233,13 @@ distExtract(char *parent, Distribution *me)
|
||||
if (me[i].my_dist)
|
||||
status = distExtract(me[i].my_name, me[i].my_dist);
|
||||
else {
|
||||
char distname[FILENAME_MAX];
|
||||
char dparent[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 (parent) /* Yetch */
|
||||
snprintf(dparent, FILENAME_MAX, "%s/", parent);
|
||||
fd = (*mediaDevice->get)(parent ? dparent : me[i].my_name, me[i].my_name);
|
||||
if (fd != -1) {
|
||||
status = mediaExtractDist(distname, me[i].my_dir, fd);
|
||||
status = mediaExtractDist(me[i].my_name, me[i].my_dir, fd);
|
||||
if (mediaDevice->close)
|
||||
(*mediaDevice->close)(mediaDevice, fd);
|
||||
else
|
||||
@ -251,7 +249,7 @@ distExtract(char *parent, Distribution *me)
|
||||
if (getenv(NO_CONFIRMATION))
|
||||
status = 0;
|
||||
else
|
||||
status = !msgYesNo("Unable to transfer the %s distribution from %s.\nDo you want to retry this distribution later?", distname, mediaDevice->name);
|
||||
status = !msgYesNo("Unable to transfer the %s distribution from %s.\nDo you want to retry this distribution later?", me[i].my_name, mediaDevice->name);
|
||||
}
|
||||
}
|
||||
if (!status) {
|
||||
|
@ -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.54 1995/05/25 01:52:02 jkh Exp $
|
||||
* $Id: install.c,v 1.55 1995/05/25 18:48:25 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -367,136 +367,61 @@ copy_self(void)
|
||||
i = vsystem("find -x /stand | cpio -pdmv /mnt");
|
||||
if (i)
|
||||
msgConfirm("Copy returned error status of %d!", i);
|
||||
/* copy up the etc files */
|
||||
(void)vsystem("(cd /mnt/stand; find etc) | cpio -pdmv /mnt");
|
||||
}
|
||||
|
||||
static Device *floppyDev;
|
||||
|
||||
static int
|
||||
floppyChoiceHook(char *str)
|
||||
{
|
||||
Device **devs;
|
||||
|
||||
/* Clip garbage off the ends */
|
||||
string_prune(str);
|
||||
str = string_skipwhite(str);
|
||||
if (!*str)
|
||||
return 0;
|
||||
devs = deviceFind(str, DEVICE_TYPE_FLOPPY);
|
||||
if (devs)
|
||||
floppyDev = devs[0];
|
||||
return devs ? 1 : 0;
|
||||
}
|
||||
static void loop_on_root_floppy();
|
||||
|
||||
static void
|
||||
root_extract(void)
|
||||
{
|
||||
int i, j, zpid, cpid, pfd[2];
|
||||
Boolean onCDROM = FALSE;
|
||||
int fd, status;
|
||||
|
||||
if (mediaDevice && mediaDevice->type == DEVICE_TYPE_CDROM) {
|
||||
if (mediaDevice->init) {
|
||||
if ((*mediaDevice->init)(mediaDevice)) {
|
||||
RootFD = open("/cdrom/floppies/root.flp", O_RDONLY);
|
||||
if (RootFD != -1) {
|
||||
msgNotify("Loading root floppy from CDROM");
|
||||
onCDROM = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OnCDROM) {
|
||||
fd = open("/floppies/root.flp", O_RDONLY);
|
||||
mediaExtractDist("root.flp", "/", fd);
|
||||
return;
|
||||
}
|
||||
if (mediaDevice) {
|
||||
switch(mediaDevice->type) {
|
||||
|
||||
tryagain:
|
||||
while (RootFD == -1) {
|
||||
if (!floppyDev) {
|
||||
Device **devs;
|
||||
int cnt;
|
||||
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_FLOPPY);
|
||||
cnt = deviceCount(devs);
|
||||
if (cnt == 1)
|
||||
floppyDev = devs[0];
|
||||
else if (cnt > 1) {
|
||||
DMenu *menu;
|
||||
|
||||
menu = deviceCreateMenu(&MenuMediaFloppy, DEVICE_TYPE_FLOPPY, floppyChoiceHook);
|
||||
dmenuOpenSimple(menu);
|
||||
case DEVICE_TYPE_DOS:
|
||||
case DEVICE_TYPE_FTP:
|
||||
case DEVICE_TYPE_DISK:
|
||||
case DEVICE_TYPE_NETWORK:
|
||||
case DEVICE_TYPE_CDROM:
|
||||
if (mediaDevice->init)
|
||||
if (!(*mediaDevice->init)(mediaDevice))
|
||||
break;
|
||||
fd = (*mediaDevice->get)("root.flp", "floppies/");
|
||||
if (fd != -1) {
|
||||
msgNotify("Loading root floppy over %s", mediaDevice->name);
|
||||
status = mediaExtractDist("root.flp", "/", fd);
|
||||
if (mediaDevice->close)
|
||||
(*mediaDevice->close)(mediaDevice, fd);
|
||||
else
|
||||
close(fd);
|
||||
}
|
||||
else {
|
||||
msgConfirm("No floppy devices found! Something is seriously wrong!");
|
||||
return;
|
||||
}
|
||||
if (!floppyDev)
|
||||
continue;
|
||||
}
|
||||
dialog_clear();
|
||||
msgConfirm("Please Insert ROOT floppy in %s", floppyDev->description);
|
||||
RootFD = open(floppyDev->devname, O_RDONLY);
|
||||
if (RootFD >= 0)
|
||||
break;
|
||||
msgDebug("Error on open of root floppy: %s (%d)\n", strerror(errno), errno);
|
||||
}
|
||||
j = fork();
|
||||
if (!j) {
|
||||
chdir("/");
|
||||
msgWeHaveOutput("Extracting contents of root floppy...");
|
||||
pipe(pfd);
|
||||
zpid = fork();
|
||||
if (!zpid) {
|
||||
dup2(RootFD, 0); close(RootFD);
|
||||
dup2(pfd[1], 1); close(pfd[1]);
|
||||
if (DebugFD != -1)
|
||||
dup2(DebugFD, 2);
|
||||
close(pfd[0]);
|
||||
i = execl("/stand/gunzip", "/stand/gunzip", 0);
|
||||
msgDebug("/stand/gunzip command returns %d status\n", i);
|
||||
exit(i);
|
||||
}
|
||||
cpid = fork();
|
||||
if (!cpid) {
|
||||
dup2(pfd[0], 0); close(pfd[0]);
|
||||
close(RootFD);
|
||||
close(pfd[1]);
|
||||
if (DebugFD != -1) {
|
||||
dup2(DebugFD, 1);
|
||||
dup2(DebugFD, 2);
|
||||
}
|
||||
else {
|
||||
close(1); open("/dev/null", O_WRONLY);
|
||||
dup2(1, 2);
|
||||
}
|
||||
i = execl("/stand/cpio", "/stand/cpio", "-iduvm", 0);
|
||||
msgDebug("/stand/cpio command returns %d status\n", i);
|
||||
exit(i);
|
||||
}
|
||||
close(pfd[0]);
|
||||
close(pfd[1]);
|
||||
close(RootFD);
|
||||
|
||||
i = waitpid(zpid, &j, 0);
|
||||
if (i < 0) { /* Don't check status - gunzip seems to return a bogus one! */
|
||||
dialog_clear();
|
||||
msgConfirm("wait for gunzip returned status of %d!", i);
|
||||
exit(1);
|
||||
case DEVICE_TYPE_FLOPPY:
|
||||
default:
|
||||
loop_on_root_floppy();
|
||||
break;
|
||||
}
|
||||
i = waitpid(cpid, &j, 0);
|
||||
if (i < 0 || WEXITSTATUS(j)) {
|
||||
dialog_clear();
|
||||
msgConfirm("cpio returned error status of %d!", WEXITSTATUS(j));
|
||||
exit(2);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
i = wait(&j);
|
||||
if (i < 0 || WEXITSTATUS(j) || access("/OK", R_OK) == -1) {
|
||||
dialog_clear();
|
||||
msgConfirm("Root floppy did not extract properly! Please verify\nthat your media is correct and try again.");
|
||||
close(RootFD);
|
||||
RootFD = -1;
|
||||
dialog_clear();
|
||||
goto tryagain;
|
||||
}
|
||||
unlink("/OK");
|
||||
if (!onCDROM)
|
||||
msgConfirm("Please remove all floppies in any drives at this time.\nThey are no longer needed.");
|
||||
loop_on_root_floppy();
|
||||
}
|
||||
|
||||
static void
|
||||
loop_on_root_floppy(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = genericGetDist("root.flp", NULL, TRUE);
|
||||
if (fd == -1)
|
||||
return;
|
||||
mediaExtractDist("root.flp", "/", fd);
|
||||
}
|
||||
|
@ -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.15 1995/05/23 02:41:09 jkh Exp $
|
||||
* $Id: media.c,v 1.16 1995/05/24 09:00:40 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -251,12 +251,9 @@ int
|
||||
mediaSetFTP(char *str)
|
||||
{
|
||||
static Device ftpDevice;
|
||||
Device *devp;
|
||||
char *cp;
|
||||
|
||||
devp = tcpDeviceSelect();
|
||||
if (!devp)
|
||||
return 0;
|
||||
tcpDeviceSelect(NULL);
|
||||
dmenuOpenSimple(&MenuMediaFTP);
|
||||
cp = getenv("ftp");
|
||||
if (!cp)
|
||||
@ -266,7 +263,7 @@ mediaSetFTP(char *str)
|
||||
ftpDevice.init = mediaInitFTP;
|
||||
ftpDevice.get = mediaGetFTP;
|
||||
ftpDevice.shutdown = mediaShutdownFTP;
|
||||
ftpDevice.private = devp;
|
||||
ftpDevice.private = mediaDevice;
|
||||
mediaDevice = &ftpDevice;
|
||||
return 1;
|
||||
}
|
||||
|
@ -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.21 1995/05/25 06:15:38 phk Exp $
|
||||
* $Id: media_strategy.c,v 1.22 1995/05/25 18:48:27 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -199,18 +199,68 @@ attr_match(struct attribs *attr, char *name)
|
||||
}
|
||||
|
||||
static pid_t getDistpid = 0;
|
||||
static Device *floppyDev;
|
||||
|
||||
static int
|
||||
genericGetDist(char *path, struct attribs *dist_attrib, Boolean prompt)
|
||||
floppyChoiceHook(char *str)
|
||||
{
|
||||
Device **devs;
|
||||
|
||||
/* Clip garbage off the ends */
|
||||
string_prune(str);
|
||||
str = string_skipwhite(str);
|
||||
if (!*str)
|
||||
return 0;
|
||||
devs = deviceFind(str, DEVICE_TYPE_FLOPPY);
|
||||
if (devs)
|
||||
floppyDev = devs[0];
|
||||
return devs ? 1 : 0;
|
||||
}
|
||||
|
||||
int
|
||||
genericGetDist(char *path, void *attrs, Boolean prompt)
|
||||
{
|
||||
int fd;
|
||||
char buf[512];
|
||||
struct stat sb;
|
||||
int pfd[2], numchunks;
|
||||
const char *tmp;
|
||||
Device *devp;
|
||||
struct attribs *dist_attrib = (struct attribs *)attrs;
|
||||
|
||||
/* Floppy is always last-ditch device */
|
||||
while (prompt && floppyDev == NULL) {
|
||||
Device **devs;
|
||||
int cnt;
|
||||
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_FLOPPY);
|
||||
cnt = deviceCount(devs);
|
||||
if (cnt == 1)
|
||||
devp = devs[0];
|
||||
else if (cnt > 1) {
|
||||
DMenu *menu;
|
||||
|
||||
menu = deviceCreateMenu(&MenuMediaFloppy, DEVICE_TYPE_FLOPPY, floppyChoiceHook);
|
||||
menu->title = "Please insert the ROOT floppy";
|
||||
dmenuOpenSimple(menu);
|
||||
}
|
||||
else {
|
||||
msgConfirm("No floppy devices found! Something is seriously wrong!");
|
||||
return -1;
|
||||
}
|
||||
if (!floppyDev)
|
||||
continue;
|
||||
fd = open(floppyDev->devname, O_RDONLY);
|
||||
return fd;
|
||||
}
|
||||
|
||||
if (stat(path, &sb) == 0)
|
||||
{
|
||||
fd = open(path, O_RDONLY, 0);
|
||||
return(fd);
|
||||
}
|
||||
|
||||
snprintf(buf, 512, "%s.tgz", path);
|
||||
|
||||
if (stat(buf, &sb) == 0)
|
||||
{
|
||||
fd = open(buf, O_RDONLY, 0);
|
||||
@ -224,8 +274,12 @@ genericGetDist(char *path, struct attribs *dist_attrib, Boolean prompt)
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp = attr_match(dist_attrib, "pieces");
|
||||
numchunks = atoi(tmp);
|
||||
if (dist_attrib) {
|
||||
tmp = attr_match(dist_attrib, "pieces");
|
||||
numchunks = atoi(tmp);
|
||||
}
|
||||
else
|
||||
numchunks = 1;
|
||||
|
||||
/* reap the previous child corpse - yuck! */
|
||||
if (getDistpid) {
|
||||
@ -240,7 +294,7 @@ genericGetDist(char *path, struct attribs *dist_attrib, Boolean prompt)
|
||||
getDistpid = 0;
|
||||
}
|
||||
|
||||
msgDebug("Attempting to extract distribution from %u files\n", numchunks);
|
||||
msgDebug("Attempting to concatenate %u chunks\n", numchunks);
|
||||
pipe(pfd);
|
||||
getDistpid = fork();
|
||||
if (!getDistpid) {
|
||||
@ -277,6 +331,8 @@ genericGetDist(char *path, struct attribs *dist_attrib, Boolean prompt)
|
||||
|
||||
if (prompt == TRUE)
|
||||
{
|
||||
extern int crc(int, unsigned long *, unsigned long *);
|
||||
|
||||
crc(fd, &val, &len);
|
||||
msgDebug("crc for %s is %lu %lu\n", buf, val, len);
|
||||
}
|
||||
@ -332,8 +388,7 @@ mediaInitCDROM(Device *dev)
|
||||
|
||||
if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1)
|
||||
{
|
||||
msgConfirm("Error mounting %s on /cdrom: %s (%u)\n",
|
||||
dev, strerror(errno), errno);
|
||||
msgConfirm("Error mounting %s on /cdrom: %s (%u)\n", dev, strerror(errno), errno);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -344,8 +399,7 @@ mediaInitCDROM(Device *dev)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
msgConfirm("Couldn't locate the directory `dists' on the cdrom\n\
|
||||
Is this a 2.0.5 CDROM?\n");
|
||||
msgConfirm("Couldn't locate the directory `dists' on the CD.\nIs this a 2.0.5 CDROM?\n");
|
||||
return FALSE;
|
||||
} else {
|
||||
msgConfirm("Couldn't stat directory %s: %s", "/cdrom/dists", strerror(errno));
|
||||
@ -357,7 +411,7 @@ Is this a 2.0.5 CDROM?\n");
|
||||
}
|
||||
|
||||
int
|
||||
mediaGetCDROM(char *dist)
|
||||
mediaGetCDROM(char *dist, char *path)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
struct attribs *dist_attr;
|
||||
@ -367,13 +421,14 @@ mediaGetCDROM(char *dist)
|
||||
|
||||
snprintf(buf, PATH_MAX, "/stand/info/%s.inf", dist);
|
||||
|
||||
if (attr_parse(&dist_attr, buf) == 0)
|
||||
if (!access(buf, R_OK) && attr_parse(&dist_attr, buf) == 0)
|
||||
{
|
||||
msgConfirm("Cannot load information file for %s distribution!\nPlease verify that your media is valid and try again.", dist);
|
||||
free(dist_attr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
snprintf(buf, PATH_MAX, "/cdrom/dists/%s", dist);
|
||||
snprintf(buf, PATH_MAX, "/cdrom/%s%s", path ? path : "", dist);
|
||||
|
||||
retval = genericGetDist(buf, dist_attr, FALSE);
|
||||
free(dist_attr);
|
||||
@ -411,7 +466,7 @@ mediaInitFloppy(Device *dev)
|
||||
}
|
||||
|
||||
int
|
||||
mediaGetFloppy(char *dist)
|
||||
mediaGetFloppy(char *dist, char *path)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
char *fname;
|
||||
@ -421,12 +476,12 @@ mediaGetFloppy(char *dist)
|
||||
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)
|
||||
if (!access(buf, R_OK) && attr_parse(&dist_attr, buf) == 0)
|
||||
{
|
||||
msgConfirm("Cannot load information file for %s distribution!\nPlease verify that your media is valid and try again.", dist);
|
||||
free(dist_attr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fname = index(dist, '/') + 1;
|
||||
snprintf(buf, PATH_MAX, "/mnt/%s", fname);
|
||||
|
||||
@ -495,7 +550,7 @@ not on the local network\n");
|
||||
}
|
||||
|
||||
int
|
||||
mediaGetTape(char *dist)
|
||||
mediaGetTape(char *dist, char *path)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -548,7 +603,8 @@ mediaInitFTP(Device *dev)
|
||||
Device *netDevice = (Device *)dev->private;
|
||||
|
||||
if (netDevice->init)
|
||||
(*netDevice->init)(netDevice);
|
||||
if (!(*netDevice->init)(netDevice))
|
||||
return FALSE;
|
||||
|
||||
if ((ftp = FtpInit()) == NULL) {
|
||||
msgConfirm("FTP initialisation failed!");
|
||||
@ -559,7 +615,7 @@ mediaInitFTP(Device *dev)
|
||||
if (!url)
|
||||
return FALSE;
|
||||
if (!strcmp(url, "other")) {
|
||||
url = msgGetInput(NULL, "Please specify the URL of a FreeBSD distribution on a\nremote ftp site. This site must accept anonymous ftp!\nAn URL looks like this: ftp://<hostname>/<path>");
|
||||
url = msgGetInput("ftp://", "Please specify the URL of a FreeBSD distribution on a\nremote ftp site. This site must accept anonymous ftp!\nA URL looks like this: ftp://<hostname>/<path>");
|
||||
if (!url)
|
||||
return FALSE;
|
||||
}
|
||||
@ -572,8 +628,10 @@ mediaInitFTP(Device *dev)
|
||||
|
||||
msgDebug("Using URL `%s'\n", url);
|
||||
hostname = url + 6;
|
||||
dir = index(hostname, '/');
|
||||
*(dir++) = '\0';
|
||||
if ((dir = index(hostname, '/')) != NULL)
|
||||
*(dir++) = '\0';
|
||||
else
|
||||
dir = "/";
|
||||
msgDebug("hostname = `%s'\n", hostname);
|
||||
msgDebug("dir = `%s'\n", dir);
|
||||
msgNotify("Looking up host %s..", hostname);
|
||||
@ -594,7 +652,7 @@ mediaInitFTP(Device *dev)
|
||||
if (getenv("ftpPassive"))
|
||||
FtpPassive(ftp, 1);
|
||||
FtpBinary(ftp, 1);
|
||||
if (*dir != '\0') {
|
||||
if (dir && *dir != '\0') {
|
||||
msgNotify("CD to distribution in ~ftp/%s", dir);
|
||||
FtpChdir(ftp, dir);
|
||||
}
|
||||
@ -605,7 +663,7 @@ mediaInitFTP(Device *dev)
|
||||
static pid_t ftppid = 0;
|
||||
|
||||
int
|
||||
mediaGetFTP(char *dist)
|
||||
mediaGetFTP(char *dist, char *path)
|
||||
{
|
||||
int fd;
|
||||
char buf[512];
|
||||
@ -613,25 +671,30 @@ mediaGetFTP(char *dist)
|
||||
const char *tmp;
|
||||
struct attribs *dist_attr;
|
||||
|
||||
msgNotify("Attempting to retreive distribution `%s' over FTP", dist);
|
||||
dist_attr = safe_malloc(sizeof(struct attribs) * MAX_ATTRIBS);
|
||||
|
||||
msgNotify("Attempting to retreive `%s' over FTP", dist);
|
||||
snprintf(buf, PATH_MAX, "/stand/info/%s.inf", dist);
|
||||
|
||||
msgDebug("Parsing attributes file for %s\n", dist);
|
||||
if (attr_parse(&dist_attr, buf) == 0)
|
||||
{
|
||||
msgConfirm("Cannot load information file for %s distribution!\nPlease verify that your media is valid and try again.", dist);
|
||||
return -1;
|
||||
}
|
||||
if (!access(buf, R_OK)) {
|
||||
msgDebug("Parsing attributes file for %s\n", dist);
|
||||
dist_attr = safe_malloc(sizeof(struct attribs) * MAX_ATTRIBS);
|
||||
if (attr_parse(&dist_attr, buf) == 0) {
|
||||
msgConfirm("Cannot load information file for %s distribution!\nPlease verify that your media is valid and try again.", dist);
|
||||
return -1;
|
||||
}
|
||||
|
||||
msgDebug("Looking for attribute `pieces'\n");
|
||||
tmp = attr_match(dist_attr, "pieces");
|
||||
numchunks = atoi(tmp);
|
||||
msgDebug("Attempting to extract distribution from %u files\n", numchunks);
|
||||
msgDebug("Looking for attribute `pieces'\n");
|
||||
tmp = attr_match(dist_attr, "pieces");
|
||||
numchunks = atoi(tmp);
|
||||
}
|
||||
else
|
||||
numchunks = 0;
|
||||
msgDebug("Attempting to extract distribution from %u files\n", numchunks ? numchunks : 1);
|
||||
|
||||
if (numchunks == 1)
|
||||
{
|
||||
/* Take the lack of an info file to mean we're a fully qualified name */
|
||||
if (!numchunks) {
|
||||
sprintf(buf, "%s%s", path ? path : "", dist);
|
||||
return(FtpGet(ftp, buf));
|
||||
}
|
||||
else if (numchunks == 1) {
|
||||
snprintf(buf, 512, "%s.aa", dist);
|
||||
return(FtpGet(ftp, buf));
|
||||
}
|
||||
@ -718,7 +781,7 @@ mediaInitUFS(Device *dev)
|
||||
}
|
||||
|
||||
int
|
||||
mediaGetUFS(char *dist)
|
||||
mediaGetUFS(char *dist, char *path)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -733,7 +796,7 @@ mediaInitDOS(Device *dev)
|
||||
}
|
||||
|
||||
int
|
||||
mediaGetDOS(char *dist)
|
||||
mediaGetDOS(char *dist, char *path)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -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.29 1995/05/25 01:22:18 jkh Exp $
|
||||
* $Id: menus.c,v 1.30 1995/05/25 18:48:29 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -586,7 +586,7 @@ DMenu MenuInstall = {
|
||||
details on the type of distribution you wish to have, where you wish\n\
|
||||
to install it from and how you wish to allocate disk storage to FreeBSD.\n\n\
|
||||
None of the items in this menu will actually modify the contents of\n\
|
||||
your disk until you select the \"Write\" menu item (and even then, only\n\
|
||||
your disk until you select the \"Install\" menu item (and even then, only\n\
|
||||
after a final confirmation). Select Cancel to leave this menu.",
|
||||
"Press F1 to read the installation guide",
|
||||
"install.hlp",
|
||||
@ -599,8 +599,8 @@ after a final confirmation). Select Cancel to leave this menu.",
|
||||
{ "Label", "Label allocated disk partitions", /* L */
|
||||
DMENU_CALL, diskLabelEditor, 0, 0 },
|
||||
{ "Networking", "Configure this host on a network", /* N */
|
||||
DMENU_CALL, tcpOpenDialog, 0, 0 },
|
||||
{ "Write", "Install FreeBSD onto your hard disk(s)", /* W */
|
||||
DMENU_CALL, tcpDeviceSelect, 0, 0 },
|
||||
{ "Install", "Install FreeBSD onto your hard disk(s)", /* I */
|
||||
DMENU_CALL, installCommit, 0, 0 },
|
||||
{ "Configure", "Do post-install configuration of FreeBSD", /* C */
|
||||
DMENU_SUBMENU, &MenuConfigure, 0, 0 },
|
||||
@ -626,7 +626,7 @@ Record to remain untouched, then select \"none\".",
|
||||
{ "Standard", "Use a standard MBR (no boot manager)", /* S */
|
||||
DMENU_SET_VARIABLE, "bootManager=mbr", 0, 0 },
|
||||
{ "None", "Leave the Master Boot Record untouched", /* N */
|
||||
DMENU_CALL, diskPartitionEditor, 0, 0 },
|
||||
DMENU_SET_VARIABLE, "bootManager=none", 0, 0 },
|
||||
{ NULL } },
|
||||
};
|
||||
|
||||
@ -644,11 +644,11 @@ When you're done, select Cancel",
|
||||
{ { "Add User", "Add users to the system",
|
||||
DMENU_SYSTEM_COMMAND, "adduser", 0, 0 },
|
||||
{ "Networking", "Configure network",
|
||||
DMENU_CALL, tcpOpenDialog, 0, 0 },
|
||||
DMENU_CALL, tcpDeviceSelect, 0, 0 },
|
||||
{ "Time Zone", "Set which time zone you're in",
|
||||
DMENU_SYSTEM_COMMAND, "tzsetup", 0, 0 },
|
||||
{ "Packages", "Install extra FreeBSD packaged software",
|
||||
DMENU_CALL, configPackages, 0, 1 },
|
||||
DMENU_CALL, configPackages, 0, 0 },
|
||||
{ "Ports", "Enable the FreeBSD Ports Collection from CD",
|
||||
DMENU_CALL, configPorts, 0, 1 },
|
||||
{ "Root Password", "Set the system manager's password",
|
||||
|
@ -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.32 1995/05/25 01:22:20 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.33 1995/05/25 18:48:30 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -144,6 +144,7 @@ typedef enum {
|
||||
DEVICE_TYPE_NONE,
|
||||
DEVICE_TYPE_DISK,
|
||||
DEVICE_TYPE_FLOPPY,
|
||||
DEVICE_TYPE_FTP,
|
||||
DEVICE_TYPE_NETWORK,
|
||||
DEVICE_TYPE_CDROM,
|
||||
DEVICE_TYPE_TAPE,
|
||||
@ -159,7 +160,7 @@ typedef struct _device {
|
||||
DeviceType type;
|
||||
Boolean enabled;
|
||||
Boolean (*init)(struct _device *);
|
||||
int (*get)(char *fname);
|
||||
int (*get)(char *fname, char *dir);
|
||||
Boolean (*close)(struct _device *, int fd);
|
||||
void (*shutdown)(struct _device *);
|
||||
void *private;
|
||||
@ -187,7 +188,6 @@ typedef int (*commandFunc)(char *key, void *data);
|
||||
|
||||
|
||||
/*** Externs ***/
|
||||
extern int RootFD; /* The file descriptor for our root floppy */
|
||||
extern int DebugFD; /* Where diagnostic output goes */
|
||||
extern Boolean OnCDROM; /* Are we running off of a CDROM? */
|
||||
extern Boolean OnSerial; /* Are we on a serial console? */
|
||||
@ -260,7 +260,7 @@ extern Device **deviceFind(char *name, DeviceType type);
|
||||
extern int deviceCount(Device **devs);
|
||||
extern Device *new_device(char *name);
|
||||
extern Device *deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled,
|
||||
Boolean (*init)(Device *mediadev), int (*get)(char *distname),
|
||||
Boolean (*init)(Device *mediadev), int (*get)(char *distname, char *path),
|
||||
Boolean (*close)(Device *mediadev, int fd), void (*shutDown)(Device *mediadev),
|
||||
void *private);
|
||||
|
||||
@ -331,6 +331,7 @@ extern Boolean mediaExtractDist(char *distname, char *dir, int fd);
|
||||
extern Boolean mediaVerify(void);
|
||||
|
||||
/* media_strategy.c */
|
||||
extern int genericGetDist(char *path, void *dist_attrib, Boolean prompt);
|
||||
extern Boolean mediaInitCDROM(Device *dev);
|
||||
extern Boolean mediaInitDOS(Device *dev);
|
||||
extern Boolean mediaInitFloppy(Device *dev);
|
||||
@ -338,12 +339,12 @@ extern Boolean mediaInitFTP(Device *dev);
|
||||
extern Boolean mediaInitNetwork(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 int mediaGetCDROM(char *dist, char *path);
|
||||
extern int mediaGetDOS(char *dist, char *path);
|
||||
extern int mediaGetFloppy(char *dist, char *path);
|
||||
extern int mediaGetFTP(char *dist, char *path);
|
||||
extern int mediaGetTape(char *dist, char *path);
|
||||
extern int mediaGetUFS(char *dist, char *path);
|
||||
extern void mediaShutdownCDROM(Device *dev);
|
||||
extern void mediaShutdownDOS(Device *dev);
|
||||
extern void mediaShutdownFTP(Device *dev);
|
||||
@ -397,8 +398,8 @@ extern void systemChangeScreenmap(const u_char newmap[]);
|
||||
extern int vsystem(char *fmt, ...);
|
||||
|
||||
/* tcpip.c */
|
||||
extern int tcpOpenDialog(char *);
|
||||
extern Device *tcpDeviceSelect(void);
|
||||
extern int tcpOpenDialog(Device *);
|
||||
extern int tcpDeviceSelect(char *str);
|
||||
extern Boolean tcpStartPPP(void);
|
||||
|
||||
/* termcap.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.33 1995/05/25 01:52:03 jkh Exp $
|
||||
* $Id: system.c,v 1.34 1995/05/25 18:48:31 jkh Exp $
|
||||
*
|
||||
* Jordan Hubbard
|
||||
*
|
||||
@ -60,7 +60,6 @@ systemInitialize(int argc, char **argv)
|
||||
close(0); open("/bootcd/dev/console", O_RDWR);
|
||||
close(1); dup(0);
|
||||
close(2); dup(0);
|
||||
RootFD = open("/floppies/root.flp", O_RDONLY);
|
||||
OnCDROM = TRUE;
|
||||
chroot("/bootcd");
|
||||
} else {
|
||||
@ -70,9 +69,9 @@ systemInitialize(int argc, char **argv)
|
||||
}
|
||||
printf("%s running as init\n", argv[0]);
|
||||
|
||||
ioctl(0, TIOCSCTTY, (char *)NULL);
|
||||
i = ioctl(0, TIOCSCTTY, (char *)NULL);
|
||||
setlogin("root");
|
||||
setenv("PATH", "/stand:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin", 1);
|
||||
setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin", 1);
|
||||
setbuf(stdin, 0);
|
||||
setbuf(stderr, 0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tcpip.c,v 1.13 1995/05/25 01:52:04 jkh Exp $
|
||||
* $Id: tcpip.c,v 1.14 1995/05/25 18:48:32 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
@ -35,6 +35,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* All kinds of hacking also performed by jkh on this code. Don't
|
||||
* blame Gary for every bogosity you see here.. :-)
|
||||
*
|
||||
* -jkh
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -48,12 +55,16 @@
|
||||
#include "rc.h"
|
||||
#include "sysinstall.h"
|
||||
|
||||
#define HOSTNAME_FIELD_LEN 256
|
||||
#define IPADDR_FIELD_LEN 16
|
||||
#define EXTRAS_FIELD_LEN 256
|
||||
|
||||
/* These are nasty, but they make the layout structure a lot easier ... */
|
||||
|
||||
static char hostname[256], domainname[256],
|
||||
gateway[32], nameserver[32], iface[8];
|
||||
static char hostname[HOSTNAME_FIELD_LEN], domainname[HOSTNAME_FIELD_LEN],
|
||||
gateway[IPADDR_FIELD_LEN], nameserver[IPADDR_FIELD_LEN];
|
||||
static int okbutton, cancelbutton;
|
||||
static char ipaddr[32], netmask[32], extras[256];
|
||||
static char ipaddr[IPADDR_FIELD_LEN], netmask[IPADDR_FIELD_LEN], extras[EXTRAS_FIELD_LEN];
|
||||
|
||||
/* What the screen size is meant to be */
|
||||
#define TCP_DIALOG_Y 0
|
||||
@ -61,18 +72,12 @@ static char ipaddr[32], netmask[32], extras[256];
|
||||
#define TCP_DIALOG_WIDTH COLS - 16
|
||||
#define TCP_DIALOG_HEIGHT LINES - 2
|
||||
|
||||
/* The per interface set of records */
|
||||
typedef struct _interface {
|
||||
char ipaddr[32];
|
||||
char netmask[32];
|
||||
char extras[256]; /* Extra stuff for ifconfig (link0, etc) */
|
||||
int valid;
|
||||
Device *dptr;
|
||||
} Interface;
|
||||
|
||||
/* The names and details of the available interfaces, for the list */
|
||||
Interface if_list[INTERFACE_MAX];
|
||||
char *iface_names[INTERFACE_MAX];
|
||||
/* This is the structure that Network devices carry around in their private, erm, structures */
|
||||
typedef struct _devPriv {
|
||||
char ipaddr[IPADDR_FIELD_LEN];
|
||||
char netmask[IPADDR_FIELD_LEN];
|
||||
char extras[EXTRAS_FIELD_LEN];
|
||||
} DevInfo;
|
||||
|
||||
/* The screen layout structure */
|
||||
typedef struct _layout {
|
||||
@ -88,49 +93,44 @@ typedef struct _layout {
|
||||
} Layout;
|
||||
|
||||
static Layout layout[] = {
|
||||
{ 1, 2, 25, 255,
|
||||
{ 1, 2, 25, HOSTNAME_FIELD_LEN - 1,
|
||||
"Host name:", "The name of your machine on a network, e.g. foo.bar.com",
|
||||
hostname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_HOSTNAME 0
|
||||
{ 1, 35, 20, 255,
|
||||
{ 1, 35, 20, HOSTNAME_FIELD_LEN - 1,
|
||||
"Domain name:",
|
||||
"The name of the domain that your machine is in, e.g. bar.com",
|
||||
domainname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_DOMAINNAME 1
|
||||
{ 5, 2, 18, 15,
|
||||
{ 5, 2, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Gateway:",
|
||||
"IP address of host forwarding packets to non-local hosts or nets",
|
||||
"IP address of host forwarding packets to non-local destinations",
|
||||
gateway, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GATEWAY 2
|
||||
{ 5, 35, 18, 15,
|
||||
{ 5, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Name server:", "IP address of your local DNS server",
|
||||
nameserver, STRINGOBJ, NULL },
|
||||
#define LAYOUT_NAMESERVER 3
|
||||
{ 9, 2, 9, 6,
|
||||
"Interface:",
|
||||
"Network devices found on boot (use <TAB> to exit from here)",
|
||||
iface, LISTOBJ, NULL },
|
||||
#define LAYOUT_IFACE 4
|
||||
{ 10, 18, 18, 15,
|
||||
{ 11, 10, 18, IPADDR_FIELD_LEN - 1,
|
||||
"IP Address:",
|
||||
"The IP address to be used for this interface - use 127.0.0.1 for lo0",
|
||||
"The IP address to be used for this interface",
|
||||
ipaddr, STRINGOBJ, NULL },
|
||||
#define LAYOUT_IPADDR 5
|
||||
{ 10, 37, 18, 15,
|
||||
{ 11, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Netmask:",
|
||||
"The netmask for this interfaace, e.g. 0xffffff00 for a class C network",
|
||||
netmask, STRINGOBJ, NULL },
|
||||
#define LAYOUT_NETMASK 6
|
||||
{ 14, 18, 37, 255,
|
||||
{ 15, 10, 37, HOSTNAME_FIELD_LEN - 1,
|
||||
"Extra options to ifconfig:",
|
||||
"Any interface-specific options to ifconfig you'd like to use",
|
||||
"Any interface-specific options to ifconfig you would like to use",
|
||||
extras, STRINGOBJ, NULL },
|
||||
#define LAYOUT_EXTRAS 7
|
||||
{ 19, 10, 0, 0,
|
||||
{ 19, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_OKBUTTON 8
|
||||
{ 19, 30, 0, 0,
|
||||
{ 19, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_CANCELBUTTON 9
|
||||
@ -139,8 +139,7 @@ static Layout layout[] = {
|
||||
|
||||
#define _validByte(b) ((b) > 0 && (b) < 255)
|
||||
|
||||
/* A JKH special - inform the user of an unusal error in a controlled
|
||||
fashion */
|
||||
/* whine */
|
||||
static void
|
||||
feepout(char *msg)
|
||||
{
|
||||
@ -174,6 +173,10 @@ verifySettings(void)
|
||||
feepout("Invalid gateway IP address specified");
|
||||
else if (nameserver[0] && !verifyIP(nameserver))
|
||||
feepout("Invalid name server IP address specified");
|
||||
else if (netmask[0] && (netmask[0] < '0' && netmask[0] > '3'))
|
||||
feepout("Invalid netmask value");
|
||||
else if (ipaddr[0] && !verifyIP(ipaddr))
|
||||
feepout("Invalid IP address");
|
||||
else
|
||||
return 1;
|
||||
return 0;
|
||||
@ -181,16 +184,14 @@ verifySettings(void)
|
||||
|
||||
/* This is it - how to get TCP setup values */
|
||||
int
|
||||
tcpOpenDialog(char *str)
|
||||
tcpOpenDialog(Device *devp)
|
||||
{
|
||||
WINDOW *ds_win;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret,
|
||||
max, n_iface;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
int max;
|
||||
char *tmp;
|
||||
Device **devs;
|
||||
char old_iface[8];
|
||||
char help[FILENAME_MAX];
|
||||
|
||||
/* We need a curses window */
|
||||
@ -198,43 +199,33 @@ tcpOpenDialog(char *str)
|
||||
if (ds_win == 0)
|
||||
msgFatal("Cannot open TCP/IP dialog window!!");
|
||||
|
||||
/* Look for net.devices for us to configure */
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_NETWORK);
|
||||
if (!devs) {
|
||||
msgConfirm("Couldn't find any potential network devices!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (devs[n] != NULL) {
|
||||
iface_names[n] = (devs[n])->name;
|
||||
if_list[n].dptr = devs[n];
|
||||
++n;
|
||||
}
|
||||
n_iface = n;
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
/* Say where our help comes from */
|
||||
systemHelpFile(TCP_HELPFILE, help);
|
||||
use_helpfile(help);
|
||||
draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X,
|
||||
TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH,
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X, TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X + 20, " Network Configuration ");
|
||||
|
||||
draw_box(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 8, TCP_DIALOG_HEIGHT - 13, TCP_DIALOG_WIDTH - 17,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X + 20,
|
||||
" Network Configuration ");
|
||||
draw_box(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 16,
|
||||
TCP_DIALOG_HEIGHT - 13, TCP_DIALOG_WIDTH - 21,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 24,
|
||||
" Per Interface Configuration ");
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 16, " Per Interface Configuration ");
|
||||
|
||||
/* Initialise vars so that dialog has something to chew on */
|
||||
strcpy(ipaddr, if_list[0].ipaddr);
|
||||
strcpy(netmask, if_list[0].netmask);
|
||||
strcpy(extras, if_list[0].extras);
|
||||
/* Initialise vars from previous device values */
|
||||
if (devp->private) {
|
||||
DevInfo *di = (DevInfo *)devp->private;
|
||||
|
||||
/* Look up values already recorded with the system, or blank the
|
||||
string variables ready to accept some new data */
|
||||
|
||||
strcpy(ipaddr, di->ipaddr);
|
||||
strcpy(netmask, di->netmask);
|
||||
strcpy(extras, di->extras);
|
||||
}
|
||||
else
|
||||
ipaddr[0] = netmask[0] = extras[0] = '\0';
|
||||
|
||||
/* Look up values already recorded with the system, or blank the string variables ready to accept some new data */
|
||||
tmp = getenv(VAR_HOSTNAME);
|
||||
if (tmp)
|
||||
strcpy(hostname, tmp);
|
||||
@ -273,11 +264,6 @@ tcpOpenDialog(char *str)
|
||||
lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X);
|
||||
break;
|
||||
|
||||
case LISTOBJ:
|
||||
lt.obj = NewListObj(ds_win, lt.prompt, (char **) iface_names,
|
||||
lt.var, lt.y + TCP_DIALOG_Y,
|
||||
lt.x + TCP_DIALOG_X, lt.len, 12, n_iface);
|
||||
break;
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
@ -299,9 +285,6 @@ tcpOpenDialog(char *str)
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
cancelbutton = okbutton = 0;
|
||||
strcpy(iface, iface_names[0]);
|
||||
if_list[0].valid = FALSE;
|
||||
strcpy(old_iface, iface);
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
@ -350,15 +333,8 @@ tcpOpenDialog(char *str)
|
||||
}
|
||||
break;
|
||||
|
||||
/* More special case handling - if we are at the interface
|
||||
list, move to the OK button - the user hasn't selected
|
||||
one of the entries in the list by pressing CR, so (s)he
|
||||
must be wanting to skip to <OK> & <CANCEL> */
|
||||
case KEY_DOWN:
|
||||
if (n == LAYOUT_EXTRAS) {
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
} else if (obj->next != NULL) {
|
||||
if (obj->next != NULL) {
|
||||
obj = obj->next;
|
||||
++n;
|
||||
} else {
|
||||
@ -367,36 +343,18 @@ tcpOpenDialog(char *str)
|
||||
}
|
||||
break;
|
||||
|
||||
/* Same as KEY_DOWN, but dialog has already move us to the
|
||||
next object on the list, which makes this slightly
|
||||
different. */
|
||||
case SEL_TAB:
|
||||
if (n == LAYOUT_EXTRAS) {
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
} else if (n < max) {
|
||||
if (n < max)
|
||||
++n;
|
||||
} else {
|
||||
else
|
||||
n = 0;
|
||||
}
|
||||
|
||||
/* This looks double dutch, but we have already MOVED onto
|
||||
the next field, so we special case around getting to
|
||||
that field, rather than moving off the previous
|
||||
one. Hence we are really testing for
|
||||
(n == LAYOUT_IFACE) */
|
||||
|
||||
if (n == LAYOUT_IPADDR) {
|
||||
n = LAYOUT_OKBUTTON;
|
||||
obj = ((obj->next)->next)->next;
|
||||
}
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cancelbutton) {
|
||||
if (cancelbutton)
|
||||
cancel = TRUE, quit = TRUE;
|
||||
} else {
|
||||
else {
|
||||
if (verifySettings())
|
||||
quit = TRUE;
|
||||
}
|
||||
@ -404,68 +362,7 @@ tcpOpenDialog(char *str)
|
||||
|
||||
/* Generic CR handler */
|
||||
case SEL_CR:
|
||||
/* Has the user selected a new interface? */
|
||||
if (strcmp(old_iface, iface)) {
|
||||
/* Now go find the new location */
|
||||
n_iface = 0;
|
||||
while (strcmp(iface, iface_names[n_iface]) &&
|
||||
(iface_names[n_iface] != NULL))
|
||||
++n_iface;
|
||||
if (iface_names[n_iface] == NULL)
|
||||
msgFatal("Erk - run off the end of the list of interfaces!");
|
||||
strcpy(ipaddr, if_list[n_iface].ipaddr);
|
||||
strcpy(netmask, if_list[n_iface].netmask);
|
||||
strcpy(extras, if_list[n_iface].extras);
|
||||
if_list[n_iface].valid = FALSE;
|
||||
|
||||
RefreshStringObj(layout[LAYOUT_IPADDR].obj);
|
||||
RefreshStringObj(layout[LAYOUT_NETMASK].obj);
|
||||
RefreshStringObj(layout[LAYOUT_EXTRAS].obj);
|
||||
|
||||
strcpy(old_iface, iface);
|
||||
}
|
||||
|
||||
/* Loop back to the interface list from the extras box -
|
||||
now we handle the case of saving out the data the user
|
||||
typed in (and also do basic verification of its
|
||||
sanity) */
|
||||
if (n == LAYOUT_EXTRAS) {
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
/* First, find the old value */
|
||||
n_iface = 0;
|
||||
while (strcmp(old_iface, iface_names[n_iface]) &&
|
||||
(iface_names[n_iface] != NULL))
|
||||
++n_iface;
|
||||
|
||||
if (iface_names[n_iface] == NULL)
|
||||
msgFatal("Erk - run off the end of the list of interfaces!");
|
||||
|
||||
/* Sanity check what the user supplied - this could probably
|
||||
be better :-( */
|
||||
|
||||
if (!verifyIP(ipaddr)) {
|
||||
feepout("Invalid or missing IP address!");
|
||||
strcpy(iface, old_iface);
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
RefreshListObj(layout[LAYOUT_IFACE].obj);
|
||||
}
|
||||
|
||||
if (netmask[0] < '0' || netmask[0] > '9') {
|
||||
feepout("Invalid or missing netmask!");
|
||||
strcpy(iface, old_iface);
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
RefreshListObj(layout[LAYOUT_IFACE].obj);
|
||||
}
|
||||
|
||||
strcpy(if_list[n_iface].ipaddr, ipaddr);
|
||||
strcpy(if_list[n_iface].netmask, netmask);
|
||||
strcpy(if_list[n_iface].extras, extras);
|
||||
if_list[n_iface].valid = TRUE;
|
||||
if_list[n_iface].dptr->enabled = TRUE;
|
||||
} else if (n < max)
|
||||
if (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
@ -504,7 +401,9 @@ tcpOpenDialog(char *str)
|
||||
out to the environment via the variable_set layers */
|
||||
|
||||
if (!cancel) {
|
||||
int foo;
|
||||
DevInfo *di;
|
||||
char temp[512], ifn[64];
|
||||
|
||||
variable_set2(VAR_HOSTNAME, hostname);
|
||||
variable_set2(VAR_DOMAINNAME, domainname);
|
||||
if (gateway[0])
|
||||
@ -512,23 +411,20 @@ tcpOpenDialog(char *str)
|
||||
if (nameserver[0])
|
||||
variable_set2(VAR_NAMESERVER, nameserver);
|
||||
|
||||
/* Loop over the per-interface data saving data which has been
|
||||
validated ... */
|
||||
for (foo = 0 ; foo < INTERFACE_MAX ; foo++) {
|
||||
if (if_list[foo].valid == TRUE) {
|
||||
char temp[512], ifn[64];
|
||||
sprintf(temp, "inet %s %s netmask %s",
|
||||
if_list[foo].ipaddr, if_list[foo].extras,
|
||||
if_list[foo].netmask);
|
||||
sprintf(ifn, "%s%s", VAR_IFCONFIG, iface_names[foo]);
|
||||
variable_set2(ifn, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!devp->private)
|
||||
devp->private = (DevInfo *)malloc(sizeof(DevInfo));
|
||||
di = devp->private;
|
||||
strcpy(di->ipaddr, ipaddr);
|
||||
strcpy(di->netmask, netmask);
|
||||
strcpy(di->extras, extras);
|
||||
|
||||
static Device *netDevice;
|
||||
sprintf(temp, "inet %s %s netmask %s", ipaddr, extras, netmask);
|
||||
sprintf(ifn, "%s%s", VAR_IFCONFIG, devp->name);
|
||||
variable_set2(ifn, temp);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
netHook(char *str)
|
||||
@ -541,32 +437,25 @@ netHook(char *str)
|
||||
if (!*str)
|
||||
return 0;
|
||||
devs = deviceFind(str, DEVICE_TYPE_NETWORK);
|
||||
if (devs)
|
||||
netDevice = devs[0];
|
||||
if (devs) {
|
||||
tcpOpenDialog(devs[0]);
|
||||
mediaDevice = devs[0];
|
||||
}
|
||||
return devs ? 1 : 0;
|
||||
}
|
||||
|
||||
/* Get a network device */
|
||||
Device *
|
||||
tcpDeviceSelect(void)
|
||||
int
|
||||
tcpDeviceSelect(char *str)
|
||||
{
|
||||
DMenu *menu;
|
||||
|
||||
/* If we can't find a hostname, ask user to set up TCP/IP */
|
||||
if (!getenv(VAR_HOSTNAME))
|
||||
tcpOpenDialog(NULL);
|
||||
|
||||
/* If we still can't, user is a bonehead */
|
||||
if (!getenv(VAR_HOSTNAME)) {
|
||||
msgConfirm("Sorry, I can't do this if you don't set up your networking first!");
|
||||
return 0;
|
||||
}
|
||||
menu = deviceCreateMenu(&MenuNetworkDevice, DEVICE_TYPE_NETWORK, netHook);
|
||||
if (!menu)
|
||||
msgFatal("Unable to create network device menu! Argh!");
|
||||
dmenuOpenSimple(menu);
|
||||
free(menu);
|
||||
return netDevice;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Start PPP on the 3rd screen */
|
||||
@ -580,6 +469,10 @@ tcpStartPPP(void)
|
||||
return FALSE;
|
||||
Mkdir("/var/log", NULL);
|
||||
Mkdir("/var/spool/lock", NULL);
|
||||
Mkdir("/etc/ppp", NULL);
|
||||
/* XXX Put our IP addr in the right file instead of this stupidity!! XXX */
|
||||
vsystem("touch /etc/ppp/ppp.linkup; chmod +x /etc/ppp/ppp.linkup");
|
||||
vsystem("touch /etc/ppp/ppp.secret; chmod +x /etc/ppp/ppp.secret");
|
||||
if (!fork()) {
|
||||
dup2(fd, 0);
|
||||
dup2(fd, 1);
|
||||
@ -589,7 +482,3 @@ tcpStartPPP(void)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <machine/console.h>
|
||||
|
||||
@ -64,8 +65,11 @@ set_termcap(void)
|
||||
}
|
||||
}
|
||||
if (DebugFD == -1) {
|
||||
int i;
|
||||
|
||||
DebugFD = open("/dev/ttyv1", O_WRONLY);
|
||||
ioctl(DebugFD, TIOCCONS, (char *)NULL);
|
||||
i = ioctl(DebugFD, TIOCCONS, (char *)NULL);
|
||||
msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)", DebugFD, i, !i ? "success" : strerror(errno));
|
||||
}
|
||||
OnVTY = TRUE;
|
||||
}
|
||||
|
@ -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.5 1995/05/24 18:52:47 jkh Exp $
|
||||
* $Id: config.c,v 1.6 1995/05/25 18:48:22 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -82,7 +82,7 @@ nameof(Chunk *c1)
|
||||
static char *
|
||||
mount_point(Chunk *c1)
|
||||
{
|
||||
if (c1->type == PART_FAT || (c1->type == part && c1->subtype != FS_SWAP))
|
||||
if (c1->type == fat || (c1->type == part && c1->subtype != FS_SWAP))
|
||||
return ((PartInfo *)c1->private)->mountpoint;
|
||||
else if (c1->type == part && c1->subtype == FS_SWAP)
|
||||
return "none";
|
||||
@ -92,7 +92,7 @@ mount_point(Chunk *c1)
|
||||
static char *
|
||||
fstype(Chunk *c1)
|
||||
{
|
||||
if (c1->type == PART_FAT)
|
||||
if (c1->type == fat)
|
||||
return "msdos";
|
||||
else if (c1->type == part) {
|
||||
if (c1->subtype != FS_SWAP)
|
||||
@ -209,7 +209,6 @@ configFstab(void)
|
||||
void
|
||||
configSysconfig(void)
|
||||
{
|
||||
#if 0
|
||||
FILE *fp;
|
||||
char *lines[5001]; /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */
|
||||
char line[256];
|
||||
@ -222,16 +221,39 @@ configSysconfig(void)
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < 5000; i++) {
|
||||
if (!fgets(line, 256, fp))
|
||||
if (!fgets(line, 255, fp))
|
||||
break;
|
||||
lines[nlines++] = strdup(line);
|
||||
}
|
||||
lines[nlines] = NULL;
|
||||
fclose(fp);
|
||||
for (v = VarHead; v; v = v->next) {
|
||||
for (i = 0; i < nlines; i++) {
|
||||
char modify[256], *cp;
|
||||
|
||||
if (lines[i][0] == '#' || lines[i][0] == ';')
|
||||
continue;
|
||||
strncpy(modify, lines[i], 255);
|
||||
cp = index(modify, '=');
|
||||
if (!cp)
|
||||
continue;
|
||||
*(cp++) = '\0';
|
||||
if (!strcmp(modify, v->name)) {
|
||||
free(lines[i]);
|
||||
lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 3);
|
||||
sprintf(lines[i], "%s=%s\n", v->name, v->value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fp = fopen("/etc/sysconfig", "w");
|
||||
if (!fp) {
|
||||
msgConfirm("Unable to re-write /etc/sysconfig file! Things may work\nrather strangely as a result of this.");
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < nlines; i++)
|
||||
fprintf(fp, lines[i]);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -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.29 1995/05/24 09:00:11 jkh Exp $
|
||||
* $Id: devices.c,v 1.30 1995/05/24 17:49:11 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -145,7 +145,7 @@ deviceDiskFree(Device *dev)
|
||||
/* Register a new device in the devices array */
|
||||
Device *
|
||||
deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled,
|
||||
Boolean (*init)(Device *), int (*get)(char *), Boolean (*close)(Device *, int),
|
||||
Boolean (*init)(Device *), int (*get)(char *, char *), Boolean (*close)(Device *, int),
|
||||
void (*shutdown)(Device *), void *private)
|
||||
{
|
||||
Device *newdev;
|
||||
|
@ -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.54 1995/05/25 01:52:02 jkh Exp $
|
||||
* $Id: install.c,v 1.55 1995/05/25 18:48:25 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -367,136 +367,61 @@ copy_self(void)
|
||||
i = vsystem("find -x /stand | cpio -pdmv /mnt");
|
||||
if (i)
|
||||
msgConfirm("Copy returned error status of %d!", i);
|
||||
/* copy up the etc files */
|
||||
(void)vsystem("(cd /mnt/stand; find etc) | cpio -pdmv /mnt");
|
||||
}
|
||||
|
||||
static Device *floppyDev;
|
||||
|
||||
static int
|
||||
floppyChoiceHook(char *str)
|
||||
{
|
||||
Device **devs;
|
||||
|
||||
/* Clip garbage off the ends */
|
||||
string_prune(str);
|
||||
str = string_skipwhite(str);
|
||||
if (!*str)
|
||||
return 0;
|
||||
devs = deviceFind(str, DEVICE_TYPE_FLOPPY);
|
||||
if (devs)
|
||||
floppyDev = devs[0];
|
||||
return devs ? 1 : 0;
|
||||
}
|
||||
static void loop_on_root_floppy();
|
||||
|
||||
static void
|
||||
root_extract(void)
|
||||
{
|
||||
int i, j, zpid, cpid, pfd[2];
|
||||
Boolean onCDROM = FALSE;
|
||||
int fd, status;
|
||||
|
||||
if (mediaDevice && mediaDevice->type == DEVICE_TYPE_CDROM) {
|
||||
if (mediaDevice->init) {
|
||||
if ((*mediaDevice->init)(mediaDevice)) {
|
||||
RootFD = open("/cdrom/floppies/root.flp", O_RDONLY);
|
||||
if (RootFD != -1) {
|
||||
msgNotify("Loading root floppy from CDROM");
|
||||
onCDROM = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OnCDROM) {
|
||||
fd = open("/floppies/root.flp", O_RDONLY);
|
||||
mediaExtractDist("root.flp", "/", fd);
|
||||
return;
|
||||
}
|
||||
if (mediaDevice) {
|
||||
switch(mediaDevice->type) {
|
||||
|
||||
tryagain:
|
||||
while (RootFD == -1) {
|
||||
if (!floppyDev) {
|
||||
Device **devs;
|
||||
int cnt;
|
||||
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_FLOPPY);
|
||||
cnt = deviceCount(devs);
|
||||
if (cnt == 1)
|
||||
floppyDev = devs[0];
|
||||
else if (cnt > 1) {
|
||||
DMenu *menu;
|
||||
|
||||
menu = deviceCreateMenu(&MenuMediaFloppy, DEVICE_TYPE_FLOPPY, floppyChoiceHook);
|
||||
dmenuOpenSimple(menu);
|
||||
case DEVICE_TYPE_DOS:
|
||||
case DEVICE_TYPE_FTP:
|
||||
case DEVICE_TYPE_DISK:
|
||||
case DEVICE_TYPE_NETWORK:
|
||||
case DEVICE_TYPE_CDROM:
|
||||
if (mediaDevice->init)
|
||||
if (!(*mediaDevice->init)(mediaDevice))
|
||||
break;
|
||||
fd = (*mediaDevice->get)("root.flp", "floppies/");
|
||||
if (fd != -1) {
|
||||
msgNotify("Loading root floppy over %s", mediaDevice->name);
|
||||
status = mediaExtractDist("root.flp", "/", fd);
|
||||
if (mediaDevice->close)
|
||||
(*mediaDevice->close)(mediaDevice, fd);
|
||||
else
|
||||
close(fd);
|
||||
}
|
||||
else {
|
||||
msgConfirm("No floppy devices found! Something is seriously wrong!");
|
||||
return;
|
||||
}
|
||||
if (!floppyDev)
|
||||
continue;
|
||||
}
|
||||
dialog_clear();
|
||||
msgConfirm("Please Insert ROOT floppy in %s", floppyDev->description);
|
||||
RootFD = open(floppyDev->devname, O_RDONLY);
|
||||
if (RootFD >= 0)
|
||||
break;
|
||||
msgDebug("Error on open of root floppy: %s (%d)\n", strerror(errno), errno);
|
||||
}
|
||||
j = fork();
|
||||
if (!j) {
|
||||
chdir("/");
|
||||
msgWeHaveOutput("Extracting contents of root floppy...");
|
||||
pipe(pfd);
|
||||
zpid = fork();
|
||||
if (!zpid) {
|
||||
dup2(RootFD, 0); close(RootFD);
|
||||
dup2(pfd[1], 1); close(pfd[1]);
|
||||
if (DebugFD != -1)
|
||||
dup2(DebugFD, 2);
|
||||
close(pfd[0]);
|
||||
i = execl("/stand/gunzip", "/stand/gunzip", 0);
|
||||
msgDebug("/stand/gunzip command returns %d status\n", i);
|
||||
exit(i);
|
||||
}
|
||||
cpid = fork();
|
||||
if (!cpid) {
|
||||
dup2(pfd[0], 0); close(pfd[0]);
|
||||
close(RootFD);
|
||||
close(pfd[1]);
|
||||
if (DebugFD != -1) {
|
||||
dup2(DebugFD, 1);
|
||||
dup2(DebugFD, 2);
|
||||
}
|
||||
else {
|
||||
close(1); open("/dev/null", O_WRONLY);
|
||||
dup2(1, 2);
|
||||
}
|
||||
i = execl("/stand/cpio", "/stand/cpio", "-iduvm", 0);
|
||||
msgDebug("/stand/cpio command returns %d status\n", i);
|
||||
exit(i);
|
||||
}
|
||||
close(pfd[0]);
|
||||
close(pfd[1]);
|
||||
close(RootFD);
|
||||
|
||||
i = waitpid(zpid, &j, 0);
|
||||
if (i < 0) { /* Don't check status - gunzip seems to return a bogus one! */
|
||||
dialog_clear();
|
||||
msgConfirm("wait for gunzip returned status of %d!", i);
|
||||
exit(1);
|
||||
case DEVICE_TYPE_FLOPPY:
|
||||
default:
|
||||
loop_on_root_floppy();
|
||||
break;
|
||||
}
|
||||
i = waitpid(cpid, &j, 0);
|
||||
if (i < 0 || WEXITSTATUS(j)) {
|
||||
dialog_clear();
|
||||
msgConfirm("cpio returned error status of %d!", WEXITSTATUS(j));
|
||||
exit(2);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
i = wait(&j);
|
||||
if (i < 0 || WEXITSTATUS(j) || access("/OK", R_OK) == -1) {
|
||||
dialog_clear();
|
||||
msgConfirm("Root floppy did not extract properly! Please verify\nthat your media is correct and try again.");
|
||||
close(RootFD);
|
||||
RootFD = -1;
|
||||
dialog_clear();
|
||||
goto tryagain;
|
||||
}
|
||||
unlink("/OK");
|
||||
if (!onCDROM)
|
||||
msgConfirm("Please remove all floppies in any drives at this time.\nThey are no longer needed.");
|
||||
loop_on_root_floppy();
|
||||
}
|
||||
|
||||
static void
|
||||
loop_on_root_floppy(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = genericGetDist("root.flp", NULL, TRUE);
|
||||
if (fd == -1)
|
||||
return;
|
||||
mediaExtractDist("root.flp", "/", fd);
|
||||
}
|
||||
|
@ -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.29 1995/05/25 01:22:18 jkh Exp $
|
||||
* $Id: menus.c,v 1.30 1995/05/25 18:48:29 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -586,7 +586,7 @@ DMenu MenuInstall = {
|
||||
details on the type of distribution you wish to have, where you wish\n\
|
||||
to install it from and how you wish to allocate disk storage to FreeBSD.\n\n\
|
||||
None of the items in this menu will actually modify the contents of\n\
|
||||
your disk until you select the \"Write\" menu item (and even then, only\n\
|
||||
your disk until you select the \"Install\" menu item (and even then, only\n\
|
||||
after a final confirmation). Select Cancel to leave this menu.",
|
||||
"Press F1 to read the installation guide",
|
||||
"install.hlp",
|
||||
@ -599,8 +599,8 @@ after a final confirmation). Select Cancel to leave this menu.",
|
||||
{ "Label", "Label allocated disk partitions", /* L */
|
||||
DMENU_CALL, diskLabelEditor, 0, 0 },
|
||||
{ "Networking", "Configure this host on a network", /* N */
|
||||
DMENU_CALL, tcpOpenDialog, 0, 0 },
|
||||
{ "Write", "Install FreeBSD onto your hard disk(s)", /* W */
|
||||
DMENU_CALL, tcpDeviceSelect, 0, 0 },
|
||||
{ "Install", "Install FreeBSD onto your hard disk(s)", /* I */
|
||||
DMENU_CALL, installCommit, 0, 0 },
|
||||
{ "Configure", "Do post-install configuration of FreeBSD", /* C */
|
||||
DMENU_SUBMENU, &MenuConfigure, 0, 0 },
|
||||
@ -626,7 +626,7 @@ Record to remain untouched, then select \"none\".",
|
||||
{ "Standard", "Use a standard MBR (no boot manager)", /* S */
|
||||
DMENU_SET_VARIABLE, "bootManager=mbr", 0, 0 },
|
||||
{ "None", "Leave the Master Boot Record untouched", /* N */
|
||||
DMENU_CALL, diskPartitionEditor, 0, 0 },
|
||||
DMENU_SET_VARIABLE, "bootManager=none", 0, 0 },
|
||||
{ NULL } },
|
||||
};
|
||||
|
||||
@ -644,11 +644,11 @@ When you're done, select Cancel",
|
||||
{ { "Add User", "Add users to the system",
|
||||
DMENU_SYSTEM_COMMAND, "adduser", 0, 0 },
|
||||
{ "Networking", "Configure network",
|
||||
DMENU_CALL, tcpOpenDialog, 0, 0 },
|
||||
DMENU_CALL, tcpDeviceSelect, 0, 0 },
|
||||
{ "Time Zone", "Set which time zone you're in",
|
||||
DMENU_SYSTEM_COMMAND, "tzsetup", 0, 0 },
|
||||
{ "Packages", "Install extra FreeBSD packaged software",
|
||||
DMENU_CALL, configPackages, 0, 1 },
|
||||
DMENU_CALL, configPackages, 0, 0 },
|
||||
{ "Ports", "Enable the FreeBSD Ports Collection from CD",
|
||||
DMENU_CALL, configPorts, 0, 1 },
|
||||
{ "Root Password", "Set the system manager's password",
|
||||
|
@ -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.32 1995/05/25 01:22:20 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.33 1995/05/25 18:48:30 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -144,6 +144,7 @@ typedef enum {
|
||||
DEVICE_TYPE_NONE,
|
||||
DEVICE_TYPE_DISK,
|
||||
DEVICE_TYPE_FLOPPY,
|
||||
DEVICE_TYPE_FTP,
|
||||
DEVICE_TYPE_NETWORK,
|
||||
DEVICE_TYPE_CDROM,
|
||||
DEVICE_TYPE_TAPE,
|
||||
@ -159,7 +160,7 @@ typedef struct _device {
|
||||
DeviceType type;
|
||||
Boolean enabled;
|
||||
Boolean (*init)(struct _device *);
|
||||
int (*get)(char *fname);
|
||||
int (*get)(char *fname, char *dir);
|
||||
Boolean (*close)(struct _device *, int fd);
|
||||
void (*shutdown)(struct _device *);
|
||||
void *private;
|
||||
@ -187,7 +188,6 @@ typedef int (*commandFunc)(char *key, void *data);
|
||||
|
||||
|
||||
/*** Externs ***/
|
||||
extern int RootFD; /* The file descriptor for our root floppy */
|
||||
extern int DebugFD; /* Where diagnostic output goes */
|
||||
extern Boolean OnCDROM; /* Are we running off of a CDROM? */
|
||||
extern Boolean OnSerial; /* Are we on a serial console? */
|
||||
@ -260,7 +260,7 @@ extern Device **deviceFind(char *name, DeviceType type);
|
||||
extern int deviceCount(Device **devs);
|
||||
extern Device *new_device(char *name);
|
||||
extern Device *deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled,
|
||||
Boolean (*init)(Device *mediadev), int (*get)(char *distname),
|
||||
Boolean (*init)(Device *mediadev), int (*get)(char *distname, char *path),
|
||||
Boolean (*close)(Device *mediadev, int fd), void (*shutDown)(Device *mediadev),
|
||||
void *private);
|
||||
|
||||
@ -331,6 +331,7 @@ extern Boolean mediaExtractDist(char *distname, char *dir, int fd);
|
||||
extern Boolean mediaVerify(void);
|
||||
|
||||
/* media_strategy.c */
|
||||
extern int genericGetDist(char *path, void *dist_attrib, Boolean prompt);
|
||||
extern Boolean mediaInitCDROM(Device *dev);
|
||||
extern Boolean mediaInitDOS(Device *dev);
|
||||
extern Boolean mediaInitFloppy(Device *dev);
|
||||
@ -338,12 +339,12 @@ extern Boolean mediaInitFTP(Device *dev);
|
||||
extern Boolean mediaInitNetwork(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 int mediaGetCDROM(char *dist, char *path);
|
||||
extern int mediaGetDOS(char *dist, char *path);
|
||||
extern int mediaGetFloppy(char *dist, char *path);
|
||||
extern int mediaGetFTP(char *dist, char *path);
|
||||
extern int mediaGetTape(char *dist, char *path);
|
||||
extern int mediaGetUFS(char *dist, char *path);
|
||||
extern void mediaShutdownCDROM(Device *dev);
|
||||
extern void mediaShutdownDOS(Device *dev);
|
||||
extern void mediaShutdownFTP(Device *dev);
|
||||
@ -397,8 +398,8 @@ extern void systemChangeScreenmap(const u_char newmap[]);
|
||||
extern int vsystem(char *fmt, ...);
|
||||
|
||||
/* tcpip.c */
|
||||
extern int tcpOpenDialog(char *);
|
||||
extern Device *tcpDeviceSelect(void);
|
||||
extern int tcpOpenDialog(Device *);
|
||||
extern int tcpDeviceSelect(char *str);
|
||||
extern Boolean tcpStartPPP(void);
|
||||
|
||||
/* termcap.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.33 1995/05/25 01:52:03 jkh Exp $
|
||||
* $Id: system.c,v 1.34 1995/05/25 18:48:31 jkh Exp $
|
||||
*
|
||||
* Jordan Hubbard
|
||||
*
|
||||
@ -60,7 +60,6 @@ systemInitialize(int argc, char **argv)
|
||||
close(0); open("/bootcd/dev/console", O_RDWR);
|
||||
close(1); dup(0);
|
||||
close(2); dup(0);
|
||||
RootFD = open("/floppies/root.flp", O_RDONLY);
|
||||
OnCDROM = TRUE;
|
||||
chroot("/bootcd");
|
||||
} else {
|
||||
@ -70,9 +69,9 @@ systemInitialize(int argc, char **argv)
|
||||
}
|
||||
printf("%s running as init\n", argv[0]);
|
||||
|
||||
ioctl(0, TIOCSCTTY, (char *)NULL);
|
||||
i = ioctl(0, TIOCSCTTY, (char *)NULL);
|
||||
setlogin("root");
|
||||
setenv("PATH", "/stand:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin", 1);
|
||||
setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin", 1);
|
||||
setbuf(stdin, 0);
|
||||
setbuf(stderr, 0);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <machine/console.h>
|
||||
|
||||
@ -64,8 +65,11 @@ set_termcap(void)
|
||||
}
|
||||
}
|
||||
if (DebugFD == -1) {
|
||||
int i;
|
||||
|
||||
DebugFD = open("/dev/ttyv1", O_WRONLY);
|
||||
ioctl(DebugFD, TIOCCONS, (char *)NULL);
|
||||
i = ioctl(DebugFD, TIOCCONS, (char *)NULL);
|
||||
msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)", DebugFD, i, !i ? "success" : strerror(errno));
|
||||
}
|
||||
OnVTY = TRUE;
|
||||
}
|
||||
|
@ -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.5 1995/05/24 18:52:47 jkh Exp $
|
||||
* $Id: config.c,v 1.6 1995/05/25 18:48:22 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -82,7 +82,7 @@ nameof(Chunk *c1)
|
||||
static char *
|
||||
mount_point(Chunk *c1)
|
||||
{
|
||||
if (c1->type == PART_FAT || (c1->type == part && c1->subtype != FS_SWAP))
|
||||
if (c1->type == fat || (c1->type == part && c1->subtype != FS_SWAP))
|
||||
return ((PartInfo *)c1->private)->mountpoint;
|
||||
else if (c1->type == part && c1->subtype == FS_SWAP)
|
||||
return "none";
|
||||
@ -92,7 +92,7 @@ mount_point(Chunk *c1)
|
||||
static char *
|
||||
fstype(Chunk *c1)
|
||||
{
|
||||
if (c1->type == PART_FAT)
|
||||
if (c1->type == fat)
|
||||
return "msdos";
|
||||
else if (c1->type == part) {
|
||||
if (c1->subtype != FS_SWAP)
|
||||
@ -209,7 +209,6 @@ configFstab(void)
|
||||
void
|
||||
configSysconfig(void)
|
||||
{
|
||||
#if 0
|
||||
FILE *fp;
|
||||
char *lines[5001]; /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */
|
||||
char line[256];
|
||||
@ -222,16 +221,39 @@ configSysconfig(void)
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < 5000; i++) {
|
||||
if (!fgets(line, 256, fp))
|
||||
if (!fgets(line, 255, fp))
|
||||
break;
|
||||
lines[nlines++] = strdup(line);
|
||||
}
|
||||
lines[nlines] = NULL;
|
||||
fclose(fp);
|
||||
for (v = VarHead; v; v = v->next) {
|
||||
for (i = 0; i < nlines; i++) {
|
||||
char modify[256], *cp;
|
||||
|
||||
if (lines[i][0] == '#' || lines[i][0] == ';')
|
||||
continue;
|
||||
strncpy(modify, lines[i], 255);
|
||||
cp = index(modify, '=');
|
||||
if (!cp)
|
||||
continue;
|
||||
*(cp++) = '\0';
|
||||
if (!strcmp(modify, v->name)) {
|
||||
free(lines[i]);
|
||||
lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 3);
|
||||
sprintf(lines[i], "%s=%s\n", v->name, v->value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fp = fopen("/etc/sysconfig", "w");
|
||||
if (!fp) {
|
||||
msgConfirm("Unable to re-write /etc/sysconfig file! Things may work\nrather strangely as a result of this.");
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < nlines; i++)
|
||||
fprintf(fp, lines[i]);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -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.29 1995/05/24 09:00:11 jkh Exp $
|
||||
* $Id: devices.c,v 1.30 1995/05/24 17:49:11 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -145,7 +145,7 @@ deviceDiskFree(Device *dev)
|
||||
/* Register a new device in the devices array */
|
||||
Device *
|
||||
deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled,
|
||||
Boolean (*init)(Device *), int (*get)(char *), Boolean (*close)(Device *, int),
|
||||
Boolean (*init)(Device *), int (*get)(char *, char *), Boolean (*close)(Device *, int),
|
||||
void (*shutdown)(Device *), void *private)
|
||||
{
|
||||
Device *newdev;
|
||||
|
@ -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.19 1995/05/24 17:49:12 jkh Exp $
|
||||
* $Id: dist.c,v 1.20 1995/05/25 18:48:24 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -233,15 +233,13 @@ distExtract(char *parent, Distribution *me)
|
||||
if (me[i].my_dist)
|
||||
status = distExtract(me[i].my_name, me[i].my_dist);
|
||||
else {
|
||||
char distname[FILENAME_MAX];
|
||||
char dparent[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 (parent) /* Yetch */
|
||||
snprintf(dparent, FILENAME_MAX, "%s/", parent);
|
||||
fd = (*mediaDevice->get)(parent ? dparent : me[i].my_name, me[i].my_name);
|
||||
if (fd != -1) {
|
||||
status = mediaExtractDist(distname, me[i].my_dir, fd);
|
||||
status = mediaExtractDist(me[i].my_name, me[i].my_dir, fd);
|
||||
if (mediaDevice->close)
|
||||
(*mediaDevice->close)(mediaDevice, fd);
|
||||
else
|
||||
@ -251,7 +249,7 @@ distExtract(char *parent, Distribution *me)
|
||||
if (getenv(NO_CONFIRMATION))
|
||||
status = 0;
|
||||
else
|
||||
status = !msgYesNo("Unable to transfer the %s distribution from %s.\nDo you want to retry this distribution later?", distname, mediaDevice->name);
|
||||
status = !msgYesNo("Unable to transfer the %s distribution from %s.\nDo you want to retry this distribution later?", me[i].my_name, mediaDevice->name);
|
||||
}
|
||||
}
|
||||
if (!status) {
|
||||
|
@ -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.54 1995/05/25 01:52:02 jkh Exp $
|
||||
* $Id: install.c,v 1.55 1995/05/25 18:48:25 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -367,136 +367,61 @@ copy_self(void)
|
||||
i = vsystem("find -x /stand | cpio -pdmv /mnt");
|
||||
if (i)
|
||||
msgConfirm("Copy returned error status of %d!", i);
|
||||
/* copy up the etc files */
|
||||
(void)vsystem("(cd /mnt/stand; find etc) | cpio -pdmv /mnt");
|
||||
}
|
||||
|
||||
static Device *floppyDev;
|
||||
|
||||
static int
|
||||
floppyChoiceHook(char *str)
|
||||
{
|
||||
Device **devs;
|
||||
|
||||
/* Clip garbage off the ends */
|
||||
string_prune(str);
|
||||
str = string_skipwhite(str);
|
||||
if (!*str)
|
||||
return 0;
|
||||
devs = deviceFind(str, DEVICE_TYPE_FLOPPY);
|
||||
if (devs)
|
||||
floppyDev = devs[0];
|
||||
return devs ? 1 : 0;
|
||||
}
|
||||
static void loop_on_root_floppy();
|
||||
|
||||
static void
|
||||
root_extract(void)
|
||||
{
|
||||
int i, j, zpid, cpid, pfd[2];
|
||||
Boolean onCDROM = FALSE;
|
||||
int fd, status;
|
||||
|
||||
if (mediaDevice && mediaDevice->type == DEVICE_TYPE_CDROM) {
|
||||
if (mediaDevice->init) {
|
||||
if ((*mediaDevice->init)(mediaDevice)) {
|
||||
RootFD = open("/cdrom/floppies/root.flp", O_RDONLY);
|
||||
if (RootFD != -1) {
|
||||
msgNotify("Loading root floppy from CDROM");
|
||||
onCDROM = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OnCDROM) {
|
||||
fd = open("/floppies/root.flp", O_RDONLY);
|
||||
mediaExtractDist("root.flp", "/", fd);
|
||||
return;
|
||||
}
|
||||
if (mediaDevice) {
|
||||
switch(mediaDevice->type) {
|
||||
|
||||
tryagain:
|
||||
while (RootFD == -1) {
|
||||
if (!floppyDev) {
|
||||
Device **devs;
|
||||
int cnt;
|
||||
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_FLOPPY);
|
||||
cnt = deviceCount(devs);
|
||||
if (cnt == 1)
|
||||
floppyDev = devs[0];
|
||||
else if (cnt > 1) {
|
||||
DMenu *menu;
|
||||
|
||||
menu = deviceCreateMenu(&MenuMediaFloppy, DEVICE_TYPE_FLOPPY, floppyChoiceHook);
|
||||
dmenuOpenSimple(menu);
|
||||
case DEVICE_TYPE_DOS:
|
||||
case DEVICE_TYPE_FTP:
|
||||
case DEVICE_TYPE_DISK:
|
||||
case DEVICE_TYPE_NETWORK:
|
||||
case DEVICE_TYPE_CDROM:
|
||||
if (mediaDevice->init)
|
||||
if (!(*mediaDevice->init)(mediaDevice))
|
||||
break;
|
||||
fd = (*mediaDevice->get)("root.flp", "floppies/");
|
||||
if (fd != -1) {
|
||||
msgNotify("Loading root floppy over %s", mediaDevice->name);
|
||||
status = mediaExtractDist("root.flp", "/", fd);
|
||||
if (mediaDevice->close)
|
||||
(*mediaDevice->close)(mediaDevice, fd);
|
||||
else
|
||||
close(fd);
|
||||
}
|
||||
else {
|
||||
msgConfirm("No floppy devices found! Something is seriously wrong!");
|
||||
return;
|
||||
}
|
||||
if (!floppyDev)
|
||||
continue;
|
||||
}
|
||||
dialog_clear();
|
||||
msgConfirm("Please Insert ROOT floppy in %s", floppyDev->description);
|
||||
RootFD = open(floppyDev->devname, O_RDONLY);
|
||||
if (RootFD >= 0)
|
||||
break;
|
||||
msgDebug("Error on open of root floppy: %s (%d)\n", strerror(errno), errno);
|
||||
}
|
||||
j = fork();
|
||||
if (!j) {
|
||||
chdir("/");
|
||||
msgWeHaveOutput("Extracting contents of root floppy...");
|
||||
pipe(pfd);
|
||||
zpid = fork();
|
||||
if (!zpid) {
|
||||
dup2(RootFD, 0); close(RootFD);
|
||||
dup2(pfd[1], 1); close(pfd[1]);
|
||||
if (DebugFD != -1)
|
||||
dup2(DebugFD, 2);
|
||||
close(pfd[0]);
|
||||
i = execl("/stand/gunzip", "/stand/gunzip", 0);
|
||||
msgDebug("/stand/gunzip command returns %d status\n", i);
|
||||
exit(i);
|
||||
}
|
||||
cpid = fork();
|
||||
if (!cpid) {
|
||||
dup2(pfd[0], 0); close(pfd[0]);
|
||||
close(RootFD);
|
||||
close(pfd[1]);
|
||||
if (DebugFD != -1) {
|
||||
dup2(DebugFD, 1);
|
||||
dup2(DebugFD, 2);
|
||||
}
|
||||
else {
|
||||
close(1); open("/dev/null", O_WRONLY);
|
||||
dup2(1, 2);
|
||||
}
|
||||
i = execl("/stand/cpio", "/stand/cpio", "-iduvm", 0);
|
||||
msgDebug("/stand/cpio command returns %d status\n", i);
|
||||
exit(i);
|
||||
}
|
||||
close(pfd[0]);
|
||||
close(pfd[1]);
|
||||
close(RootFD);
|
||||
|
||||
i = waitpid(zpid, &j, 0);
|
||||
if (i < 0) { /* Don't check status - gunzip seems to return a bogus one! */
|
||||
dialog_clear();
|
||||
msgConfirm("wait for gunzip returned status of %d!", i);
|
||||
exit(1);
|
||||
case DEVICE_TYPE_FLOPPY:
|
||||
default:
|
||||
loop_on_root_floppy();
|
||||
break;
|
||||
}
|
||||
i = waitpid(cpid, &j, 0);
|
||||
if (i < 0 || WEXITSTATUS(j)) {
|
||||
dialog_clear();
|
||||
msgConfirm("cpio returned error status of %d!", WEXITSTATUS(j));
|
||||
exit(2);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
i = wait(&j);
|
||||
if (i < 0 || WEXITSTATUS(j) || access("/OK", R_OK) == -1) {
|
||||
dialog_clear();
|
||||
msgConfirm("Root floppy did not extract properly! Please verify\nthat your media is correct and try again.");
|
||||
close(RootFD);
|
||||
RootFD = -1;
|
||||
dialog_clear();
|
||||
goto tryagain;
|
||||
}
|
||||
unlink("/OK");
|
||||
if (!onCDROM)
|
||||
msgConfirm("Please remove all floppies in any drives at this time.\nThey are no longer needed.");
|
||||
loop_on_root_floppy();
|
||||
}
|
||||
|
||||
static void
|
||||
loop_on_root_floppy(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = genericGetDist("root.flp", NULL, TRUE);
|
||||
if (fd == -1)
|
||||
return;
|
||||
mediaExtractDist("root.flp", "/", fd);
|
||||
}
|
||||
|
@ -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.15 1995/05/23 02:41:09 jkh Exp $
|
||||
* $Id: media.c,v 1.16 1995/05/24 09:00:40 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -251,12 +251,9 @@ int
|
||||
mediaSetFTP(char *str)
|
||||
{
|
||||
static Device ftpDevice;
|
||||
Device *devp;
|
||||
char *cp;
|
||||
|
||||
devp = tcpDeviceSelect();
|
||||
if (!devp)
|
||||
return 0;
|
||||
tcpDeviceSelect(NULL);
|
||||
dmenuOpenSimple(&MenuMediaFTP);
|
||||
cp = getenv("ftp");
|
||||
if (!cp)
|
||||
@ -266,7 +263,7 @@ mediaSetFTP(char *str)
|
||||
ftpDevice.init = mediaInitFTP;
|
||||
ftpDevice.get = mediaGetFTP;
|
||||
ftpDevice.shutdown = mediaShutdownFTP;
|
||||
ftpDevice.private = devp;
|
||||
ftpDevice.private = mediaDevice;
|
||||
mediaDevice = &ftpDevice;
|
||||
return 1;
|
||||
}
|
||||
|
@ -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.29 1995/05/25 01:22:18 jkh Exp $
|
||||
* $Id: menus.c,v 1.30 1995/05/25 18:48:29 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -586,7 +586,7 @@ DMenu MenuInstall = {
|
||||
details on the type of distribution you wish to have, where you wish\n\
|
||||
to install it from and how you wish to allocate disk storage to FreeBSD.\n\n\
|
||||
None of the items in this menu will actually modify the contents of\n\
|
||||
your disk until you select the \"Write\" menu item (and even then, only\n\
|
||||
your disk until you select the \"Install\" menu item (and even then, only\n\
|
||||
after a final confirmation). Select Cancel to leave this menu.",
|
||||
"Press F1 to read the installation guide",
|
||||
"install.hlp",
|
||||
@ -599,8 +599,8 @@ after a final confirmation). Select Cancel to leave this menu.",
|
||||
{ "Label", "Label allocated disk partitions", /* L */
|
||||
DMENU_CALL, diskLabelEditor, 0, 0 },
|
||||
{ "Networking", "Configure this host on a network", /* N */
|
||||
DMENU_CALL, tcpOpenDialog, 0, 0 },
|
||||
{ "Write", "Install FreeBSD onto your hard disk(s)", /* W */
|
||||
DMENU_CALL, tcpDeviceSelect, 0, 0 },
|
||||
{ "Install", "Install FreeBSD onto your hard disk(s)", /* I */
|
||||
DMENU_CALL, installCommit, 0, 0 },
|
||||
{ "Configure", "Do post-install configuration of FreeBSD", /* C */
|
||||
DMENU_SUBMENU, &MenuConfigure, 0, 0 },
|
||||
@ -626,7 +626,7 @@ Record to remain untouched, then select \"none\".",
|
||||
{ "Standard", "Use a standard MBR (no boot manager)", /* S */
|
||||
DMENU_SET_VARIABLE, "bootManager=mbr", 0, 0 },
|
||||
{ "None", "Leave the Master Boot Record untouched", /* N */
|
||||
DMENU_CALL, diskPartitionEditor, 0, 0 },
|
||||
DMENU_SET_VARIABLE, "bootManager=none", 0, 0 },
|
||||
{ NULL } },
|
||||
};
|
||||
|
||||
@ -644,11 +644,11 @@ When you're done, select Cancel",
|
||||
{ { "Add User", "Add users to the system",
|
||||
DMENU_SYSTEM_COMMAND, "adduser", 0, 0 },
|
||||
{ "Networking", "Configure network",
|
||||
DMENU_CALL, tcpOpenDialog, 0, 0 },
|
||||
DMENU_CALL, tcpDeviceSelect, 0, 0 },
|
||||
{ "Time Zone", "Set which time zone you're in",
|
||||
DMENU_SYSTEM_COMMAND, "tzsetup", 0, 0 },
|
||||
{ "Packages", "Install extra FreeBSD packaged software",
|
||||
DMENU_CALL, configPackages, 0, 1 },
|
||||
DMENU_CALL, configPackages, 0, 0 },
|
||||
{ "Ports", "Enable the FreeBSD Ports Collection from CD",
|
||||
DMENU_CALL, configPorts, 0, 1 },
|
||||
{ "Root Password", "Set the system manager's password",
|
||||
|
@ -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.32 1995/05/25 01:22:20 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.33 1995/05/25 18:48:30 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -144,6 +144,7 @@ typedef enum {
|
||||
DEVICE_TYPE_NONE,
|
||||
DEVICE_TYPE_DISK,
|
||||
DEVICE_TYPE_FLOPPY,
|
||||
DEVICE_TYPE_FTP,
|
||||
DEVICE_TYPE_NETWORK,
|
||||
DEVICE_TYPE_CDROM,
|
||||
DEVICE_TYPE_TAPE,
|
||||
@ -159,7 +160,7 @@ typedef struct _device {
|
||||
DeviceType type;
|
||||
Boolean enabled;
|
||||
Boolean (*init)(struct _device *);
|
||||
int (*get)(char *fname);
|
||||
int (*get)(char *fname, char *dir);
|
||||
Boolean (*close)(struct _device *, int fd);
|
||||
void (*shutdown)(struct _device *);
|
||||
void *private;
|
||||
@ -187,7 +188,6 @@ typedef int (*commandFunc)(char *key, void *data);
|
||||
|
||||
|
||||
/*** Externs ***/
|
||||
extern int RootFD; /* The file descriptor for our root floppy */
|
||||
extern int DebugFD; /* Where diagnostic output goes */
|
||||
extern Boolean OnCDROM; /* Are we running off of a CDROM? */
|
||||
extern Boolean OnSerial; /* Are we on a serial console? */
|
||||
@ -260,7 +260,7 @@ extern Device **deviceFind(char *name, DeviceType type);
|
||||
extern int deviceCount(Device **devs);
|
||||
extern Device *new_device(char *name);
|
||||
extern Device *deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled,
|
||||
Boolean (*init)(Device *mediadev), int (*get)(char *distname),
|
||||
Boolean (*init)(Device *mediadev), int (*get)(char *distname, char *path),
|
||||
Boolean (*close)(Device *mediadev, int fd), void (*shutDown)(Device *mediadev),
|
||||
void *private);
|
||||
|
||||
@ -331,6 +331,7 @@ extern Boolean mediaExtractDist(char *distname, char *dir, int fd);
|
||||
extern Boolean mediaVerify(void);
|
||||
|
||||
/* media_strategy.c */
|
||||
extern int genericGetDist(char *path, void *dist_attrib, Boolean prompt);
|
||||
extern Boolean mediaInitCDROM(Device *dev);
|
||||
extern Boolean mediaInitDOS(Device *dev);
|
||||
extern Boolean mediaInitFloppy(Device *dev);
|
||||
@ -338,12 +339,12 @@ extern Boolean mediaInitFTP(Device *dev);
|
||||
extern Boolean mediaInitNetwork(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 int mediaGetCDROM(char *dist, char *path);
|
||||
extern int mediaGetDOS(char *dist, char *path);
|
||||
extern int mediaGetFloppy(char *dist, char *path);
|
||||
extern int mediaGetFTP(char *dist, char *path);
|
||||
extern int mediaGetTape(char *dist, char *path);
|
||||
extern int mediaGetUFS(char *dist, char *path);
|
||||
extern void mediaShutdownCDROM(Device *dev);
|
||||
extern void mediaShutdownDOS(Device *dev);
|
||||
extern void mediaShutdownFTP(Device *dev);
|
||||
@ -397,8 +398,8 @@ extern void systemChangeScreenmap(const u_char newmap[]);
|
||||
extern int vsystem(char *fmt, ...);
|
||||
|
||||
/* tcpip.c */
|
||||
extern int tcpOpenDialog(char *);
|
||||
extern Device *tcpDeviceSelect(void);
|
||||
extern int tcpOpenDialog(Device *);
|
||||
extern int tcpDeviceSelect(char *str);
|
||||
extern Boolean tcpStartPPP(void);
|
||||
|
||||
/* termcap.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.33 1995/05/25 01:52:03 jkh Exp $
|
||||
* $Id: system.c,v 1.34 1995/05/25 18:48:31 jkh Exp $
|
||||
*
|
||||
* Jordan Hubbard
|
||||
*
|
||||
@ -60,7 +60,6 @@ systemInitialize(int argc, char **argv)
|
||||
close(0); open("/bootcd/dev/console", O_RDWR);
|
||||
close(1); dup(0);
|
||||
close(2); dup(0);
|
||||
RootFD = open("/floppies/root.flp", O_RDONLY);
|
||||
OnCDROM = TRUE;
|
||||
chroot("/bootcd");
|
||||
} else {
|
||||
@ -70,9 +69,9 @@ systemInitialize(int argc, char **argv)
|
||||
}
|
||||
printf("%s running as init\n", argv[0]);
|
||||
|
||||
ioctl(0, TIOCSCTTY, (char *)NULL);
|
||||
i = ioctl(0, TIOCSCTTY, (char *)NULL);
|
||||
setlogin("root");
|
||||
setenv("PATH", "/stand:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin", 1);
|
||||
setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin", 1);
|
||||
setbuf(stdin, 0);
|
||||
setbuf(stderr, 0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tcpip.c,v 1.13 1995/05/25 01:52:04 jkh Exp $
|
||||
* $Id: tcpip.c,v 1.14 1995/05/25 18:48:32 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
@ -35,6 +35,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* All kinds of hacking also performed by jkh on this code. Don't
|
||||
* blame Gary for every bogosity you see here.. :-)
|
||||
*
|
||||
* -jkh
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -48,12 +55,16 @@
|
||||
#include "rc.h"
|
||||
#include "sysinstall.h"
|
||||
|
||||
#define HOSTNAME_FIELD_LEN 256
|
||||
#define IPADDR_FIELD_LEN 16
|
||||
#define EXTRAS_FIELD_LEN 256
|
||||
|
||||
/* These are nasty, but they make the layout structure a lot easier ... */
|
||||
|
||||
static char hostname[256], domainname[256],
|
||||
gateway[32], nameserver[32], iface[8];
|
||||
static char hostname[HOSTNAME_FIELD_LEN], domainname[HOSTNAME_FIELD_LEN],
|
||||
gateway[IPADDR_FIELD_LEN], nameserver[IPADDR_FIELD_LEN];
|
||||
static int okbutton, cancelbutton;
|
||||
static char ipaddr[32], netmask[32], extras[256];
|
||||
static char ipaddr[IPADDR_FIELD_LEN], netmask[IPADDR_FIELD_LEN], extras[EXTRAS_FIELD_LEN];
|
||||
|
||||
/* What the screen size is meant to be */
|
||||
#define TCP_DIALOG_Y 0
|
||||
@ -61,18 +72,12 @@ static char ipaddr[32], netmask[32], extras[256];
|
||||
#define TCP_DIALOG_WIDTH COLS - 16
|
||||
#define TCP_DIALOG_HEIGHT LINES - 2
|
||||
|
||||
/* The per interface set of records */
|
||||
typedef struct _interface {
|
||||
char ipaddr[32];
|
||||
char netmask[32];
|
||||
char extras[256]; /* Extra stuff for ifconfig (link0, etc) */
|
||||
int valid;
|
||||
Device *dptr;
|
||||
} Interface;
|
||||
|
||||
/* The names and details of the available interfaces, for the list */
|
||||
Interface if_list[INTERFACE_MAX];
|
||||
char *iface_names[INTERFACE_MAX];
|
||||
/* This is the structure that Network devices carry around in their private, erm, structures */
|
||||
typedef struct _devPriv {
|
||||
char ipaddr[IPADDR_FIELD_LEN];
|
||||
char netmask[IPADDR_FIELD_LEN];
|
||||
char extras[EXTRAS_FIELD_LEN];
|
||||
} DevInfo;
|
||||
|
||||
/* The screen layout structure */
|
||||
typedef struct _layout {
|
||||
@ -88,49 +93,44 @@ typedef struct _layout {
|
||||
} Layout;
|
||||
|
||||
static Layout layout[] = {
|
||||
{ 1, 2, 25, 255,
|
||||
{ 1, 2, 25, HOSTNAME_FIELD_LEN - 1,
|
||||
"Host name:", "The name of your machine on a network, e.g. foo.bar.com",
|
||||
hostname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_HOSTNAME 0
|
||||
{ 1, 35, 20, 255,
|
||||
{ 1, 35, 20, HOSTNAME_FIELD_LEN - 1,
|
||||
"Domain name:",
|
||||
"The name of the domain that your machine is in, e.g. bar.com",
|
||||
domainname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_DOMAINNAME 1
|
||||
{ 5, 2, 18, 15,
|
||||
{ 5, 2, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Gateway:",
|
||||
"IP address of host forwarding packets to non-local hosts or nets",
|
||||
"IP address of host forwarding packets to non-local destinations",
|
||||
gateway, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GATEWAY 2
|
||||
{ 5, 35, 18, 15,
|
||||
{ 5, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Name server:", "IP address of your local DNS server",
|
||||
nameserver, STRINGOBJ, NULL },
|
||||
#define LAYOUT_NAMESERVER 3
|
||||
{ 9, 2, 9, 6,
|
||||
"Interface:",
|
||||
"Network devices found on boot (use <TAB> to exit from here)",
|
||||
iface, LISTOBJ, NULL },
|
||||
#define LAYOUT_IFACE 4
|
||||
{ 10, 18, 18, 15,
|
||||
{ 11, 10, 18, IPADDR_FIELD_LEN - 1,
|
||||
"IP Address:",
|
||||
"The IP address to be used for this interface - use 127.0.0.1 for lo0",
|
||||
"The IP address to be used for this interface",
|
||||
ipaddr, STRINGOBJ, NULL },
|
||||
#define LAYOUT_IPADDR 5
|
||||
{ 10, 37, 18, 15,
|
||||
{ 11, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Netmask:",
|
||||
"The netmask for this interfaace, e.g. 0xffffff00 for a class C network",
|
||||
netmask, STRINGOBJ, NULL },
|
||||
#define LAYOUT_NETMASK 6
|
||||
{ 14, 18, 37, 255,
|
||||
{ 15, 10, 37, HOSTNAME_FIELD_LEN - 1,
|
||||
"Extra options to ifconfig:",
|
||||
"Any interface-specific options to ifconfig you'd like to use",
|
||||
"Any interface-specific options to ifconfig you would like to use",
|
||||
extras, STRINGOBJ, NULL },
|
||||
#define LAYOUT_EXTRAS 7
|
||||
{ 19, 10, 0, 0,
|
||||
{ 19, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_OKBUTTON 8
|
||||
{ 19, 30, 0, 0,
|
||||
{ 19, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_CANCELBUTTON 9
|
||||
@ -139,8 +139,7 @@ static Layout layout[] = {
|
||||
|
||||
#define _validByte(b) ((b) > 0 && (b) < 255)
|
||||
|
||||
/* A JKH special - inform the user of an unusal error in a controlled
|
||||
fashion */
|
||||
/* whine */
|
||||
static void
|
||||
feepout(char *msg)
|
||||
{
|
||||
@ -174,6 +173,10 @@ verifySettings(void)
|
||||
feepout("Invalid gateway IP address specified");
|
||||
else if (nameserver[0] && !verifyIP(nameserver))
|
||||
feepout("Invalid name server IP address specified");
|
||||
else if (netmask[0] && (netmask[0] < '0' && netmask[0] > '3'))
|
||||
feepout("Invalid netmask value");
|
||||
else if (ipaddr[0] && !verifyIP(ipaddr))
|
||||
feepout("Invalid IP address");
|
||||
else
|
||||
return 1;
|
||||
return 0;
|
||||
@ -181,16 +184,14 @@ verifySettings(void)
|
||||
|
||||
/* This is it - how to get TCP setup values */
|
||||
int
|
||||
tcpOpenDialog(char *str)
|
||||
tcpOpenDialog(Device *devp)
|
||||
{
|
||||
WINDOW *ds_win;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret,
|
||||
max, n_iface;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
int max;
|
||||
char *tmp;
|
||||
Device **devs;
|
||||
char old_iface[8];
|
||||
char help[FILENAME_MAX];
|
||||
|
||||
/* We need a curses window */
|
||||
@ -198,43 +199,33 @@ tcpOpenDialog(char *str)
|
||||
if (ds_win == 0)
|
||||
msgFatal("Cannot open TCP/IP dialog window!!");
|
||||
|
||||
/* Look for net.devices for us to configure */
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_NETWORK);
|
||||
if (!devs) {
|
||||
msgConfirm("Couldn't find any potential network devices!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (devs[n] != NULL) {
|
||||
iface_names[n] = (devs[n])->name;
|
||||
if_list[n].dptr = devs[n];
|
||||
++n;
|
||||
}
|
||||
n_iface = n;
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
/* Say where our help comes from */
|
||||
systemHelpFile(TCP_HELPFILE, help);
|
||||
use_helpfile(help);
|
||||
draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X,
|
||||
TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH,
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X, TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X + 20, " Network Configuration ");
|
||||
|
||||
draw_box(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 8, TCP_DIALOG_HEIGHT - 13, TCP_DIALOG_WIDTH - 17,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X + 20,
|
||||
" Network Configuration ");
|
||||
draw_box(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 16,
|
||||
TCP_DIALOG_HEIGHT - 13, TCP_DIALOG_WIDTH - 21,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 24,
|
||||
" Per Interface Configuration ");
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 16, " Per Interface Configuration ");
|
||||
|
||||
/* Initialise vars so that dialog has something to chew on */
|
||||
strcpy(ipaddr, if_list[0].ipaddr);
|
||||
strcpy(netmask, if_list[0].netmask);
|
||||
strcpy(extras, if_list[0].extras);
|
||||
/* Initialise vars from previous device values */
|
||||
if (devp->private) {
|
||||
DevInfo *di = (DevInfo *)devp->private;
|
||||
|
||||
/* Look up values already recorded with the system, or blank the
|
||||
string variables ready to accept some new data */
|
||||
|
||||
strcpy(ipaddr, di->ipaddr);
|
||||
strcpy(netmask, di->netmask);
|
||||
strcpy(extras, di->extras);
|
||||
}
|
||||
else
|
||||
ipaddr[0] = netmask[0] = extras[0] = '\0';
|
||||
|
||||
/* Look up values already recorded with the system, or blank the string variables ready to accept some new data */
|
||||
tmp = getenv(VAR_HOSTNAME);
|
||||
if (tmp)
|
||||
strcpy(hostname, tmp);
|
||||
@ -273,11 +264,6 @@ tcpOpenDialog(char *str)
|
||||
lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X);
|
||||
break;
|
||||
|
||||
case LISTOBJ:
|
||||
lt.obj = NewListObj(ds_win, lt.prompt, (char **) iface_names,
|
||||
lt.var, lt.y + TCP_DIALOG_Y,
|
||||
lt.x + TCP_DIALOG_X, lt.len, 12, n_iface);
|
||||
break;
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
@ -299,9 +285,6 @@ tcpOpenDialog(char *str)
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
cancelbutton = okbutton = 0;
|
||||
strcpy(iface, iface_names[0]);
|
||||
if_list[0].valid = FALSE;
|
||||
strcpy(old_iface, iface);
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
@ -350,15 +333,8 @@ tcpOpenDialog(char *str)
|
||||
}
|
||||
break;
|
||||
|
||||
/* More special case handling - if we are at the interface
|
||||
list, move to the OK button - the user hasn't selected
|
||||
one of the entries in the list by pressing CR, so (s)he
|
||||
must be wanting to skip to <OK> & <CANCEL> */
|
||||
case KEY_DOWN:
|
||||
if (n == LAYOUT_EXTRAS) {
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
} else if (obj->next != NULL) {
|
||||
if (obj->next != NULL) {
|
||||
obj = obj->next;
|
||||
++n;
|
||||
} else {
|
||||
@ -367,36 +343,18 @@ tcpOpenDialog(char *str)
|
||||
}
|
||||
break;
|
||||
|
||||
/* Same as KEY_DOWN, but dialog has already move us to the
|
||||
next object on the list, which makes this slightly
|
||||
different. */
|
||||
case SEL_TAB:
|
||||
if (n == LAYOUT_EXTRAS) {
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
} else if (n < max) {
|
||||
if (n < max)
|
||||
++n;
|
||||
} else {
|
||||
else
|
||||
n = 0;
|
||||
}
|
||||
|
||||
/* This looks double dutch, but we have already MOVED onto
|
||||
the next field, so we special case around getting to
|
||||
that field, rather than moving off the previous
|
||||
one. Hence we are really testing for
|
||||
(n == LAYOUT_IFACE) */
|
||||
|
||||
if (n == LAYOUT_IPADDR) {
|
||||
n = LAYOUT_OKBUTTON;
|
||||
obj = ((obj->next)->next)->next;
|
||||
}
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cancelbutton) {
|
||||
if (cancelbutton)
|
||||
cancel = TRUE, quit = TRUE;
|
||||
} else {
|
||||
else {
|
||||
if (verifySettings())
|
||||
quit = TRUE;
|
||||
}
|
||||
@ -404,68 +362,7 @@ tcpOpenDialog(char *str)
|
||||
|
||||
/* Generic CR handler */
|
||||
case SEL_CR:
|
||||
/* Has the user selected a new interface? */
|
||||
if (strcmp(old_iface, iface)) {
|
||||
/* Now go find the new location */
|
||||
n_iface = 0;
|
||||
while (strcmp(iface, iface_names[n_iface]) &&
|
||||
(iface_names[n_iface] != NULL))
|
||||
++n_iface;
|
||||
if (iface_names[n_iface] == NULL)
|
||||
msgFatal("Erk - run off the end of the list of interfaces!");
|
||||
strcpy(ipaddr, if_list[n_iface].ipaddr);
|
||||
strcpy(netmask, if_list[n_iface].netmask);
|
||||
strcpy(extras, if_list[n_iface].extras);
|
||||
if_list[n_iface].valid = FALSE;
|
||||
|
||||
RefreshStringObj(layout[LAYOUT_IPADDR].obj);
|
||||
RefreshStringObj(layout[LAYOUT_NETMASK].obj);
|
||||
RefreshStringObj(layout[LAYOUT_EXTRAS].obj);
|
||||
|
||||
strcpy(old_iface, iface);
|
||||
}
|
||||
|
||||
/* Loop back to the interface list from the extras box -
|
||||
now we handle the case of saving out the data the user
|
||||
typed in (and also do basic verification of its
|
||||
sanity) */
|
||||
if (n == LAYOUT_EXTRAS) {
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
/* First, find the old value */
|
||||
n_iface = 0;
|
||||
while (strcmp(old_iface, iface_names[n_iface]) &&
|
||||
(iface_names[n_iface] != NULL))
|
||||
++n_iface;
|
||||
|
||||
if (iface_names[n_iface] == NULL)
|
||||
msgFatal("Erk - run off the end of the list of interfaces!");
|
||||
|
||||
/* Sanity check what the user supplied - this could probably
|
||||
be better :-( */
|
||||
|
||||
if (!verifyIP(ipaddr)) {
|
||||
feepout("Invalid or missing IP address!");
|
||||
strcpy(iface, old_iface);
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
RefreshListObj(layout[LAYOUT_IFACE].obj);
|
||||
}
|
||||
|
||||
if (netmask[0] < '0' || netmask[0] > '9') {
|
||||
feepout("Invalid or missing netmask!");
|
||||
strcpy(iface, old_iface);
|
||||
n = LAYOUT_IFACE;
|
||||
obj = (((first->next)->next)->next)->next;
|
||||
RefreshListObj(layout[LAYOUT_IFACE].obj);
|
||||
}
|
||||
|
||||
strcpy(if_list[n_iface].ipaddr, ipaddr);
|
||||
strcpy(if_list[n_iface].netmask, netmask);
|
||||
strcpy(if_list[n_iface].extras, extras);
|
||||
if_list[n_iface].valid = TRUE;
|
||||
if_list[n_iface].dptr->enabled = TRUE;
|
||||
} else if (n < max)
|
||||
if (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
@ -504,7 +401,9 @@ tcpOpenDialog(char *str)
|
||||
out to the environment via the variable_set layers */
|
||||
|
||||
if (!cancel) {
|
||||
int foo;
|
||||
DevInfo *di;
|
||||
char temp[512], ifn[64];
|
||||
|
||||
variable_set2(VAR_HOSTNAME, hostname);
|
||||
variable_set2(VAR_DOMAINNAME, domainname);
|
||||
if (gateway[0])
|
||||
@ -512,23 +411,20 @@ tcpOpenDialog(char *str)
|
||||
if (nameserver[0])
|
||||
variable_set2(VAR_NAMESERVER, nameserver);
|
||||
|
||||
/* Loop over the per-interface data saving data which has been
|
||||
validated ... */
|
||||
for (foo = 0 ; foo < INTERFACE_MAX ; foo++) {
|
||||
if (if_list[foo].valid == TRUE) {
|
||||
char temp[512], ifn[64];
|
||||
sprintf(temp, "inet %s %s netmask %s",
|
||||
if_list[foo].ipaddr, if_list[foo].extras,
|
||||
if_list[foo].netmask);
|
||||
sprintf(ifn, "%s%s", VAR_IFCONFIG, iface_names[foo]);
|
||||
variable_set2(ifn, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!devp->private)
|
||||
devp->private = (DevInfo *)malloc(sizeof(DevInfo));
|
||||
di = devp->private;
|
||||
strcpy(di->ipaddr, ipaddr);
|
||||
strcpy(di->netmask, netmask);
|
||||
strcpy(di->extras, extras);
|
||||
|
||||
static Device *netDevice;
|
||||
sprintf(temp, "inet %s %s netmask %s", ipaddr, extras, netmask);
|
||||
sprintf(ifn, "%s%s", VAR_IFCONFIG, devp->name);
|
||||
variable_set2(ifn, temp);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
netHook(char *str)
|
||||
@ -541,32 +437,25 @@ netHook(char *str)
|
||||
if (!*str)
|
||||
return 0;
|
||||
devs = deviceFind(str, DEVICE_TYPE_NETWORK);
|
||||
if (devs)
|
||||
netDevice = devs[0];
|
||||
if (devs) {
|
||||
tcpOpenDialog(devs[0]);
|
||||
mediaDevice = devs[0];
|
||||
}
|
||||
return devs ? 1 : 0;
|
||||
}
|
||||
|
||||
/* Get a network device */
|
||||
Device *
|
||||
tcpDeviceSelect(void)
|
||||
int
|
||||
tcpDeviceSelect(char *str)
|
||||
{
|
||||
DMenu *menu;
|
||||
|
||||
/* If we can't find a hostname, ask user to set up TCP/IP */
|
||||
if (!getenv(VAR_HOSTNAME))
|
||||
tcpOpenDialog(NULL);
|
||||
|
||||
/* If we still can't, user is a bonehead */
|
||||
if (!getenv(VAR_HOSTNAME)) {
|
||||
msgConfirm("Sorry, I can't do this if you don't set up your networking first!");
|
||||
return 0;
|
||||
}
|
||||
menu = deviceCreateMenu(&MenuNetworkDevice, DEVICE_TYPE_NETWORK, netHook);
|
||||
if (!menu)
|
||||
msgFatal("Unable to create network device menu! Argh!");
|
||||
dmenuOpenSimple(menu);
|
||||
free(menu);
|
||||
return netDevice;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Start PPP on the 3rd screen */
|
||||
@ -580,6 +469,10 @@ tcpStartPPP(void)
|
||||
return FALSE;
|
||||
Mkdir("/var/log", NULL);
|
||||
Mkdir("/var/spool/lock", NULL);
|
||||
Mkdir("/etc/ppp", NULL);
|
||||
/* XXX Put our IP addr in the right file instead of this stupidity!! XXX */
|
||||
vsystem("touch /etc/ppp/ppp.linkup; chmod +x /etc/ppp/ppp.linkup");
|
||||
vsystem("touch /etc/ppp/ppp.secret; chmod +x /etc/ppp/ppp.secret");
|
||||
if (!fork()) {
|
||||
dup2(fd, 0);
|
||||
dup2(fd, 1);
|
||||
@ -589,7 +482,3 @@ tcpStartPPP(void)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <machine/console.h>
|
||||
|
||||
@ -64,8 +65,11 @@ set_termcap(void)
|
||||
}
|
||||
}
|
||||
if (DebugFD == -1) {
|
||||
int i;
|
||||
|
||||
DebugFD = open("/dev/ttyv1", O_WRONLY);
|
||||
ioctl(DebugFD, TIOCCONS, (char *)NULL);
|
||||
i = ioctl(DebugFD, TIOCCONS, (char *)NULL);
|
||||
msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)", DebugFD, i, !i ? "success" : strerror(errno));
|
||||
}
|
||||
OnVTY = TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user