Fix bogon I introduced into dist extraction code last night.

Update to Poul's latest gripe list fixes.
This commit is contained in:
Jordan K. Hubbard 1995-05-28 20:28:15 +00:00
parent d490f49f9f
commit 0d65268039
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8820
14 changed files with 163 additions and 200 deletions

View file

@ -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.10 1995/05/26 20:55:11 jkh Exp $
* $Id: config.c,v 1.11 1995/05/28 09:31:29 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -113,6 +113,8 @@ fstype_short(Chunk *c1)
else
return "sw";
}
else if (c1->type == fat)
return "rw";
return "bog";
}

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: disks.c,v 1.27 1995/05/22 14:10:12 jkh Exp $
* $Id: disks.c,v 1.28 1995/05/25 18:48:23 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -109,7 +109,7 @@ print_command_summary()
mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable");
mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Exit this screen");
mvprintw(18, 0, "U = Undo All Changes ESC = Exit this screen");
mvprintw(20, 0, "The currently selected partition is displayed in ");
attrset(A_REVERSE); addstr("reverse"); attrset(A_NORMAL); addstr(" video.");
mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");

View file

@ -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.29 1995/05/28 07:05:21 phk Exp $
* $Id: dist.c,v 1.30 1995/05/28 09:43:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -147,11 +147,11 @@ static Distribution DistTable[] = {
{ "manpages", "/", &Dists, DIST_MANPAGES, NULL },
{ "proflibs", "/", &Dists, DIST_PROFLIBS, NULL },
{ "dict", "/", &Dists, DIST_DICT, NULL },
{ "src/", "/", &Dists, DIST_SRC, SrcDistTable },
{ "src", "/", &Dists, DIST_SRC, SrcDistTable },
{ "des", "/", &Dists, DIST_DES, NULL },
{ "compat1x", "/", &Dists, DIST_COMPAT1X, NULL },
{ "compat20", "/", &Dists, DIST_COMPAT20, NULL },
{ "XF86311/", "/usr", &Dists, DIST_XF86, XF86DistTable },
{ "XF86311", "/usr", &Dists, DIST_XF86, XF86DistTable },
{ NULL },
};
@ -171,7 +171,8 @@ static Distribution SrcDistTable[] = {
{ "ssys", "/usr/src", &SrcDists, DIST_SRC_SYS, NULL },
{ "subin", "/usr/src", &SrcDists, DIST_SRC_UBIN, NULL },
{ "susbin", "/usr/src", &SrcDists, DIST_SRC_USBIN, NULL },
{ "xf86", "/usr/X11R6/src", &SrcDists, DIST_SRC_XF86, NULL },
{ "XF86-xc", "/usr/X11R6/src", &SrcDists, DIST_SRC_XF86, NULL },
{ "XF86-co", "/usr/X11R6/src", &SrcDists, DIST_SRC_XF86, NULL },
{ NULL },
};
@ -180,7 +181,7 @@ static Distribution XF86DistTable[] = {
{ "X311bin", "/usr", &XF86Dists, DIST_XF86_BIN, NULL },
{ "X311lib", "/usr", &XF86Dists, DIST_XF86_LIB, NULL },
{ "X311doc", "/usr", &XF86Dists, DIST_XF86_DOC, NULL },
{ "Xf86311/", "/usr", &XF86Dists, DIST_XF86_FONTS, XF86FontDistTable },
{ "Xf86311", "/usr", &XF86Dists, DIST_XF86_FONTS, XF86FontDistTable },
{ "X311man", "/usr", &XF86Dists, DIST_XF86_MAN, NULL },
{ "X311prog", "/usr", &XF86Dists, DIST_XF86_PROG, NULL },
{ "X311link", "/usr", &XF86Dists, DIST_XF86_LINK, NULL },
@ -188,7 +189,7 @@ static Distribution XF86DistTable[] = {
{ "X311lbx", "/usr", &XF86Dists, DIST_XF86_LBX, NULL },
{ "X311xicf", "/usr", &XF86Dists, DIST_XF86_XINIT, NULL },
{ "X311xdmcf", "/usr", &XF86Dists, DIST_XF86_XDMCF, NULL },
{ "Xf86311/", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable },
{ "Xf86311", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable },
{ NULL },
};
@ -246,7 +247,7 @@ distExtract(char *parent, Distribution *me)
dist = me[i].my_name;
path = parent ? parent : me[i].my_name;
snprintf(buf, 512, "%s%s.tgz", path, dist);
snprintf(buf, 512, "%s/%s.tgz", path, dist);
fd = (*mediaDevice->get)(buf);
if (fd != -1) {
status = mediaExtractDist(me[i].my_name, me[i].my_dir, fd);
@ -257,7 +258,7 @@ distExtract(char *parent, Distribution *me)
goto done;
}
snprintf(buf, sizeof buf, "/stand/info/%s%s.inf", path, dist);
snprintf(buf, sizeof buf, "/stand/info/%s/%s.inf", path, dist);
if (!access(buf, R_OK)) {
msgDebug("Parsing attributes file for %s\n", dist);
dist_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
@ -279,7 +280,7 @@ distExtract(char *parent, Distribution *me)
msgDebug("Attempting to extract distribution from %u chunks.\n", numchunks);
if (numchunks < 2 ) {
snprintf(buf, 512, "%s%s", path, dist);
snprintf(buf, 512, "%s/%s", path, dist);
if (numchunks)
strcat(buf,".aa");
fd = (*mediaDevice->get)(buf);
@ -299,7 +300,7 @@ distExtract(char *parent, Distribution *me)
for (chunk = 0; chunk < numchunks; chunk++) {
int n, retval;
snprintf(buf, 512, "%s%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
snprintf(buf, 512, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
fd = (*mediaDevice->get)(buf);
if (fd < 0) {
msgConfirm("failed to retreive piece file %s!\nAborting the transfer", buf);

View file

@ -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.62 1995/05/27 23:39:30 phk Exp $
* $Id: install.c,v 1.63 1995/05/28 09:31:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -55,7 +55,6 @@ static void make_filesystems(void);
static void copy_self(void);
static void root_extract(void);
static Disk *rootdisk;
static Chunk *rootdev;
static Boolean
@ -78,9 +77,7 @@ checkLabels(void)
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
if (c1->type == freebsd) {
for (c2 = c1->part; c2; c2 = c2->next) {
if (c2->type == part && c2->subtype != FS_SWAP &&
c2->private && c2->flags & CHUNK_IS_ROOT) {
rootdisk = disk;
if (c2->type == part && c2->subtype != FS_SWAP && c2->private && c2->flags & CHUNK_IS_ROOT) {
rootdev = c2;
break;
}
@ -182,12 +179,10 @@ installInitial(void)
msgNotify("Running bad block scan on partition %s", c1->name);
ret = vsystem("bad144 -v /dev/r%s 1234", c1->name);
if (ret)
msgConfirm("Bad144 init on %s returned status of %d!",
c1->name, ret);
msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret);
ret = vsystem("bad144 -v -s /dev/r%s", c1->name);
if (ret)
msgConfirm("Bad144 scan on %s returned status of %d!",
c1->name, ret);
msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret);
}
}
}
@ -198,6 +193,7 @@ installInitial(void)
chdir("/");
variable_set2(RUNNING_ON_ROOT, "yes");
/* stick a helpful shell over on the 4th VTY */
msgDebug("Sticking a potentially helpful shell over on the 4th screen\n");
if (!fork()) {
int i, fd;
@ -277,7 +273,7 @@ make_filesystems(void)
if (p->newfs) {
int i;
sprintf(dname, "/dev/r%sa", rootdisk->name);
sprintf(dname, "/dev/r%sa", rootdev->disk->name);
msgNotify("Making a new root filesystem on %s", dname);
i = vsystem("%s %s", p->newfs_cmd, dname);
if (i) {
@ -287,13 +283,13 @@ make_filesystems(void)
}
else {
msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD.");
sprintf(dname, "/dev/r%sa", rootdisk->name);
sprintf(dname, "/dev/r%sa", rootdev->disk->name);
msgNotify("Checking integrity of existing %s filesystem", dname);
i = vsystem("fsck -y %s", dname);
if (i)
msgConfirm("Warning: fsck returned status off %d - this partition may be\nunsafe to use.", i);
}
sprintf(dname, "/dev/%sa", rootdisk->name);
sprintf(dname, "/dev/%sa", rootdev->disk->name);
if (Mount("/mnt", dname)) {
msgConfirm("Unable to mount the root file system! Giving up.");
return;
@ -313,6 +309,9 @@ make_filesystems(void)
/* Now buzz through the rest of the partitions and mount them too */
for (i = 0; devs[i]; i++) {
if (!devs[i]->enabled)
continue;
disk = (Disk *)devs[i]->private;
if (!disk->chunks)
msgFatal("No chunk list found for %s!", disk->name);

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: label.c,v 1.26 1995/05/26 11:21:46 jkh Exp $
* $Id: label.c,v 1.27 1995/05/28 09:31:34 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -79,8 +79,7 @@ check_conflict(char *name)
int i;
for (i = 0; label_chunk_info[i].c; i++)
if (label_chunk_info[i].type == PART_FILESYSTEM
&& label_chunk_info[i].c->private
if (label_chunk_info[i].type == PART_FILESYSTEM && label_chunk_info[i].c->private
&& !strcmp(((PartInfo *)label_chunk_info[i].c->private)->mountpoint, name))
return TRUE;
return FALSE;
@ -180,11 +179,10 @@ new_part(char *mpoint, Boolean newfs, u_long size)
ret->newfs = newfs;
if (!size)
return ret;
for(target = size; target; target--) {
for(divisor = 4096 ; divisor > 1023; divisor--) {
for (target = size; target; target--) {
for (divisor = 4096 ; divisor > 1023; divisor--) {
if (!(target % divisor)) {
sprintf(ret->newfs_cmd+strlen(ret->newfs_cmd),
" -u %ld",divisor);
sprintf(ret->newfs_cmd + strlen(ret->newfs_cmd), " -u %ld",divisor);
return ret;
}
}
@ -351,19 +349,10 @@ print_label_chunks(void)
memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name, strlen(label_chunk_info[i].c->name));
/* If it's a filesystem, display the mountpoint */
if (label_chunk_info[i].type == PART_FILESYSTEM || label_chunk_info[i].type == PART_FAT) {
if (label_chunk_info[i].c->private == NULL) {
static int mnt = 0;
char foo[10];
/*
* Hmm! A partition that must have already been here.
* Fill in a fake mountpoint and register it
*/
sprintf(foo, "/mnt%d", mnt++);
label_chunk_info[i].c->private = new_part(foo, FALSE, label_chunk_info[i].c->size);
label_chunk_info[i].c->private_free = safe_free;
}
mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
if (label_chunk_info[i].c->private != NULL)
mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
else
mountpoint = " ";
if (label_chunk_info[i].type == PART_FAT)
newfs = "DOS";
else
@ -394,10 +383,9 @@ print_label_chunks(void)
static void
print_command_summary()
{
mvprintw(17, 0,
"The following commands are valid here (upper or lower case):");
mvprintw(19, 0, "C = Create Partition D = Delete Partition M = Mount Partition");
mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs ESC = Exit this screen");
mvprintw(17, 0, "The following commands are valid here (upper or lower case):");
mvprintw(19, 0, "C = Create New D = Delete M = Set Mountpoint");
mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs U = Undo ESC = Exit");
mvprintw(21, 0, "The default target will be displayed in ");
attrset(A_REVERSE);
@ -489,30 +477,23 @@ diskLabelEditor(char *str)
char *val, *cp;
int size;
struct chunk *tmp;
char osize[80];
u_long flags = 0;
val = msgGetInput(NULL, "Please specify the size for new FreeBSD partition in blocks, or\nappend a trailing `M' for megabytes (e.g. 20M), `C' for cylinders\nor `%%' for a percentage of remaining space.\n\nSpace free is %d blocks (%dMB)", sz, sz / ONE_MEG);
sprintf(osize, "%d", sz);
val = msgGetInput(osize, "Please specify the size for new FreeBSD partition in blocks, or\nappend a trailing `M' for megabytes (e.g. 20M) or `C' for cylinders.\n\nSpace free is %d blocks (%dMB)", sz, sz / ONE_MEG);
if (!val || (size = strtol(val, &cp, 0)) <= 0)
break;
if (sz <= FS_MIN_SIZE) {
msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
break;
}
if (*cp) {
if (toupper(*cp) == 'M')
size *= ONE_MEG;
else if (toupper(*cp) == 'C')
size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
else if (*cp == '%') {
float fsz, fsize;
fsz = (float)sz;
fsize = (float)size;
fsize *= 0.10;
fsz *= fsize;
size = (int)fsz;
}
}
if (size <= FS_MIN_SIZE) {
msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
break;
}
type = get_partition_type();
if (type == PART_NONE)
@ -552,7 +533,8 @@ diskLabelEditor(char *str)
}
if (type != PART_SWAP) {
/* This is needed to tell the newfs -u about the size */
tmp->private = new_part(p->mountpoint,p->newfs,tmp->size);
tmp->private = new_part(p->mountpoint, p->newfs, tmp->size);
tmp->private_free = safe_free;
safe_free(p);
} else {
tmp->private = p;
@ -617,18 +599,22 @@ diskLabelEditor(char *str)
case 'T': /* Toggle newfs state */
if (label_chunk_info[here].type == PART_FILESYSTEM &&
label_chunk_info[here].c->private) {
PartInfo *pi = ((PartInfo *)
label_chunk_info[here].c->private);
label_chunk_info[here].c->private = new_part(
pi->mountpoint,
!pi->newfs,
label_chunk_info[here].c->size);
PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private);
label_chunk_info[here].c->private = new_part(pi->mountpoint, !pi->newfs, label_chunk_info[here].c->size);
safe_free(pi);
label_chunk_info[here].c->private_free = safe_free;
}
else
msg = MSG_NOT_APPLICABLE;
break;
case 'U':
Free_Disk(label_chunk_info[here].c->disk);
label_chunk_info[here].c->disk = Open_Disk(label_chunk_info[here].c->disk->name);
if (!label_chunk_info[here].c->disk)
msgFatal("Can't reopen disk in undo!");
record_label_chunks();
case 'W':
if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\nThis is an entirely undocumented feature which you are not\nexpected to understand!")) {
int i;

View file

@ -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.10 1995/05/26 20:55:11 jkh Exp $
* $Id: config.c,v 1.11 1995/05/28 09:31:29 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -113,6 +113,8 @@ fstype_short(Chunk *c1)
else
return "sw";
}
else if (c1->type == fat)
return "rw";
return "bog";
}

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: disks.c,v 1.27 1995/05/22 14:10:12 jkh Exp $
* $Id: disks.c,v 1.28 1995/05/25 18:48:23 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -109,7 +109,7 @@ print_command_summary()
mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable");
mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Exit this screen");
mvprintw(18, 0, "U = Undo All Changes ESC = Exit this screen");
mvprintw(20, 0, "The currently selected partition is displayed in ");
attrset(A_REVERSE); addstr("reverse"); attrset(A_NORMAL); addstr(" video.");
mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");

View file

@ -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.62 1995/05/27 23:39:30 phk Exp $
* $Id: install.c,v 1.63 1995/05/28 09:31:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -55,7 +55,6 @@ static void make_filesystems(void);
static void copy_self(void);
static void root_extract(void);
static Disk *rootdisk;
static Chunk *rootdev;
static Boolean
@ -78,9 +77,7 @@ checkLabels(void)
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
if (c1->type == freebsd) {
for (c2 = c1->part; c2; c2 = c2->next) {
if (c2->type == part && c2->subtype != FS_SWAP &&
c2->private && c2->flags & CHUNK_IS_ROOT) {
rootdisk = disk;
if (c2->type == part && c2->subtype != FS_SWAP && c2->private && c2->flags & CHUNK_IS_ROOT) {
rootdev = c2;
break;
}
@ -182,12 +179,10 @@ installInitial(void)
msgNotify("Running bad block scan on partition %s", c1->name);
ret = vsystem("bad144 -v /dev/r%s 1234", c1->name);
if (ret)
msgConfirm("Bad144 init on %s returned status of %d!",
c1->name, ret);
msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret);
ret = vsystem("bad144 -v -s /dev/r%s", c1->name);
if (ret)
msgConfirm("Bad144 scan on %s returned status of %d!",
c1->name, ret);
msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret);
}
}
}
@ -198,6 +193,7 @@ installInitial(void)
chdir("/");
variable_set2(RUNNING_ON_ROOT, "yes");
/* stick a helpful shell over on the 4th VTY */
msgDebug("Sticking a potentially helpful shell over on the 4th screen\n");
if (!fork()) {
int i, fd;
@ -277,7 +273,7 @@ make_filesystems(void)
if (p->newfs) {
int i;
sprintf(dname, "/dev/r%sa", rootdisk->name);
sprintf(dname, "/dev/r%sa", rootdev->disk->name);
msgNotify("Making a new root filesystem on %s", dname);
i = vsystem("%s %s", p->newfs_cmd, dname);
if (i) {
@ -287,13 +283,13 @@ make_filesystems(void)
}
else {
msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD.");
sprintf(dname, "/dev/r%sa", rootdisk->name);
sprintf(dname, "/dev/r%sa", rootdev->disk->name);
msgNotify("Checking integrity of existing %s filesystem", dname);
i = vsystem("fsck -y %s", dname);
if (i)
msgConfirm("Warning: fsck returned status off %d - this partition may be\nunsafe to use.", i);
}
sprintf(dname, "/dev/%sa", rootdisk->name);
sprintf(dname, "/dev/%sa", rootdev->disk->name);
if (Mount("/mnt", dname)) {
msgConfirm("Unable to mount the root file system! Giving up.");
return;
@ -313,6 +309,9 @@ make_filesystems(void)
/* Now buzz through the rest of the partitions and mount them too */
for (i = 0; devs[i]; i++) {
if (!devs[i]->enabled)
continue;
disk = (Disk *)devs[i]->private;
if (!disk->chunks)
msgFatal("No chunk list found for %s!", disk->name);

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: label.c,v 1.26 1995/05/26 11:21:46 jkh Exp $
* $Id: label.c,v 1.27 1995/05/28 09:31:34 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -79,8 +79,7 @@ check_conflict(char *name)
int i;
for (i = 0; label_chunk_info[i].c; i++)
if (label_chunk_info[i].type == PART_FILESYSTEM
&& label_chunk_info[i].c->private
if (label_chunk_info[i].type == PART_FILESYSTEM && label_chunk_info[i].c->private
&& !strcmp(((PartInfo *)label_chunk_info[i].c->private)->mountpoint, name))
return TRUE;
return FALSE;
@ -180,11 +179,10 @@ new_part(char *mpoint, Boolean newfs, u_long size)
ret->newfs = newfs;
if (!size)
return ret;
for(target = size; target; target--) {
for(divisor = 4096 ; divisor > 1023; divisor--) {
for (target = size; target; target--) {
for (divisor = 4096 ; divisor > 1023; divisor--) {
if (!(target % divisor)) {
sprintf(ret->newfs_cmd+strlen(ret->newfs_cmd),
" -u %ld",divisor);
sprintf(ret->newfs_cmd + strlen(ret->newfs_cmd), " -u %ld",divisor);
return ret;
}
}
@ -351,19 +349,10 @@ print_label_chunks(void)
memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name, strlen(label_chunk_info[i].c->name));
/* If it's a filesystem, display the mountpoint */
if (label_chunk_info[i].type == PART_FILESYSTEM || label_chunk_info[i].type == PART_FAT) {
if (label_chunk_info[i].c->private == NULL) {
static int mnt = 0;
char foo[10];
/*
* Hmm! A partition that must have already been here.
* Fill in a fake mountpoint and register it
*/
sprintf(foo, "/mnt%d", mnt++);
label_chunk_info[i].c->private = new_part(foo, FALSE, label_chunk_info[i].c->size);
label_chunk_info[i].c->private_free = safe_free;
}
mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
if (label_chunk_info[i].c->private != NULL)
mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
else
mountpoint = " ";
if (label_chunk_info[i].type == PART_FAT)
newfs = "DOS";
else
@ -394,10 +383,9 @@ print_label_chunks(void)
static void
print_command_summary()
{
mvprintw(17, 0,
"The following commands are valid here (upper or lower case):");
mvprintw(19, 0, "C = Create Partition D = Delete Partition M = Mount Partition");
mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs ESC = Exit this screen");
mvprintw(17, 0, "The following commands are valid here (upper or lower case):");
mvprintw(19, 0, "C = Create New D = Delete M = Set Mountpoint");
mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs U = Undo ESC = Exit");
mvprintw(21, 0, "The default target will be displayed in ");
attrset(A_REVERSE);
@ -489,30 +477,23 @@ diskLabelEditor(char *str)
char *val, *cp;
int size;
struct chunk *tmp;
char osize[80];
u_long flags = 0;
val = msgGetInput(NULL, "Please specify the size for new FreeBSD partition in blocks, or\nappend a trailing `M' for megabytes (e.g. 20M), `C' for cylinders\nor `%%' for a percentage of remaining space.\n\nSpace free is %d blocks (%dMB)", sz, sz / ONE_MEG);
sprintf(osize, "%d", sz);
val = msgGetInput(osize, "Please specify the size for new FreeBSD partition in blocks, or\nappend a trailing `M' for megabytes (e.g. 20M) or `C' for cylinders.\n\nSpace free is %d blocks (%dMB)", sz, sz / ONE_MEG);
if (!val || (size = strtol(val, &cp, 0)) <= 0)
break;
if (sz <= FS_MIN_SIZE) {
msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
break;
}
if (*cp) {
if (toupper(*cp) == 'M')
size *= ONE_MEG;
else if (toupper(*cp) == 'C')
size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
else if (*cp == '%') {
float fsz, fsize;
fsz = (float)sz;
fsize = (float)size;
fsize *= 0.10;
fsz *= fsize;
size = (int)fsz;
}
}
if (size <= FS_MIN_SIZE) {
msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
break;
}
type = get_partition_type();
if (type == PART_NONE)
@ -552,7 +533,8 @@ diskLabelEditor(char *str)
}
if (type != PART_SWAP) {
/* This is needed to tell the newfs -u about the size */
tmp->private = new_part(p->mountpoint,p->newfs,tmp->size);
tmp->private = new_part(p->mountpoint, p->newfs, tmp->size);
tmp->private_free = safe_free;
safe_free(p);
} else {
tmp->private = p;
@ -617,18 +599,22 @@ diskLabelEditor(char *str)
case 'T': /* Toggle newfs state */
if (label_chunk_info[here].type == PART_FILESYSTEM &&
label_chunk_info[here].c->private) {
PartInfo *pi = ((PartInfo *)
label_chunk_info[here].c->private);
label_chunk_info[here].c->private = new_part(
pi->mountpoint,
!pi->newfs,
label_chunk_info[here].c->size);
PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private);
label_chunk_info[here].c->private = new_part(pi->mountpoint, !pi->newfs, label_chunk_info[here].c->size);
safe_free(pi);
label_chunk_info[here].c->private_free = safe_free;
}
else
msg = MSG_NOT_APPLICABLE;
break;
case 'U':
Free_Disk(label_chunk_info[here].c->disk);
label_chunk_info[here].c->disk = Open_Disk(label_chunk_info[here].c->disk->name);
if (!label_chunk_info[here].c->disk)
msgFatal("Can't reopen disk in undo!");
record_label_chunks();
case 'W':
if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\nThis is an entirely undocumented feature which you are not\nexpected to understand!")) {
int i;

View file

@ -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.10 1995/05/26 20:55:11 jkh Exp $
* $Id: config.c,v 1.11 1995/05/28 09:31:29 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -113,6 +113,8 @@ fstype_short(Chunk *c1)
else
return "sw";
}
else if (c1->type == fat)
return "rw";
return "bog";
}

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: disks.c,v 1.27 1995/05/22 14:10:12 jkh Exp $
* $Id: disks.c,v 1.28 1995/05/25 18:48:23 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -109,7 +109,7 @@ print_command_summary()
mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable");
mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Exit this screen");
mvprintw(18, 0, "U = Undo All Changes ESC = Exit this screen");
mvprintw(20, 0, "The currently selected partition is displayed in ");
attrset(A_REVERSE); addstr("reverse"); attrset(A_NORMAL); addstr(" video.");
mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");

View file

@ -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.29 1995/05/28 07:05:21 phk Exp $
* $Id: dist.c,v 1.30 1995/05/28 09:43:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -147,11 +147,11 @@ static Distribution DistTable[] = {
{ "manpages", "/", &Dists, DIST_MANPAGES, NULL },
{ "proflibs", "/", &Dists, DIST_PROFLIBS, NULL },
{ "dict", "/", &Dists, DIST_DICT, NULL },
{ "src/", "/", &Dists, DIST_SRC, SrcDistTable },
{ "src", "/", &Dists, DIST_SRC, SrcDistTable },
{ "des", "/", &Dists, DIST_DES, NULL },
{ "compat1x", "/", &Dists, DIST_COMPAT1X, NULL },
{ "compat20", "/", &Dists, DIST_COMPAT20, NULL },
{ "XF86311/", "/usr", &Dists, DIST_XF86, XF86DistTable },
{ "XF86311", "/usr", &Dists, DIST_XF86, XF86DistTable },
{ NULL },
};
@ -171,7 +171,8 @@ static Distribution SrcDistTable[] = {
{ "ssys", "/usr/src", &SrcDists, DIST_SRC_SYS, NULL },
{ "subin", "/usr/src", &SrcDists, DIST_SRC_UBIN, NULL },
{ "susbin", "/usr/src", &SrcDists, DIST_SRC_USBIN, NULL },
{ "xf86", "/usr/X11R6/src", &SrcDists, DIST_SRC_XF86, NULL },
{ "XF86-xc", "/usr/X11R6/src", &SrcDists, DIST_SRC_XF86, NULL },
{ "XF86-co", "/usr/X11R6/src", &SrcDists, DIST_SRC_XF86, NULL },
{ NULL },
};
@ -180,7 +181,7 @@ static Distribution XF86DistTable[] = {
{ "X311bin", "/usr", &XF86Dists, DIST_XF86_BIN, NULL },
{ "X311lib", "/usr", &XF86Dists, DIST_XF86_LIB, NULL },
{ "X311doc", "/usr", &XF86Dists, DIST_XF86_DOC, NULL },
{ "Xf86311/", "/usr", &XF86Dists, DIST_XF86_FONTS, XF86FontDistTable },
{ "Xf86311", "/usr", &XF86Dists, DIST_XF86_FONTS, XF86FontDistTable },
{ "X311man", "/usr", &XF86Dists, DIST_XF86_MAN, NULL },
{ "X311prog", "/usr", &XF86Dists, DIST_XF86_PROG, NULL },
{ "X311link", "/usr", &XF86Dists, DIST_XF86_LINK, NULL },
@ -188,7 +189,7 @@ static Distribution XF86DistTable[] = {
{ "X311lbx", "/usr", &XF86Dists, DIST_XF86_LBX, NULL },
{ "X311xicf", "/usr", &XF86Dists, DIST_XF86_XINIT, NULL },
{ "X311xdmcf", "/usr", &XF86Dists, DIST_XF86_XDMCF, NULL },
{ "Xf86311/", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable },
{ "Xf86311", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable },
{ NULL },
};
@ -246,7 +247,7 @@ distExtract(char *parent, Distribution *me)
dist = me[i].my_name;
path = parent ? parent : me[i].my_name;
snprintf(buf, 512, "%s%s.tgz", path, dist);
snprintf(buf, 512, "%s/%s.tgz", path, dist);
fd = (*mediaDevice->get)(buf);
if (fd != -1) {
status = mediaExtractDist(me[i].my_name, me[i].my_dir, fd);
@ -257,7 +258,7 @@ distExtract(char *parent, Distribution *me)
goto done;
}
snprintf(buf, sizeof buf, "/stand/info/%s%s.inf", path, dist);
snprintf(buf, sizeof buf, "/stand/info/%s/%s.inf", path, dist);
if (!access(buf, R_OK)) {
msgDebug("Parsing attributes file for %s\n", dist);
dist_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
@ -279,7 +280,7 @@ distExtract(char *parent, Distribution *me)
msgDebug("Attempting to extract distribution from %u chunks.\n", numchunks);
if (numchunks < 2 ) {
snprintf(buf, 512, "%s%s", path, dist);
snprintf(buf, 512, "%s/%s", path, dist);
if (numchunks)
strcat(buf,".aa");
fd = (*mediaDevice->get)(buf);
@ -299,7 +300,7 @@ distExtract(char *parent, Distribution *me)
for (chunk = 0; chunk < numchunks; chunk++) {
int n, retval;
snprintf(buf, 512, "%s%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
snprintf(buf, 512, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
fd = (*mediaDevice->get)(buf);
if (fd < 0) {
msgConfirm("failed to retreive piece file %s!\nAborting the transfer", buf);

View file

@ -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.62 1995/05/27 23:39:30 phk Exp $
* $Id: install.c,v 1.63 1995/05/28 09:31:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -55,7 +55,6 @@ static void make_filesystems(void);
static void copy_self(void);
static void root_extract(void);
static Disk *rootdisk;
static Chunk *rootdev;
static Boolean
@ -78,9 +77,7 @@ checkLabels(void)
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
if (c1->type == freebsd) {
for (c2 = c1->part; c2; c2 = c2->next) {
if (c2->type == part && c2->subtype != FS_SWAP &&
c2->private && c2->flags & CHUNK_IS_ROOT) {
rootdisk = disk;
if (c2->type == part && c2->subtype != FS_SWAP && c2->private && c2->flags & CHUNK_IS_ROOT) {
rootdev = c2;
break;
}
@ -182,12 +179,10 @@ installInitial(void)
msgNotify("Running bad block scan on partition %s", c1->name);
ret = vsystem("bad144 -v /dev/r%s 1234", c1->name);
if (ret)
msgConfirm("Bad144 init on %s returned status of %d!",
c1->name, ret);
msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret);
ret = vsystem("bad144 -v -s /dev/r%s", c1->name);
if (ret)
msgConfirm("Bad144 scan on %s returned status of %d!",
c1->name, ret);
msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret);
}
}
}
@ -198,6 +193,7 @@ installInitial(void)
chdir("/");
variable_set2(RUNNING_ON_ROOT, "yes");
/* stick a helpful shell over on the 4th VTY */
msgDebug("Sticking a potentially helpful shell over on the 4th screen\n");
if (!fork()) {
int i, fd;
@ -277,7 +273,7 @@ make_filesystems(void)
if (p->newfs) {
int i;
sprintf(dname, "/dev/r%sa", rootdisk->name);
sprintf(dname, "/dev/r%sa", rootdev->disk->name);
msgNotify("Making a new root filesystem on %s", dname);
i = vsystem("%s %s", p->newfs_cmd, dname);
if (i) {
@ -287,13 +283,13 @@ make_filesystems(void)
}
else {
msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD.");
sprintf(dname, "/dev/r%sa", rootdisk->name);
sprintf(dname, "/dev/r%sa", rootdev->disk->name);
msgNotify("Checking integrity of existing %s filesystem", dname);
i = vsystem("fsck -y %s", dname);
if (i)
msgConfirm("Warning: fsck returned status off %d - this partition may be\nunsafe to use.", i);
}
sprintf(dname, "/dev/%sa", rootdisk->name);
sprintf(dname, "/dev/%sa", rootdev->disk->name);
if (Mount("/mnt", dname)) {
msgConfirm("Unable to mount the root file system! Giving up.");
return;
@ -313,6 +309,9 @@ make_filesystems(void)
/* Now buzz through the rest of the partitions and mount them too */
for (i = 0; devs[i]; i++) {
if (!devs[i]->enabled)
continue;
disk = (Disk *)devs[i]->private;
if (!disk->chunks)
msgFatal("No chunk list found for %s!", disk->name);

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: label.c,v 1.26 1995/05/26 11:21:46 jkh Exp $
* $Id: label.c,v 1.27 1995/05/28 09:31:34 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -79,8 +79,7 @@ check_conflict(char *name)
int i;
for (i = 0; label_chunk_info[i].c; i++)
if (label_chunk_info[i].type == PART_FILESYSTEM
&& label_chunk_info[i].c->private
if (label_chunk_info[i].type == PART_FILESYSTEM && label_chunk_info[i].c->private
&& !strcmp(((PartInfo *)label_chunk_info[i].c->private)->mountpoint, name))
return TRUE;
return FALSE;
@ -180,11 +179,10 @@ new_part(char *mpoint, Boolean newfs, u_long size)
ret->newfs = newfs;
if (!size)
return ret;
for(target = size; target; target--) {
for(divisor = 4096 ; divisor > 1023; divisor--) {
for (target = size; target; target--) {
for (divisor = 4096 ; divisor > 1023; divisor--) {
if (!(target % divisor)) {
sprintf(ret->newfs_cmd+strlen(ret->newfs_cmd),
" -u %ld",divisor);
sprintf(ret->newfs_cmd + strlen(ret->newfs_cmd), " -u %ld",divisor);
return ret;
}
}
@ -351,19 +349,10 @@ print_label_chunks(void)
memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name, strlen(label_chunk_info[i].c->name));
/* If it's a filesystem, display the mountpoint */
if (label_chunk_info[i].type == PART_FILESYSTEM || label_chunk_info[i].type == PART_FAT) {
if (label_chunk_info[i].c->private == NULL) {
static int mnt = 0;
char foo[10];
/*
* Hmm! A partition that must have already been here.
* Fill in a fake mountpoint and register it
*/
sprintf(foo, "/mnt%d", mnt++);
label_chunk_info[i].c->private = new_part(foo, FALSE, label_chunk_info[i].c->size);
label_chunk_info[i].c->private_free = safe_free;
}
mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
if (label_chunk_info[i].c->private != NULL)
mountpoint = ((PartInfo *)label_chunk_info[i].c->private)->mountpoint;
else
mountpoint = " ";
if (label_chunk_info[i].type == PART_FAT)
newfs = "DOS";
else
@ -394,10 +383,9 @@ print_label_chunks(void)
static void
print_command_summary()
{
mvprintw(17, 0,
"The following commands are valid here (upper or lower case):");
mvprintw(19, 0, "C = Create Partition D = Delete Partition M = Mount Partition");
mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs ESC = Exit this screen");
mvprintw(17, 0, "The following commands are valid here (upper or lower case):");
mvprintw(19, 0, "C = Create New D = Delete M = Set Mountpoint");
mvprintw(20, 0, "N = Newfs Options T = Toggle Newfs U = Undo ESC = Exit");
mvprintw(21, 0, "The default target will be displayed in ");
attrset(A_REVERSE);
@ -489,30 +477,23 @@ diskLabelEditor(char *str)
char *val, *cp;
int size;
struct chunk *tmp;
char osize[80];
u_long flags = 0;
val = msgGetInput(NULL, "Please specify the size for new FreeBSD partition in blocks, or\nappend a trailing `M' for megabytes (e.g. 20M), `C' for cylinders\nor `%%' for a percentage of remaining space.\n\nSpace free is %d blocks (%dMB)", sz, sz / ONE_MEG);
sprintf(osize, "%d", sz);
val = msgGetInput(osize, "Please specify the size for new FreeBSD partition in blocks, or\nappend a trailing `M' for megabytes (e.g. 20M) or `C' for cylinders.\n\nSpace free is %d blocks (%dMB)", sz, sz / ONE_MEG);
if (!val || (size = strtol(val, &cp, 0)) <= 0)
break;
if (sz <= FS_MIN_SIZE) {
msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
break;
}
if (*cp) {
if (toupper(*cp) == 'M')
size *= ONE_MEG;
else if (toupper(*cp) == 'C')
size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
else if (*cp == '%') {
float fsz, fsize;
fsz = (float)sz;
fsize = (float)size;
fsize *= 0.10;
fsz *= fsize;
size = (int)fsz;
}
}
if (size <= FS_MIN_SIZE) {
msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
break;
}
type = get_partition_type();
if (type == PART_NONE)
@ -552,7 +533,8 @@ diskLabelEditor(char *str)
}
if (type != PART_SWAP) {
/* This is needed to tell the newfs -u about the size */
tmp->private = new_part(p->mountpoint,p->newfs,tmp->size);
tmp->private = new_part(p->mountpoint, p->newfs, tmp->size);
tmp->private_free = safe_free;
safe_free(p);
} else {
tmp->private = p;
@ -617,18 +599,22 @@ diskLabelEditor(char *str)
case 'T': /* Toggle newfs state */
if (label_chunk_info[here].type == PART_FILESYSTEM &&
label_chunk_info[here].c->private) {
PartInfo *pi = ((PartInfo *)
label_chunk_info[here].c->private);
label_chunk_info[here].c->private = new_part(
pi->mountpoint,
!pi->newfs,
label_chunk_info[here].c->size);
PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private);
label_chunk_info[here].c->private = new_part(pi->mountpoint, !pi->newfs, label_chunk_info[here].c->size);
safe_free(pi);
label_chunk_info[here].c->private_free = safe_free;
}
else
msg = MSG_NOT_APPLICABLE;
break;
case 'U':
Free_Disk(label_chunk_info[here].c->disk);
label_chunk_info[here].c->disk = Open_Disk(label_chunk_info[here].c->disk->name);
if (!label_chunk_info[here].c->disk)
msgFatal("Can't reopen disk in undo!");
record_label_chunks();
case 'W':
if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\nThis is an entirely undocumented feature which you are not\nexpected to understand!")) {
int i;