Update the -current sources from the 2.1 branch.

Approved (in spirit) by: jkh
This commit is contained in:
Peter Wemm 1995-12-07 10:34:59 +00:00
parent cde694287a
commit 40b0c0d936
136 changed files with 11779 additions and 8770 deletions

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: change.c,v 1.8.2.1 1995/06/05 02:24:20 jkh Exp $
* $Id: change.c,v 1.9.2.1 1995/09/20 10:43:01 jkh Exp $
*
*/
@ -46,7 +46,7 @@ Set_Bios_Geom(struct disk *disk, u_long cyl, u_long hd, u_long sect)
}
void
All_FreeBSD(struct disk *d)
All_FreeBSD(struct disk *d, int force_all)
{
struct chunk *c;
@ -57,5 +57,6 @@ All_FreeBSD(struct disk *d)
goto again;
}
c=d->chunks;
Create_Chunk(d,c->offset,c->size,freebsd,0xa5,0);
Create_Chunk(d,c->offset,c->size,freebsd,0xa5,
force_all? CHUNK_FORCE_ALL: 0);
}

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: create_chunk.c,v 1.20.2.1 1995/05/31 23:53:45 jkh Exp $
* $Id: create_chunk.c,v 1.21.2.6 1995/11/18 10:02:10 jkh Exp $
*
*/
@ -15,6 +15,8 @@
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/disklabel.h>
#include <sys/diskslice.h>
@ -23,275 +25,335 @@
#include <err.h>
#include "libdisk.h"
/* Clone these two from sysinstall because we need our own copies
* due to link order problems with `crunch'. Feh!
*/
static int
isDebug()
{
static int debug = 0; /* Allow debugger to tweak it */
return debug;
}
/* Write something to the debugging port */
static void
msgDebug(char *fmt, ...)
{
va_list args;
char *dbg;
static int DebugFD = -1;
if (DebugFD == -1)
DebugFD = open("/dev/ttyv1", O_RDWR);
dbg = (char *)alloca(FILENAME_MAX);
strcpy(dbg, "DEBUG: ");
va_start(args, fmt);
vsnprintf((char *)(dbg + strlen(dbg)), FILENAME_MAX, fmt, args);
va_end(args);
write(DebugFD, dbg, strlen(dbg));
}
void
Fixup_FreeBSD_Names(struct disk *d, struct chunk *c)
{
struct chunk *c1, *c3;
int j;
if (!strcmp(c->name, "X")) return;
/* reset all names to "X" */
for (c1 = c->part; c1 ; c1 = c1->next) {
c1->oname = c1->name;
c1->name = malloc(12);
if(!c1->name) err(1,"Malloc failed");
strcpy(c1->name,"X");
}
/* Allocate the first swap-partition we find */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
if (c1->subtype != FS_SWAP) continue;
sprintf(c1->name,"%s%c",c->name,SWAP_PART+'a');
break;
}
/* Allocate the first root-partition we find */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
if (!(c1->flags & CHUNK_IS_ROOT)) continue;
sprintf(c1->name,"%s%c",c->name,0+'a');
break;
}
/* Try to give them the same as they had before */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (strcmp(c1->name,"X")) continue;
for(c3 = c->part; c3 ; c3 = c3->next)
if (c1 != c3 && !strcmp(c3->name, c1->oname)) {
goto newname;
}
strcpy(c1->name,c1->oname);
newname:
}
/* Allocate the rest sequentially */
for (c1 = c->part; c1 ; c1 = c1->next) {
const char order[] = "efghabd";
if (c1->type == unused) continue;
if (strcmp("X",c1->name)) continue;
for(j=0;j<strlen(order);j++) {
sprintf(c1->name,"%s%c",c->name,order[j]);
for(c3 = c->part; c3 ; c3 = c3->next)
if (c1 != c3 && !strcmp(c3->name, c1->name))
goto match;
break;
match:
strcpy(c1->name,"X");
continue;
}
}
for (c1 = c->part; c1 ; c1 = c1->next) {
free(c1->oname);
c1->oname = 0;
struct chunk *c1, *c3;
int j;
if (!strcmp(c->name, "X")) return;
/* reset all names to "X" */
for (c1 = c->part; c1 ; c1 = c1->next) {
c1->oname = c1->name;
c1->name = malloc(12);
if(!c1->name) err(1,"Malloc failed");
strcpy(c1->name,"X");
}
/* Allocate the first swap-partition we find */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
if (c1->subtype != FS_SWAP) continue;
sprintf(c1->name,"%s%c",c->name,SWAP_PART+'a');
break;
}
/* Allocate the first root-partition we find */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
if (!(c1->flags & CHUNK_IS_ROOT)) continue;
sprintf(c1->name,"%s%c",c->name,0+'a');
break;
}
/* Try to give them the same as they had before */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (strcmp(c1->name,"X")) continue;
for(c3 = c->part; c3 ; c3 = c3->next)
if (c1 != c3 && !strcmp(c3->name, c1->oname)) {
goto newname;
}
strcpy(c1->name,c1->oname);
newname:
}
/* Allocate the rest sequentially */
for (c1 = c->part; c1 ; c1 = c1->next) {
const char order[] = "efghabd";
if (c1->type == unused) continue;
if (strcmp("X",c1->name)) continue;
for(j=0;j<strlen(order);j++) {
sprintf(c1->name,"%s%c",c->name,order[j]);
for(c3 = c->part; c3 ; c3 = c3->next)
if (c1 != c3 && !strcmp(c3->name, c1->name))
goto match;
break;
match:
strcpy(c1->name,"X");
continue;
}
}
for (c1 = c->part; c1 ; c1 = c1->next) {
free(c1->oname);
c1->oname = 0;
}
}
void
Fixup_Extended_Names(struct disk *d, struct chunk *c)
{
struct chunk *c1;
int j=5;
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
free(c1->name);
c1->name = malloc(12);
if(!c1->name) err(1,"malloc failed");
sprintf(c1->name,"%ss%d",d->chunks->name,j++);
if (c1->type == freebsd)
Fixup_FreeBSD_Names(d,c1);
}
struct chunk *c1;
int j=5;
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
free(c1->name);
c1->name = malloc(12);
if(!c1->name) err(1,"malloc failed");
sprintf(c1->name,"%ss%d",d->chunks->name,j++);
if (c1->type == freebsd)
Fixup_FreeBSD_Names(d,c1);
}
}
void
Fixup_Names(struct disk *d)
{
struct chunk *c1, *c2, *c3;
int i,j;
c1 = d->chunks;
for(i=1,c2 = c1->part; c2 ; c2 = c2->next) {
c2->flags &= ~CHUNK_BSD_COMPAT;
if (c2->type == unused)
continue;
if (strcmp(c2->name,"X"))
continue;
c2->oname = malloc(12);
if(!c2->oname) err(1,"malloc failed");
for(j=1;j<=NDOSPART;j++) {
sprintf(c2->oname,"%ss%d",c1->name,j);
for(c3 = c1->part; c3 ; c3 = c3->next)
if (c3 != c2 && !strcmp(c3->name, c2->oname))
goto match;
free(c2->name);
c2->name = c2->oname;
c2->oname = 0;
break;
match:
continue;
}
if (c2->oname)
free(c2->oname);
struct chunk *c1, *c2, *c3;
int i,j;
c1 = d->chunks;
for(i=1,c2 = c1->part; c2 ; c2 = c2->next) {
c2->flags &= ~CHUNK_BSD_COMPAT;
if (c2->type == unused)
continue;
if (strcmp(c2->name,"X"))
continue;
c2->oname = malloc(12);
if(!c2->oname) err(1,"malloc failed");
for(j=1;j<=NDOSPART;j++) {
sprintf(c2->oname,"%ss%d",c1->name,j);
for(c3 = c1->part; c3 ; c3 = c3->next)
if (c3 != c2 && !strcmp(c3->name, c2->oname))
goto match;
free(c2->name);
c2->name = c2->oname;
c2->oname = 0;
break;
match:
continue;
}
for(c2 = c1->part; c2 ; c2 = c2->next) {
if (c2->type == freebsd) {
c2->flags |= CHUNK_BSD_COMPAT;
break;
}
}
for(c2 = c1->part; c2 ; c2 = c2->next) {
if (c2->type == freebsd)
Fixup_FreeBSD_Names(d,c2);
if (c2->type == extended)
Fixup_Extended_Names(d,c2);
if (c2->oname)
free(c2->oname);
}
for(c2 = c1->part; c2 ; c2 = c2->next) {
if (c2->type == freebsd) {
c2->flags |= CHUNK_BSD_COMPAT;
break;
}
}
for(c2 = c1->part; c2 ; c2 = c2->next) {
if (c2->type == freebsd)
Fixup_FreeBSD_Names(d,c2);
if (c2->type == extended)
Fixup_Extended_Names(d,c2);
}
}
int
Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, int subtype, u_long flags)
{
int i;
u_long l;
int i;
u_long l;
if(!(flags & CHUNK_FORCE_ALL))
{
/* Never use the first track */
if (!offset) {
offset += d->bios_sect;
size -= d->bios_sect;
offset += d->bios_sect;
size -= d->bios_sect;
}
/* Always end on cylinder boundary */
l = (offset+size) % (d->bios_sect * d->bios_hd);
size -= l;
i = Add_Chunk(d,offset,size,"X",type,subtype,flags);
Fixup_Names(d);
return i;
}
i = Add_Chunk(d,offset,size,"X",type,subtype,flags);
Fixup_Names(d);
return i;
}
struct chunk *
Create_Chunk_DWIM(struct disk *d, struct chunk *parent , u_long size, chunk_e type, int subtype, u_long flags)
{
int i;
struct chunk *c1;
u_long offset,edge;
if (!parent)
parent = d->chunks;
for (c1=parent->part; c1 ; c1 = c1->next) {
if (c1->type != unused) continue;
if (c1->size < size) continue;
offset = c1->offset;
goto found;
}
warn("Not enough unused space");
int i;
struct chunk *c1;
u_long offset,edge;
if (!parent)
parent = d->chunks;
for (c1=parent->part; c1 ; c1 = c1->next) {
if (c1->type != unused) continue;
if (c1->size < size) continue;
offset = c1->offset;
goto found;
}
warn("Not enough unused space");
return 0;
found:
if (parent->flags & CHUNK_BAD144) {
edge = c1->end - d->bios_sect - 127;
if (offset > edge)
return 0;
if (offset + size > edge)
size = edge - offset + 1;
}
i = Add_Chunk(d,offset,size,"X",type,subtype,flags);
if (i) {
warn("Didn't cut it");
return 0;
found:
if (parent->flags & CHUNK_BAD144) {
edge = c1->end - d->bios_sect - 127;
if (offset > edge)
return 0;
if (offset + size > edge)
size = edge - offset + 1;
}
i = Add_Chunk(d,offset,size,"X",type,subtype,flags);
if (i) {
warn("Didn't cut it");
return 0;
}
Fixup_Names(d);
for (c1=parent->part; c1 ; c1 = c1->next)
if (c1->offset == offset)
return c1;
err(1,"Serious internal trouble");
}
Fixup_Names(d);
for (c1=parent->part; c1 ; c1 = c1->next)
if (c1->offset == offset)
return c1;
err(1,"Serious internal trouble");
}
int
MakeDev(struct chunk *c1, char *path)
{
char *p = c1->name;
u_long cmaj,bmaj,min,unit,part,slice;
char buf[BUFSIZ],buf2[BUFSIZ];
char *p = c1->name;
u_long cmaj, bmaj, min, unit, part, slice;
char buf[BUFSIZ], buf2[BUFSIZ];
*buf2 = '\0';
if(!strcmp(p,"X"))
*buf2 = '\0';
if (isDebug())
msgDebug("MakeDev: Called with %s on path %s\n", p, path);
if (!strcmp(p, "X"))
return 0;
if (!strncmp(p, "wd", 2))
bmaj = 0, cmaj = 3;
else if (!strncmp(p, "sd", 2))
bmaj = 4, cmaj = 13;
else {
return 0;
}
p += 2;
if (!isdigit(*p)) {
msgDebug("MakeDev: Invalid disk unit passed: %s\n", p);
return 0;
}
unit = *p - '0';
p++;
if (!*p) {
slice = 1;
part = 2;
goto done;
}
else if (isdigit(*p)) {
unit *= 10;
unit += (*p - '0');
p++;
}
if (*p != 's') {
msgDebug("MakeDev: `%s' is not a valid slice delimiter\n", p);
return 0;
}
p++;
if (!isdigit(*p)) {
msgDebug("MakeDev: `%s' is an invalid slice number\n", p);
return 0;
}
slice = *p - '0';
p++;
if (isdigit(*p)) {
slice *= 10;
slice += (*p - '0');
p++;
}
slice = slice + 1;
if (!*p) {
part = 2;
if(c1->type == freebsd)
sprintf(buf2, "%sc", c1->name);
goto done;
}
if (*p < 'a' || *p > 'h') {
msgDebug("MakeDev: `%s' is not a valid partition name.\n", p);
return 0;
}
part = *p - 'a';
done:
if (isDebug())
msgDebug("MakeDev: Unit %d, Slice %d, Part %d\n", unit, slice, part);
if (unit > 32)
return 0;
if (slice > 32)
return 0;
min = unit * 8 + 65536 * slice + part;
sprintf(buf, "%s/r%s", path, c1->name);
unlink(buf);
if (mknod(buf, S_IFCHR|0640, makedev(cmaj,min)) == -1) {
msgDebug("mknod of %s returned failure status!\n", buf);
return 0;
}
if (*buf2) {
sprintf(buf, "%s/r%s", path, buf2);
unlink(buf);
if (mknod(buf, S_IFCHR|0640, makedev(cmaj,min)) == -1) {
msgDebug("mknod of %s returned failure status!\n", buf);
return 0;
if (p[0] == 'w' && p[1] == 'd') {
bmaj = 0; cmaj = 3;
} else if (p[0] == 's' && p[1] == 'd') {
bmaj = 4; cmaj = 13;
} else {
return 0;
}
p += 2;
if (!isdigit(*p))
return 0;
unit = *p - '0';
p++;
if (isdigit(*p)) {
unit *= 10;
unit = *p - '0';
p++;
}
if (!*p) {
slice = 1;
part = 2;
goto done;
}
if (*p != 's')
return 0;
p++;
if (!isdigit(*p))
return 0;
slice = *p - '0';
p++;
if (isdigit(*p)) {
slice *= 10;
slice = *p - '0';
p++;
}
slice = slice+1;
if (!*p) {
part = 2;
if(c1->type == freebsd)
sprintf(buf2,"%sc",c1->name);
goto done;
}
if (*p < 'a' || *p > 'h')
return 0;
part = *p - 'a';
done:
if (unit > 32)
return 0;
if (slice > 32)
return 0;
min = unit * 8 + 65536 * slice + part;
sprintf(buf,"%s/r%s",path,c1->name);
unlink(buf); mknod(buf,S_IFCHR|0640,makedev(cmaj,min));
if(*buf2) {
sprintf(buf,"%s/r%s",path,buf2);
unlink(buf); mknod(buf,S_IFCHR|0640,makedev(cmaj,min));
}
sprintf(buf,"%s/%s",path,c1->name);
unlink(buf); mknod(buf,S_IFBLK|0640,makedev(bmaj,min));
return 1;
}
sprintf(buf, "%s/%s", path, c1->name);
unlink(buf);
if (mknod(buf, S_IFBLK|0640, makedev(bmaj,min)) == -1) {
msgDebug("mknod of %s returned failure status!\n", buf);
return 0;
}
return 1;
}
void
MakeDevChunk(struct chunk *c1,char *path)
int
MakeDevChunk(struct chunk *c1, char *path)
{
MakeDev(c1,path);
if (c1->next) MakeDevChunk(c1->next,path);
if (c1->part) MakeDevChunk(c1->part,path);
int i;
i = MakeDev(c1, path);
if (c1->next)
MakeDevChunk(c1->next, path);
if (c1->part)
MakeDevChunk(c1->part, path);
return i;
}
void
MakeDevDisk(struct disk *d,char *path)
int
MakeDevDisk(struct disk *d, char *path)
{
MakeDevChunk(d->chunks,path);
return MakeDevChunk(d->chunks, path);
}

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: libdisk.h,v 1.18.2.2 1995/06/05 02:24:32 jkh Exp $
* $Id: libdisk.h,v 1.19.2.2 1995/10/13 08:19:12 jkh Exp $
*
*/
@ -74,6 +74,10 @@ struct chunk {
/* This 'part' is a rootfs, allocate 'a' */
# define CHUNK_ACTIVE 32
/* This is the active slice in the MBR */
# define CHUNK_FORCE_ALL 64
/* Force a dedicated disk for FreeBSD, bypassing
* all BIOS geometry considerations
*/
void (*private_free)(void*);
void *(*private_clone)(void*);
@ -138,8 +142,10 @@ Create_Chunk(struct disk *disk, u_long offset, u_long size, chunk_e type, int su
*/
void
All_FreeBSD(struct disk *d);
/* Make one FreeBSD chunk covering the entire disk
All_FreeBSD(struct disk *d, int force_all);
/* Make one FreeBSD chunk covering the entire disk;
* if force_all is set, bypass all BIOS geometry
* considerations.
*/
char *
@ -211,7 +217,10 @@ Create_Chunk_DWIM(struct disk *d, struct chunk *parent , u_long size, chunk_e ty
* enough is used.
*/
void
int
MakeDev(struct chunk *c, char *path);
int
MakeDevDisk(struct disk *d,char *path);
/* Make device nodes for all chunks on this disk */

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: tst01.c,v 1.14.2.1 1995/06/05 02:24:35 jkh Exp $
* $Id: tst01.c,v 1.15.2.1 1995/09/20 10:43:04 jkh Exp $
*
*/
@ -189,7 +189,11 @@ main(int argc, char **argv)
continue;
}
if (!strcasecmp(*cmds,"allfreebsd")) {
All_FreeBSD(d);
All_FreeBSD(d, 0);
continue;
}
if (!strcasecmp(*cmds,"dedicate")) {
All_FreeBSD(d, 1);
continue;
}
if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
@ -280,6 +284,7 @@ main(int argc, char **argv)
printf("\007ERROR\n");
printf("CMDS:\n");
printf("\tallfreebsd\n");
printf("\tdedicate\n");
printf("\tbios cyl hd sect\n");
printf("\tboot\n");
printf("\tbteasy17\n");

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: write_disk.c,v 1.14 1995/06/11 19:29:38 rgrimes Exp $
* $Id: write_disk.c,v 1.15 1995/08/26 04:57:03 davidg Exp $
*
*/
@ -79,11 +79,11 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
dl->d_secsize = 512;
dl->d_secperunit = new->chunks->size;
#if 0
dl->d_secpercyl = new->real_cyl ? new->real_cyl : new->bios_cyl;
dl->d_ncylinders = new->real_cyl ? new->real_cyl : new->bios_cyl;
dl->d_ntracks = new->real_hd ? new->real_hd : new->bios_hd;
dl->d_nsectors = new->real_sect ? new->real_sect : new->bios_sect;
#else
dl->d_secpercyl = new->bios_cyl;
dl->d_ncylinders = new->bios_cyl;
dl->d_ntracks = new->bios_hd;
dl->d_nsectors = new->bios_sect;
#endif

View file

@ -1,13 +1,13 @@
$Id: MIRROR.SITES,v 1.1 1995/10/15 01:41:51 jfieber Exp $
$Id: MIRROR.SITES,v 1.2 1995/11/16 09:30:09 asami Exp $
Obtaining FreeBSD
The official sources for FreeBSD available via anonymous FTP from:
ftp://ftp.FreeBSD.org/pub/FreeBSD
and on CD-ROM from Walnut Creek CDROM:
Walnut Creek CDROM
1547 Palos Verdes Mall, Suite 260
Walnut Creek CA 94596 USA
@ -15,76 +15,75 @@ Obtaining FreeBSD
Fax: +1 510 674-0821
Email: info@cdrom.com
WWW: http://www.cdrom.com/
Additionally, FreeBSD is available via anonymous FTP from the
following mirror sites. If you choose to obtain FreeBSD via anonymous
FTP, please try to use a site near you.
Australia
+ ftp://ftp.physics.usyd.edu.au/FreeBSD
Contact: dawes@xfree86.org.
+ ftp://minnie.cs.adfa.oz.au/FreeBSD
Contact: wkt@dolphin.cs.adfa.oz.au.
Canada
+ ftp://ftp.synapse.net/contrib/FreeBSD
Contact: evanc@synapse.net.
Finland
+ ftp://nic.funet.fi/pub/unix/FreeBSD
Contact: count@nic.funet.fi.
France
+ ftp://ftp.ibp.fr/pub/FreeBSD
Contact: Remy.Card@ibp.fr.
Germany
+ ftp://ftp.fb9dv.uni-duisburg.de/pub/unix/FreeBSD
Contact: ftp@ftp.fb9dv.uni-duisburg.de.
+ ftp://gil.physik.rwth-aachen.de/pub/FreeBSD
Contact: kuku@gil.physik.rwth-aachen.de.
+ ftp://ftp.uni-paderborn.de/freebsd
Contact: ftp@uni-paderborn.de.
+ ftp://ftp.leo.org/pub/comp/os/bsd/FreeBSD
Contact: bsd@leo.org.
+ ftp://ftp.tu-dresden.de/pub/soft/unix/bsd/FreeBSD
Contact: pdsowner@rcs1.urz.tu-dresden.de.
Hong Kong
+ ftp://ftp.hk.super.net/pub/FreeBSD
+ ftp://ftp.hk.super.net/pub/mirror/FreeBSD
Contact: ftp-admin@HK.Super.NET.
Ireland
+ ftp://ftp.internet-eireann.ie/pub/FreeBSD
Contact: ftpadmin@internet-eireann.ie.
Israel
+ ftp://orgchem.weizmann.ac.il/pub/FreeBSD
Contact: serg@klara.weizmann.ac.il.
Japan
+ ftp://ftp.tokyonet.ad.jp/pub/FreeBSD
Contact: ftpadmin@TokyoNet.AD.JP.
+ ftp://ftp.nisiq.net/pub/os/FreeBSD/
Contact: ftp-admin@nisiq.net.
+ ftp://ftp.iij.ad.jp/pub/FreeBSD/
Contact: ftp@ftp.iij.ad.jp.
@ -93,77 +92,82 @@ Obtaining FreeBSD
+ ftp://ftp.ee.uec.ac.jp/pub/os/mirror/ftp.freebsd.org
Contact: ftp-admin@ftp.ee.uec.ac.jp.
+ ftp://ftp.u-aizu.ac.jp/pub/os/FreeBSD
Contact: ftp-admin@u-aizu.ac.jp.
Korea
+ ftp://ftp.cau.ac.kr/pub/FreeBSD
Contact: ftpadm@ftp.cau.ac.kr.
+ ftp://ftp.easy.re.kr/pub/FreeBSD
Contact: ftpadm@easy.re.kr.
Netherlands
+ ftp://ftp.nl.net/pub/os/FreeBSD
Contact: archive@nl.net.
Poland
+ ftp://SunSITE.icm.edu.pl/pub/FreeBSD/ftp.freebsd.org
Contact: w.sylwestrzak@icm.edu.pl
Russia
+ ftp://ftp.kiae.su/FreeBSD
Contact: ftp@ftp.kiae.su.
Sweden
+ ftp://ftp.luth.se/pub/FreeBSD
Contact: ragge@ludd.luth.se.
Taiwan
+ ftp://NCTUCCCA.edu.tw/Operating-Systems/FreeBSD
Contact: freebsd@NCTUCCCA.edu.tw.
+ ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD
Contact: ftp@netbsd.csie.nctu.edu.tw.
Thailand
+ ftp://ftp.nectec.or.th/pub/FreeBSD
+ ftp://ftp.nectec.or.th/pub/mirrors/FreeBSD
Contact: ftpadmin@ftp.nectec.or.th.
USA
+ ftp://gatekeeper.dec.com/pub/BSD/FreeBSD
Contact: hubbard@gatekeeper.dec.com.
+ ftp://ftp.cybernetics.net/pub/FreeBSD
Contact: michael@Cybernetics.NET.
+ ftp://ftp.neosoft.com/systems/FreeBSD
Contact: smace@NeoSoft.COM.
+ ftp://kryten.atinc.com/pub/FreeBSD
Contact: jmb@kryten.atinc.com.
+ ftp://ftp.dataplex.net/pub/FreeBSD
Contact: rkw@dataplex.net.
+ ftp://ftp.cps.cmich.edu/pub/ftp.freebsd.org
Contact: ftpadmin@cps.cmich.edu.
+ ftp://ftp.cslab.vt.edu/pub/FreeBSD
Contact: ftp@ftp.cslab.vt.edu.
UK
+ ftp://src.doc.ic.ac.uk/packages/unix/FreeBSD
Contact: wizards@doc.ic.ac.uk.
+ ftp://unix.hensa.ac.uk/pub/walnut.creek/FreeBSD
+ ftp://unix.hensa.ac.uk/mirrors/walnut.creek/FreeBSD
Contact: archive-admin@unix.hensa.ac.uk.
+ ftp://ftp.demon.co.uk/pub/BSD/FreeBSD
Contact: uploads@demon.net.
USA
+ ftp://ftp.cybernetics.net/pub/FreeBSD
Contact: michael@Cybernetics.NET.
+ ftp://ftp.neosoft.com/systems/FreeBSD
Contact: smace@NeoSoft.COM.
+ ftp://kryten.atinc.com/pub/FreeBSD
Contact: jmb@kryten.atinc.com.
+ ftp://ftp.dataplex.net/pub/FreeBSD
Contact: rkw@dataplex.net.
+ ftp://ftp.cps.cmich.edu/pub/ftp.freebsd.org
Contact: ftpadmin@cps.cmich.edu.
+ ftp://ftp.cslab.vt.edu/pub/FreeBSD
Contact: ftp@ftp.cslab.vt.edu.
The latest versions of export-restricted code for FreeBSD (2.0C or
@ -171,22 +175,21 @@ Obtaining FreeBSD
locations. If you are outside the U.S. or Canada, please get secure
(DES) and eBones (Kerberos) from one of the following foreign
distribution sites:
SouthAfrica
South Africa
+ ftp://ftp.internat.freebsd.org/pub/FreeBSD
Contact: Mark Murray mark@grondar.za.
+ ftp://storm.sea.uct.ac.za/pub/FreeBSD
Contact: Shaun Courtney ftp@storm.sea.uct.ac.za.
Brazil
+ ftp://ftp.iqm.unicamp.br/pub/FreeBSD
Contact: Pedro A M Vazquez vazquez@iqm.unicamp.br.
Finland
+ ftp://nic.funet.fi/pub/unix/FreeBSD/eurocrypt
Contact: count@nic.funet.fi.

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.193 1995/06/11 19:29:26 rgrimes Exp $
# $Id: Makefile,v 1.194 1995/07/25 19:13:20 jkh Exp $
#
# How to roll a release:
#
@ -11,10 +11,10 @@
# that on a 14.4 line just yet...
#
# SET THIS !!!
#BUILDNAME=SOME_RANDOM_BUILD
BUILDNAME=2.1.0-RELEASE
CHROOTDIR=/a/release
# If this is a RELEASE, then set
#RELEASETAG=something
RELEASETAG=RELENG_2_1_0
# Things which without too much trouble can be considered variables
@ -22,6 +22,12 @@ EXPORT_DISTS= games manpages proflibs dict info
EXTRA_DISTS= krb des ${EXPORT_DISTS}
ALL_DISTS= bin ${EXTRA_DISTS}
# Extra source tarballs; each argument is a pair of source dir and
# distribution name. The dist name should not exceed 7 characters
# (another "s" for "source" will be prepended).
EXTRA_SRC+= usr.sbin/sendmail/cf smailcf
#EXTRA_SRC+= usr.sbin/config kconf
BOOT1= etc/protocols etc/sysconfig
FAQS= MIRROR.SITES
@ -44,8 +50,8 @@ ZIPNSPLIT= gzip --no-name -9 -c | split -b 240640 -
# Size of the mfs to put in the kernel we boot.
# You want to keep this as small as possible, it costs dearly in RAM.
BOOTMFSSIZE= 1075
MFSINODE= 80000
BOOTMFSSIZE= 1000
MFSINODE= 70000
# Things which will get you into trouble if you change them
DISTRIBUTIONS= bin ${EXTRA_DISTS}
@ -64,16 +70,15 @@ release:
.endif
.if exists(${CHROOTDIR})
chflags -R noschg ${CHROOTDIR}/.
rm -rf ${CHROOTDIR}/*
.else
mkdir ${CHROOTDIR}
rm -rf ${CHROOTDIR}
.endif
mkdir -p ${CHROOTDIR}
cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR}
cd ${.CURDIR}/.. ; ${MAKE} install DESTDIR=${CHROOTDIR}
echo "#!/bin/sh" > ${CHROOTDIR}/mk
echo "set -ex" >> ${CHROOTDIR}/mk
echo "CFLAGS='-O2 -pipe'" >> ${CHROOTDIR}/mk
echo "CFLAGS='-O -pipe'" >> ${CHROOTDIR}/mk
echo "export CFLAGS" >> ${CHROOTDIR}/mk
echo "RELEASEDIR=/R" >> ${CHROOTDIR}/mk
echo "export RELEASEDIR" >> ${CHROOTDIR}/mk
@ -82,32 +87,30 @@ release:
echo "cd /usr/src/release" >> ${CHROOTDIR}/mk
echo "make obj" >> ${CHROOTDIR}/mk
echo "make doRELEASE" >> ${CHROOTDIR}/mk
echo "echo Release Finished" >> ${CHROOTDIR}/mk
.if !defined(RELEASETAG)
cd ${CHROOTDIR}/usr ; cvs co -P src
.else
cd ${CHROOTDIR}/usr ; cvs co -P -r ${RELEASETAG} src
.endif
( cd ${CHROOTDIR}/usr/src/sys/conf && \
mv newvers.sh foo && \
sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh; rm foo )
# To be used in development...
#find ${.CURDIR} -print | cpio -dumpv ${CHROOTDIR}
cp newvers.sh foo && \
sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh; rm foo )
( cd ${CHROOTDIR}/usr/src/release/sysinstall && \
sed "s/__RELEASE/${BUILDNAME}/" version.h > version.h.new && mv version.h.new version.h )
chmod 755 ${CHROOTDIR}/mk
chroot ${CHROOTDIR} /mk
# Same as above, but assume that a build just fell over, has been corrected
# and now we just want to pick up where we left off.
# Same as above but for re-rolling the release after simply changing a few
# things.
rerelease:
.if !defined(CHROOTDIR) || !defined(BUILDNAME)
@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
@echo "To make a re-release you must set CHROOTDIR and BUILDNAME" && false
.endif
@if [ ! -d ${CHROOTDIR} ]; then echo "No ${CHROOTDIR} directory to re-release in!"; exit 1; fi
cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR}
cd ${.CURDIR}/.. ; ${MAKE} -k install DESTDIR=${CHROOTDIR}
echo "#!/bin/sh" > ${CHROOTDIR}/mk
echo "set -ex" >> ${CHROOTDIR}/mk
echo "CFLAGS='-O2 -pipe'" >> ${CHROOTDIR}/mk
echo "CFLAGS='-O -pipe'" >> ${CHROOTDIR}/mk
echo "export CFLAGS" >> ${CHROOTDIR}/mk
echo "RELEASEDIR=/R" >> ${CHROOTDIR}/mk
echo "export RELEASEDIR" >> ${CHROOTDIR}/mk
@ -122,6 +125,7 @@ rerelease:
echo "cd /usr/src/release" >> ${CHROOTDIR}/mk
echo "make obj" >> ${CHROOTDIR}/mk
echo "make doRELEASE" >> ${CHROOTDIR}/mk
echo "echo Re-Release Finished" >> ${CHROOTDIR}/mk
.if !defined(RELEASENOUPDATE)
.if !defined(RELEASETAG)
cd ${CHROOTDIR}/usr ; cvs update -P -d -q src
@ -130,13 +134,17 @@ rerelease:
.endif
.endif
( cd ${CHROOTDIR}/usr/src/sys/conf && \
mv newvers.sh foo && \
sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh; rm foo )
# To be used in development...
#find ${.CURDIR} -print | cpio -dumpv ${CHROOTDIR}
mv newvers.sh foo && \
sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh; rm foo )
( cd ${CHROOTDIR}/usr/src/release/sysinstall && \
sed "s/__RELEASE/${BUILDNAME}/" version.h > version.h.new && mv version.h.new version.h )
chmod 755 ${CHROOTDIR}/mk
chroot ${CHROOTDIR} /mk
whap:
( cd ${CHROOTDIR}/usr/src/release/sysinstall && \
sed "s/__RELEASE/${BUILDNAME}/" version.h > version.h.new && mv version.h.new version.h )
clean:
rm -rf root_crunch boot_crunch release.[0-9] release.1[0]
@ -179,15 +187,20 @@ release.2:
install -m 444 -o bin -g bin libgcc.so.261.0 ${RD}/trees/bin/usr/lib
touch release.2
# Make and install a couple of kernels we need.
# Make and install a couple of kernels we need. To keep BOOTMFS smaller,
# we cull out certain options (see fgrep -v) before building it.
release.3:
rm -rf ${RD}/kernels
mkdir -p ${RD}/kernels
@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
cd ${.CURDIR}/../sys/i386/conf && \
sed 's/GENERIC/BOOTMFS/g' GENERIC > BOOTMFS && \
fgrep -v SYSV GENERIC | \
fgrep -v pty | \
fgrep -v PROCFS | \
sed 's/GENERIC/BOOTMFS/g' > BOOTMFS && \
echo "options \"MFS_ROOT=${BOOTMFSSIZE}\"" >> BOOTMFS && \
echo "options MFS" >> BOOTMFS
for i in BOOTMFS GENERIC ; do \
cd ${.CURDIR}/../sys/i386/conf && \
config $$i && \
@ -198,7 +211,6 @@ release.3:
rm -rf ${.CURDIR}/../sys/compile/$$i ; \
done
rm -f ${.CURDIR}/../sys/i386/conf/BOOTCDROM
cd ${RD}/kernels && kzip GENERIC
touch release.3
# Make and install the three crunched binaries which live on the floppies.
@ -300,6 +312,18 @@ release.7:
TD=src ARG="$$i" ; \
fi ; \
done
.if defined(EXTRA_SRC)
@set ${EXTRA_SRC} ; \
while [ $$# -ge 2 ] ; do \
if [ -d /usr/src/$$1 -a "$$1" != "CVS" ] ; then \
cd ${.CURDIR} ; \
$(MAKE) doTARBALL SD=/usr/src \
TN="s$$2" \
TD=src ARG="$$1" ; \
fi ; \
shift ; shift ; \
done
.endif
( cd ${RD}/dists/src && \
if [ -f ssecure.aa ] ; then mv ssecure.* ../des ; fi && \
if [ -f sebones.aa ] ; then mv sebones.* ../des ; fi )
@ -330,11 +354,11 @@ release.8: write_mfs_in_kernel
cd ${RD}/mfsfd && \
mkdir -p dev mnt stand/help
@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
DIR=${RD}/mfsfd/stand ZIP=false
DIR=${RD}/mfsfd/stand ZIP=true
( cd ${RD}/trees/bin/dev && \
ls console tty ttyv0 ttyv1 ttyv2 ttyv3 null zero \
*[sw]d* cuaa[01] fd[01] rfd[01] \
cd0a mcd0a scd0a matcd0a rst0 ft0 rwt0 | \
*[sw]d* cuaa[01] cuaa[23] fd[01] rfd[01] \
cd0a mcd0a scd0a matcd0a wcd0c rst0 rft0 rwt0 | \
cpio -dump ${RD}/mfsfd/dev )
( cd ${RD}/mfsfd/dev && rm -f *[sw]d*[bdefgh] )
cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
@ -342,12 +366,9 @@ release.8: write_mfs_in_kernel
echo "ftp 21/tcp" >> ${RD}/mfsfd/stand/etc/services
echo "domain 53/tcp nameserver" >> ${RD}/mfsfd/stand/etc/services
echo "domain 53/udp nameserver" >> ${RD}/mfsfd/stand/etc/services
rm -rf ${.CURDIR}/sysinstall/help/ja_JP.JIS
tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
tar xvf - -C ${RD}/mfsfd/stand
install -c ${.CURDIR}/../COPYRIGHT ${RD}/mfsfd/stand/help/en_US.ISO8859-1/COPYRIGHT
(cd ${RD}/mfsfd/stand/help && tar cf - * | gzip -9 > ../help.tgz)
(cd ${RD}/mfsfd/stand && rm -rf help)
install -c ${.CURDIR}/../COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
( \
a=`expr ${BOOTMFSSIZE} \* 2` && \
echo && \
@ -357,6 +378,8 @@ release.8: write_mfs_in_kernel
echo " :pc#$$a:oc#0:bc#4096:fc#512:" && \
echo \
) >> /etc/disktab
# first the standard boot floppy, with GENERIC kernel
cd ${.CURDIR} && ${MAKE} doFS FSSIZE=${BOOTMFSSIZE} \
FSPROTO=${RD}/mfsfd FSLABEL=mfs${BOOTMFSSIZE} \
FSINODE=${MFSINODE}
@ -386,7 +409,9 @@ release.9:
mv ${RD}/rootfd/stand/info/src/ssecure.inf ${RD}/rootfd/stand/info/des
mv ${RD}/rootfd/stand/info/src/sebones.inf ${RD}/rootfd/stand/info/des
tar -cf - -C ${RD}/trees/bin/dev MAKEDEV | tar xvf - -C ${RD}/rootfd/stand
cd ${RD}/rootfd && ( rm -f OK && find . -print && touch OK && echo OK ) | cpio -H tar -oa | gzip -9 -c | dd conv=osync > ${RD}/floppies/root.tmp
cp ${.CURDIR}/sysinstall/power.uu ${RD}/rootfd/stand && \
cd ${RD}/rootfd/stand && uudecode power.uu && rm power.uu
cd ${RD}/rootfd && ( rm -f OK && find . -print && touch OK && echo OK ) | cpio -H newc -oa | gzip -9 -c | dd conv=osync > ${RD}/floppies/root.tmp
mv ${RD}/floppies/root.tmp ${RD}/floppies/root.flp
touch release.9
@ -397,23 +422,15 @@ release.10:
mkdir ${RD}/fixitfd
cd ${RD}/fixitfd && \
mkdir stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp
ln -f ${RD}/kernels/GENERIC.kz ${RD}/fixitfd/kernel
@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
DIR=${RD}/fixitfd/stand ZIP=true
( cd ${RD}/trees/bin/dev && \
sh MAKEDEV wd0s5 wd0s6 wd0s7 wd0s8 && \
ls console tty ttyv0 ttyv1 null zero \
*[sw]d* fd[01] rfd[01] | \
sh MAKEDEV all && \
find . -print | \
cpio -dump ${RD}/fixitfd/dev )
ln -f ${RD}/fixitfd/stand/init ${RD}/fixitfd/sbin
ln -f ${RD}/fixitfd/stand/sh ${RD}/fixitfd/bin
cp ${RD}/trees/bin/usr/mdec/fdboot ${RD}/fixitfd/etc/boot1
cp ${RD}/trees/bin/usr/mdec/bootfd ${RD}/fixitfd/etc/boot2
cp ${RD}/trees/bin/etc/spwd.db ${RD}/fixitfd/etc
cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
echo 'echo /etc/rc' > ${RD}/fixitfd/etc/rc
echo 'exit 1' >> ${RD}/fixitfd/etc/rc
touch ${RD}/fixitfd/etc/spwd.db
cd ${.CURDIR} && ${MAKE} doFLOPPY FLOPPY=fixit
cd ${.CURDIR} && ${MAKE} doFLOPPY FLOPPY=fixit FDINODE=1024
touch release.10
ftp.1:
@ -421,7 +438,7 @@ ftp.1:
mkdir ${FD}
cd ${RD} && find floppies -print | cpio -dumpl ${FD}
cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
cd ${RD}/trees/bin/usr/share/FAQ/Text && ln -f ${FAQS} ${FD}
cd ${.CURDIR} && ln -f ${FAQS} ${FD}
# This rule makes ${CHROOTDIR}/R/ftp a suitable anon ftp for testing.
ftp.2:
@ -469,13 +486,14 @@ doTARBALL:
)
doRELEASE: release.1 release.2 release.3 release.4 release.5 release.6 \
release.7 release.8 release.9
release.7 release.8 release.9 release.10
cd ${.CURDIR} && ${MAKE} cdrom.1 ftp.1
@echo "Release done"
floppies:
rm -f release.4 release.8 release.9
cd ${.CURDIR} && ${MAKE} doRELEASE
cd ${.CURDIR} && ${MAKE} boot.flp
cd ${.CURDIR} && ${MAKE} root.flp
cd ${.CURDIR} && ${MAKE} fixit.flp
boot.flp:
rm -f release.4 release.8

View file

@ -1,183 +0,0 @@
#!/stand/sh
#
# Written: November 6th, 1994
# Copyright (C) 1994 by Michael Reifenberger
#
# Permission to copy or use this software for any purpose is granted
# provided that this message stay intact, and at this location (e.g. no
# putting your name on top after doing something trivial like reindenting
# it, just to make it look like you wrote it!).
########################
# First set some globals
startuid=1000;
startgid=1000;
gname=guest
uname=guest
shell="/bin/csh"
needgentry="NO"
. /stand/miscfuncs.sh
#########################
# Some Functions we need.
#
###########################
# Show the User all options
usage() {
message "
adduser -h Prints help
adduser -i For interactively adding users
Command line options:
adduser [-u UserName][-g GroupName][-s Shell]"
exit 1
}
##########################
# Get the next free UserID
getuid() {
local xx=$startuid;
uid=$startuid;
for i in `cut -f 3 -d : /etc/master.passwd | cut -c 2- | sort -n`; do
if [ $i -lt $xx ]; then
elif [ $i -eq $xx ]; then xx=`expr $xx + 1`
else uid=$xx; return 0
fi
done
}
#######################################################
# Get the next free GroupID or the GroupID of GroupName
getgid() {
local xx=$startgid;
gid=$startgid;
needgentry="YES"
if grep -q \^$gname: /etc/group; then
gid=`grep \^$gname: /etc/group | cut -f 3 -d:`
needgentry="NO"
else
for i in `cut -f 3 -d : /etc/group | cut -c 2- | sort -n`; do
if [ $i -lt $xx ]; then
elif [ $i -eq $xx ]; then xx=`expr $xx + 1`
else gid=$xx; return 0
fi
done
fi
}
##########################################
# Ask the User interactively what he wants
interact() {
dialog --title "Add New User Name" --clear \
--inputbox "Please specify a login name for the user:\n\
Hit [return] for a default of <$uname>" -1 -1 2> /tmp/i.$$
ret=$?
case $ret in
0)
if [ x`cat /tmp/i.$$` != x ]; then
uname=`cat /tmp/i.$$`; fi;;
1|255)
exit 1;;
esac
if grep -q \^$uname: /etc/master.passwd; then
error "Username $uname already exists."
exit 1
fi
dialog --title "Group Name" --clear \
--inputbox "Which group should $uname belong to?\n\
Hit [return] for default of <$gname>" -1 -1 2> /tmp/i.$$
ret=$?
case $ret in
0)
if [ x`cat /tmp/i.$$` != x ]; then
gname=`cat /tmp/i.$$`; fi;;
1|255)
exit 1;;
esac
dialog --title "Login Shell" --clear \
--inputbox "Please specify which login shell\n<$uname> should use\n\
Hit [return] for default of <$shell>" -1 -1 2> /tmp/i.$$
ret=$?
case $ret in
0)
if [ x`cat /tmp/i.$$` != x ]; then
shell=`cat /tmp/i.$$`; fi;;
1|255)
exit 1;;
esac
##############
# Remove junk
rm -f /tmp/i.$$
}
#########
# START #
#########
###################################
# Parse the commandline for options
set -- `getopt hiu:g:s: $*`
if [ $? != 0 ]; then
usage
fi
for i; do
case "$i"
in
-h)
usage; shift;;
-i)
interact; shift; iflag=yes; break;;
-u)
uname=$2; shift; shift;;
-g)
gname=$2; shift; shift;;
-s)
shell=$2; shift; shift;;
--)
shift; break;;
# *)
# usage; shift;;
esac
done
#####################
# This is no Edituser
if grep -q \^$uname: /etc/master.passwd; then
error "This user already exists in the master password file.\n
Use 'chpass' to edit an existing user rather than adduser.."
exit 1;
fi
###############
# Get Free ID's
getuid;
getgid;
###################
# Only if necessary
if [ $needgentry = "YES" ]; then
echo "$gname:*:$gid:$uname" >> /etc/group
fi
################
# Make /home BTW
mkdir -p -m755 /home/$uname
if [ ! -d /home/$uname ]; then
error "Could not create /home/$uname"
exit 1
else
for xx in /usr/share/skel/*; do
cp $xx /home/$uname/.`basename $xx | cut -f 2 -d .`
done
fi
#####################
# Make the User happy
if [ ! -x $shell ]; then
message "There is no <$shell> shell, using /bin/sh instead.\n
If you wish, you can change this choice later with 'chpass'"
shell="/bin/csh"
elif ! grep -q $shell /etc/shells; then
echo $shell >> /etc/shells
echo "<$shell> added to /etc/shells"
fi
echo "$uname:*:$uid:$gid::0:0:User &:/home/$uname:$shell" >> /etc/master.passwd
pwd_mkdb /etc/master.passwd
chown -R $uname.$gname /home/$uname
chmod -R 644 /home/$uname
chmod 755 /home/$uname
passwd $uname

View file

@ -1,10 +1,10 @@
# $Id: boot_crunch.conf,v 1.19.2.1 1995/06/04 11:52:44 jkh Exp $
# $Id: boot_crunch.conf,v 1.20.2.3 1995/10/05 08:58:19 jkh Exp $
srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin
srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/i386
progs sh find
progs ft ppp
progs pwd ft ppp
progs sysinstall newfs gzip cpio bad144 fsck ifconfig route slattach
progs mount_nfs
ln gzip gunzip

View file

@ -1,4 +1,4 @@
# $Id: fixit_crunch.conf,v 1.2 1995/04/12 08:00:24 phk Exp $
# $Id: fixit_crunch.conf,v 1.3.4.7 1995/10/05 09:27:06 jkh Exp $
# first, we list the source dirs that our programs reside in. These are
# searched in order listed to find the dir containing each program.
@ -14,34 +14,28 @@ srcdirs /usr/src/sbin/i386
# /bin stuff
progs cat chmod chroot cp date dd df echo ed expr hostname kill ln ls mkdir
progs mt mv pwd rcp rm rmdir sh sleep stty sync test
progs mt mv pwd rcp rm rmdir sleep stty sync test
ln test [
ln sh -sh # init invokes the shell this way
# /sbin stuff
progs bad144 badsect chown clri disklabel dump dmesg fdisk fsck ifconfig init
progs mknod mount newfs ping reboot restore swapon umount
progs badsect chown clri disklabel dump dmesg fdisk
progs mknod mount newfs ping reboot restore scsi swapon umount
progs mount_msdos mount_cd9660 mount_nfs
ln dump rdump
ln restore rrestore
ln newfs mount_mfs
# /usr/bin stuff
progs ftp rsh sed telnet rlogin common find
progs ftp rsh sed telnet rlogin common find grep
ln common vi
ln common view
ln common ex
# gnu stuff
progs cpio gzip
ln gzip gunzip
ln gzip gzcat
# finally, we specify the libraries to link in with our binary
libs -lcrypt -ltelnet -lutil -ll
libs -lcurses -ltermcap -ledit -lkvm
libs -lcurses -ltermcap -ledit -lgnuregex -lkvm -lscsi

View file

@ -1,10 +1,10 @@
# $Id: boot_crunch.conf,v 1.19.2.1 1995/06/04 11:52:44 jkh Exp $
# $Id: boot_crunch.conf,v 1.20.2.3 1995/10/05 08:58:19 jkh Exp $
srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin
srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/i386
progs sh find
progs ft ppp
progs pwd ft ppp
progs sysinstall newfs gzip cpio bad144 fsck ifconfig route slattach
progs mount_nfs
ln gzip gunzip

View file

@ -1,143 +0,0 @@
#!/stand/sh
#
# bininst - perform the last stage of installation by somehow getting
# a bindist onto the user's disk and unpacking it. The name bininst
# is actually something of a misnomer, since this utility will install
# more than just the bindist set.
#
# Written: November 11th, 1994
# Copyright (C) 1994 by Jordan K. Hubbard
#
# Permission to copy or use this software for any purpose is granted
# provided that this message stay intact, and at this location (e.g. no
# putting your name on top after doing something trivial like reindenting
# it, just to make it look like you wrote it!).
#
# $Id: bininst,v 1.55 1994/12/29 20:09:59 jkh Exp $
if [ "${_BININST_LOADED_}" = "yes" ]; then
error "Error, $0 loaded more than once!"
return 1
else
_BININST_LOADED_=yes
fi
# Grab the miscellaneous functions.
. /stand/miscfuncs.sh
# Grab the installation routines
. /stand/instdist.sh
# Grab the network setup routines
. /stand/netinst.sh
# Deal with trigger-happy users.
trap interrupt 1 2 15
# set initial defaults
set_defaults()
{
network_set_defaults
media_set_defaults
INSTALLING="yes"
mkdir -p ${TMP}
cp /stand/etc/* /etc
}
# Print welcome banner.
welcome()
{
dialog --title "Welcome to FreeBSD!" --msgbox \
"Installation may now proceed from tape, CDROM, a network (NFS or ftp
over ethernet, SLIP or parallel port) or DOS (existing hard disk
partition or floppies). If you're installing over a network, make
sure your cables are plugged in and ready to go. If you're installing
from tape, CDROM or floppies, now would be a good time to remember
where you put the distribution media! :-) Please remove the cpio
floppy from the drive and press return." -1 -1
}
do_last_config()
{
DONE=""
while [ "${DONE}" = "" ]; do
dialog --title "Final Configuration!" --menu \
"We now come to the end of the installation. If there's a\n\
floppy in the boot drive, now would probably be a good time\n\
to remove it as the system will reboot when you exit the shell\n\
at the end of this stage.\n\n\
Please select one of the following options:" -1 -1 5 \
"tzsetup" "Configure your time zone" \
"network" "Configure networking" \
"user" "Add a user name for yourself to the system" \
"guest" "Simply add a user \"guest\" with all default options" \
"done" "Exit the installation." 2> ${TMP}/menu.tmp.$$
RETVAL=$?
CHOICE=`cat ${TMP}/menu.tmp.$$`
rm -f ${TMP}/menu.tmp.$$
if ! handle_rval ${RETVAL}; then exit 0; fi
case ${CHOICE} in
tzsetup)
dialog --clear
sh /stand/tzsetup
dialog --clear
;;
network)
network_setup
;;
user)
sh /stand/adduser.sh -i
;;
guest)
sh /stand/adduser.sh
;;
done)
DONE="yes"
;;
esac
done
dialog --title "Auf Wiedersehen!" --msgbox \
"Don't forget that the login name \"root\" has no password.
If you didn't create any users with adduser, you can at least log in
as this user. Also be aware that root is the _superuser_, which means
that you can easily wipe out your system if you're not careful!
There are many useful pre-compiled packages for ${DISTNAME}
available which you may also wish to investigate. Look in:
ftp://ftp.freebsd.org/pub/FreeBSD/${DISTNAME}/packages
Any install-related comments to jkh@freebsd.org, phk@freebsd.org or
paul@freebsd.org.
We sincerely hope you enjoy FreeBSD 2.0!
The FreeBSD Project Team" -1 -1
}
welcome
set_defaults
while [ "${INSTALLING}" = "yes" ]; do
if media_select_distribution; then
if media_chose; then
for xx in ${MEDIA_DISTRIBUTIONS}; do
MEDIA_DISTRIBUTION=`eval echo \`echo $xx\``
media_install_set
done
fi
else
do_last_config
INSTALLING="no"
fi
done
echo; echo "Spawning shell. Exit shell to continue with new bindist."
echo "Progress <installation completed>" > /dev/ttyv1
/stand/sh
exit 20

View file

@ -1,10 +1,10 @@
# $Id: boot_crunch.conf,v 1.19.2.1 1995/06/04 11:52:44 jkh Exp $
# $Id: boot_crunch.conf,v 1.20.2.3 1995/10/05 08:58:19 jkh Exp $
srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin
srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/i386
progs sh find
progs ft ppp
progs pwd ft ppp
progs sysinstall newfs gzip cpio bad144 fsck ifconfig route slattach
progs mount_nfs
ln gzip gunzip

View file

@ -1,18 +0,0 @@
# $Id: boot_flp.conf,v 1.3 1994/11/18 11:31:28 phk Exp $
srcdirs /usr/src/bin /usr/src/sbin /usr/src/usr.bin /usr/src/gnu/usr.bin
srcdirs /usr/src/usr.sbin
# Programs from bin/
# progs sh mkdir rm mknod chmod expr
# progs ln test mount umount cat mv sync cp
# progs cpio gzip sysinstall newfs
progs sysinstall newfs gzip cpio fsck dialog bad144 fsck
ln gzip gunzip
ln gzip zcat
# ln sh -sh
# ln sysinstall oinit
# ln test [
# libs -ll -ledit -ltermcap -lutil -lscrypt
libs -ldialog -lncurses -lmytinfo

View file

@ -1,37 +0,0 @@
# $Id: cpio_crunch.conf,v 1.6 1995/05/21 18:29:51 jkh Exp $
# first, we list the source dirs that our programs reside in. These are
# searched in order listed to find the dir containing each program.
srcdirs /usr/src/gnu/usr.bin
srcdirs /usr/src/bin /usr/src/sbin /usr/src/sbin/i386 /usr/src/usr.bin
srcdirs /usr/src/usr.sbin
# second, we list all the programs we want to include in our crunched binary.
# The order doesn't matter. Any program that needs hard links to it gets an
# `ln' directive.
# /bin stuff
progs cat chmod cksum cp date dd df echo ed expr grep hostname kill ln
progs mkdir mt mv pwd rcp rm rmdir sleep slattach stty sync test ft
ln test [
# /sbin stuff
progs badsect basename chown clri disklabel dmesg dump dmesg fdisk ft
progs getopt init mknod mount mount_cd9660 mount_msdos mount_nfs
progs ping reboot restore swapon umount
ln dump rdump
ln restore rrestore
ln reboot halt
# /usr/bin stuff
progs tar ncftp ppp rsh sed telnet rlogin
#progs tip
#ln tip cu
# finally, we specify the libraries to link in with our binary
libs -lcrypt -ltelnet -lutil -ll -ledit
libs -lgnuregex -lreadline -lcurses -ltermcap -lkvm

View file

@ -1,37 +0,0 @@
# fixit.conf - put in anything we think we might want on a fixit floppy
# first, we list the source dirs that our programs reside in. These are
# searched in order listed to find the dir containing each program.
srcdirs /usr/src/gnu/usr.bin
srcdirs /usr/src/bin /usr/src/sbin /usr/src/sbin/i386 /usr/src/usr.bin
srcdirs /usr/src/usr.sbin
# second, we list all the programs we want to include in our crunched binary.
# The order doesn't matter. Any program that needs hard links to it gets an
# `ln' directive.
# /bin stuff
progs cat chmod cksum cp date dd df echo ed expr grep hostname kill ln ls
progs mkdir mt mv pwd rcp rm rmdir sh sleep slattach stty sync test
ln test [
ln sh -sh # init invokes the shell this way
# /sbin stuff
progs badsect basename chown clri disklabel dmesg dump dmesg fdisk fsck ft
progs getopt ifconfig init mknod mount mount_cd9660 mount_msdos mount_nfs
progs newfs ping reboot restore route swapon umount
ln dump rdump
ln restore rrestore
ln reboot halt
# /usr/bin stuff
progs tar tip ftp ncftp rsh sed telnet rlogin
ln tip cu
# finally, we specify the libraries to link in with our binary
libs -lcrypt -ltelnet -lutil -ll -ledit
libs -lgnuregex -lreadline -lcurses -ltermcap -lkvm

View file

@ -1,41 +0,0 @@
#!/bin/sh
# $Id: extract.sh,v 1.16 1994/11/29 00:56:30 jkh Exp $
PATH=/stand:$PATH
DDIR=/
if [ -f bindist.aa ] ; then
# Temporary kludge for pathological bindist.
if [ -f $DDIR/etc/myname ]; then
cp $DDIR/etc/hosts $DDIR/etc/myname $DDIR/stand/etc
fi
if [ -f $DDIR/etc/defaultrouter ]; then
cp $DDIR/etc/defaultrouter $DDIR/stand/etc
fi
echo; echo "Extracting bindist, please wait."
cat bindist.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
if [ -f $DDIR/stand/etc/myname ]; then
# Add back what the bindist nuked.
cp $DDIR/stand/etc/myname $DDIR/etc
cat $DDIR/stand/etc/hosts >> $DDIR/etc/hosts
fi
if [ -f $DDIR/stand/etc/defaultrouter ]; then
cp $DDIR/stand/etc/defaultrouter $DDIR/etc
fi
chmod 1777 /tmp
rm -f /sys
ln -s /usr/src/sys /sys
fi
for i in *.aa
do
b=`basename $i .aa`
if [ "$b" != bindist ] ; then
if [ "$b" = des ] ; then
# We cannot replace /sbin/init while it runs
# so move it out of the way for now
mv /sbin/init /sbin/non_des_init
fi
echo "Extracting $b"
cat $b.?? | gzip -c -d | ( cd $DDIR; cpio -H tar -imdu )
fi
done

View file

@ -1,4 +1,4 @@
# $Id: fixit_crunch.conf,v 1.2 1995/04/12 08:00:24 phk Exp $
# $Id: fixit_crunch.conf,v 1.3.4.7 1995/10/05 09:27:06 jkh Exp $
# first, we list the source dirs that our programs reside in. These are
# searched in order listed to find the dir containing each program.
@ -14,34 +14,28 @@ srcdirs /usr/src/sbin/i386
# /bin stuff
progs cat chmod chroot cp date dd df echo ed expr hostname kill ln ls mkdir
progs mt mv pwd rcp rm rmdir sh sleep stty sync test
progs mt mv pwd rcp rm rmdir sleep stty sync test
ln test [
ln sh -sh # init invokes the shell this way
# /sbin stuff
progs bad144 badsect chown clri disklabel dump dmesg fdisk fsck ifconfig init
progs mknod mount newfs ping reboot restore swapon umount
progs badsect chown clri disklabel dump dmesg fdisk
progs mknod mount newfs ping reboot restore scsi swapon umount
progs mount_msdos mount_cd9660 mount_nfs
ln dump rdump
ln restore rrestore
ln newfs mount_mfs
# /usr/bin stuff
progs ftp rsh sed telnet rlogin common find
progs ftp rsh sed telnet rlogin common find grep
ln common vi
ln common view
ln common ex
# gnu stuff
progs cpio gzip
ln gzip gunzip
ln gzip gzcat
# finally, we specify the libraries to link in with our binary
libs -lcrypt -ltelnet -lutil -ll
libs -lcurses -ltermcap -ledit -lkvm
libs -lcurses -ltermcap -ledit -lgnuregex -lkvm -lscsi

View file

@ -1,10 +1,10 @@
# $Id: boot_crunch.conf,v 1.19.2.1 1995/06/04 11:52:44 jkh Exp $
# $Id: boot_crunch.conf,v 1.20.2.3 1995/10/05 08:58:19 jkh Exp $
srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin
srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/i386
progs sh find
progs ft ppp
progs pwd ft ppp
progs sysinstall newfs gzip cpio bad144 fsck ifconfig route slattach
progs mount_nfs
ln gzip gunzip

View file

@ -1,565 +0,0 @@
#!/stand/sh
#
# instdist - Install a distribution from some sort of media.
#
# Written: November 11th, 1994
# Copyright (C) 1994 by Jordan K. Hubbard
#
# Permission to copy or use this software for any purpose is granted
# provided that this message stay intact, and at this location (e.g. no
# putting your name on top after doing something trivial like reindenting
# it, just to make it look like you wrote it!).
#
# $Id: instdist.sh,v 1.50 1995/01/09 14:41:13 jkh Exp $
if [ "${_INSTINST_SH_LOADED_}" = "yes" ]; then
return 0
else
_INSTINST_SH_LOADED_=yes
fi
# Grab the miscellaneous functions.
. /stand/miscfuncs.sh
# Set the initial state for media installation.
media_set_defaults()
{
MEDIA_TYPE=""
MEDIA_DEVICE=""
MEDIA_DISTRIBUTIONS=""
DISTRIB_SUBDIR=""
TMPDIR=""
FTP_PATH=""
NFS_PATH=""
}
# Set the installation media to undefined.
media_reset()
{
MEDIA_DEVICE=""
MEDIA_TYPE=""
MEDIA_DISTRIBUTIONS=""
FTP_PATH=""
NFS_PATH=""
NFS_OPTIONS=""
}
# Set the location of our temporary unpacking directory.
media_set_tmpdir()
{
if [ "X${TMPDIR}" != "X" ]; then
return
fi
TITLE="Choose temporary directory"
TMPDIR="/usr/tmp"
DEFAULT_VALUE="${TMPDIR}"
if ! input \
"Please specify the name of a directory containing enough free
space to hold the temporary files for this distribution. At
minimum, a binary distribution will require around 21MB of
temporary space. At maximum, a srcdist may take 30MB or more.
If the directory you specify does not exist, it will be created
for you. If you do not have enough free space to hold both the
packed and unpacked distribution files, consider using the NFS
or CDROM installation methods as they require no temporary
storage."; then return 1; fi
TMPDIR=${ANSWER}
mkdir -p ${TMPDIR}
return 0
}
media_cd_tmpdir()
{
if ! cd ${TMPDIR} > /dev/ttyv1 2>&1; then
error "No such file or directory for ${TMPDIR}, sorry! Please fix this and try again."
return 1
fi
}
media_rm_tmpdir()
{
cd /
if [ "X${NO_ASK_REMOVE}" != "X" ]; then
rm -rf ${_TARGET}
return
fi
if [ -d ${TMPDIR}/${MEDIA_DISTRIBUTION} ]; then
_TARGET=${TMPDIR}/${MEDIA_DISTRIBUTION}
else
_TARGET=${TMPDIR}
fi
if dialog --title "Delete contents?" --yesno \
"Do you wish to delete ${_TARGET}?" -1 -1; then
rm -rf ${_TARGET}
if dialog --title "Future Confirmation?" --yesno \
"Do you wish to suppress this dialog in the future?" -1 -1;
then
NO_ASK_REMOVE=yes
fi
fi
}
media_select_ftp_site()
{
dialog --title "Please specify an ftp site" --menu \
"FreeBSD is distributed from a number of sites on the Internet.\n\
Please select the site closest to you or \"other\" if you'd like\n\
to specify another choice. Also note that not all sites carry\n\
every possible distribution! Distributions other than the basic\n\
binary set are only guaranteed to be available from the Primary site.\n\
If the first site selected doesn't respond, try one of the alternates.\n\
Please use arrow keys to scroll through all items." \
-1 -1 5 \
"Primary" "ftp.freebsd.org" \
"Secondary" "freefall.cdrom.com" \
"Australia" "ftp.physics.usyd.edu.au" \
"Finland" "nic.funet.fi" \
"France" "ftp.ibp.fr" \
"Germany" "ftp.uni-duisburg.de" \
"Israel" "orgchem.weizmann.ac.il" \
"Japan" "ftp.sra.co.jp" \
"Japan-2" "ftp.mei.co.jp" \
"Japan-3" "ftp.waseda.ac.jp" \
"Japan-4" "ftp.pu-toyama.ac.jp" \
"Japan-5" "ftpsv1.u-aizu.ac.jp" \
"Japan-6" "tutserver.tutcc.tut.ac.jp" \
"Japan-7" "ftp.ee.uec.ac.jp" \
"Korea" "ftp.cau.ac.kr" \
"Netherlands" "ftp.nl.net" \
"Russia" "ftp.kiae.su" \
"Taiwan" "netbsd.csie.nctu.edu.tw" \
"Thailand" "ftp.nectec.or.th" \
"UK" "ftp.demon.co.uk" \
"UK-2" "src.doc.ic.ac.uk" \
"UK-3" "unix.hensa.ac.uk" \
"USA" "ref.tfs.com" \
"USA-2" "ftp.dataplex.net" \
"USA-3" "kryten.atinc.com" \
"USA-4" "ftp.neosoft.com" \
"other" "None of the above. I want to specify my own." \
2> ${TMP}/menu.tmp.$$
RETVAL=$?
ANSWER=`cat ${TMP}/menu.tmp.$$`
rm -f ${TMP}/menu.tmp.$$
if ! handle_rval ${RETVAL}; then return 1; fi
case ${ANSWER} in
Primary) FTP_PATH="ftp://ftp.freebsd.org/pub/FreeBSD/${DISTNAME}" ;;
Secondary) FTP_PATH="ftp://freefall.cdrom.com/pub/FreeBSD/${DISTNAME}" ;;
Australia) FTP_PATH="ftp://ftp.physics.usyd.edu.au/FreeBSD/${DISTNAME}" ;;
Finland) FTP_PATH="ftp://nic.funet.fi/pub/unix/FreeBSD/${DISTNAME}" ;;
France) FTP_PATH="ftp://ftp.ibp.fr/pub/FreeBSD/${DISTNAME}" ;;
Germany) FTP_PATH="ftp://ftp.uni-duisburg.de/pub/unix/FreeBSD/${DISTNAME}" ;;
Israel) FTP_PATH="ftp://orgchem.weizmann.ac.il/pub/FreeBSD-${DISTNAME}" ;;
Japan) FTP_PATH="ftp://ftp.sra.co.jp/pub/os/FreeBSD/distribution/${DISTNAME}" ;;
Japan-2) FTP_PATH="ftp://ftp.mei.co.jp/free/PC-UNIX/FreeBSD/${DISTNAME}" ;;
Japan-3) FTP_PATH="ftp://ftp.waseda.ac.jp/pub/FreeBSD/${DISTNAME}" ;;
Japan-4) FTP_PATH="ftp://ftp.pu-toyama.ac.jp/pub/FreeBSD/${DISTNAME}" ;;
Japan-5) FTP_PATH="ftp://ftpsv1.u-aizu.ac.jp/pub/os/FreeBSD/${DISTNAME}" ;;
Japan-6) FTP_PATH="ftp://tutserver.tutcc.tut.ac.jp/FreeBSD/FreeBSD-${DISTNAME}" ;;
Japan-7) FTP_PATH="ftp://ftp.ee.uec.ac.jp/pub/os/FreeBSD.other/FreeBSD-${DISTNAME}" ;;
Korea) FTP_PATH="ftp://ftp.cau.ac.kr/pub/FreeBSD/${DISTNAME}" ;;
Netherlands) FTP_PATH="ftp://ftp.nl.net/pub/os/FreeBSD/${DISTNAME}" ;;
Russia) FTP_PATH="ftp://ftp.kiae.su/FreeBSD/${DISTNAME}" ;;
Taiwan) FTP_PATH="ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD/${DISTNAME}" ;;
Thailand) FTP_PATH="ftp://ftp.nectec.or.th/pub/FreeBSD/${DISTNAME}" ;;
UK) FTP_PATH="ftp://ftp.demon.co.uk/pub/BSD/FreeBSD/${DISTNAME}" ;;
UK-2) FTP_PATH="ftp://src.doc.ic.ac.uk/packages/unix/FreeBSD/${DISTNAME}" ;;
UK-3) FTP_PATH="ftp://unix.hensa.ac.uk/pub/walnut.creek/FreeBSD/${DISTNAME}" ;;
USA) FTP_PATH="ftp://ref.tfs.com/pub/FreeBSD/${DISTNAME}" ;;
USA-2) FTP_PATH="ftp://ftp.dataplex.net/pub/FreeBSD/${DISTNAME}" ;;
USA-3) FTP_PATH="ftp://kryten.atinc.com/pub/FreeBSD/${DISTNAME}" ;;
USA-4) FTP_PATH="ftp://ftp.neosoft.com/systems/FreeBSD/${DISTNAME}" ;;
other)
TITLE="FTP Installation Information"
DEFAULT_VALUE="${FTP_PATH}"
if ! input \
"Please specify the machine and parent directory location of the
distribution you wish to load. This should be either a \"URL style\"
specification (e.g. ftp://ftp.freeBSD.org/pub/FreeBSD/) or simply
the name of a host to connect to. If only a host name is specified,
the installation assumes that you will properly connect and \"mget\"
the files yourself."; then return 1; fi
FTP_PATH=${ANSWER}
;;
esac
}
media_extract_dist()
{
if [ ! -f do_cksum.sh ]; then
if [ -f ${MEDIA_DISTRIBUTION}/do_cksum.sh ]; then
cd ${MEDIA_DISTRIBUTION}
fi
fi
if [ -f do_cksum.sh ]; then
message "Verifying checksums for distribution. Please wait!"
if sh ./do_cksum.sh; then
if [ -f extract.sh ]; then
message "Extracting ${MEDIA_DISTRIBUTION} distribution. Please wait!"
if [ -f ./is_interactive ]; then
sh ./extract.sh
else
sh ./extract.sh < /dev/ttyv1 > /dev/ttyv1 2>&1
fi
dialog --title "Extraction Complete" --msgbox "Please press return to continue" -1 -1
else
error "No installation script found!"
fi
else
error "Checksum error(s) found. Please check media!"
fi
else
error "Improper distribution. No checksum script found!"
media_reset
fi
}
media_install_set()
{
# check to see if we already have it
if [ -f ${TMPDIR}/${MEDIA_DISTRIBUTION}/extract.sh ]; then
cd ${TMPDIR}/${MEDIA_DISTRIBUTION}
media_extract_dist
cd /
return
fi
case ${MEDIA_TYPE} in
cdrom|nfs|ufs|doshd)
if ! cd ${MEDIA_DEVICE}/${MEDIA_DISTRIBUTION} > /dev/ttyv1 2>&1; then
error "Unable to cd to ${MEDIA_DEVICE}/${MEDIA_DISTRIBUTION} directory."
media_reset
else
media_extract_dist
cd /
fi
return
;;
tape)
if ! media_set_tmpdir; then return; fi
if ! media_cd_tmpdir; then return; fi
if dialog --title "Please mount tape for ${MEDIA_DEVICE}." \
--yesno "Please enter the next tape and select\n<Yes> to continue or <No> if finished" -1 -1; then
message "Loading distribution from ${MEDIA_DEVICE}.\nUse ALT-F2 to see output, ALT-F1 to return."
if [ "${MEDIA_DEVICE}" = "ftape" ]; then
progress "${FT_CMD} | ${TAR_CMD} ${TAR_FLAGS} -"
${FT_CMD} | ${TAR_CMD} ${TAR_FLAGS} - > /dev/ttyv1 2>&1
else
progress "${TAR_CMD} ${TAR_FLAGS} ${MEDIA_DEVICE}"
${TAR_CMD} ${TAR_FLAGS} ${MEDIA_DEVICE} > /dev/ttyv1 2>&1
fi
fi
if [ -d ${MEDIA_DISTRIBUTION} ]; then cd ${MEDIA_DISTRIBUTION}; fi
media_extract_dist
media_rm_tmpdir
;;
dosfd)
if ! media_set_tmpdir; then return; fi
if ! media_cd_tmpdir; then return; fi
COPYING="yes"
progress "Preparing to extract from DOS floppies"
while [ "${COPYING}" = "yes" ]; do
progress "Asking for DOS diskette"
if dialog --title "Insert distribution diskette" \
--yesno "Please enter the next diskette and select\n<Yes> to continue or <No> if finished" -1 -1; then
umount ${MNT} > /dev/null 2>&1
if ! mount_msdos -o ro ${MEDIA_DEVICE} ${MNT}; then
error "Unable to mount floppy! Please correct."
else
message "Loading distribution from ${MEDIA_DEVICE}.\nUse ALT-F2 to see output, ALT-F1 to return."
( ${TAR_CMD} -cf - -C ${MNT} . | ${TAR_CMD} -xvf - ) >/dev/ttyv1 2>&1
umount ${MNT}
fi
else
COPYING="no"
fi
done
media_extract_dist
media_rm_tmpdir
return
;;
ftp)
if ! media_set_tmpdir; then return; fi
if ! media_cd_tmpdir; then return; fi
if ! echo ${MEDIA_DEVICE} | grep -q -v 'ftp://'; then
message "Fetching distribution using ncftp.\nUse ALT-F2 to see output, ALT-F1 to return."
mkdir -p ${MEDIA_DISTRIBUTION}
if ! ncftp ${MEDIA_DEVICE}/${MEDIA_DISTRIBUTION}/* < /dev/null > /dev/ttyv1 2>&1; then
error "Couldn't fetch ${MEDIA_DISTRIBUTION} distribution from\n${MEDIA_DEVICE}!"
else
media_extract_dist
fi
else
dialog --clear
ftp ${MEDIA_DEVICE}
dialog --clear
media_extract_dist
fi
media_rm_tmpdir
return
;;
esac
}
media_select_distribution()
{
MEDIA_DISTRIBUTIONS=""
while [ "${MEDIA_DISTRIBUTIONS}" = "" ]; do
dialog --title "Please specify a distribution to load" \
--checklist \
"FreeBSD is separated into a number of distributions for ease of\n\
installation. With repeated passes through this screen, you'll be\n\
given the chance to load one or all of them. Mandatory distributions\n\
MUST be loaded! Please also note that the secrdist is NOT FOR EXPORT\n\
from the U.S. Please don't endanger U.S. ftp sites by getting it\n\
illegally, thanks! When finished, select <Cancel>." \
-1 -1 10 \
"?diskfree" "How much disk space do I have free?" OFF \
"bindist" "Binary base files (mandatory - ${BINSIZE})" ON \
"games" "Games and other frivolities (optional - ${GAMESIZE})" OFF \
"manpages" "Manual pages (optional - ${MANSIZE})" OFF \
"proflibs" "Profiled libraries (optional - ${PROFSIZE})" OFF \
"dict" "Spelling checker dictionary files (optional - ${DICTSIZE})" OFF \
"srcdist" "Sources for everything but DES (optional - ${SRCSIZE})" OFF \
"secrdist" "DES encryption code (and sources) (optional - ${SECRSIZE})" OFF \
"compat1xdist" "FreeBSD 1.x binary compatability (optional - ${COMPATSIZE})" OFF \
"XFree86-3.1" "The XFree86 3.1 distribution (optional - ${X11SIZE})" OFF \
2> ${TMP}/menu.tmp.$$
RETVAL=$?
MEDIA_DISTRIBUTIONS=`cat ${TMP}/menu.tmp.$$`
rm -f ${TMP}/menu.tmp.$$
if ! handle_rval ${RETVAL}; then return 1; fi
if [ "${MEDIA_DISTRIBUTIONS}" = "?diskfree" ]; then
if df -k > ${TMP}/df.out; then
dialog --title "How much free space do I have?" \
--textbox ${TMP}/df.out 15 76
else
error "Couldn't get disk usage information! :-("
fi
MEDIA_DISTRIBUTIONS=""
fi
done
}
media_get_possible_subdir()
{
if [ -f ${MNT}/${MEDIA_DISTRIBUTION}/extract.sh ]; then return; fi
DEFAULT_VALUE="${DISTRIB_SUBDIR}"
TITLE="Distribution Subdirectory"
if input \
"If the distributions are in a subdirectory of the mount point,
please enter it here (no leading slash - it should be relative
to the mount point). The directory you enter should be the
*parent* directory of any distribution subdirectories."; then
if [ "${ANSWER}" != "" ]; then
MEDIA_DEVICE=${MEDIA_DEVICE}/${ANSWER}
DISTRIB_SUBDIR=${ANSWER}
fi
else
return 1
fi
}
# Get values into $MEDIA_TYPE and $MEDIA_DEVICE. Call network initialization
# if necessary.
media_chose()
{
while [ "${MEDIA_DEVICE}" = "" ]; do
dialog --title "Installation From" \
--menu \
"Before installing a distribution, you need to chose and/or configure\n\
a method of installation. Please pick from one of the following options.\n\
If none of the listed options works for you, then your best bet may be to\n\
simply press ESC twice to get a subshell and proceed manually on your own.\n\
If you are already finished with the installation process, select cancel\n\
to proceed." -1 -1 7 \
"?Kern" "Please show me the kernel boot messages again!" \
"Tape" "Load distribution from SCSI, QIC-02 or floppy tape" \
"CDROM" "Load distribution from SCSI or Mitsumi CDROM" \
"DOS" "Load from DOS floppies or a DOS hard disk partition" \
"FTP" "Load distribution using FTP" \
"UFS" "Load the distribution from existing UFS partition" \
"NFS" "Load the distribution over NFS" 2> ${TMP}/menu.tmp.$$
RETVAL=$?
CHOICE=`cat ${TMP}/menu.tmp.$$`
rm -f ${TMP}/menu.tmp.$$
if ! handle_rval ${RETVAL}; then return 1; fi
case ${CHOICE} in
?Kern)
if dmesg > ${TMP}/dmesg.out; then
dialog --title "Kernel boot message output" \
--textbox ${TMP}/dmesg.out 22 76
else
error "Couldn't get dmesg information! :-("
fi
;;
Tape)
dialog --title "Choose Tape Type" --menu \
"Which type of tape drive do you have attached to your \n\
system? FreeBSD supports the following types:\n" -1 -1 3 \
"SCSI" "SCSI tape drive attached to supported SCSI controller" \
"QIC-02" "QIC-02 tape drive (Colorado Jumbo, etc)" \
"floppy" "Floppy tape drive (QIC-40/QIC-80)" 2> ${TMP}/menu.tmp.$$
RETVAL=$?
CHOICE=`cat ${TMP}/menu.tmp.$$`
rm -f ${TMP}/menu.tmp.$$
if ! handle_rval ${RETVAL}; then continue; fi
MEDIA_TYPE=tape;
case ${CHOICE} in
SCSI)
DEFAULT_VALUE="/dev/rst0"
TITLE="SCSI Tape Device"
if input \
"If you only have one tape drive, simply press return - the
default value should be correct. Otherwise, enter the
correct value and press return."; then
MEDIA_DEVICE=${ANSWER}
fi
;;
QIC-02)
DEFAULT_VALUE="/dev/rwt0"
TITLE="QIC-02 Tape Device"
if input \
"If you only have one tape drive, simply press return - the
default value should be correct. Otherwise, enter the
correct value and press return."; then
MEDIA_DEVICE=${ANSWER}
fi
;;
floppy)
MEDIA_DEVICE=ftape
;;
esac
;;
CDROM)
dialog --title "Choose CDROM Type" --menu \
"Which type of CDROM drive do you have attached to your \n\
system? FreeBSD supports the following types:\n" -1 -1 2 \
"SCSI" "SCSI CDROM drive attached to supported SCSI controller" \
"Mitsumi" "Mitsumi CDROM drive" \
2> ${TMP}/menu.tmp.$$
RETVAL=$?
CHOICE=`cat ${TMP}/menu.tmp.$$`
rm -f ${TMP}/menu.tmp.$$
if ! handle_rval ${RETVAL}; then continue; fi
MEDIA_TYPE=cdrom;
case ${CHOICE} in
SCSI)
MEDIA_DEVICE=/dev/cd0a
;;
Mitsumi)
MEDIA_DEVICE=/dev/mcd0a
;;
esac
umount ${MNT} > /dev/null 2>&1
if ! mount_cd9660 ${MEDIA_DEVICE} ${MNT} > /dev/ttyv1 2>&1; then
error "Unable to mount ${MEDIA_DEVICE} on ${MNT}"
MEDIA_DEVICE=""
else
MEDIA_DEVICE=${MNT}
media_get_possible_subdir
return 0
fi
;;
DOS)
DEFAULT_VALUE="/dev/fd0"
if input \
"Please specify the device pointing at your DOS partition or
floppy media. For a hard disk, this might be something like
/dev/wd0h or /dev/sd0h (as identified in the disklabel editor).
For the "A" floppy drive, it's /dev/fd0, for the "B" floppy
drive it's /dev/fd1\n"; then
MEDIA_DEVICE=${ANSWER}
if echo ${MEDIA_DEVICE} | grep -q -v fd; then
umount ${MNT} > /dev/null 2>&1
if ! mount_msdos ${MEDIA_DEVICE} ${MNT} > /dev/ttyv1 2>&1; then
error "Unable to mount ${MEDIA_DEVICE}"
MEDIA_DEVICE=""
else
MEDIA_TYPE=doshd
MEDIA_DEVICE=${MNT}
media_get_possible_subdir
return 0
fi
else
MEDIA_TYPE=dosfd
return 0
fi
fi
;;
FTP)
if ! network_setup; then continue; fi
if media_select_ftp_site; then
MEDIA_TYPE=ftp
MEDIA_DEVICE=${FTP_PATH}
return 0
fi
;;
NFS)
if ! network_setup; then continue; fi
TITLE="NFS Installation Information"
DEFAULT_VALUE="${NFS_PATH}"
if ! input \
"Please specify a machine and directory mount point for the
distribution you wish to load. This must be in machine:dir
format (e.g. zooey:/a/FreeBSD/${DISTNAME}). The remote
directory *must* be be exported to your machine (or globally)
for this to work!\n"; then continue; fi
NFS_PATH=${ANSWER}
DEFAULT_VALUE="${NFS_OPTIONS}"
if input \
"Do you wish to specify any options to NFS? If you're installing
from a Sun 4.1.x system, you may wish to specify \`-o resvport' to send
NFS requests over a privileged port (use this if you get nasty
\`\`credential too weak'' errors from the server). When using a slow
ethernet card or network link, \`-o -r=1024,-w=1024' may also prove helpful.
Options, if any, should be separated by commas."; then
if [ "${ANSWER}" != "" ]; then
NFS_OPTIONS="${ANSWER}"
fi
fi
MEDIA_TYPE=nfs
umount ${MNT} > /dev/null 2>&1
if ! mount_nfs ${NFS_OPTIONS} ${NFS_PATH} ${MNT} > /dev/ttyv1 2>&1; then
error "Unable to mount ${NFS_PATH}"
else
message "${NFS_PATH} mounted successfully"
MEDIA_DEVICE=${MNT}
media_get_possible_subdir
return 0
fi
;;
UFS)
dialog --title "User Intervention Requested" --msgbox "
Please mount the filesystem you wish to use somewhere convenient and
exit the shell when you're through. I'll ask you for the location
of the distribution's parent directory when we come back." -1 -1
dialog --clear
/stand/sh
TITLE="Please enter directory"
DEFAULT_VALUE="${MNT}"
if input "Ok, now give me the full pathname of the parent directorys for the distribution(s)."; then
MEDIA_TYPE=ufs
MEDIA_DEVICE=${ANSWER}
return 0
fi
;;
esac
done
}

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: change.c,v 1.8.2.1 1995/06/05 02:24:20 jkh Exp $
* $Id: change.c,v 1.9.2.1 1995/09/20 10:43:01 jkh Exp $
*
*/
@ -46,7 +46,7 @@ Set_Bios_Geom(struct disk *disk, u_long cyl, u_long hd, u_long sect)
}
void
All_FreeBSD(struct disk *d)
All_FreeBSD(struct disk *d, int force_all)
{
struct chunk *c;
@ -57,5 +57,6 @@ All_FreeBSD(struct disk *d)
goto again;
}
c=d->chunks;
Create_Chunk(d,c->offset,c->size,freebsd,0xa5,0);
Create_Chunk(d,c->offset,c->size,freebsd,0xa5,
force_all? CHUNK_FORCE_ALL: 0);
}

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: create_chunk.c,v 1.20.2.1 1995/05/31 23:53:45 jkh Exp $
* $Id: create_chunk.c,v 1.21.2.6 1995/11/18 10:02:10 jkh Exp $
*
*/
@ -15,6 +15,8 @@
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/disklabel.h>
#include <sys/diskslice.h>
@ -23,275 +25,335 @@
#include <err.h>
#include "libdisk.h"
/* Clone these two from sysinstall because we need our own copies
* due to link order problems with `crunch'. Feh!
*/
static int
isDebug()
{
static int debug = 0; /* Allow debugger to tweak it */
return debug;
}
/* Write something to the debugging port */
static void
msgDebug(char *fmt, ...)
{
va_list args;
char *dbg;
static int DebugFD = -1;
if (DebugFD == -1)
DebugFD = open("/dev/ttyv1", O_RDWR);
dbg = (char *)alloca(FILENAME_MAX);
strcpy(dbg, "DEBUG: ");
va_start(args, fmt);
vsnprintf((char *)(dbg + strlen(dbg)), FILENAME_MAX, fmt, args);
va_end(args);
write(DebugFD, dbg, strlen(dbg));
}
void
Fixup_FreeBSD_Names(struct disk *d, struct chunk *c)
{
struct chunk *c1, *c3;
int j;
if (!strcmp(c->name, "X")) return;
/* reset all names to "X" */
for (c1 = c->part; c1 ; c1 = c1->next) {
c1->oname = c1->name;
c1->name = malloc(12);
if(!c1->name) err(1,"Malloc failed");
strcpy(c1->name,"X");
}
/* Allocate the first swap-partition we find */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
if (c1->subtype != FS_SWAP) continue;
sprintf(c1->name,"%s%c",c->name,SWAP_PART+'a');
break;
}
/* Allocate the first root-partition we find */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
if (!(c1->flags & CHUNK_IS_ROOT)) continue;
sprintf(c1->name,"%s%c",c->name,0+'a');
break;
}
/* Try to give them the same as they had before */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (strcmp(c1->name,"X")) continue;
for(c3 = c->part; c3 ; c3 = c3->next)
if (c1 != c3 && !strcmp(c3->name, c1->oname)) {
goto newname;
}
strcpy(c1->name,c1->oname);
newname:
}
/* Allocate the rest sequentially */
for (c1 = c->part; c1 ; c1 = c1->next) {
const char order[] = "efghabd";
if (c1->type == unused) continue;
if (strcmp("X",c1->name)) continue;
for(j=0;j<strlen(order);j++) {
sprintf(c1->name,"%s%c",c->name,order[j]);
for(c3 = c->part; c3 ; c3 = c3->next)
if (c1 != c3 && !strcmp(c3->name, c1->name))
goto match;
break;
match:
strcpy(c1->name,"X");
continue;
}
}
for (c1 = c->part; c1 ; c1 = c1->next) {
free(c1->oname);
c1->oname = 0;
struct chunk *c1, *c3;
int j;
if (!strcmp(c->name, "X")) return;
/* reset all names to "X" */
for (c1 = c->part; c1 ; c1 = c1->next) {
c1->oname = c1->name;
c1->name = malloc(12);
if(!c1->name) err(1,"Malloc failed");
strcpy(c1->name,"X");
}
/* Allocate the first swap-partition we find */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
if (c1->subtype != FS_SWAP) continue;
sprintf(c1->name,"%s%c",c->name,SWAP_PART+'a');
break;
}
/* Allocate the first root-partition we find */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
if (!(c1->flags & CHUNK_IS_ROOT)) continue;
sprintf(c1->name,"%s%c",c->name,0+'a');
break;
}
/* Try to give them the same as they had before */
for (c1 = c->part; c1 ; c1 = c1->next) {
if (strcmp(c1->name,"X")) continue;
for(c3 = c->part; c3 ; c3 = c3->next)
if (c1 != c3 && !strcmp(c3->name, c1->oname)) {
goto newname;
}
strcpy(c1->name,c1->oname);
newname:
}
/* Allocate the rest sequentially */
for (c1 = c->part; c1 ; c1 = c1->next) {
const char order[] = "efghabd";
if (c1->type == unused) continue;
if (strcmp("X",c1->name)) continue;
for(j=0;j<strlen(order);j++) {
sprintf(c1->name,"%s%c",c->name,order[j]);
for(c3 = c->part; c3 ; c3 = c3->next)
if (c1 != c3 && !strcmp(c3->name, c1->name))
goto match;
break;
match:
strcpy(c1->name,"X");
continue;
}
}
for (c1 = c->part; c1 ; c1 = c1->next) {
free(c1->oname);
c1->oname = 0;
}
}
void
Fixup_Extended_Names(struct disk *d, struct chunk *c)
{
struct chunk *c1;
int j=5;
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
free(c1->name);
c1->name = malloc(12);
if(!c1->name) err(1,"malloc failed");
sprintf(c1->name,"%ss%d",d->chunks->name,j++);
if (c1->type == freebsd)
Fixup_FreeBSD_Names(d,c1);
}
struct chunk *c1;
int j=5;
for (c1 = c->part; c1 ; c1 = c1->next) {
if (c1->type == unused) continue;
free(c1->name);
c1->name = malloc(12);
if(!c1->name) err(1,"malloc failed");
sprintf(c1->name,"%ss%d",d->chunks->name,j++);
if (c1->type == freebsd)
Fixup_FreeBSD_Names(d,c1);
}
}
void
Fixup_Names(struct disk *d)
{
struct chunk *c1, *c2, *c3;
int i,j;
c1 = d->chunks;
for(i=1,c2 = c1->part; c2 ; c2 = c2->next) {
c2->flags &= ~CHUNK_BSD_COMPAT;
if (c2->type == unused)
continue;
if (strcmp(c2->name,"X"))
continue;
c2->oname = malloc(12);
if(!c2->oname) err(1,"malloc failed");
for(j=1;j<=NDOSPART;j++) {
sprintf(c2->oname,"%ss%d",c1->name,j);
for(c3 = c1->part; c3 ; c3 = c3->next)
if (c3 != c2 && !strcmp(c3->name, c2->oname))
goto match;
free(c2->name);
c2->name = c2->oname;
c2->oname = 0;
break;
match:
continue;
}
if (c2->oname)
free(c2->oname);
struct chunk *c1, *c2, *c3;
int i,j;
c1 = d->chunks;
for(i=1,c2 = c1->part; c2 ; c2 = c2->next) {
c2->flags &= ~CHUNK_BSD_COMPAT;
if (c2->type == unused)
continue;
if (strcmp(c2->name,"X"))
continue;
c2->oname = malloc(12);
if(!c2->oname) err(1,"malloc failed");
for(j=1;j<=NDOSPART;j++) {
sprintf(c2->oname,"%ss%d",c1->name,j);
for(c3 = c1->part; c3 ; c3 = c3->next)
if (c3 != c2 && !strcmp(c3->name, c2->oname))
goto match;
free(c2->name);
c2->name = c2->oname;
c2->oname = 0;
break;
match:
continue;
}
for(c2 = c1->part; c2 ; c2 = c2->next) {
if (c2->type == freebsd) {
c2->flags |= CHUNK_BSD_COMPAT;
break;
}
}
for(c2 = c1->part; c2 ; c2 = c2->next) {
if (c2->type == freebsd)
Fixup_FreeBSD_Names(d,c2);
if (c2->type == extended)
Fixup_Extended_Names(d,c2);
if (c2->oname)
free(c2->oname);
}
for(c2 = c1->part; c2 ; c2 = c2->next) {
if (c2->type == freebsd) {
c2->flags |= CHUNK_BSD_COMPAT;
break;
}
}
for(c2 = c1->part; c2 ; c2 = c2->next) {
if (c2->type == freebsd)
Fixup_FreeBSD_Names(d,c2);
if (c2->type == extended)
Fixup_Extended_Names(d,c2);
}
}
int
Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, int subtype, u_long flags)
{
int i;
u_long l;
int i;
u_long l;
if(!(flags & CHUNK_FORCE_ALL))
{
/* Never use the first track */
if (!offset) {
offset += d->bios_sect;
size -= d->bios_sect;
offset += d->bios_sect;
size -= d->bios_sect;
}
/* Always end on cylinder boundary */
l = (offset+size) % (d->bios_sect * d->bios_hd);
size -= l;
i = Add_Chunk(d,offset,size,"X",type,subtype,flags);
Fixup_Names(d);
return i;
}
i = Add_Chunk(d,offset,size,"X",type,subtype,flags);
Fixup_Names(d);
return i;
}
struct chunk *
Create_Chunk_DWIM(struct disk *d, struct chunk *parent , u_long size, chunk_e type, int subtype, u_long flags)
{
int i;
struct chunk *c1;
u_long offset,edge;
if (!parent)
parent = d->chunks;
for (c1=parent->part; c1 ; c1 = c1->next) {
if (c1->type != unused) continue;
if (c1->size < size) continue;
offset = c1->offset;
goto found;
}
warn("Not enough unused space");
int i;
struct chunk *c1;
u_long offset,edge;
if (!parent)
parent = d->chunks;
for (c1=parent->part; c1 ; c1 = c1->next) {
if (c1->type != unused) continue;
if (c1->size < size) continue;
offset = c1->offset;
goto found;
}
warn("Not enough unused space");
return 0;
found:
if (parent->flags & CHUNK_BAD144) {
edge = c1->end - d->bios_sect - 127;
if (offset > edge)
return 0;
if (offset + size > edge)
size = edge - offset + 1;
}
i = Add_Chunk(d,offset,size,"X",type,subtype,flags);
if (i) {
warn("Didn't cut it");
return 0;
found:
if (parent->flags & CHUNK_BAD144) {
edge = c1->end - d->bios_sect - 127;
if (offset > edge)
return 0;
if (offset + size > edge)
size = edge - offset + 1;
}
i = Add_Chunk(d,offset,size,"X",type,subtype,flags);
if (i) {
warn("Didn't cut it");
return 0;
}
Fixup_Names(d);
for (c1=parent->part; c1 ; c1 = c1->next)
if (c1->offset == offset)
return c1;
err(1,"Serious internal trouble");
}
Fixup_Names(d);
for (c1=parent->part; c1 ; c1 = c1->next)
if (c1->offset == offset)
return c1;
err(1,"Serious internal trouble");
}
int
MakeDev(struct chunk *c1, char *path)
{
char *p = c1->name;
u_long cmaj,bmaj,min,unit,part,slice;
char buf[BUFSIZ],buf2[BUFSIZ];
char *p = c1->name;
u_long cmaj, bmaj, min, unit, part, slice;
char buf[BUFSIZ], buf2[BUFSIZ];
*buf2 = '\0';
if(!strcmp(p,"X"))
*buf2 = '\0';
if (isDebug())
msgDebug("MakeDev: Called with %s on path %s\n", p, path);
if (!strcmp(p, "X"))
return 0;
if (!strncmp(p, "wd", 2))
bmaj = 0, cmaj = 3;
else if (!strncmp(p, "sd", 2))
bmaj = 4, cmaj = 13;
else {
return 0;
}
p += 2;
if (!isdigit(*p)) {
msgDebug("MakeDev: Invalid disk unit passed: %s\n", p);
return 0;
}
unit = *p - '0';
p++;
if (!*p) {
slice = 1;
part = 2;
goto done;
}
else if (isdigit(*p)) {
unit *= 10;
unit += (*p - '0');
p++;
}
if (*p != 's') {
msgDebug("MakeDev: `%s' is not a valid slice delimiter\n", p);
return 0;
}
p++;
if (!isdigit(*p)) {
msgDebug("MakeDev: `%s' is an invalid slice number\n", p);
return 0;
}
slice = *p - '0';
p++;
if (isdigit(*p)) {
slice *= 10;
slice += (*p - '0');
p++;
}
slice = slice + 1;
if (!*p) {
part = 2;
if(c1->type == freebsd)
sprintf(buf2, "%sc", c1->name);
goto done;
}
if (*p < 'a' || *p > 'h') {
msgDebug("MakeDev: `%s' is not a valid partition name.\n", p);
return 0;
}
part = *p - 'a';
done:
if (isDebug())
msgDebug("MakeDev: Unit %d, Slice %d, Part %d\n", unit, slice, part);
if (unit > 32)
return 0;
if (slice > 32)
return 0;
min = unit * 8 + 65536 * slice + part;
sprintf(buf, "%s/r%s", path, c1->name);
unlink(buf);
if (mknod(buf, S_IFCHR|0640, makedev(cmaj,min)) == -1) {
msgDebug("mknod of %s returned failure status!\n", buf);
return 0;
}
if (*buf2) {
sprintf(buf, "%s/r%s", path, buf2);
unlink(buf);
if (mknod(buf, S_IFCHR|0640, makedev(cmaj,min)) == -1) {
msgDebug("mknod of %s returned failure status!\n", buf);
return 0;
if (p[0] == 'w' && p[1] == 'd') {
bmaj = 0; cmaj = 3;
} else if (p[0] == 's' && p[1] == 'd') {
bmaj = 4; cmaj = 13;
} else {
return 0;
}
p += 2;
if (!isdigit(*p))
return 0;
unit = *p - '0';
p++;
if (isdigit(*p)) {
unit *= 10;
unit = *p - '0';
p++;
}
if (!*p) {
slice = 1;
part = 2;
goto done;
}
if (*p != 's')
return 0;
p++;
if (!isdigit(*p))
return 0;
slice = *p - '0';
p++;
if (isdigit(*p)) {
slice *= 10;
slice = *p - '0';
p++;
}
slice = slice+1;
if (!*p) {
part = 2;
if(c1->type == freebsd)
sprintf(buf2,"%sc",c1->name);
goto done;
}
if (*p < 'a' || *p > 'h')
return 0;
part = *p - 'a';
done:
if (unit > 32)
return 0;
if (slice > 32)
return 0;
min = unit * 8 + 65536 * slice + part;
sprintf(buf,"%s/r%s",path,c1->name);
unlink(buf); mknod(buf,S_IFCHR|0640,makedev(cmaj,min));
if(*buf2) {
sprintf(buf,"%s/r%s",path,buf2);
unlink(buf); mknod(buf,S_IFCHR|0640,makedev(cmaj,min));
}
sprintf(buf,"%s/%s",path,c1->name);
unlink(buf); mknod(buf,S_IFBLK|0640,makedev(bmaj,min));
return 1;
}
sprintf(buf, "%s/%s", path, c1->name);
unlink(buf);
if (mknod(buf, S_IFBLK|0640, makedev(bmaj,min)) == -1) {
msgDebug("mknod of %s returned failure status!\n", buf);
return 0;
}
return 1;
}
void
MakeDevChunk(struct chunk *c1,char *path)
int
MakeDevChunk(struct chunk *c1, char *path)
{
MakeDev(c1,path);
if (c1->next) MakeDevChunk(c1->next,path);
if (c1->part) MakeDevChunk(c1->part,path);
int i;
i = MakeDev(c1, path);
if (c1->next)
MakeDevChunk(c1->next, path);
if (c1->part)
MakeDevChunk(c1->part, path);
return i;
}
void
MakeDevDisk(struct disk *d,char *path)
int
MakeDevDisk(struct disk *d, char *path)
{
MakeDevChunk(d->chunks,path);
return MakeDevChunk(d->chunks, path);
}

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: libdisk.h,v 1.18.2.2 1995/06/05 02:24:32 jkh Exp $
* $Id: libdisk.h,v 1.19.2.2 1995/10/13 08:19:12 jkh Exp $
*
*/
@ -74,6 +74,10 @@ struct chunk {
/* This 'part' is a rootfs, allocate 'a' */
# define CHUNK_ACTIVE 32
/* This is the active slice in the MBR */
# define CHUNK_FORCE_ALL 64
/* Force a dedicated disk for FreeBSD, bypassing
* all BIOS geometry considerations
*/
void (*private_free)(void*);
void *(*private_clone)(void*);
@ -138,8 +142,10 @@ Create_Chunk(struct disk *disk, u_long offset, u_long size, chunk_e type, int su
*/
void
All_FreeBSD(struct disk *d);
/* Make one FreeBSD chunk covering the entire disk
All_FreeBSD(struct disk *d, int force_all);
/* Make one FreeBSD chunk covering the entire disk;
* if force_all is set, bypass all BIOS geometry
* considerations.
*/
char *
@ -211,7 +217,10 @@ Create_Chunk_DWIM(struct disk *d, struct chunk *parent , u_long size, chunk_e ty
* enough is used.
*/
void
int
MakeDev(struct chunk *c, char *path);
int
MakeDevDisk(struct disk *d,char *path);
/* Make device nodes for all chunks on this disk */

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: tst01.c,v 1.14.2.1 1995/06/05 02:24:35 jkh Exp $
* $Id: tst01.c,v 1.15.2.1 1995/09/20 10:43:04 jkh Exp $
*
*/
@ -189,7 +189,11 @@ main(int argc, char **argv)
continue;
}
if (!strcasecmp(*cmds,"allfreebsd")) {
All_FreeBSD(d);
All_FreeBSD(d, 0);
continue;
}
if (!strcasecmp(*cmds,"dedicate")) {
All_FreeBSD(d, 1);
continue;
}
if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
@ -280,6 +284,7 @@ main(int argc, char **argv)
printf("\007ERROR\n");
printf("CMDS:\n");
printf("\tallfreebsd\n");
printf("\tdedicate\n");
printf("\tbios cyl hd sect\n");
printf("\tboot\n");
printf("\tbteasy17\n");

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: write_disk.c,v 1.14 1995/06/11 19:29:38 rgrimes Exp $
* $Id: write_disk.c,v 1.15 1995/08/26 04:57:03 davidg Exp $
*
*/
@ -79,11 +79,11 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
dl->d_secsize = 512;
dl->d_secperunit = new->chunks->size;
#if 0
dl->d_secpercyl = new->real_cyl ? new->real_cyl : new->bios_cyl;
dl->d_ncylinders = new->real_cyl ? new->real_cyl : new->bios_cyl;
dl->d_ntracks = new->real_hd ? new->real_hd : new->bios_hd;
dl->d_nsectors = new->real_sect ? new->real_sect : new->bios_sect;
#else
dl->d_secpercyl = new->bios_cyl;
dl->d_ncylinders = new->bios_cyl;
dl->d_ntracks = new->bios_hd;
dl->d_nsectors = new->bios_sect;
#endif

View file

@ -1,140 +0,0 @@
#!/stand/sh
#
# miscfuncs - miscellaneous functions for the other distribution scripts.
#
# Written: November 15th, 1994
# Copyright (C) 1994 by Jordan K. Hubbard
#
# Permission to copy or use this software for any purpose is granted
# provided that this message stay intact, and at this location (e.g. no
# putting your name on top after doing something trivial like reindenting
# it, just to make it look like you wrote it!).
#
# $Id: miscfuncs.sh,v 1.13 1994/12/23 05:11:18 jkh Exp $
if [ "${_MISCFUNCS_SH_LOADED_}" = "yes" ]; then
return 0
else
_MISCFUNCS_SH_LOADED_=yes
fi
PATH=/usr/bin:/usr/sbin:/bin:/sbin:/stand
export PATH
# Keep this current with the distribution!
DISTNAME="2.0-950112-SNAP"
# Express or Custom install?
INSTALL_TYPE=""
# Flagrant guesses for now. These need to be hand-edited or, much better yet,
# automatically done as part of the release process. When that's the case,
# the hardwired constants will be replaced with tokens that get sed'd for
# the real sizes.
#
BINSIZE="40MB"
GAMESIZE="8MB"
MANSIZE="8MB"
PROFSIZE="4MB"
DICTSIZE="2MB"
SRCSIZE="120MB"
SECRSIZE="4MB"
COMPATSIZE="3MB"
X11SIZE="50MB"
# Paths
ETC="/etc"
MNT="/mnt"
HOME=/; export HOME
TMP=/tmp
# Commands and flags
FT_CMD="ft"
TAR_CMD="tar"
TAR_FLAGS="--unlink -xvf"
IFCONFIG_CMD="ifconfig"
ROUTE_CMD="route"
ROUTE_FLAGS="add default"
HOSTNAME_CMD="hostname"
SLATTACH_CMD="slattach"
SLATTACH_FLAGS="-l -a -s"
PPPD_CMD="pppd"
PPPD_FLAGS="crtscts defaultroute -ip -mn netmask $netmask"
interrupt()
{
dialog --clear --title "User Interrupt Requested" \
--msgbox "\n ** Aborting the installation ** \n" -1 -1
exit 0;
}
# Handle the return value from a dialog, doing some pre-processing
# so that each client doesn't have to.
handle_rval()
{
case $1 in
0)
return 0
;;
255)
PS1="subshell# " /stand/sh
;;
*)
return 1
;;
esac
}
# stick a progress message out on the other vty
progress()
{
echo "Progress <$*>" > /dev/ttyv1
}
# A simple user-confirmation dialog.
confirm()
{
dialog --title "User Confirmation" --msgbox "$*" -1 -1
}
# A simple message box dialog.
message()
{
progress $*
dialog --title "Progress" --infobox "$*" -1 -1
}
# A simple error dialog.
error()
{
echo "ERROR <$*>" > /dev/ttyv1
dialog --title "Error!" --msgbox "$*" -1 -1
}
# Something isn't supported yet! :-(
not_supported()
{
echo "<Feature not supported>" > /dev/ttyv1
dialog --title "Sorry!" --msgbox \
"This feature is not supported in the current version of the
installation tools. Barring some sort of fatal accident, we do
expect it to be in a later release. Please press RETURN to go on." -1 -1
}
# Get a string from the user
input()
{
TITLE=${TITLE-"User Input Required"}
dialog --title "${TITLE}" \
--inputbox "$*" -1 -1 "${DEFAULT_VALUE}" 2> ${TMP}/inputbox.tmp.$$
if ! handle_rval $?; then rm -f ${TMP}/inputbox.tmp.$$; return 1; fi
ANSWER=`cat ${TMP}/inputbox.tmp.$$`
rm -f ${TMP}/inputbox.tmp.$$
}
# Ask a networking question
network_dialog()
{
TITLE="Network Configuration"
if ! input "$*"; then return 1; fi
}

View file

@ -1,25 +0,0 @@
#!/bin/sh
#
# mkchecksums.sh - generate interactive checksum-checking script.
# Jordan Hubbard
#
# This script generates a cksum.sh script from a set of tarballs
# and should not be run by anyone but the release coordinator (there
# wouldn't be much point).
#
# Jordan
# $Id: mkchecksums.sh,v 1.1 1994/11/17 15:20:04 jkh Exp $
#
# Remove any previous attempts.
rm -rf CKSUMS do_cksum.sh
# First generate the CKSUMS file for the benefit of those who wish to
# use it in some other way. If we find out that folks aren't even using
# it, we should consider eliminating it at some point. The interactive
# stuff makes it somewhat superfluous.
cksum * > CKSUMS
# Now generate a script for actually verifying the checksums.
awk 'BEGIN {print "rval=0"} { printf("if [ \"\`cksum %s%s%s\`\" != \"%s %s %s\" ]; then dialog --title Error --infobox \"Checksum error detected on %s!\" -1 -1; rval=1; fi\n", "\047", $3, "\047", $1, $2, $3, $3);} END {print "exit $rval"}' < CKSUMS > do_cksum.sh
chmod +x do_cksum.sh

View file

@ -1,60 +0,0 @@
#!/bin/sh
#
# mkextract - generate extract.sh
# Jordan Hubbard
#
# This script generates the extract.sh script from the current tarballs
# and should not be run by anyone but the release coordinator (there wouldn't
# be much point).
#
# Jordan
BASEDIR=/usr/X11R6
TARGETS=XFree86-3.1*
echo -n "Creating extract.sh.."
cat > extract.sh << DO_THE_FUNKY_CHICKEN
#!/bin/sh
#
# Don't edit me - I'm auto-generated by mkextract.sh!
#
if [ ! -f /usr/bin/tar ]; then
dialog --title "Error!" --msgbox "You must install the bindist before this distribution!" 6 72
exit 0
fi
dialog --title "XFree86 3.1 Installation" \
--msgbox "Welcome to the XFree86 3.1 installation! You'll be asked
a series of annoying yes/no questions for each component of the
XFree86 distribution you wish to install. If you're not sure
whether or not you need some component, simply answer yes and
delete it later if it turns out you don't need it. This is
a little rough, yes, but I'm working on it!
Comments on the XFree86 distribution to David Dawes
<dawes@FreeBSD.org>
Comments on this install to Jordan Hubbard
<jkh@FreeBSD.org>
Thanks!" 18 72
dialog --title "Read This First" --textbox README.FreeBSD 22 76
DO_THE_FUNKY_CHICKEN
for i in $TARGETS; do
abbrevname=`echo $i | sed -e 's/XFree86-3.1-//' -e 's/.tar.gz//'`
echo "if dialog --title \"Install Request\" --yesno \"Do you wish to install the ${abbrevname} distribution?\" 6 72; then dialog --title \"Progress\" --infobox \"Installing $i\" 6 72; tar --unlink -xvzf $i -C /usr > /dev/ttyv1 2>&1 ; fi" >> extract.sh
done
cat >> extract.sh << OH_YEAH_BABY_GET_DOWN
dialog --title "Finished!" \
--infobox "
You're now done with the installation of XFree86 3.1.
Now would probably be a very good time to look in ${BASEDIR}/lib/X11/doc
for further information on what to do next. XFree86 3.1 is now
installed in the ${BASEDIR} directory, unlike
earlier releases. For backwards compatibility, you might consider
a symlink to /usr/X386." 10 76
OH_YEAH_BABY_GET_DOWN
chmod 755 extract.sh
echo " Done."

View file

@ -1,61 +0,0 @@
#!/bin/sh
#
# mkextract - generate extract.sh
# Jordan Hubbard
#
# This script generates the extract.sh script from the current tarballs
# and should not be run by anyone but the release coordinator (there wouldn't
# be much point).
#
# Jordan
BASEDIR=/usr/X11R6
TARGETS=XFree86-3.1*
echo -n "Creating extract.sh.."
cat > extract.sh << DO_THE_FUNKY_CHICKEN
#!/bin/sh
#
# Don't edit me - I'm auto-generated by mkextract.sh!
#
if [ ! -f /usr/bin/tar ]; then
dialog --title "Error!" --msgbox "You must install the bindist before this distribution!" -1 -1
exit 0
fi
dialog --title "XFree86 3.1 Installation" \
--msgbox "Welcome to the XFree86 3.1 installation! You'll be asked
a series of annoying yes/no questions for each component of the
XFree86 distribution you wish to install. If you're not sure
whether or not you need some component, simply answer yes and
delete it later if it turns out you don't need it. This is
a little rough, yes, but I'm working on it!
Comments on the XFree86 distribution to David Dawes
<dawes@FreeBSD.org>
Comments on this install to Jordan Hubbard
<jkh@FreeBSD.org>
Thanks!" -1 -1
dialog --title "Read This First" --textbox README.FreeBSD 22 76
DO_THE_FUNKY_CHICKEN
for i in $TARGETS; do
abbrevname=`echo $i | sed -e 's/XFree86-3.1-//' -e 's/.tar.gz//'`
echo "if [ "${INSTALL_TYPE}" != "Express" ]; then if dialog --title \"Install Request\" --yesno \"Do you wish to install the ${abbrevname} distribution?\" -1 -1; then dialog --title \"Progress\" --infobox \"Installing $i\" -1 -1; tar --unlink -xzf $i -C /usr; fi; fi" >> extract.sh
done
cat >> extract.sh << OH_YEAH_BABY_GET_DOWN
dialog --title "Finished!" \
--infobox "
You're now done with the installation of XFree86 3.1.
Now would probably be a very good time to look in ${BASEDIR}/lib/X11/doc
for further information on what to do next. XFree86 3.1 is now
installed in the ${BASEDIR} directory, unlike
earlier releases. For backwards compatibility, you might consider
a symlink to /usr/X386." -1 -1
OH_YEAH_BABY_GET_DOWN
chmod 755 extract.sh
touch -f .is_interactive
echo " Done."

View file

@ -1,208 +0,0 @@
#!/stand/sh
#
# netinst.sh - configure the user's network.
#
# Written: November 11th, 1994
# Copyright (C) 1994 by Jordan K. Hubbard
#
# Permission to copy or use this software for any purpose is granted
# provided that this message stay intact, and at this location (e.g. no
# putting your name on top after doing something trivial like reindenting
# it, just to make it look like you wrote it!).
#
# $Id: netinst.sh,v 1.16 1994/12/05 00:13:11 ache Exp $
if [ "${_NETINST_SH_LOADED_}" = "yes" ]; then
return 0
else
_NETINST_SH_LOADED_=yes
fi
# Grab the miscellaneous functions.
. /stand/miscfuncs.sh
network_set_defaults()
{
HOSTNAME=""
DOMAIN=""
NETMASK="0xffffff00"
IPADDR="127.0.0.1"
IFCONFIG_FLAGS=""
REMOTE_HOSTIP=""
REMOTE_IPADDR=""
INTERFACE=""
SERIAL_INTERFACE="/dev/cuaa0"
SERIAL_SPEED="38400"
}
network_basic_setup()
{
HOSTNAME=""
while [ "${HOSTNAME}" = "" ]; do
DEFAULT_VALUE=""
if ! network_dialog "What is the fully qualified name of this host?"; then return 1; fi
if [ "${ANSWER}" = "" ]; then
error "You must select a host name!"
continue
else
HOSTNAME=${ANSWER}
fi
done
echo ${HOSTNAME} > ${ETC}/myname
${HOSTNAME_CMD} ${HOSTNAME}
DEFAULT_VALUE=`echo ${HOSTNAME} | sed -e 's/[^.]*\.//' | grep \.`
if network_dialog "What is the domain name of this host (Internet, not YP/NIS)?"; then
DOMAIN=${ANSWER}
fi
DEFAULT_VALUE=${IPADDR}
if ! network_dialog "What is the IP address of this host?"; then return 1; fi
IPADDR=${ANSWER}
echo "${IPADDR} ${HOSTNAME} `echo ${HOSTNAME} | sed -e 's/\.${DOMAIN}//'`" >> ${ETC}/hosts
}
network_setup_ether()
{
dialog --title "Ethernet Interface Name" --menu \
"Please select the type of ethernet interface you have:\n" -1 -1 8 \
"ed0" "WD80x3, SMC, Novell NE[21]000 or 3C503 generic NIC at 0x280" \
"ed1" "Same as above, but at address 0x300 and IRQ 5" \
"ep0" "3COM 3C509 at address 0x300 and IRQ 10" \
"de0" "DEC PCI ethernet adapter (or compatible)" \
"ie0" "AT&T StarLan and EN100 family at 0x360 and IRQ 7" \
"is0" "Isolan 4141-0 or Isolink 4110 at 0x280 and IRQ 7" \
"le0" "DEC Etherworks ethernet adapter" \
"ze0" "PCMCIA IBM or National card at 0x300 and IRQ 5" \
2> ${TMP}/menu.tmp.$$
RETVAL=$?
INTERFACE=`cat ${TMP}/menu.tmp.$$`
rm -f ${TMP}/menu.tmp.$$
if ! handle_rval ${RETVAL}; then return 1; fi
}
network_setup_remote()
{
DEFAULT_VALUE="${REMOTE_IPADDR}"
if ! network_dialog "What is the IP number for the remote host?"; then
return 1
fi
REMOTE_IPADDR=${ANSWER}
}
network_setup_serial()
{
network_setup_remote
INTERFACE=$1
DEFAULT_VALUE=${SERIAL_INTERFACE}
if ! network_dialog "What serial port do you wish to use?"; then
return 1
fi
SERIAL_INTERFACE=${ANSWER}
DEFAULT_VALUE=${SERIAL_SPEED}
if ! network_dialog "What speed is the serial connection?"; then
return 1
fi
SERIAL_SPEED=${ANSWER}
if dialog --title "Dial" --yesno \
"Do you need to dial the phone or otherwise talk to the modem?" \
-1 -1; then
mkdir -p /var/log
touch -f /var/log/aculog > /dev/null 2>&1
chmod 666 /var/log/aculog > /dev/null 2>&1
confirm \
"You may now dialog with your modem and set up the connection.
Be sure to disable DTR sensitivity (usually with AT&D0) or the
modem may hang up when you exit 'cu'. Use ~. to exit cu and
continue."
dialog --clear
# Grottyness to deal with a weird crunch bug.
if [ ! -f /stand/cu ]; then ln /stand/tip /stand/cu; fi
/stand/cu -l ${SERIAL_INTERFACE} -s ${SERIAL_SPEED}
dialog --clear
fi
}
network_setup_plip()
{
network_setup_remote
INTERFACE=lp0
}
network_setup()
{
DONE=0
while [ "${INTERFACE}" = "" ]; do
dialog --title "Set up network interface" --menu \
"Please select the type of network connection you have:\n" \
-1 -1 3 \
"Ether" "A supported ethernet card" \
"SLIP" "A point-to-point SLIP (Serial Line IP) connection" \
"PLIP" "A Parallel-Line IP setup (with standard laplink cable)" \
2> ${TMP}/menu.tmp.$$
RETVAL=$?
CHOICE=`cat ${TMP}/menu.tmp.$$`
rm -f ${TMP}/menu.tmp.$$
if ! handle_rval ${RETVAL}; then return 1; fi
case ${CHOICE} in
Ether) if ! network_setup_ether; then continue; fi ;;
SLIP) if ! network_setup_serial sl0; then continue; fi ;;
PLIP) if ! network_setup_plip; then continue; fi ;;
esac
if [ "${INTERFACE}" = "" ]; then continue; fi
network_basic_setup
DEFAULT_VALUE="${NETMASK}"
if network_dialog "Please specify the netmask"; then
if [ "${ANSWER}" != "" ]; then
NETMASK=${ANSWER}
fi
fi
DEFAULT_VALUE=""
if network_dialog "Set extra flags to ${IFCONFIG_CMD}?"; then
IFCONFIG_FLAGS=${ANSWER}
fi
echo "Progress <${IFCONFIG_CMD} ${INTERFACE} ${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS}>" >/dev/ttyv1
if ! ${IFCONFIG_CMD} ${INTERFACE} ${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS} > /dev/ttyv1 2>&1 ; then
error "Unable to configure interface ${INTERFACE}"
IPADDR=""
INTERFACE=""
continue
fi
if [ "${INTERFACE}" = "sl0" ]; then
DEFAULT_VALUE=${SLATTACH_FLAGS}
if network_dialog "Set extra flags to ${SLATTACH_CMD}?"; then
SLATTACH_FLAGS=${ANSWER}
fi
${SLATTACH_CMD} ${SLATTACH_FLAGS} ${SERIAL_SPEED} ${SERIAL_INTERFACE}
progress ${SLATTACH_CMD} ${SLATTACH_FLAGS} ${SERIAL_SPEED} ${SERIAL_INTERFACE}
fi
echo "${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS}" > ${ETC}/hostname.${INTERFACE}
DEFAULT_VALUE=""
if network_dialog "If you have a default gateway, enter its IP address"; then
if [ "${ANSWER}" != "" ]; then
GATEWAY=${ANSWER}
${ROUTE_CMD} ${ROUTE_FLAGS} ${GATEWAY} > /dev/ttyv1 2>&1
progress ${ROUTE_CMD} ${ROUTE_FLAGS} ${GATEWAY}
echo ${GATEWAY} > ${ETC}/defaultrouter
fi
fi
DEFAULT_VALUE=""
if network_dialog "If you have a name server, enter its IP address"; then
if [ "${ANSWER}" != "" ]; then
NAMESERVER=${ANSWER}
echo "domain ${DOMAIN}" > ${ETC}/resolv.conf
echo "nameserver ${NAMESERVER}" >> ${ETC}/resolv.conf
fi
fi
done
return 0
}

View file

@ -1,10 +1,10 @@
# $Id: boot_crunch.conf,v 1.19.2.1 1995/06/04 11:52:44 jkh Exp $
# $Id: boot_crunch.conf,v 1.20.2.3 1995/10/05 08:58:19 jkh Exp $
srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin
srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/i386
progs sh find
progs ft ppp
progs pwd ft ppp
progs sysinstall newfs gzip cpio bad144 fsck ifconfig route slattach
progs mount_nfs
ln gzip gunzip

View file

@ -1,4 +1,4 @@
# $Id: root_crunch.conf,v 1.4.2.2 1995/06/01 05:54:37 jkh Exp $
# $Id: root_crunch.conf,v 1.5.2.3 1995/10/05 09:31:38 jkh Exp $
# first, we list the source dirs that our programs reside in. These are
# searched in order listed to find the dir containing each program.
@ -13,8 +13,8 @@ srcdirs /usr/src/usr.sbin
# /bin stuff
progs ls cat df pwd chmod cksum cp date dd echo ed expr grep hostname kill ln
progs mkdir mt mv pwd rcp rm rmdir sleep stty sync test ft
progs ls cat df ee chmod cksum cp date dd echo ed expr grep hostname kill ln
progs mkdir mt mv rcp rm rmdir sleep stty sync test ft
ln test [
# /sbin stuff
@ -32,4 +32,4 @@ progs tar ftp rsh sed telnet rlogin
# finally, we specify the libraries to link in with our binary
libs -lcrypt -ltelnet -lutil -ll -ledit
libs -lgnuregex -lreadline -lcurses -ltermcap -lkvm
libs -lgnuregex -lreadline -lncurses -lmytinfo -lkvm

View file

@ -4,14 +4,14 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum
SRCS= attr.c cdrom.c command.c config.c decode.c devices.c disks.c dist.c \
dmenu.c dos.c floppy.c ftp.c ftp_strat.c globals.c install.c label.c \
main.c makedevs.c media.c menus.c misc.c msg.c network.c nfs.c system.c tape.c \
tcpip.c termcap.c ufs.c variable.c wizard.c
SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c decode.c \
devices.c disks.c dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
ftp_strat.c globals.c index.c install.c installFinal.c \
installPreconfig.c installUpgrade.c label.c lndir.c main.c \
makedevs.c media.c menus.c misc.c msg.c network.c nfs.c options.c \
package.c system.c tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
CFLAGS+= -Wall -I${.CURDIR}/../libdisk \
-I${.CURDIR}/../../gnu/lib/libdialog
CFLAGS+= -Wall -I${.CURDIR}/../libdisk -I${.CURDIR}/../../gnu/lib/libdialog
LDADD= -ldialog -lncurses -lmytinfo -lutil
.if exists(${.CURDIR}/../libdisk/obj)
@ -55,4 +55,3 @@ testftp: ftp.c
cc -o testftp -I../libdisk -DSTANDALONE_FTP ftp.c
.include <bsd.prog.mk>

View file

@ -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: attr.c,v 1.2.2.4 1995/06/06 00:44:51 jkh Exp $
* $Id: attr.c,v 1.3.2.7 1995/10/22 17:38:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -45,28 +45,35 @@
#include "sysinstall.h"
#include <ctype.h>
#include <fcntl.h>
#include <sys/errno.h>
static int num_attribs;
int
attr_parse(Attribs **attr, char *file)
attr_parse_file(Attribs *attr, char *file)
{
int fd;
if ((fd = open(file, O_RDONLY)) == -1) {
dialog_clear();
msgConfirm("Cannot open the information file `%s': %s (%d)", file, strerror(errno), errno);
return RET_FAIL;
}
return attr_parse(attr, fd);
}
int
attr_parse(Attribs *attr, int fd)
{
char hold_n[MAX_NAME+1];
char hold_v[MAX_VALUE+1];
int n, v, ch = 0;
int n, v;
enum { LOOK, COMMENT, NAME, VALUE, COMMIT } state;
FILE *fp;
static int lno;
int lno, num_attribs;
char ch;
num_attribs = n = v = lno = 0;
n = v = lno = num_attribs = 0;
state = LOOK;
if ((fp = fopen(file, "r")) == NULL) {
msgConfirm("Cannot open the information file `%s': %s (%d)", file, strerror(errno), errno);
return 0;
}
while (state == COMMIT || (ch = fgetc(fp)) != EOF) {
while (state == COMMIT || (read(fd, &ch, 1) == 1)) {
/* Count lines */
if (ch == '\n')
++lno;
@ -79,12 +86,14 @@ attr_parse(Attribs **attr, char *file)
state = COMMENT;
continue;
}
else if (isalpha(ch)) {
else if (isalpha(ch) || ch == '_') {
hold_n[n++] = ch;
state = NAME;
}
else
msgFatal("Invalid character '%c' at line %d\n", ch, lno);
else {
msgDebug("Parse config: Invalid character '%c' at line %d", ch, lno);
state = COMMENT; /* Ignore the rest of the line */
}
break;
case COMMENT:
@ -113,14 +122,10 @@ attr_parse(Attribs **attr, char *file)
continue;
else if (ch == '{') {
/* multiline value */
while ((ch = fgetc(fp)) != '}') {
if (ch == EOF)
msgFatal("Unexpected EOF on line %d", lno);
else {
if (v == MAX_VALUE)
msgFatal("Value length overflow at line %d", lno);
hold_v[v++] = ch;
}
while (read(fd, &ch, 1) == 1 && ch != '}') {
if (v == MAX_VALUE)
msgFatal("Value length overflow at line %d", lno);
hold_v[v++] = ch;
}
hold_v[v] = '\0';
state = COMMIT;
@ -138,41 +143,45 @@ attr_parse(Attribs **attr, char *file)
break;
case COMMIT:
(*attr)[num_attribs].name = strdup(hold_n);
(*attr)[num_attribs++].value = strdup(hold_v);
strcpy(attr[num_attribs].name, hold_n);
strcpy(attr[num_attribs].value, hold_v);
state = LOOK;
v = n = 0;
++num_attribs;
break;
default:
msgFatal("Unknown state at line %d??\n", lno);
msgFatal("Unknown state at line %d??", lno);
}
}
fclose(fp);
return 1;
attr[num_attribs].name[0] = '\0'; /* end marker */
attr[num_attribs].value[0] = '\0'; /* end marker */
if (isDebug())
msgDebug("Finished parsing %d attributes.\n", num_attribs);
return RET_SUCCESS;
}
const char *
char *
attr_match(Attribs *attr, char *name)
{
int n = 0;
int n;
if (isDebug())
msgDebug("Trying to match attribute `%s'\n", name);
while ((n < num_attribs) && (strcasecmp(attr[n].name, name) != 0)) {
for (n = 0; attr[n].name[0] && strcasecmp(attr[n].name, name) != 0; n++) {
if (isDebug())
msgDebug("Skipping attribute %u\n", n);
n++;
}
if (isDebug())
msgDebug("Stopped on attribute %u\n", n);
if (n < num_attribs) {
if (attr[n].name[0]) {
if (isDebug())
msgDebug("Returning `%s'\n", attr[n].value);
return((const char *) attr[n].value);
return(attr[n].value);
}
return NULL;

View file

@ -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: cdrom.c,v 1.7.2.2 1995/07/21 11:45:32 rgrimes Exp $
* $Id: cdrom.c,v 1.8 1995/09/18 16:52:20 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -58,13 +58,16 @@
#include <sys/mount.h>
#undef CD9660
static Boolean cdromMounted;
/* This isn't static, like the others, since it's often useful to know whether or not we have a CDROM
available in some of the other installation screens. */
Boolean cdromMounted;
Boolean
mediaInitCDROM(Device *dev)
{
struct iso_args args;
struct stat sb;
char specialrel[80];
if (!RunningAsInit || cdromMounted)
return TRUE;
@ -77,38 +80,51 @@ mediaInitCDROM(Device *dev)
args.flags = 0;
if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
msgConfirm("Error mounting %s on /cdrom: %s (%u)\n", dev, strerror(errno), errno);
dialog_clear();
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
return FALSE;
}
/*
* Do a very simple check to see if this looks roughly like a 2.0.5 CDROM
* Do a very simple check to see if this looks roughly like a FreeBSD CDROM
* Unfortunately FreeBSD won't let us read the ``label'' AFAIK, which is one
* sure way of telling the disc version :-(
*/
if (stat("/cdrom/dists", &sb)) {
snprintf(specialrel, 80, "/cdrom/%s/dists", variable_get(VAR_RELNAME));
if (stat("/cdrom/dists", &sb) && stat(specialrel, &sb)) {
if (errno == ENOENT) {
msgConfirm("Couldn't locate the directory `dists' on the CD.\nIs this a FreeBSD CDROM?\n");
dialog_clear();
msgConfirm("Couldn't locate the directory `dists' anywhere on the CD.\n"
"Is this a FreeBSD CDROM? Is the release version set properly\n"
"in the Options editor?");
return FALSE;
}
else {
msgConfirm("Couldn't stat directory %s: %s", "/cdrom/dists", strerror(errno));
dialog_clear();
msgConfirm("Error trying to stat the CDROM's dists directory: %s", strerror(errno));
return FALSE;
}
}
cdromMounted = TRUE;
msgDebug("Mounted CDROM device %s on /cdrom\n", dev->devname);
return TRUE;
}
int
mediaGetCDROM(Device *dev, char *file, Attribs *dist_attrs)
mediaGetCDROM(Device *dev, char *file, Boolean tentative)
{
char buf[PATH_MAX];
char buf[PATH_MAX];
msgDebug("Request for %s from CDROM\n", file);
snprintf(buf, PATH_MAX, "/cdrom/%s", file);
if (!access(buf,R_OK))
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/cdrom/dists/%s", file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/cdrom/%s/%s", variable_get(VAR_RELNAME), file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/cdrom/%s/dists/%s", variable_get(VAR_RELNAME), file);
return open(buf, O_RDONLY);
}
@ -117,10 +133,12 @@ mediaShutdownCDROM(Device *dev)
{
if (!RunningAsInit || !cdromMounted)
return;
msgDebug("Unmounting /cdrom\n");
if (unmount("/cdrom", MNT_FORCE) != 0)
msgConfirm("Could not unmount the CDROM: %s\n", strerror(errno));
msgDebug("Unmount returned\n");
msgDebug("Unmounting %s from /cdrom\n", dev->devname);
if (unmount("/cdrom", MNT_FORCE) != 0) {
dialog_clear();
msgConfirm("Could not unmount the CDROM from /cdrom: %s", strerror(errno));
}
msgDebug("Unmount successful\n");
cdromMounted = FALSE;
return;
}

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: command.c,v 1.11.4.1 1995/07/21 11:45:35 rgrimes Exp $
* $Id: command.c,v 1.12 1995/09/18 16:52:21 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -77,7 +77,7 @@ addit(char *key, int type, void *cmd, void *data)
{
int i;
/* First, look for the key already present and add a command to it */
/* First, look for the key already present and add a command to it if found */
for (i = 0; i < numCommands; i++) {
if (!strcmp(commandStack[i]->key, key)) {
if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
@ -98,7 +98,8 @@ addit(char *key, int type, void *cmd, void *data)
commandStack[numCommands]->ncmds = 1;
commandStack[numCommands]->cmds[0].type = type;
commandStack[numCommands]->cmds[0].ptr = cmd;
commandStack[numCommands++]->cmds[0].data = data;
commandStack[numCommands]->cmds[0].data = data;
++numCommands;
}
/* Add a shell command under a given key */
@ -108,9 +109,9 @@ command_shell_add(char *key, char *fmt, ...)
va_list args;
char *cmd;
cmd = (char *)safe_malloc(1024);
cmd = (char *)safe_malloc(256);
va_start(args, fmt);
vsnprintf(cmd, 1024, fmt, args);
vsnprintf(cmd, 256, fmt, args);
va_end(args);
addit(key, CMD_SHELL, cmd, NULL);
@ -123,17 +124,36 @@ command_func_add(char *key, commandFunc func, void *data)
addit(key, CMD_FUNCTION, func, data);
}
/* arg to sort */
static int
sort_compare(const void *p1, const void *p2)
sort_compare(Command *p1, Command *p2)
{
return strcmp(((Command *)p1)->key, ((Command *)p2)->key);
if (!p1 && !p2)
return 0;
else if (!p1 && p2) /* NULL has a "greater" value for commands */
return 1;
else if (p1 && !p2)
return -1;
else
return strcmp(p1->key, p2->key);
}
void
command_sort(void)
{
qsort(commandStack, numCommands, sizeof(Command *), sort_compare);
int i, j;
commandStack[numCommands] = NULL;
/* Just do a crude bubble sort since the list is small */
for (i = 0; i < numCommands; i++) {
for (j = 0; j < numCommands; j++) {
if (sort_compare(commandStack[j], commandStack[j + 1]) > 0) {
Command *tmp = commandStack[j];
commandStack[j] = commandStack[j + 1];
commandStack[j + 1] = tmp;
}
}
}
}
/* Run all accumulated commands in sorted order */
@ -155,7 +175,8 @@ command_execute(void)
else {
/* It's a function pointer - call it with the key and the data */
func = (commandFunc)commandStack[i]->cmds[j].ptr;
msgNotify("%x: Execute(%s, %s)", func, commandStack[i]->key, commandStack[i]->cmds[j].data);
if (isDebug())
msgDebug("%x: Execute(%s, %s)", func, commandStack[i]->key, commandStack[i]->cmds[j].data);
ret = (*func)(commandStack[i]->key, commandStack[i]->cmds[j].data);
if (isDebug())
msgDebug("Function @ %x returns status %d\n", commandStack[i]->cmds[j].ptr, ret);

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.16.2.2 1995/07/21 11:45:36 rgrimes Exp $
* $Id: config.c,v 1.17 1995/09/18 16:52:22 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -50,34 +50,53 @@ static int nchunks;
/* arg to sort */
static int
chunk_compare(const void *p1, const void *p2)
chunk_compare(Chunk *c1, Chunk *c2)
{
Chunk *c1, *c2;
c1 = (Chunk *)p1;
c2 = (Chunk *)p2;
if (!c1->private && !c2->private)
if (!c1 && !c2)
return 0;
else if (!c1 && c2)
return 1;
else if (c1 && !c2)
return -1;
else if (!c1->private && !c2->private)
return 0;
else if (c1->private && !c2->private)
return -1;
else if (!c1->private && c2->private)
return 1;
else if (!c1->private && c2->private)
return -1;
else
return strcmp(((PartInfo *)c1->private)->mountpoint, ((PartInfo *)c2->private)->mountpoint);
return strcmp(((PartInfo *)(c1->private))->mountpoint, ((PartInfo *)(c2->private))->mountpoint);
}
static void
chunk_sort(void)
{
int i, j;
for (i = 0; i < nchunks; i++) {
for (j = 0; j < nchunks; j++) {
if (chunk_compare(chunk_list[j], chunk_list[j + 1]) > 0) {
Chunk *tmp = chunk_list[j];
chunk_list[j] = chunk_list[j + 1];
chunk_list[j + 1] = tmp;
}
}
}
}
static char *
nameof(Chunk *c1)
name_of(Chunk *c1)
{
static char rootname[64];
static char rootname[32];
/* Our boot blocks can't deal with root partitions on slices - need the compatbility name */
if (c1->type == part && c1->flags & CHUNK_IS_ROOT) {
sprintf(rootname, "%sa", c1->disk->name);
return rootname;
sprintf(rootname, "%sa", c1->disk->name);
return rootname;
}
else
return c1->name;
return c1->name;
}
static char *
@ -126,7 +145,7 @@ seq_num(Chunk *c1)
return 0;
}
void
int
configFstab(void)
{
Device **devs;
@ -137,14 +156,20 @@ configFstab(void)
if (!RunningAsInit) {
if (file_readable("/etc/fstab"))
return;
else
msgConfirm("Attempting to rebuild your /etc/fstab file.\nWarning: If you had any CD devices in use before running\nsysinstall then they may NOT be found in this run!");
return RET_SUCCESS;
else {
dialog_clear();
msgConfirm("Attempting to rebuild your /etc/fstab file. Warning: If you had\n"
"any CD devices in use before running sysinstall then they may NOT\n"
"be found by this run!");
}
}
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("No disks found!");
return;
return RET_FAIL;
}
/* Record all the chunks */
@ -166,20 +191,21 @@ configFstab(void)
chunk_list[nchunks++] = c1;
}
}
/* Sort them puppies! */
qsort(chunk_list, nchunks, sizeof(Chunk *), chunk_compare);
chunk_list[nchunks] = 0;
chunk_sort();
fstab = fopen("/etc/fstab", "w");
if (!fstab) {
msgConfirm("Unable to create a new /etc/fstab file!\nManual intervention will be required.");
return;
dialog_clear();
msgConfirm("Unable to create a new /etc/fstab file! Manual intervention\n"
"will be required.");
return RET_FAIL;
}
/* Go for the burn */
msgDebug("Generating /etc/fstab file\n");
for (i = 0; i < nchunks; i++)
fprintf(fstab, "/dev/%s\t\t\t%s\t\t%s\t%s %d %d\n", nameof(chunk_list[i]), mount_point(chunk_list[i]),
fprintf(fstab, "/dev/%s\t\t\t%s\t\t%s\t%s %d %d\n", name_of(chunk_list[i]), mount_point(chunk_list[i]),
fstype(chunk_list[i]), fstype_short(chunk_list[i]), seq_num(chunk_list[i]), seq_num(chunk_list[i]));
Mkdir("/proc", NULL);
fprintf(fstab, "proc\t\t\t\t/proc\t\tprocfs\trw 0 0\n");
@ -190,8 +216,12 @@ configFstab(void)
/* Write the first one out as /cdrom */
if (cnt) {
Mkdir("/cdrom", NULL);
fprintf(fstab, "/dev/%s\t\t\t/cdrom\t\tcd9660\tro 0 0\n", devs[0]->name);
if (Mkdir("/cdrom", NULL)) {
dialog_clear();
msgConfirm("Unable to make mount point for: /cdrom");
}
else
fprintf(fstab, "/dev/%s\t\t\t/cdrom\t\tcd9660\tro,noauto 0 0\n", devs[0]->name);
}
/* Write the others out as /cdrom<n> */
@ -199,185 +229,308 @@ configFstab(void)
char cdname[10];
sprintf(cdname, "/cdrom%d", i);
Mkdir(cdname, NULL);
fprintf(fstab, "/dev/%s\t\t\t%s\t\tcd9660\tro 0 0\n", devs[i]->name, cdname);
if (Mkdir(cdname, NULL)) {
dialog_clear();
msgConfirm("Unable to make mount point for: %s", cdname);
}
else
fprintf(fstab, "/dev/%s\t\t\t%s\t\tcd9660\tro,noauto 0 0\n", devs[i]->name, cdname);
}
fclose(fstab);
if (isDebug())
msgDebug("Wrote out /etc/fstab file\n");
return RET_SUCCESS;
}
/*
* This sucks in /etc/sysconfig, substitutes anything needing substitution, then
* writes it all back out. It's pretty gross and needs re-writing at some point.
*/
#define MAX_LINES 2000 /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */
void
configSysconfig(void)
{
FILE *fp;
char *lines[5001]; /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */
char *lines[MAX_LINES], *cp;
char line[256];
Variable *v;
int i, nlines = 0;
int i, nlines;
fp = fopen("/etc/sysconfig", "r");
if (!fp) {
msgConfirm("Unable to open /etc/sysconfig file! Things may work\nrather strangely as a result of this.");
dialog_clear();
msgConfirm("Unable to open /etc/sysconfig file! Things may work\n"
"rather strangely as a result of this.");
return;
}
for (i = 0; i < 5000; i++) {
msgNotify("Writing configuration changes to /etc/sysconfig file..");
nlines = 0;
/* Read in the entire file */
for (i = 0; i < MAX_LINES; i++) {
if (!fgets(line, 255, fp))
break;
lines[nlines++] = strdup(line);
}
lines[nlines] = NULL;
fclose(fp);
msgDebug("Read %d lines from sysconfig.\n", nlines);
/* Now do variable substitutions */
for (v = VarHead; v; v = v->next) {
for (i = 0; i < nlines; i++) {
char modify[256], *cp;
char tmp[256];
if (lines[i][0] == '#' || lines[i][0] == ';')
/* Skip the comments */
if (lines[i][0] == '#')
continue;
strncpy(modify, lines[i], 255);
cp = index(modify, '=');
strcpy(tmp, lines[i]);
cp = index(tmp, '=');
if (!cp)
continue;
*(cp++) = '\0';
if (!strcmp(modify, v->name)) {
if (!strcmp(tmp, v->name)) {
free(lines[i]);
lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 3);
lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 5);
sprintf(lines[i], "%s=\"%s\"\n", v->name, v->value);
msgDebug("Variable substitution on: %s\n", lines[i]);
}
}
}
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]);
free(lines[i]);
/* Now write it all back out again */
fclose(fp);
fp = fopen("/etc/sysconfig", "w");
for (i = 0; i < nlines; i++) {
static Boolean firstTime = TRUE;
fprintf(fp, lines[i]);
/* Stand by for bogus special case handling - we try to dump the interface specs here */
if (!strncmp(lines[i], VAR_INTERFACES, strlen(VAR_INTERFACES))) {
if (firstTime && !strncmp(lines[i], VAR_INTERFACES, strlen(VAR_INTERFACES))) {
Device **devp;
int j, cnt;
devp = deviceFind(NULL, DEVICE_TYPE_NETWORK);
cnt = deviceCount(devp);
for (j = 0; j < cnt; j++) {
if (devp[j]->private && strncmp(devp[j]->name, "cuaa", 4)) {
char iname[64];
char iname[255];
snprintf(iname, 64, "%s%s", VAR_IFCONFIG, devp[j]->name);
if (getenv(iname))
fprintf(fp, "%s=\"%s\"\n", iname, getenv(iname));
snprintf(iname, 255, "%s%s", VAR_IFCONFIG, devp[j]->name);
if ((cp = variable_get(iname))) {
fprintf(fp, "%s=\"%s\"\n", iname, cp);
}
}
firstTime = FALSE;
}
free(lines[i]);
}
fclose(fp);
/* If we're an NFS server, we need an exports file */
if (getenv("nfs_server") && !file_readable("/etc/exports")) {
msgConfirm("You have chosen to be an NFS server but have not yet configured\nthe /etc/exports file. The format for an exports entry is:\n <mountpoint> <opts> <host [..host]>\nWhere <mounpoint> is the name of a filesystem as specified\nin the Label editor, <opts> is a list of special options we\nwon't concern ourselves with here (``man exports'' when the\nsystem is fully installed) and <host> is one or more host\nnames who are allowed to mount this file system. Press\n[ENTER] now to invoke the editor on /etc/exports");
systemExecute("vi /etc/exports");
}
}
int
configSaverTimeout(char *str)
{
char *val;
val = msgGetInput("60", "Enter time-out period in seconds for screen saver");
if (val)
variable_set2("blanktime", val);
return 0;
return variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver")
? RET_SUCCESS : RET_FAIL;
}
int
configNTP(char *str)
{
char *val;
val = msgGetInput(NULL, "Enter the name of an NTP server");
if (val)
variable_set2("ntpdate", val);
return 0;
return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") ? RET_SUCCESS : RET_FAIL;
}
void
configResolv(void)
{
FILE *fp;
char *cp;
char *cp, *dp, *hp;
if (!RunningAsInit && file_readable("/etc/resolv.conf"))
return;
if (!getenv(VAR_NAMESERVER)) {
if (mediaDevice && (mediaDevice->type == DEVICE_TYPE_NFS || mediaDevice->type == DEVICE_TYPE_FTP))
msgConfirm("Warning: Missing name server value - network operations\nmay fail as a result!");
if (!variable_get(VAR_NAMESERVER)) {
if (mediaDevice && (mediaDevice->type == DEVICE_TYPE_NFS || mediaDevice->type == DEVICE_TYPE_FTP)) {
dialog_clear();
msgConfirm("Warning: Missing name server value - network operations\n"
"may fail as a result!");
}
goto skip;
}
Mkdir("/etc", NULL);
if (Mkdir("/etc", NULL)) {
dialog_clear();
msgConfirm("Unable to create /etc directory. Network configuration\n"
"files will therefore not be written!");
return;
}
fp = fopen("/etc/resolv.conf", "w");
if (!fp) {
dialog_clear();
msgConfirm("Unable to open /etc/resolv.conf! You will need to do this manually.");
return;
}
if (getenv(VAR_DOMAINNAME))
fprintf(fp, "domain\t%s\n", getenv(VAR_DOMAINNAME));
fprintf(fp, "nameserver\t%s\n", getenv(VAR_NAMESERVER));
if (variable_get(VAR_DOMAINNAME))
fprintf(fp, "domain\t%s\n", variable_get(VAR_DOMAINNAME));
fprintf(fp, "nameserver\t%s\n", variable_get(VAR_NAMESERVER));
fclose(fp);
if (isDebug())
msgDebug("Wrote out /etc/resolv.conf\n");
skip:
/* Tack ourselves at the end of /etc/hosts */
cp = getenv(VAR_IPADDR);
if (cp && *cp != '0' && getenv(VAR_HOSTNAME)) {
fp = fopen("/etc/hosts", "a");
fprintf(fp, "%s\t\t%s\n", cp, getenv(VAR_HOSTNAME));
/* Tack ourselves into /etc/hosts */
cp = variable_get(VAR_IPADDR);
dp = variable_get(VAR_DOMAINNAME);
if (cp && *cp != '0' && (hp = variable_get(VAR_HOSTNAME))) {
char cp2[255];
(void)vsystem("hostname %s", hp);
fp = fopen("/etc/hosts", "w");
if (!index(hp, '.'))
cp2[0] = '\0';
else {
strcpy(cp2, hp);
*(index(cp2, '.')) = '\0';
}
fprintf(fp, "127.0.0.1\t\tlocalhost.%s localhost\n", dp ? dp : "my.domain");
fprintf(fp, "%s\t\t%s %s\n", cp, hp, cp2);
fclose(fp);
if (isDebug())
msgDebug("Appended entry for %s to /etc/hosts\n", cp);
msgDebug("Wrote entry for %s to /etc/hosts\n", cp);
}
}
int
configRoutedFlags(char *str)
{
char *val;
val = msgGetInput("-q", "Specify the flags for routed; -q is the default, -s is\na good choice for gateway machines.");
if (val)
variable_set2("routedflags", val);
return 0;
return variable_get_value(VAR_ROUTEDFLAGS,
"Specify the flags for routed; -q is the default, -s is\n"
"a good choice for gateway machines.") ? RET_SUCCESS : RET_FAIL;
}
int
configPackages(char *str)
{
Boolean onCD;
PkgNode top, plist;
int fd;
/* If we're running as init, we know that a CD in the drive is probably ours */
onCD = file_readable("/cdrom/packages");
if (!onCD && RunningAsInit) {
if (mediaSetCDROM(NULL)) {
if ((*mediaDevice->init)(mediaDevice))
onCD = TRUE;
if (!mediaVerify())
return RET_FAIL;
if (!mediaDevice->init(mediaDevice))
return RET_FAIL;
msgNotify("Attempting to fetch packages/INDEX file from selected media.");
fd = mediaDevice->get(mediaDevice, "packages/INDEX", TRUE);
if (fd < 0) {
dialog_clear();
msgConfirm("Unable to get packages/INDEX file from selected media.\n"
"This may be because the packages collection is not available at\n"
"on the distribution media you've chosen (most likely an FTP site\n"
"without the packages collection mirrored). Please verify media\n"
"(or path to media) and try again. If your local site does not\n"
"carry the packages collection, then we recommend either a CD\n"
"distribution or the master distribution on ftp.freebsd.org.");
return RET_FAIL;
}
msgNotify("Got INDEX successfully, now building packages menu..");
index_init(&top, &plist);
if (index_read(fd, &top)) {
dialog_clear();
msgConfirm("I/O or format error on packages/INDEX file.\n"
"Please verify media (or path to media) and try again.");
mediaDevice->close(mediaDevice, fd);
return RET_FAIL;
}
mediaDevice->close(mediaDevice, fd);
index_sort(&top);
while (1) {
int ret, pos, scroll;
/* Bring up the packages menu */
pos = scroll = 0;
index_menu(&top, &plist, &pos, &scroll);
if (plist.kids) {
/* Now show the packing list menu */
pos = scroll = 0;
ret = index_menu(&plist, NULL, &pos, &scroll);
if (ret == RET_DONE)
break;
else if (ret != RET_FAIL) {
index_extract(mediaDevice, &plist);
break;
}
}
else {
dialog_clear();
msgConfirm("No packages were selected for extraction.");
break;
}
}
/* XXX Construct some sort of menu here using an INDEX file from /cdrom/packages XXX */
return 0;
index_node_free(&top, &plist);
mediaDevice->shutdown(mediaDevice);
return RET_SUCCESS;
}
int
configPorts(char *str)
{
return 0;
char *cp, *dist = NULL; /* Shut up compiler */
if (!variable_get(VAR_PORTS_PATH))
variable_set2(VAR_PORTS_PATH, dist = "/cdrom/ports");
while (!directoryExists(dist)) {
dist = variable_get_value(VAR_PORTS_PATH,
"Unable to locate a ports tree on CDROM. Please specify the\n"
"location of the master ports directory you wish to create the\n"
"link tree to.");
if (!dist)
break;
}
if (dist) {
cp = msgGetInput("/usr/ports",
"Where would you like to create the link tree?\n"
"(press [ENTER] for default location). The link tree should\n"
"reside in a directory with as much free space as possible,\n"
"as you'll need space to compile any ports.");
if (!cp || !*cp)
return RET_FAIL;
if (Mkdir(cp, NULL)) {
dialog_clear();
msgConfirm("Unable to make the %s directory!", cp);
return RET_FAIL;
}
else {
if (strcmp(cp, "/usr/ports")) {
unlink("/usr/ports");
if (symlink(cp, "/usr/ports") == -1) {
msgConfirm("Unable to create a symlink from /usr/ports to %s!\n"
"I can't continue, sorry!", cp);
return RET_FAIL;
}
else {
msgConfirm("NOTE: This directory is also now symlinked to /usr/ports\n"
"which, for a variety of reasons, is the directory the ports\n"
"framework expects to find its files in. You should refer to\n"
"/usr/ports instead of %s directly when you're working in the\n"
"ports collection.", cp);
}
}
msgNotify("Making a link tree from %s to %s.", dist, cp);
if (lndir(dist, cp) != RET_SUCCESS) {
dialog_clear();
msgConfirm("The lndir function returned an error status and may not have.\n"
"successfully generated the link tree. You may wish to inspect\n"
"the /usr/ports directory carefully for any missing link files.");
}
else {
msgConfirm("The /usr/ports directory is now ready to use. When the system comes\n"
"up fully, you can cd to this directory and type `make' in any sub-\n"
"directory for which you'd like to compile a port. You can also\n"
"cd to /usr/ports and type `make print-index' for a complete list of all\n"
"ports in the hierarchy.");
}
}
}
else
return RET_FAIL;
return RET_SUCCESS;
}

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: decode.c,v 1.5.2.3 1995/06/02 15:30:47 jkh Exp $
* $Id: decode.c,v 1.6.2.5 1995/11/03 12:02:26 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -56,15 +56,15 @@ decode(DMenu *menu, char *name)
return tmp;
}
Boolean
int
dispatch(DMenuItem *tmp, char *name)
{
Boolean failed = FALSE;
int val = RET_SUCCESS;
switch (tmp->type) {
/* We want to simply display a file */
/* We want to simply display a help file */
case DMENU_DISPLAY_FILE:
systemDisplayFile((char *)tmp->ptr);
systemDisplayHelp((char *)tmp->ptr);
break;
/* It's a sub-menu; recurse on it */
@ -72,7 +72,7 @@ dispatch(DMenuItem *tmp, char *name)
(void)dmenuOpenSimple((DMenu *)tmp->ptr);
break;
/* Execute it as a system command */
/* Execute it as a direct exec */
case DMENU_SYSTEM_COMMAND:
(void)systemExecute((char *)tmp->ptr);
break;
@ -86,14 +86,16 @@ dispatch(DMenuItem *tmp, char *name)
break;
case DMENU_CALL:
failed = (((int (*)())tmp->ptr)(name));
val = (((int (*)())tmp->ptr)(name));
break;
case DMENU_CANCEL:
return TRUE;
val = RET_DONE;
break;
case DMENU_SET_VARIABLE:
variable_set((char *)tmp->ptr);
msgInfo("Set %s", tmp->ptr);
break;
case DMENU_SET_FLAG:
@ -110,10 +112,10 @@ dispatch(DMenuItem *tmp, char *name)
default:
msgFatal("Don't know how to deal with menu type %d", tmp->type);
}
return failed;
return val;
}
Boolean
int
decode_and_dispatch_multiple(DMenu *menu, char *names)
{
DMenuItem *tmp;
@ -140,7 +142,7 @@ decode_and_dispatch_multiple(DMenu *menu, char *names)
if (!*names)
return FALSE;
if ((tmp = decode(menu, names)) != NULL) {
if (dispatch(tmp, names))
if (dispatch(tmp, names) != RET_SUCCESS)
++errors;
}
else
@ -148,6 +150,5 @@ decode_and_dispatch_multiple(DMenu *menu, char *names)
names, menu->title);
names = cp;
}
return errors ? TRUE : FALSE;
return errors;
}

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: devices.c,v 1.35.2.9 1995/06/05 12:03:46 jkh Exp $
* $Id: devices.c,v 1.36.2.11 1995/11/15 06:57:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -82,16 +82,20 @@ static struct {
{ DEVICE_TYPE_CDROM, "scd1a", "Sony CDROM drive - CDU31/33A type (2nd unit)" },
{ DEVICE_TYPE_CDROM, "matcd0a", "Matsushita CDROM ('sound blaster' type)" },
{ DEVICE_TYPE_CDROM, "matcd1a", "Matsushita CDROM (2nd unit)" },
{ DEVICE_TYPE_CDROM, "wcd0c", "ATAPI IDE CDROM" },
{ DEVICE_TYPE_CDROM, "wcd1c", "ATAPI IDE CDROM (2nd unit)" },
{ DEVICE_TYPE_TAPE, "rst0", "SCSI tape drive" },
{ DEVICE_TYPE_TAPE, "rst1", "SCSI tape drive (2nd unit)" },
{ DEVICE_TYPE_TAPE, "ft0", "Floppy tape drive (QIC-02)" },
{ DEVICE_TYPE_TAPE, "wt0", "Wangtek tape drive" },
{ DEVICE_TYPE_TAPE, "rft0", "Floppy tape drive (QIC-02)" },
{ DEVICE_TYPE_TAPE, "rwt0", "Wangtek tape drive" },
{ DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
{ DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
{ DEVICE_TYPE_FLOPPY, "fd0", "floppy drive unit A" },
{ DEVICE_TYPE_FLOPPY, "fd1", "floppy drive unit B" },
{ DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) - possible PPP/SLIP device" },
{ DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) - possible PPP/SLIP device" },
{ DEVICE_TYPE_NETWORK, "cuaa2", "Serial port (COM3) - possible PPP/SLIP device" },
{ DEVICE_TYPE_NETWORK, "cuaa3", "Serial port (COM4) - possible PPP/SLIP device" },
{ DEVICE_TYPE_NETWORK, "lp0", "Parallel Port IP (PLIP) using laplink cable" },
{ DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" },
{ DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" },
@ -126,18 +130,21 @@ new_device(char *name)
Boolean
dummyInit(Device *dev)
{
msgDebug("Dummy init called for %s\n", dev->name);
return TRUE;
}
int
dummyGet(Device *dev, char *dist, Attribs *dist_attrs)
dummyGet(Device *dev, char *dist, Boolean tentative)
{
msgDebug("Dummy get called for %s\n", dev->name);
return -1;
}
Boolean
dummyClose(Device *dev, int fd)
{
msgDebug("Dummy [default] close called for %s with fd of %d.\n", dev->name, fd);
if (!close(fd))
return TRUE;
return FALSE;
@ -146,6 +153,7 @@ dummyClose(Device *dev, int fd)
void
dummyShutdown(Device *dev)
{
msgDebug("Dummy shutdown called for %s\n", dev->name);
return;
}
@ -166,7 +174,7 @@ deviceTry(char *name, char *try)
/* 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)(Device *, char *, Attribs *),
Boolean (*init)(Device *), int (*get)(Device *, char *, Boolean),
Boolean (*close)(Device *, int), void (*shutdown)(Device *), void *private)
{
Device *newdev;
@ -294,10 +302,12 @@ deviceGetAll(void)
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
dialog_clear();
msgConfirm("ifconfig: socket");
return;
}
if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) {
dialog_clear();
msgConfirm("ifconfig (SIOCGIFCONF)");
return;
}
@ -316,6 +326,7 @@ deviceGetAll(void)
msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name);
close(s);
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
dialog_clear();
msgConfirm("ifconfig: socket");
continue;
}

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.31.2.2 1995/07/21 11:45:38 rgrimes Exp $
* $Id: disks.c,v 1.32 1995/09/18 16:52:23 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -49,7 +49,7 @@
#define CHUNK_START_ROW 5
/* Where we keep track of MBR chunks */
static struct chunk *chunk_info[10];
static struct chunk *chunk_info[16];
static int current_chunk;
static void
@ -60,15 +60,13 @@ record_chunks(Disk *d)
int last_free = 0;
if (!d->chunks)
msgFatal("No chunk list found for %s!", d->name);
c1 = d->chunks->part;
current_chunk = 0;
while (c1) {
for (c1 = d->chunks->part; c1; c1 = c1->next) {
if (c1->type == unused && c1->size > last_free) {
last_free = c1->size;
current_chunk = i;
}
chunk_info[i++] = c1;
c1 = c1->next;
}
chunk_info[i] = NULL;
}
@ -79,16 +77,32 @@ print_chunks(Disk *d)
int row;
int i;
if ((!d->bios_cyl || d->bios_cyl > 65536) || (!d->bios_hd || d->bios_hd > 256) || (!d->bios_sect || d->bios_sect >= 64))
msgConfirm("WARNING: The detected geometry is incorrect! Please adjust it to\nthe correct values manually with the (G)eometry command. If you are\nunsure about the correct geometry (which may be \"translated\"), please\nconsult the Hardware Guide in the Documentation submenu.");
if ((!d->bios_cyl || d->bios_cyl > 65536) || (!d->bios_hd || d->bios_hd > 256) || (!d->bios_sect || d->bios_sect >= 64)) {
int sz;
dialog_clear();
msgConfirm("WARNING: The current geometry for %s is incorrect. Using\n"
"a default geometry of 64 heads and 32 sectors. If this geometry\n"
"is incorrect or you are unsure as to whether or not it's correct,\n"
"please consult the Hardware Guide in the Documentation submenu\n"
"or use the (G)eometry command to change it now.", d->name);
d->bios_hd = 64;
d->bios_sect = 32;
sz = 0;
for (i = 0; chunk_info[i]; i++)
sz += chunk_info[i]->size;
if (sz)
d->bios_cyl = sz / ONE_MEG;
else
msgConfirm("Couldn't set geometry! You'll have to do it by hand.");
}
attrset(A_NORMAL);
mvaddstr(0, 0, "Disk name:\t");
clrtobot();
attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
attrset(A_REVERSE); mvaddstr(0, 55, "FDISK Partition Editor"); attrset(A_NORMAL);
mvprintw(1, 0,
"BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
"DISK Geometry:\t%lu cyls/%lu heads/%lu sectors",
d->bios_cyl, d->bios_hd, d->bios_sect);
mvprintw(3, 1, "%10s %10s %10s %8s %8s %8s %8s %8s",
"Offset", "Size", "End", "Name", "PType", "Desc",
@ -111,7 +125,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(17, 0, "D = Delete Partition G = Set Drive Geometry S = Set Bootable");
mvprintw(18, 0, "U = Undo All Changes Q = Finish W = Write Changes");
mvprintw(20, 0, "The currently selected partition is displayed in ");
attrset(A_REVERSE); addstr("reverse"); attrset(A_NORMAL); addstr(" video.");
@ -119,17 +133,142 @@ print_command_summary()
move(0, 0);
}
static Disk *
diskPartition(Disk *d)
/* Partition a disk based wholly on which variables are set */
static void
scriptPartition(Device *dev, Disk *d)
{
char *cp;
int i, sz;
record_chunks(d);
cp = variable_get(VAR_GEOMETRY);
if (cp) {
msgDebug("Setting geometry from script to: %s\n", cp);
d->bios_cyl = strtol(cp, &cp, 0);
d->bios_hd = strtol(cp + 1, &cp, 0);
d->bios_sect = strtol(cp + 1, 0, 0);
}
cp = variable_get(VAR_DISKSPACE);
if (cp) {
if (!strcmp(cp, "free")) {
/* Do free disk space case */
for (i = 0; chunk_info[i]; i++) {
/* If a chunk is at least 10MB in size, use it. */
if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size, freebsd, 3,
(chunk_info[i]->flags & CHUNK_ALIGN));
variable_set2(DISK_PARTITIONED, "yes");
break;
}
}
if (!chunk_info[i]) {
dialog_clear();
msgConfirm("Unable to find any free space on this disk!");
return;
}
}
else if (!strcmp(cp, "all")) {
/* Do all disk space case */
msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
All_FreeBSD(d, FALSE);
}
else if (!strcmp(cp, "exclusive")) {
/* Do really-all-the-disk-space case */
msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
All_FreeBSD(d, TRUE);
}
else if ((sz = strtol(cp, &cp, 0))) {
/* Look for sz bytes free */
if (*cp && toupper(*cp) == 'M')
sz *= ONE_MEG;
for (i = 0; chunk_info[i]; i++) {
/* If a chunk is at least sz MB, use it. */
if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3, (chunk_info[i]->flags & CHUNK_ALIGN));
variable_set2(DISK_PARTITIONED, "yes");
break;
}
}
if (!chunk_info[i]) {
dialog_clear();
msgConfirm("Unable to find %d free blocks on this disk!", sz);
return;
}
}
else if (!strcmp(cp, "existing")) {
/* Do existing FreeBSD case */
for (i = 0; chunk_info[i]; i++) {
if (chunk_info[i]->type == freebsd)
break;
}
if (!chunk_info[i]) {
dialog_clear();
msgConfirm("Unable to find any existing FreeBSD partitions on this disk!");
return;
}
}
else {
dialog_clear();
msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_DISKSPACE);
return;
}
variable_set2(DISK_PARTITIONED, "yes");
}
}
static u_char *
getBootMgr(char *dname)
{
extern u_char mbr[], bteasy17[];
char str[80];
char *cp;
int i = 0;
cp = variable_get(VAR_BOOTMGR);
if (!cp) {
/* Figure out what kind of MBR the user wants */
sprintf(str, "Install Boot Manager for drive %s?", dname);
MenuMBRType.title = str;
dialog_clear();
i = dmenuOpenSimple(&MenuMBRType);
}
else {
if (!strncmp(cp, "boot", 4))
BootMgr = 0;
else if (!strcmp(cp, "standard"))
BootMgr = 1;
else
BootMgr = 2;
}
if (cp || i) {
switch (BootMgr) {
case 0:
return bteasy17;
case 1:
return mbr;
case 2:
default:
break;
}
}
return NULL;
}
void
diskPartition(Device *dev, Disk *d)
{
char *p;
int key = 0;
Boolean chunking;
char *msg = NULL;
char name[40];
u_char *mbrContents;
chunking = TRUE;
strncpy(name, d->name, 40);
keypad(stdscr, TRUE);
clear();
@ -148,6 +287,7 @@ diskPartition(Disk *d)
case '\014': /* ^L */
clear();
print_command_summary();
continue;
case KEY_UP:
@ -175,23 +315,46 @@ diskPartition(Disk *d)
case KEY_F(1):
case '?':
systemDisplayFile("slice.hlp");
systemDisplayHelp("slice");
break;
case 'A':
All_FreeBSD(d);
case 'A': {
int rv;
rv = msgYesNo("Do you want to do this with a true partition entry\n"
"so as to remain cooperative with any future possible\n"
"operating systems on the drive(s)?");
if (rv) {
rv = !msgYesNo("This is dangerous in that it will make the drive totally\n"
"uncooperative with other potential operating systems on the\n"
"same disk. It will lead instead to a totally dedicated disk,\n"
"starting at the very first sector, bypassing all BIOS geometry\n"
"considerations.\n"
"You will run into serious trouble with ST-506 and ESDI drives\n"
"and possibly some IDE drives (e.g. drives running under the\n"
"control of sort of disk manager). SCSI drives are considerably\n"
"less at risk.\n\n"
"Do you insist on dedicating the entire disk this way?");
}
All_FreeBSD(d, rv);
if (rv)
d->bios_hd = d->bios_sect = d->bios_cyl = 1;
variable_set2(DISK_PARTITIONED, "yes");
record_chunks(d);
}
break;
case 'B':
if (chunk_info[current_chunk]->type != freebsd)
msg = "Can only scan for bad blocks in FreeBSD partition.";
else if (strncmp(name, "sd", 2) ||
!msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\nAre you sure you want to do this on a SCSI disk?"))
else if (strncmp(d->name, "sd", 2) ||
!msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\n"
"Are you sure you want to do this on a SCSI disk?")) {
if (chunk_info[current_chunk]->flags & CHUNK_BAD144)
chunk_info[current_chunk]->flags &= ~CHUNK_BAD144;
else
chunk_info[current_chunk]->flags |= CHUNK_BAD144;
}
break;
case 'C':
@ -202,12 +365,14 @@ diskPartition(Disk *d)
int size;
snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\n"
"a trailing `M' for megabytes (e.g. 20M).");
if (val && (size = strtol(val, &cp, 0)) > 0) {
if (*cp && toupper(*cp) == 'M')
size *= 2048;
size *= ONE_MEG;
Create_Chunk(d, chunk_info[current_chunk]->offset, size, freebsd, 3,
(chunk_info[current_chunk]->flags & CHUNK_ALIGN));
variable_set2(DISK_PARTITIONED, "yes");
record_chunks(d);
}
}
@ -218,6 +383,7 @@ diskPartition(Disk *d)
msg = "Partition is already unused!";
else {
Delete_Chunk(d, chunk_info[current_chunk]);
variable_set2(DISK_PARTITIONED, "yes");
record_chunks(d);
}
break;
@ -226,40 +392,74 @@ diskPartition(Disk *d)
char *val, geometry[80];
snprintf(geometry, 80, "%lu/%lu/%lu", d->bios_cyl, d->bios_hd, d->bios_sect);
val = msgGetInput(geometry,
"Please specify the new geometry in cyl/hd/sect format.\nDon't forget to use the two slash (/) separator characters!\nIt's not possible to parse the field without them.");
val = msgGetInput(geometry, "Please specify the new geometry in cyl/hd/sect format.\n"
"Don't forget to use the two slash (/) separator characters!\n"
"It's not possible to parse the field without them.");
if (val) {
d->bios_cyl = strtol(val, &val, 0);
d->bios_hd = strtol(val + 1, &val, 0);
d->bios_sect = strtol(val + 1, 0, 0);
}
}
break;
break;
case 'S':
/* Set Bootable */
chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
break;
case 'U':
Free_Disk(d);
d = Open_Disk(name);
if (!d)
msgFatal("Can't reopen disk %s!", name);
case 'S':
/* Set Bootable */
chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
break;
case 'U':
clear();
if (msgYesNo("Are you SURE you want to Undo everything?"))
break;
d = Open_Disk(d->name);
if (!d) {
dialog_clear();
msgConfirm("Can't reopen disk %s! Internal state is probably corrupted", d->name);
return;
}
Free_Disk(dev->private);
dev->private = d;
variable_unset(DISK_PARTITIONED);
record_chunks(d);
break;
case 'W':
if (!msgYesNo("Are you sure you want to write this now? You do also\nhave the option of not modifying the disk until *all*\nconfiguration information has been entered, at which\npoint you can do it all at once. If you're unsure, then\nchoose No at this dialog."))
diskPartitionWrite(NULL);
if (!msgYesNo("Are you SURE you want to write this now? You do also\n"
"have the option of not modifying the disk until *all*\n"
"configuration information has been entered, at which\n"
"point you can do it all at once. If you're unsure, then\n"
"PLEASE CHOOSE NO at this dialog! This option is DANGEROUS\n"
"if you do not know EXACTLY what you are doing!")) {
variable_set2(DISK_PARTITIONED, "yes");
clear();
/* Don't trash the MBR if the first (and therefore only) chunk is marked for a truly dedicated
* disk (i.e., the disklabel starts at sector 0), even in cases where the user has requested
* booteasy or a "standard" MBR -- both would be fatal in this case.
*/
if ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL
&& (mbrContents = getBootMgr(d->name)) != NULL)
Set_Boot_Mgr(d, mbrContents);
if (diskPartitionWrite(NULL) != RET_SUCCESS) {
dialog_clear();
msgConfirm("Disk partition write returned an error status!");
}
else {
msgConfirm("Wrote FDISK partition information out successfully.");
}
}
break;
case '|':
if (!msgYesNo("Are you sure you want to go into Wizard mode?\nNo seat belts whatsoever are provided!")) {
if (!msgYesNo("Are you SURE you want to go into Wizard mode?\n"
"No seat belts whatsoever are provided!")) {
dialog_clear();
end_dialog();
DialogActive = FALSE;
slice_wizard(d);
variable_set2(DISK_PARTITIONED, "yes");
dialog_clear();
DialogActive = TRUE;
record_chunks(d);
@ -270,6 +470,14 @@ diskPartition(Disk *d)
case 'Q':
chunking = FALSE;
clear();
/* Don't trash the MBR if the first (and therefore only) chunk is marked for a truly dedicated
* disk (i.e., the disklabel starts at sector 0), even in cases where the user has requested
* booteasy or a "standard" MBR -- both would be fatal in this case.
*/
if ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL
&& (mbrContents = getBootMgr(d->name)) != NULL)
Set_Boot_Mgr(d, mbrContents);
break;
default:
@ -280,12 +488,11 @@ diskPartition(Disk *d)
}
p = CheckRules(d);
if (p) {
dialog_clear();
msgConfirm(p);
free(p);
}
dialog_clear();
variable_set2(DISK_PARTITIONED, "yes");
return d;
}
static int
@ -309,13 +516,16 @@ partitionHook(char *str)
}
devs = deviceFind(str, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("Unable to find disk %s!", str);
return 0;
}
else if (devs[1])
else if (devs[1]) {
dialog_clear();
msgConfirm("Bizarre multiple match for %s!", str);
devs[0]->private = diskPartition((Disk *)devs[0]->private);
}
devs[0]->enabled = TRUE;
diskPartition(devs[0], (Disk *)devs[0]->private);
str = cp;
}
return devs ? 1 : 0;
@ -326,65 +536,73 @@ diskPartitionEditor(char *str)
{
DMenu *menu;
Device **devs;
int cnt;
int i, cnt;
char *cp;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
cp = variable_get(VAR_DISK);
devs = deviceFind(cp, DEVICE_TYPE_DISK);
cnt = deviceCount(devs);
if (!cnt) {
msgConfirm("No disks found! Please verify that your disk controller is being\nproperly probed at boot time. See the Hardware Guide on the Documentation menu\nfor clues on diagnosing this type of problem.");
return 0;
dialog_clear();
msgConfirm("No disks found! Please verify that your disk controller is being\n"
"properly probed at boot time. See the Hardware Guide on the\n"
"Documentation menu for clues on diagnosing this type of problem.");
i = RET_FAIL;
}
else if (cnt == 1) {
devs[0]->private = diskPartition((Disk *)devs[0]->private);
devs[0]->enabled = TRUE;
if (str && !strcmp(str, "script"))
scriptPartition(devs[0], (Disk *)devs[0]->private);
else
diskPartition(devs[0], (Disk *)devs[0]->private);
i = RET_SUCCESS;
variable_set2(DISK_SELECTED, "yes");
}
else {
menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook);
if (!menu)
msgConfirm("No devices suitable for installation found!\n\nPlease verify that your disk controller (and attached drives) were detected properly. This can be done by selecting the ``Bootmsg'' option on the main menu and reviewing the boot messages carefully.");
if (!menu) {
dialog_clear();
msgConfirm("No devices suitable for installation found!\n\n"
"Please verify that your disk controller (and attached drives)\n"
"were detected properly. This can be done by pressing the\n"
"[Scroll Lock] key and using the Arrow keys to move back to\n"
"the boot messages. Press [Scroll Lock] again to return.");
i = RET_FAIL;
}
else {
dmenuOpenSimple(menu);
if (!dmenuOpenSimple(menu))
i = RET_FAIL;
else {
i = RET_SUCCESS;
variable_set2(DISK_SELECTED, "yes");
}
free(menu);
}
}
return 0;
}
static u_char *
getBootMgr(void)
{
extern u_char mbr[], bteasy17[];
/* Figure out what kind of MBR the user wants */
if (dmenuOpenSimple(&MenuMBRType)) {
switch (BootMgr) {
case 0:
return bteasy17;
case 1:
return mbr;
case 2:
default:
break;
}
}
return NULL;
return i;
}
int
diskPartitionWrite(char *str)
{
extern u_char boot1[], boot2[];
u_char *mbrContents;
Device **devs;
char *cp;
int i;
mbrContents = getBootMgr();
if ((cp = variable_get(DISK_PARTITIONED)) && strcmp(cp, "yes"))
return RET_SUCCESS;
else if (!cp) {
dialog_clear();
msgConfirm("You must partition the disk(s) before this option can be used.");
return RET_FAIL;
}
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("Unable to find any disks to write to??");
return 0;
return RET_FAIL;
}
for (i = 0; devs[i]; i++) {
@ -394,16 +612,13 @@ diskPartitionWrite(char *str)
if (!devs[i]->enabled)
continue;
/* Do it once so that it only goes on the first drive */
if (mbrContents) {
Set_Boot_Mgr(d, mbrContents);
mbrContents = NULL;
}
Set_Boot_Blocks(d, boot1, boot2);
msgNotify("Writing partition information to drive %s", d->name);
Write_Disk(d);
if (Write_Disk(d)) {
dialog_clear();
msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
return RET_FAIL;
}
/* Now scan for bad blocks, if necessary */
for (c1 = d->chunks->part; c1; c1 = c1->next) {
if (c1->flags & CHUNK_BAD144) {
@ -411,13 +626,19 @@ diskPartitionWrite(char *str)
msgNotify("Running bad block scan on partition %s", c1->name);
ret = vsystem("bad144 -v /dev/r%s 1234", c1->name);
if (ret)
if (ret) {
dialog_clear();
msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret);
}
ret = vsystem("bad144 -v -s /dev/r%s", c1->name);
if (ret)
if (ret) {
dialog_clear();
msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret);
}
}
}
}
return 0;
/* Now it's not "yes", but "written" */
variable_set2(DISK_PARTITIONED, "written");
return RET_SUCCESS;
}

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.36.2.1 1995/07/21 10:53:48 rgrimes Exp $
* $Id: dist.c,v 1.37 1995/09/18 16:52:24 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -80,7 +80,7 @@ static Distribution DistTable[] = {
{ "compat20", "/", &Dists, DIST_COMPAT20, NULL },
{ "commerce", "/usr/local", &Dists, DIST_COMMERCIAL, NULL },
{ "xperimnt", "/usr/local", &Dists, DIST_EXPERIMENTAL, NULL },
{ "XF86311", "/usr", &Dists, DIST_XF86, XF86DistTable },
{ "XF86312", "/usr", &Dists, DIST_XF86, XF86DistTable },
{ NULL },
};
@ -110,23 +110,27 @@ 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 },
{ "ssmailcf", "/usr/src", &SrcDists, DIST_SRC_SMAILCF, NULL },
{ NULL },
};
/* The XFree86 distribution */
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 },
{ "X311man", "/usr", &XF86Dists, DIST_XF86_MAN, NULL },
{ "X311prog", "/usr", &XF86Dists, DIST_XF86_PROG, NULL },
{ "X311link", "/usr", &XF86Dists, DIST_XF86_LINK, NULL },
{ "X311pex", "/usr", &XF86Dists, DIST_XF86_PEX, NULL },
{ "X311lbx", "/usr", &XF86Dists, DIST_XF86_LBX, NULL },
{ "X311xicf", "/usr", &XF86Dists, DIST_XF86_XINIT, NULL },
{ "X311xdcf", "/usr", &XF86Dists, DIST_XF86_XDMCF, NULL },
{ "XF86311", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable },
{ "X312bin", "/usr", &XF86Dists, DIST_XF86_BIN, NULL },
{ "X312lib", "/usr", &XF86Dists, DIST_XF86_LIB, NULL },
{ "X312doc", "/usr", &XF86Dists, DIST_XF86_DOC, NULL },
{ "X312etc", "/usr", &XF86Dists, DIST_XF86_ETC, NULL },
{ "XF86312", "/usr", &XF86Dists, DIST_XF86_FONTS, XF86FontDistTable },
{ "X312man", "/usr", &XF86Dists, DIST_XF86_MAN, NULL },
{ "X312ctrb", "/usr", &XF86Dists, DIST_XF86_CTRB, NULL },
{ "X312prog", "/usr", &XF86Dists, DIST_XF86_PROG, NULL },
{ "X312link", "/usr", &XF86Dists, DIST_XF86_LINK, NULL },
{ "X312pex", "/usr", &XF86Dists, DIST_XF86_PEX, NULL },
{ "X312lbx", "/usr", &XF86Dists, DIST_XF86_LBX, NULL },
{ "X312ubin", "/usr", &XF86Dists, DIST_XF86_UBIN, NULL },
{ "X312xicf", "/usr", &XF86Dists, DIST_XF86_XINIT, NULL },
{ "X312xdcf", "/usr", &XF86Dists, DIST_XF86_XDMCF, NULL },
{ "XF86312", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable },
{ "XF86-xc", "/usr/X11R6/src", &XF86Dists, DIST_XF86_SRC, NULL },
{ "XF86-co", "/usr/X11R6/src", &XF86Dists, DIST_XF86_SRC, NULL },
{ NULL },
@ -134,28 +138,29 @@ static Distribution XF86DistTable[] = {
/* The XFree86 server distribution */
static Distribution XF86ServerDistTable[] = {
{ "X3118514", "/usr", &XF86ServerDists, DIST_XF86_SERVER_8514, NULL },
{ "X311AGX", "/usr", &XF86ServerDists, DIST_XF86_SERVER_AGX, NULL },
{ "X311Ma8", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH8, NULL },
{ "X311Ma32", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH32,NULL },
{ "X311Ma64", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH64,NULL },
{ "X311Mono", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MONO, NULL },
{ "X311P9K", "/usr", &XF86ServerDists, DIST_XF86_SERVER_P9000, NULL },
{ "X311S3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_S3, NULL },
{ "X311SVGA", "/usr", &XF86ServerDists, DIST_XF86_SERVER_SVGA, NULL },
{ "X311VG16", "/usr", &XF86ServerDists, DIST_XF86_SERVER_VGA16, NULL },
{ "X311W32", "/usr", &XF86ServerDists, DIST_XF86_SERVER_W32, NULL },
{ "X311nest", "/usr", &XF86ServerDists, DIST_XF86_SERVER_NEST, NULL },
{ "X3128514", "/usr", &XF86ServerDists, DIST_XF86_SERVER_8514, NULL },
{ "X312AGX", "/usr", &XF86ServerDists, DIST_XF86_SERVER_AGX, NULL },
{ "X312Ma8", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH8, NULL },
{ "X312Ma32", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH32,NULL },
{ "X312Ma64", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH64,NULL },
{ "X312Mono", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MONO, NULL },
{ "X312P9K", "/usr", &XF86ServerDists, DIST_XF86_SERVER_P9000, NULL },
{ "X312S3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_S3, NULL },
{ "X312SVGA", "/usr", &XF86ServerDists, DIST_XF86_SERVER_SVGA, NULL },
{ "X312VG16", "/usr", &XF86ServerDists, DIST_XF86_SERVER_VGA16, NULL },
{ "X312W32", "/usr", &XF86ServerDists, DIST_XF86_SERVER_W32, NULL },
{ "X312nest", "/usr", &XF86ServerDists, DIST_XF86_SERVER_NEST, NULL },
{ NULL },
};
/* The XFree86 font distribution */
static Distribution XF86FontDistTable[] = {
{ "X311fnts", "/usr", &XF86FontDists, DIST_XF86_FONTS_MISC, NULL },
{ "X311f100", "/usr", &XF86FontDists, DIST_XF86_FONTS_100, NULL },
{ "X311fscl", "/usr", &XF86FontDists, DIST_XF86_FONTS_SCALE, NULL },
{ "X311fnon", "/usr", &XF86FontDists, DIST_XF86_FONTS_NON, NULL },
{ "X311fsrv", "/usr", &XF86FontDists, DIST_XF86_FONTS_SERVER, NULL },
{ "X312fnts", "/usr", &XF86FontDists, DIST_XF86_FONTS_MISC, NULL },
{ "X312f100", "/usr", &XF86FontDists, DIST_XF86_FONTS_100, NULL },
{ "X312fcyr", "/usr", &XF86FontDists, DIST_XF86_FONTS_CYR, NULL },
{ "X312fscl", "/usr", &XF86FontDists, DIST_XF86_FONTS_SCALE, NULL },
{ "X312fnon", "/usr", &XF86FontDists, DIST_XF86_FONTS_NON, NULL },
{ "X312fsrv", "/usr", &XF86FontDists, DIST_XF86_FONTS_SERVER, NULL },
{ NULL },
};
@ -167,7 +172,7 @@ distReset(char *str)
XF86Dists = 0;
XF86ServerDists = 0;
XF86FontDists = 0;
return 0;
return RET_SUCCESS;
}
int
@ -176,7 +181,7 @@ distSetDeveloper(char *str)
distReset(NULL);
Dists = _DIST_DEVELOPER;
SrcDists = DIST_SRC_ALL;
return 0;
return RET_SUCCESS;
}
int
@ -189,7 +194,7 @@ distSetXDeveloper(char *str)
XF86ServerDists = DIST_XF86_SERVER_SVGA;
XF86FontDists = DIST_XF86_FONTS_MISC;
distSetXF86(NULL);
return 0;
return RET_SUCCESS;
}
int
@ -198,7 +203,7 @@ distSetKernDeveloper(char *str)
distReset(NULL);
Dists = _DIST_DEVELOPER;
SrcDists = DIST_SRC_SYS;
return 0;
return RET_SUCCESS;
}
int
@ -206,7 +211,7 @@ distSetUser(char *str)
{
distReset(NULL);
Dists = _DIST_USER;
return 0;
return RET_SUCCESS;
}
int
@ -218,7 +223,7 @@ distSetXUser(char *str)
XF86ServerDists = DIST_XF86_SERVER_SVGA;
XF86FontDists = DIST_XF86_FONTS_MISC;
distSetXF86(NULL);
return 0;
return RET_SUCCESS;
}
int
@ -226,7 +231,7 @@ distSetMinimum(char *str)
{
distReset(NULL);
Dists = DIST_BIN;
return 0;
return RET_SUCCESS;
}
int
@ -237,16 +242,33 @@ distSetEverything(char *str)
XF86Dists = DIST_XF86_ALL;
XF86ServerDists = DIST_XF86_SERVER_ALL;
XF86FontDists = DIST_XF86_FONTS_ALL;
return 0;
return RET_SUCCESS;
}
int
distSetCustom(char *str)
{
/* These *ALL* have to be set at once. It's for power users only! :) */
if (sscanf(str, "%d %d %d %d %d %d",
&Dists, &DESDists, &SrcDists, &XF86Dists, &XF86ServerDists, &XF86FontDists) != 6) {
dialog_clear();
msgConfirm("Warning: A `%s' set was configured which did not set all\n"
"distributions explicitly. Some distributions will default to\n"
"unselected as a result.", str);
}
return RET_SUCCESS;
}
int
distSetDES(char *str)
{
dmenuOpenSimple(&MenuDESDistributions);
if (DESDists)
if (DESDists) {
if (DESDists & DIST_DES_KERBEROS)
DESDists |= DIST_DES_DES;
Dists |= DIST_DES;
return 0;
}
return RET_SUCCESS;
}
int
@ -255,7 +277,7 @@ distSetSrc(char *str)
dmenuOpenSimple(&MenuSrcDistributions);
if (SrcDists)
Dists |= DIST_SRC;
return 0;
return RET_SUCCESS;
}
int
@ -271,7 +293,7 @@ distSetXF86(char *str)
if (isDebug())
msgDebug("SetXF86 Masks: Server: %0x, Fonts: %0x, XDists: %0x, Dists: %0x\n",
XF86ServerDists, XF86FontDists, XF86Dists, Dists);
return 0;
return RET_SUCCESS;
}
static Boolean
@ -312,43 +334,46 @@ distExtract(char *parent, Distribution *me)
snprintf(buf, 512, "%s/%s.tgz", path, dist);
if (isDebug())
msgDebug("Trying to get large piece: %s\n", buf);
/* Set it as an "exploratory get" so that we don't loop unnecessarily on it */
mediaDevice->flags |= OPT_EXPLORATORY_GET;
fd = (*mediaDevice->get)(mediaDevice, buf, NULL);
mediaDevice->flags &= ~OPT_EXPLORATORY_GET;
fd = mediaDevice->get(mediaDevice, buf, TRUE);
if (fd >= 0) {
msgNotify("Extracting %s into %s directory...", me[i].my_name, me[i].my_dir);
status = mediaExtractDist(me[i].my_dir, fd);
(*mediaDevice->close)(mediaDevice, fd);
mediaDevice->close(mediaDevice, fd);
goto done;
}
else if (fd == -2) { /* Hard error, can't continue */
mediaDevice->shutdown(mediaDevice);
status = FALSE;
goto done;
}
else if (fd == -2) /* Hard error, can't continue */
return FALSE;
/* If we couldn't get it as one file then we need to get multiple pieces; get info file telling us how many */
/*
* If we couldn't get it as one file then we need to get multiple pieces; locate and parse an
* info file telling us how many we need for this distribution.
*/
dist_attr = NULL;
numchunks = 0;
snprintf(buf, sizeof buf, "/stand/info/%s/%s.inf", path, dist);
if (!access(buf, R_OK)) {
if (file_readable(buf)) {
if (isDebug())
msgDebug("Parsing attributes file for %s\n", dist);
msgDebug("Parsing attributes file for distribution %s\n", dist);
dist_attr = safe_malloc(sizeof(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 FALSE;
if (attr_parse_file(dist_attr, buf) == RET_FAIL) {
dialog_clear();
msgConfirm("Cannot load information file for %s distribution!\n"
"Please verify that your media is valid and try again.", dist);
}
else {
if (isDebug())
msgDebug("Looking for attribute `pieces'\n");
tmp = attr_match(dist_attr, "pieces");
if (tmp)
numchunks = strtol(tmp, 0, 0);
}
safe_free(dist_attr);
}
if (isDebug())
msgDebug("Looking for attribute `pieces'\n");
tmp = attr_match(dist_attr, "pieces");
if (tmp)
numchunks = strtol(tmp, 0, 0);
else
numchunks = 0;
}
else {
if (isDebug())
msgDebug("Couldn't open attributes file: %s\n", buf);
numchunks = 0;
}
if (!numchunks)
continue;
@ -364,8 +389,8 @@ distExtract(char *parent, Distribution *me)
snprintf(buf, 512, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
if (isDebug())
msgDebug("trying for piece %d of %d: %s\n", chunk, numchunks, buf);
fd = (*mediaDevice->get)(mediaDevice, buf, dist_attr);
msgDebug("trying for piece %d of %d: %s\n", chunk + 1, numchunks, buf);
fd = mediaDevice->get(mediaDevice, buf, FALSE);
if (fd < 0) {
dialog_clear();
msgConfirm("failed to retreive piece file %s!\nAborting the transfer", buf);
@ -373,18 +398,17 @@ distExtract(char *parent, Distribution *me)
}
snprintf(prompt, 80, "Extracting %s into %s directory...", me[i].my_name, me[i].my_dir);
dialog_gauge("Progress", prompt, 8, 15, 6, 50, (int)((float)(chunk + 1) / numchunks * 100));
move(0, 0); /* Get cursor out of the way - it makes gauges look strange */
while ((n = read(fd, buf, sizeof buf)) > 0) {
retval = write(fd2, buf, n);
if (retval != n) {
if (mediaDevice->close)
(*mediaDevice->close)(mediaDevice, fd);
else
close(fd);
mediaDevice->close(mediaDevice, fd);
dialog_clear();
msgConfirm("Write failure on transfer! (wrote %d bytes of %d bytes)", retval, n);
goto punt;
}
}
(*mediaDevice->close)(mediaDevice, fd);
mediaDevice->close(mediaDevice, fd);
}
close(fd2);
status = mediaExtractDistEnd(zpid, cpid);
@ -397,15 +421,23 @@ distExtract(char *parent, Distribution *me)
done:
if (!status) {
if (OptFlags & OPT_NO_CONFIRM)
if (variable_get(VAR_NO_CONFIRM))
status = TRUE;
else {
if (me[i].my_dist) {
msgConfirm("Unable to transfer all components of the %s distribution.\nIf this is a CDROM install, it may be because export restrictions prohibit\nDES code from being shipped from the U.S. Try to get this code from a\nlocal FTP site instead!");
dialog_clear();
msgConfirm("Unable to transfer all components of the %s distribution.\n"
"If this is a CDROM install, it may be because export restrictions prohibit\n"
"DES code from being shipped from the U.S. Try to get this code from a\n"
"local FTP site instead!", me[i].my_name);
status = TRUE;
}
else
status = msgYesNo("Unable to transfer the %s distribution from %s.\nDo you want to try to retrieve it again?", me[i].my_name, mediaDevice->name);
else {
dialog_clear();
status = msgYesNo("Unable to transfer the %s distribution from %s.\n"
"Do you want to try to retrieve it again?",
me[i].my_name, mediaDevice->name);
}
}
}
/* Extract was successful, remove ourselves from further consideration */
@ -415,24 +447,58 @@ distExtract(char *parent, Distribution *me)
return status;
}
static void
printSelected(char *buf, int selected, Distribution *me)
{
int i;
static int col = 0;
/* Loop through to see if we're in our parent's plans */
for (i = 0; me[i].my_name; i++) {
/* If our bit isn't set, go to the next */
if (!(me[i].my_bit & selected))
continue;
/* This is shorthand for "dist currently disabled" */
if (!me[i].my_dir)
continue;
col += strlen(me[i].my_name);
if (col > 50) {
col = 0;
strcat(buf, "\n");
}
sprintf(&buf[strlen(buf)], " %s", me[i].my_name);
/* Recurse if have a sub-distribution */
if (me[i].my_dist)
printSelected(buf, *(me[i].my_mask), me[i].my_dist);
}
}
int
distExtractAll(char *unused)
distExtractAll(char *ptr)
{
int retries = 0;
char buf[512];
/* First try to initialize the state of things */
if (!(*mediaDevice->init)(mediaDevice))
return 0;
if (!mediaDevice->init(mediaDevice))
return RET_FAIL;
if (!Dists && ptr) {
msgConfirm("You haven't selected any distributions to extract.");
return RET_FAIL;
}
/* Try for 3 times around the loop, then give up. */
while (Dists && ++retries < 3)
distExtract(NULL, DistTable);
/* Anything left? */
if (Dists)
msgConfirm("Couldn't extract all of the distributions. This may\nbe because the specified distributions are not available from the\ninstallation media you've chosen (residue: %0x)", Dists);
/* Close up shop and go home */
(*mediaDevice->shutdown)(mediaDevice);
return 0;
if (Dists) {
printSelected(buf, Dists, DistTable);
dialog_clear();
msgConfirm("Couldn't extract all of the distributions. This may\n"
"be because the following distributions are not available on the\n"
"installation media you've chosen:\n\n\t%s", buf);
}
return RET_SUCCESS;
}

View file

@ -47,21 +47,25 @@
#define DIST_SRC_UBIN 0x1000
#define DIST_SRC_USBIN 0x2000
#define DIST_SRC_BIN 0x4000
#define DIST_SRC_ALL 0xFFFF
#define DIST_SRC_SMAILCF 0x8000
#define DIST_SRC_ALL 0x7FFF /* no SMAILCF, it's part of USBIN */
/* Subtypes for XFree86 distribution */
#define DIST_XF86_BIN 0x0001
#define DIST_XF86_LIB 0x0002
#define DIST_XF86_DOC 0x0004
#define DIST_XF86_MAN 0x0008
#define DIST_XF86_PROG 0x0010
#define DIST_XF86_LINK 0x0020
#define DIST_XF86_PEX 0x0040
#define DIST_XF86_LBX 0x0080
#define DIST_XF86_XINIT 0x0100
#define DIST_XF86_XDMCF 0x0200
#define DIST_XF86_SRC 0x0400
#define DIST_XF86_SERVER 0x0800
#define DIST_XF86_ETC 0x0008
#define DIST_XF86_MAN 0x0010
#define DIST_XF86_CTRB 0x0020
#define DIST_XF86_PROG 0x0040
#define DIST_XF86_LINK 0x0080
#define DIST_XF86_UBIN 0x0100
#define DIST_XF86_PEX 0x0200
#define DIST_XF86_LBX 0x0400
#define DIST_XF86_XINIT 0x0800
#define DIST_XF86_XDMCF 0x1000
#define DIST_XF86_SRC 0x2000
#define DIST_XF86_SERVER 0x4000
#define DIST_XF86_SERVER_8514 0x0001
#define DIST_XF86_SERVER_AGX 0x0002
#define DIST_XF86_SERVER_MACH8 0x0004
@ -75,13 +79,14 @@
#define DIST_XF86_SERVER_W32 0x0400
#define DIST_XF86_SERVER_NEST 0x0800
#define DIST_XF86_SERVER_ALL 0x0FFF
#define DIST_XF86_FONTS 0x1000
#define DIST_XF86_FONTS 0x8000
#define DIST_XF86_FONTS_MISC 0x0001
#define DIST_XF86_FONTS_100 0x0002
#define DIST_XF86_FONTS_SCALE 0x0004
#define DIST_XF86_FONTS_NON 0x0008
#define DIST_XF86_FONTS_SERVER 0x0010
#define DIST_XF86_FONTS_ALL 0x00FF
#define DIST_XF86_FONTS_CYR 0x0004
#define DIST_XF86_FONTS_SCALE 0x0008
#define DIST_XF86_FONTS_NON 0x0010
#define DIST_XF86_FONTS_SERVER 0x0020
#define DIST_XF86_FONTS_ALL 0x003F
#define DIST_XF86_ALL 0xFFFF
#endif

View file

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: dmenu.c,v 1.11.2.11 1995/06/10 19:44:54 jkh Exp $
* $Id: dmenu.c,v 1.12.2.5 1995/10/19 15:55:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -44,7 +44,7 @@
#include "sysinstall.h"
#include <sys/types.h>
#define MAX_MENU 8
#define MAX_MENU 15
/* Traverse menu but give user no control over positioning */
Boolean
@ -68,19 +68,24 @@ dmenuFlagCheck(DMenuItem *item)
char *
dmenuVarCheck(DMenuItem *item)
{
char *cp, *cp2, tmp[256];
char *w, *cp, *cp2, tmp[256];
strncpy(tmp, (char *)item->ptr, 256);
w = (char *)item->parm;
if (!w)
w = (char *)item->ptr;
if (!w)
return "OFF";
strncpy(tmp, w, 256);
if ((cp = index(tmp, '=')) != NULL) {
*(cp++) = '\0';
cp2 = getenv(tmp);
if (cp2)
return !strcmp(cp, cp2) ? "ON" : "OFF";
else
return "OFF";
*(cp++) = '\0';
cp2 = getenv(tmp);
if (cp2)
return !strcmp(cp, cp2) ? "ON" : "OFF";
else
return "OFF";
}
else
return getenv(tmp) ? "ON" : "OFF";
return getenv(tmp) ? "ON" : "OFF";
}
char *
@ -100,6 +105,19 @@ checkHookVal(DMenuItem *item)
return (*item->check)(item);
}
static int
menu_height(DMenu *menu, int n)
{
int max;
char *t;
for (t = menu->title, max = MAX_MENU; *t; t++) {
if (*t == '\n')
--max;
}
return n > max ? max : n;
}
/* Traverse over an internal menu */
Boolean
dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
@ -128,18 +146,17 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
use_helpfile(systemHelpFile(menu->helpfile, buf));
/* Pop up that dialog! */
if (menu->options & DMENU_NORMAL_TYPE) {
if (menu->options & DMENU_NORMAL_TYPE)
rval = dialog_menu((u_char *)menu->title, (u_char *)menu->prompt, -1, -1,
n > MAX_MENU ? MAX_MENU : n, n, (u_char **)nitems, (u_char *)result, choice, scroll);
}
else if (menu->options & DMENU_RADIO_TYPE) {
menu_height(menu, n), n, (u_char **)nitems, (u_char *)result, choice, scroll);
else if (menu->options & DMENU_RADIO_TYPE)
rval = dialog_radiolist((u_char *)menu->title, (u_char *)menu->prompt, -1, -1,
n > MAX_MENU ? MAX_MENU : n, n, (u_char **)nitems, (u_char *)result);
}
else if (menu->options & DMENU_MULTIPLE_TYPE) {
menu_height(menu, n), n, (u_char **)nitems, (u_char *)result);
else if (menu->options & DMENU_MULTIPLE_TYPE)
rval = dialog_checklist((u_char *)menu->title, (u_char *)menu->prompt, -1, -1,
n > MAX_MENU ? MAX_MENU : n, n, (u_char **)nitems, (u_char *)result);
}
menu_height(menu, n), n, (u_char **)nitems, (u_char *)result);
/* This seems to be the only technique that works for getting the display to look right */
dialog_clear();
@ -149,8 +166,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
if (menu->options & DMENU_CALL_FIRST)
tmp = &(menu->items[0]);
else {
if (decode_and_dispatch_multiple(menu, result) ||
menu->options & DMENU_SELECTION_RETURNS) {
if (decode_and_dispatch_multiple(menu, result) || menu->options & DMENU_SELECTION_RETURNS) {
items_free(nitems, curr, max);
return TRUE;
}
@ -160,7 +176,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
if ((tmp = decode(menu, result)) == NULL)
return FALSE;
}
if (dispatch(tmp, result) || (menu->options & DMENU_SELECTION_RETURNS)) {
if (dispatch(tmp, result) == RET_DONE || (menu->options & DMENU_SELECTION_RETURNS)) {
items_free(nitems, curr, max);
return TRUE;
}

View file

@ -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: dos.c,v 1.6.2.1 1995/07/21 10:53:52 rgrimes Exp $
* $Id: dos.c,v 1.7 1995/09/18 16:52:26 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -66,7 +66,7 @@ mediaInitDOS(Device *dev)
if (!RunningAsInit || DOSMounted)
return TRUE;
if (Mkdir("/dos", NULL))
if (Mkdir("/dos", NULL) != RET_SUCCESS)
return FALSE;
memset(&args, 0, sizeof(args));
@ -75,22 +75,32 @@ mediaInitDOS(Device *dev)
args.mask = 0777;
if (mount(MOUNT_MSDOS, "/dos", MNT_RDONLY, (caddr_t)&args) == -1) {
msgConfirm("Error mounting %s on /dos: %s (%u)\n", args.fspec, strerror(errno), errno);
dialog_clear();
msgConfirm("Error mounting %s on /dos: %s (%u)", args.fspec, strerror(errno), errno);
return FALSE;
}
else
msgDebug("Mounted DOS device (%s) on /dos.\n", args.fspec);
DOSMounted = TRUE;
return TRUE;
}
int
mediaGetDOS(Device *dev, char *file, Attribs *dist_attrs)
mediaGetDOS(Device *dev, char *file, Boolean tentative)
{
char buf[PATH_MAX];
msgDebug("Request for %s from DOS\n", file);
snprintf(buf, PATH_MAX, "/dos/freebsd/%s", file);
if (!access(buf, R_OK))
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/dos/freebsd/dists/%s", file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/dos/%s", file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/dos/dists/%s", file);
return open(buf, O_RDONLY);
}
@ -99,11 +109,13 @@ mediaShutdownDOS(Device *dev)
{
if (!RunningAsInit || !DOSMounted)
return;
msgDebug("Unmounting /dos\n");
if (unmount("/dos", MNT_FORCE) != 0)
msgConfirm("Could not unmount the DOS partition: %s\n", strerror(errno));
msgDebug("Unmounting %s from /dos\n", dev->name);
if (unmount("/dos", MNT_FORCE) != 0) {
dialog_clear();
msgConfirm("Could not unmount the DOS partition: %s", strerror(errno));
}
if (isDebug())
msgDebug("Unmount returned\n");
msgDebug("Unmount successful\n");
DOSMounted = FALSE;
return;
}

View file

@ -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: floppy.c,v 1.6.2.17 1995/06/10 09:14:51 jkh Exp $
* $Id: floppy.c,v 1.7.2.8 1995/10/22 17:39:07 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -73,11 +73,11 @@ floppyChoiceHook(char *str)
string_prune(str);
str = string_skipwhite(str);
if (!*str)
return 0;
return RET_FAIL;
devs = deviceFind(str, DEVICE_TYPE_FLOPPY);
if (devs)
floppyDev = devs[0];
return devs ? 1 : 0;
return devs ? RET_DONE : RET_FAIL;
}
/* Our last-ditch routine for getting ROOT from a floppy */
@ -93,11 +93,13 @@ getRootFloppy(void)
devs = deviceFind(NULL, DEVICE_TYPE_FLOPPY);
cnt = deviceCount(devs);
if (!cnt) {
dialog_clear();
msgConfirm("No floppy devices found! Something is seriously wrong!");
return -1;
}
else if (cnt == 1) {
floppyDev = devs[0];
dialog_clear();
msgConfirm("Please insert the ROOT floppy in %s and press [ENTER]", floppyDev->description);
}
else {
@ -121,96 +123,75 @@ Boolean
mediaInitFloppy(Device *dev)
{
struct msdosfs_args dosargs;
struct ufs_args u_args;
if (floppyMounted)
return TRUE;
if (Mkdir("/mnt", NULL)) {
if (Mkdir("/dist", NULL)) {
dialog_clear();
msgConfirm("Unable to make directory mountpoint for %s!", dev->devname);
return FALSE;
}
if (!distWanted)
msgDebug("Init floppy called for %s distribution.\n", distWanted ? distWanted : "some");
if (!distWanted) {
dialog_clear();
msgConfirm("Please insert next floppy into %s", dev->description);
else {
msgConfirm("Please insert floppy containing %s into %s", distWanted, dev->description);
distWanted = NULL;
}
else {
dialog_clear();
msgConfirm("Please insert floppy containing %s into %s", distWanted, dev->description);
}
memset(&dosargs, 0, sizeof dosargs);
dosargs.fspec = dev->devname;
dosargs.uid = dosargs.gid = 0;
dosargs.mask = 0777;
if (mount(MOUNT_MSDOS, "/mnt", 0, (caddr_t)&dosargs) == -1) {
msgConfirm("Error mounting floppy %s (%s) on /mnt : %s", dev->name, dev->devname, strerror(errno));
return FALSE;
memset(&u_args, 0, sizeof(u_args));
u_args.fspec = dev->devname;
if (mount(MOUNT_MSDOS, "/dist", MNT_RDONLY, (caddr_t)&dosargs) == -1) {
if (mount(MOUNT_UFS, "/dist", MNT_RDONLY, (caddr_t)&u_args) == -1) {
dialog_clear();
msgConfirm("Error mounting floppy %s (%s) on /dist : %s", dev->name, dev->devname, strerror(errno));
return FALSE;
}
}
if (isDebug())
msgDebug("initFloppy: mounted floppy %s successfully on /mnt\n", dev->devname);
msgDebug("initFloppy: mounted floppy %s successfully on /dist\n", dev->devname);
floppyMounted = TRUE;
distWanted = NULL;
return TRUE;
}
int
mediaGetFloppy(Device *dev, char *file, Attribs *dist_attrs)
mediaGetFloppy(Device *dev, char *file, Boolean tentative)
{
char buf[PATH_MAX];
#ifdef DO_CRC_CHECK
char *extn, *var;
const char *val;
char attrib[10];
u_long cval1, clen1, cval2, clen2;
#endif
int fd;
int nretries = 5;
snprintf(buf, PATH_MAX, "/mnt/%s", file);
snprintf(buf, PATH_MAX, "/dist/%s", file);
if (access(buf, R_OK)) {
if (dev->flags & OPT_EXPLORATORY_GET)
msgDebug("Request for %s from floppy on /dist, tentative is %d.\n", buf, tentative);
if (!file_readable(buf)) {
if (tentative)
return -1;
else {
while (access(buf, R_OK) != 0) {
while (!file_readable(buf)) {
if (!--nretries) {
msgConfirm("GetFloppy: Failed to get %s after retries;\ngiving up.", file);
dialog_clear();
msgConfirm("GetFloppy: Failed to get %s after retries;\ngiving up.", buf);
return -1;
}
distWanted = buf;
(*dev->shutdown)(dev);
if (!(dev->init)(dev))
mediaShutdownFloppy(dev);
if (!mediaInitFloppy(dev))
return -1;
}
}
}
fd = open(buf, O_RDONLY);
#ifdef DO_CRC_CHECK
if (dist_attrs != NULL && fd != -1) {
extn = rindex(buf, '.');
snprintf(attrib, 10, "cksum%s", extn);
val = attr_match(dist_attrs, attrib);
if (val != NULL) {
if (isDebug())
msgDebug("attr_match(%s,%s) returned `%s'\n", dist_attrs, attrib, val);
var = strdup(val);
cval1 = strtol(var, &extn, 10);
clen1 = strtol(extn, NULL, 10);
if (crc(fd, &cval2, &clen2) != 0) {
msgConfirm("crc() of file `%s' failed!", file);
close(fd);
return -1;
}
if ((cval1 != cval2) || (clen1 != clen2)) {
msgConfirm("Invalid file `%s' (checksum `%u %u' should be %s)", file, cval2, clen2, var);
close(fd);
return -1;
}
lseek(fd, 0, 0);
}
else
msgNotify("No checksum information for file %s..", file);
}
#endif
return fd;
}
@ -218,10 +199,12 @@ void
mediaShutdownFloppy(Device *dev)
{
if (floppyMounted) {
if (unmount("/mnt", MNT_FORCE) != 0)
msgDebug("Umount of floppy on /mnt failed: %s (%d)\n", strerror(errno), errno);
if (unmount("/dist", MNT_FORCE) != 0)
msgDebug("Umount of floppy on /dist failed: %s (%d)\n", strerror(errno), errno);
else {
floppyMounted = FALSE;
msgDebug("Floppy unmounted successfully.\n");
dialog_clear();
msgConfirm("You may remove the floppy from %s", dev->description);
}
}

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: ftp.c,v 1.13.2.9 1995/06/05 18:34:15 jkh Exp $
* $Id: ftp.c,v 1.14.2.1 1995/10/21 14:06:35 jkh Exp $
*
* Return values have been sanitized:
* -1 error, but you (still) have a session.
@ -34,6 +34,9 @@
/* Handy global for us to stick the port # */
int FtpPort;
/* How to see by a given code whether or not the connection has timed out */
#define FTP_TIMEOUT(code) (code == 421)
#ifndef STANDALONE_FTP
#include "sysinstall.h"
#endif /*STANDALONE_FTP*/
@ -288,7 +291,7 @@ FtpGet(FTP_t ftp, char *file)
return botch(ftp,"FtpGet","open");
if(ftp->binary) {
i = cmd(ftp,"TYPE I");
if (i < 0)
if (i < 0 || FTP_TIMEOUT(i))
return zap(ftp);
if (i > 299)
return -1;
@ -331,7 +334,7 @@ FtpGet(FTP_t ftp, char *file)
}
ftp->fd_xfer = s;
i = cmd(ftp,"RETR %s",file);
if (i < 0) {
if (i < 0 || FTP_TIMEOUT(i)) {
close(s);
return zap(ftp);
}
@ -374,11 +377,14 @@ FtpGet(FTP_t ftp, char *file)
close(s);
return zap(ftp);
}
else if (i > 299) {
else if (i > 299 || FTP_TIMEOUT(i)) {
if (isDebug())
msgDebug("FTP: No such file %s, moving on.\n", file);
close(s);
return -1;
if (FTP_TIMEOUT(i))
return zap(ftp);
else
return -1;
}
ftp->fd_xfer = accept(s, 0, 0);
if (ftp->fd_xfer < 0) {

View file

@ -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: ftp_strat.c,v 1.6.2.25 1995/06/07 09:53:14 jkh Exp $
* $Id: ftp_strat.c,v 1.7.2.40 1995/11/08 07:09:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -52,53 +52,69 @@
#include <netdb.h>
#include "ftp.h"
Boolean ftpInitted;
Boolean ftpInitted = FALSE;
static FTP_t ftp;
extern int FtpPort;
int
mediaSetFtpUserPass(char *str)
{
char *user, *pass;
dialog_clear();
if ((user = msgGetInput(getenv(FTP_USER), "Please enter the username you wish to login as")) != NULL)
variable_set2(FTP_USER, user);
if ((pass = msgGetInput(getenv(FTP_PASS), "Please enter the password for this user.\nWARNING: This password will echo on the screen!")) != NULL)
variable_set2(FTP_PASS, pass);
dialog_clear();
return 0;
}
static char *lastRequest;
static Boolean
get_new_host(Device *dev)
get_new_host(Device *dev, Boolean tentative)
{
Boolean i;
int j;
char *oldTitle = MenuMediaFTP.title;
Device *netDev = dev->private;
char *cp = variable_get(VAR_FTP_ONERROR);
MenuMediaFTP.title = "Connection timed out - please select another site";
i = mediaSetFTP(NULL);
MenuMediaFTP.title = oldTitle;
if (i) {
char *cp = getenv(FTP_USER);
if (cp && *cp)
(void)mediaSetFtpUserPass(NULL);
netDev->flags |= OPT_LEAVE_NETWORK_UP;
(*dev->shutdown)(dev);
i = (*dev->init)(dev);
netDev->flags &= ~OPT_LEAVE_NETWORK_UP;
if (tentative || (cp && strcmp(cp, "reselect")))
i = TRUE;
else {
i = FALSE;
dialog_clear();
msgConfirm("The %s file failed to load from the FTP site you\n"
"selected. Please select another one from the FTP menu.", lastRequest ? lastRequest : "requested");
MenuMediaFTP.title = "Request failed - please select another site";
j = mediaSetFTP(NULL);
MenuMediaFTP.title = oldTitle;
if (j == RET_SUCCESS) {
/* Bounce the link if necessary */
if (ftpInitted) {
msgDebug("Bouncing FTP connection before reselecting new host.\n");
dev->shutdown(dev);
i = dev->init(dev);
}
}
else {
msgDebug("User elected not to reselect, shutting down open connection.\n");
dev->shutdown(dev);
}
}
return i;
}
static Boolean HasDistsDir;
/* Should we throw in the towel? */
static Boolean
ftpShouldAbort(Device *dev, int retries)
{
char *cp, *cp2;
int maxretries, rval = FALSE;
cp = variable_get(VAR_FTP_ONERROR);
cp2 = variable_get(VAR_FTP_RETRIES);
maxretries = atoi(cp2);
if (retries > maxretries || (cp && !strcmp(cp, "abort"))) {
rval = TRUE;
if (isDebug())
msgDebug("Aborting FTP connection.\n");
dev->shutdown(dev);
}
return rval;
}
Boolean
mediaInitFTP(Device *dev)
{
int i, retries, max_retries = MAX_FTP_RETRIES;
int i, retries;
char *cp, *hostname, *dir;
char *user, *login_name, password[80], url[BUFSIZ];
Device *netDevice = (Device *)dev->private;
@ -106,25 +122,29 @@ mediaInitFTP(Device *dev)
if (ftpInitted)
return TRUE;
if (!(*netDevice->init)(netDevice))
if (isDebug())
msgDebug("Init routine for FTP called. Net device is %x\n", netDevice);
if (!netDevice->init(netDevice))
return FALSE;
if ((ftp = FtpInit()) == NULL) {
if (!ftp && (ftp = FtpInit()) == NULL) {
dialog_clear();
msgConfirm("FTP initialisation failed!");
goto punt;
return FALSE;
}
cp = variable_get(VAR_FTP_PATH);
if (!cp) {
dialog_clear();
msgConfirm("%s is not set!", VAR_FTP_PATH);
return FALSE;
}
if (isDebug())
msgDebug("Initialized FTP library.\n");
cp = getenv("ftp");
if (!cp)
goto punt;
if (isDebug())
msgDebug("Attempting to open connection for: %s\n", cp);
hostname = getenv(VAR_HOSTNAME);
msgDebug("Attempting to open connection for URL: %s\n", cp);
hostname = variable_get(VAR_HOSTNAME);
if (strncmp("ftp://", cp, 6) != NULL) {
dialog_clear();
msgConfirm("Invalid URL: %s\n(A URL must start with `ftp://' here)", cp);
goto punt;
return FALSE;
}
strncpy(url, cp, BUFSIZ);
if (isDebug())
@ -145,118 +165,145 @@ mediaInitFTP(Device *dev)
}
msgNotify("Looking up host %s..", hostname);
if ((gethostbyname(hostname) == NULL) && (inet_addr(hostname) == INADDR_NONE)) {
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\nname server, gateway and network interface are configured?", hostname);
goto punt;
dialog_clear();
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n"
"name server, gateway and network interface are configured?", hostname);
netDevice->shutdown(netDevice);
return FALSE;
}
user = getenv(FTP_USER);
user = variable_get(VAR_FTP_USER);
if (!user || !*user) {
snprintf(password, BUFSIZ, "installer@%s", hostname);
snprintf(password, BUFSIZ, "installer@%s", variable_get(VAR_HOSTNAME));
login_name = "anonymous";
}
else {
login_name = user;
strcpy(password, getenv(FTP_PASS) ? getenv(FTP_PASS) : login_name);
strcpy(password, variable_get(VAR_FTP_PASS) ? variable_get(VAR_FTP_PASS) : login_name);
}
retries = i = 0;
if (OptFlags & (OPT_FTP_RESELECT + OPT_FTP_ABORT))
max_retries = 0;
retries = 0;
retry:
if (i && ++retries > max_retries) {
if ((OptFlags & OPT_FTP_ABORT) || !get_new_host(dev))
return FALSE;
retries = 0;
}
msgNotify("Logging in as %s..", login_name);
if ((i = FtpOpen(ftp, hostname, login_name, password)) != 0) {
if (OptFlags & OPT_NO_CONFIRM)
msgNotify("Couldn't open FTP connection to %s\n", hostname);
else
msgConfirm("Couldn't open FTP connection to %s\n", hostname);
if (FtpOpen(ftp, hostname, login_name, password) != 0) {
if (variable_get(VAR_NO_CONFIRM))
msgNotify("Couldn't open FTP connection to %s", hostname);
else {
dialog_clear();
msgConfirm("Couldn't open FTP connection to %s", hostname);
}
if (ftpShouldAbort(dev, ++retries) || !get_new_host(dev, FALSE))
return FALSE;
goto retry;
}
FtpPassive(ftp, (OptFlags & OPT_FTP_PASSIVE) ? 1 : 0);
FtpPassive(ftp, !strcmp(variable_get(VAR_FTP_STATE), "passive"));
FtpBinary(ftp, 1);
if (dir && *dir != '\0') {
msgNotify("CD to distribution in ~ftp/%s", dir);
if ((i = FtpChdir(ftp, dir)) == -2)
msgNotify("Attempt to chdir to distribution in %s..", dir);
if ((i = FtpChdir(ftp, dir)) != 0) {
if (i == -2 || ftpShouldAbort(dev, ++retries))
goto punt;
else if (get_new_host(dev, FALSE))
retries = 0;
goto retry;
}
}
if (!FtpChdir(ftp, "dists")) {
HasDistsDir = TRUE;
FtpChdir(ftp, ".."); /* Hope this works! :-( */
}
else
HasDistsDir = FALSE;
/* Give it a shot - can't hurt to try and zoom in if we can, unless we get a hard error back that is! */
if (FtpChdir(ftp, getenv(VAR_RELNAME)) == -2)
goto punt;
if (isDebug())
msgDebug("leaving mediaInitFTP!\n");
msgDebug("mediaInitFTP was successful (logged in and chdir'd)\n");
ftpInitted = TRUE;
return TRUE;
punt:
FtpClose(ftp);
ftp = NULL;
(*netDevice->shutdown)(netDevice);
if (ftp != NULL) {
FtpClose(ftp);
ftp = NULL;
}
return FALSE;
}
int
mediaGetFTP(Device *dev, char *file, Attribs *dist_attrs)
mediaGetFTP(Device *dev, char *file, Boolean tentative)
{
int fd;
int nretries = 0, max_retries = MAX_FTP_RETRIES;
Boolean inDists = FALSE;
int nretries;
char *fp;
char buf[PATH_MAX];
if (OptFlags & (OPT_FTP_RESELECT + OPT_FTP_ABORT) || dev->flags & OPT_EXPLORATORY_GET)
max_retries = 1;
fp = file;
nretries = 0;
while ((fd = FtpGet(ftp, file)) < 0) {
lastRequest = file;
while ((fd = FtpGet(ftp, fp)) < 0) {
/* If a hard fail, try to "bounce" the ftp server to clear it */
if (fd == -2 || ++nretries > max_retries) {
if ((OptFlags & OPT_FTP_ABORT) || (dev->flags & OPT_EXPLORATORY_GET))
return -1;
else if (!get_new_host(dev))
if (fd == -2 && ++nretries < atoi(variable_get(VAR_FTP_RETRIES))) {
dev->shutdown(dev);
/* If we can't re-initialize, just forget it */
if (!dev->init(dev))
return -2;
nretries = 0;
continue;
}
if (HasDistsDir) {
if (!inDists) {
FtpChdir(ftp, "dists");
inDists = TRUE;
}
else {
FtpChdir(ftp, "..");
inDists = FALSE;
else if (tentative || ftpShouldAbort(dev, ++nretries))
return -1;
else {
/* Try some alternatives */
switch (nretries) {
case 1:
sprintf(buf, "dists/%s", file);
fp = buf;
break;
case 2:
sprintf(buf, "%s/%s", variable_get(VAR_RELNAME), file);
fp = buf;
break;
case 3:
sprintf(buf, "%s/dists/%s", variable_get(VAR_RELNAME), file);
fp = buf;
break;
case 4:
fp = file;
if (get_new_host(dev, tentative)) {
nretries = 0;
continue;
}
else
break;
}
}
}
if (inDists)
FtpChdir(ftp, "..");
return fd;
}
Boolean
mediaCloseFTP(Device *dev, int fd)
{
FtpEOF(ftp);
if (!close(fd))
return (TRUE);
if (isDebug())
msgDebug("FTP Close called\n");
if (ftp)
FtpEOF(ftp);
return FALSE;
}
void
mediaShutdownFTP(Device *dev)
{
Device *netdev = (Device *)dev->private;
/* Device *netdev = (Device *)dev->private; */
if (!ftpInitted)
return;
if (isDebug())
msgDebug("FTP shutdown called. FTP = %x\n", ftp);
if (ftp != NULL) {
FtpClose(ftp);
ftp = NULL;
}
(*netdev->shutdown)(netdev);
/* (*netdev->shutdown)(netdev); */
ftpInitted = FALSE;
}

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: globals.c,v 1.9.2.2 1995/06/05 03:15:38 jkh Exp $
* $Id: globals.c,v 1.10.2.1 1995/10/21 14:06:41 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -55,9 +55,7 @@ Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
Device *mediaDevice; /* Where we're installing from */
unsigned int OptFlags; /* Option flags */
int BootMgr;
char *InstallPrefix; /* Always install under here */
/*
* Yes, I know some of these are already automatically initialized as
@ -73,6 +71,4 @@ globalsInit(void)
VarHead = NULL;
mediaDevice = NULL;
RunningAsInit = FALSE;
OptFlags = 0;
InstallPrefix = NULL;
}

View file

@ -1,6 +1,8 @@
README for XFree86 3.1.1u1 on FreeBSD 2.0.5
README for XFree86 3.1.2 on FreeBSD 2.1
Rich Murphey, David Dawes
20 January 1995
[Last Updated: 14 October 1995]
1. What and Where is XFree86?
------------------------------
@ -14,7 +16,7 @@ well as binary distributions for many architectures.
See the Copyright Notice (COPYRIGHT.html).
The sources for XFree86 are available as part of the FreeBSD 2.0.5
The sources for XFree86 are available as part of the FreeBSD 2.1
distribution, or by anonymous ftp from:
ftp.XFree86.org:/pub/XFree86/current
@ -22,7 +24,7 @@ ftp.XFree86.org:/pub/XFree86/current
Binaries for XFree86 on FreeBSD are also available as part of
2.0.5 or from:
2.1 or from:
ftp.XFree86.org:/pub/XFree86/current/binaries/FreeBSD-2.0
(ftp://ftp.XFree86.org/pub/XFree86/current/binaries/FreeBSD-2.0)
@ -37,7 +39,7 @@ comments or suggestions about this file and we'll revise it.
2. Installing the Binaries
---------------------------
In the FreeBSD 2.0.5 distribution, XFree86 comes in 3 major sections:
In the FreeBSD 2.1 distribution, XFree86 comes in 3 major sections:
"basic" distributions, fonts and servers. At the minimum, you will
need the binaries and libraries from the basic distribution, the
"misc" fonts collection and at least one server. The smallest usable
@ -47,102 +49,108 @@ If you can't decide what to pick and you have 52Mb of disk
space, it's safe to unpack everything.
What follows is a description of the various distribution files
comprising XFree86. If you are installing this as part of FreeBSD
2.0.5 then there's no need to use these files directly: You may
simply check the desired components off the installation menus
provided for that purpose. If you're installing this manually,
then the following information should prove useful:
comprising XFree86. If you are installing this as part of FreeBSD 2.1
then there's no need to use these files directly: You may simply check
the desired components off the installation menus provided for that
purpose. If you're installing this manually, then the following
information should prove useful:
Required (6.7Mb):
X311bin.tgz
X312bin.tgz
all the executable X client applications and shared libs
X311fnts.tgz
X312fnts.tgz
the misc and 75 dpi fonts
X311lib.tgz
X312lib.tgz
data files needed at runtime
Required unless you have already customized your configuration
files:
X311xicf.tgz
X312xicf.tgz
customizable xinit runtime configuration file
X311xdcf.tgz
X312xdcf.tgz
customizable xdm runtime configuration file
Choose at least one server ( 2.3Mb):
X3118514.tgz
X3128514.tgz
8-bit color for IBM 8514 and true compatibles.
X311AGX.tgz
X312AGX.tgz
8-bit color for AGX boards.
X311Mch3.tgz
X312Mch3.tgz
8 and 16-bit color for ATI Mach32 boards.
X311Mch8.tgz
X312Mch8.tgz
8-bit color for ATI Mach8 boards.
X311Mono.tgz
X312Mono.tgz
1-bit monochrome for VGA, Super-VGA, Hercules, and others.
X311P9K.tgz
X312P9K.tgz
8, 16, and 24-bit color for Weitek P9000 boards (Diamond
Viper).
X311S3.tgz
X312S3.tgz
8, 16 and 24-bit color for S3 boards (#9 GXE, Actix GE32,
SPEA Mercury, STB Pegasus)
X311SVGA.tgz
X312SVGA.tgz
8-bit color for Super-VGA cards.
X311VG16.tgz
X312VG16.tgz
4-bit color for VGA and Super-VGA cards
X311W32.tgz
X312W32.tgz
8-bit Color for ET4000/W32, /W32i and /W32p cards.
X311nest.tgz
X312nest.tgz
A nested server running as a client window on another
display.
Optional:
X311doc.tgz
X312doc.tgz
(.5Mb) READMEs and XFree86 specific man pages
X311man.tgz
X312man.tgz
(1.7Mb) man pages except XFree86 specific ones in etc archive
X311f100.tgz
X312ctrb.tgz
(1.0Mb) Contributed clients like ico, xeyes, etc.
X312f100.tgz
(1.8Mb) 100dpi fonts
X311fscl.tgz
X312fcyr.tgz
(1.8Mb) Cyrillic fonts
X312fscl.tgz
(1.6Mb) Speedo and Type1 fonts
X311fnon.tgz
X312fnon.tgz
(3.3Mb) Japanese, Chinese and other non-English fonts
X311fsrv.tgz
X312fsrv.tgz
(.3Mb) the font server and it's man page
X311prog.tgz
X312prog.tgz
(3.9Mb) config, lib*.a and *.h files needed only for
compiling
X311link.tgz
X312link.tgz
(7.8Mb) X server reconfiguration kit
X311pex.tgz
X312pex.tgz
(.5Mb) PEX fonts and shared libs needed by PEX applications.
X311lbx.tgz
X312lbx.tgz
(.2Mb) low bandwidth X proxy server and libraries.
Note that there is no longer a separate xdm archive. FreeBSD 2.0
@ -154,8 +162,8 @@ us to provide separate tar balls.
2.1. Full Install:
-------------------
[ Note: Unless you're installing XFree86 3.1.1u1 manually, that is
to say not as part of the FreeBSD 2.0.5 installation, you may skip
[ Note: Unless you're installing XFree86 3.1.2 manually, that is
to say not as part of the FreeBSD 2.1 installation, you may skip
to section 2.3 ]
1. You must be logged in as root to unpack the archives because
@ -181,14 +189,14 @@ us to provide separate tar balls.
If you are using sh (as root usually does):
# for i in X311*.tgz; do
# for i in X312*.tgz; do
# tar -xzf $i
# done
Else, if you are using csh:
% foreach i (X311*.tgz)
% foreach i (X312*.tgz)
% tar -xzf $i
% end
@ -207,7 +215,7 @@ us to provide separate tar balls.
First do numbers 1 and 2 above. Then unpack the required archives:
# for i in bin fnts lib xicf; do
# tar -xzf X311$i.tgz
# tar -xzf X312$i.tgz
# done
@ -216,7 +224,7 @@ server man pages, X11R6/man/man1/XF86_*, list the vga chip sets
supported by each server. For example, if you have an ET4000 based
card you will use the XF86_SVGA server:
# tar -xzf X311SVGA.tgz
# tar -xzf X312SVGA.tgz
# cd /usr/X11R6/bin; rm X; ln -s XF86_SVGA X
@ -256,7 +264,6 @@ applications.
abort with the message ``could not open default font
'fixed'''.
3. Installing The Display Manager (xdm)
----------------------------------------
@ -286,6 +293,11 @@ The XF86Config file tells the X server what kind of monitor, video
card and mouse you have. You must create it to tell the server what
specific hardware you have.
If you are installing XFree86 as part of FreeBSD 2.1, you may invoke
XF86Config automatically from the FreeBSD configuration menu. You
should still read this document first, however, as it contains
valuable information on mouse and VGA card selection below.
XFree86 3.1 uses a new configuration file format. Consult the
XF86Config man page and the general INSTALL (INSTALL.html) file for
instructions.
@ -311,25 +323,61 @@ You'll need info on your hardware:
o Your monitor's sync frequencies.
The easiest way to find which device your mouse is plugged into is to
Bus Mice:
In FreeBSD, the bus mouse is generally found on /dev/mse0. Specify
/dev/mse0 when asked, and in case of failure ensure that your Bus
mouse was indeed "probed" when the system was booted. To make
sure of this, type:
% dmesg | grep mse
If you do not see something like this:
mse0 at 0x23c irq 5 on isa
then it means that your bus mouse was not detected properly and you
should reboot with the `-c' flag and verify that the device entry for
mse0 matches your bus mouse settings.
If the mouse is probed properly but still fails to function then you
might double check that the /dev entry for the bus mouse exists. Use
the script /dev/MAKEDEV to create the entry if it doesn't already
exist, e.g:
% cd /dev
% sh MAKEDEV mse0
Serial Mice:
The easiest way to find which port your mouse is plugged into is to
use ``cat'' or ``kermit'' to look at the output of the mouse. Connect
to it and just make sure that it generates output when the mouse is
moved or clicked:
moved or clicked. If your mouse is plugged into the first serial port
(COM1), for example, you could do this:
% cat < /dev/cuaa0
If you can't find the right mouse device then use ``dmesg|grep sio''
to get a list of devices that were detected upon booting:
Where /dev/cuaa0 represents the first serial port, /dev/cuaa1 the
second, /dev/cuaa2 the third and so on.
If you can't find the right mouse port then use ``dmesg | grep sio''
to get a list of serial devices that were detected at boot time:
% dmesg|grep sio
sio0 at 0x3f8-0x3ff irq 4 on isa
Then double check the /dev entries corresponding to these devices.
Use the script /dev/MAKEDEV to create entries if they don't already
exist:
The presence of sio0 will indicate that COM1 was found. If you see
sio1, sio2 or sio3 then it means that a serial port was found at one
of the other com addresses and you should use the appropriate
/dev/cuaa<n> device entry to talk to it.
If things still aren't working then double check that the /dev entries
corresponding to these devices exist. Use the script /dev/MAKEDEV to
create entries if they don't already exist, e.g:
% cd /dev
% sh MAKEDEV cuaa0
% sh MAKEDEV cuaa0 [cuaa1, cuaa2, etc..]
If you plan to fine tune the screen size or position on your monitor
you'll need the specs for sync frequencies from your monitor's manual.
@ -358,7 +406,7 @@ your home directory as described in the xinit and startx man pages.
6. Rebuilding Kernels for X
----------------------------
The GENERIC FreeBSD 2.0 kernel supports XFree86 without any
The GENERIC FreeBSD 2.x kernel supports XFree86 without any
modifications required. You do not need to make any changes to the
GENERIC kernel or any kernel configuration which is a superset.
@ -368,6 +416,9 @@ smm.02.config.ps.Z
a ready-to-print postscript copy of the kernel configuration chapter
from the system maintainers manual.
Alternatively, you can read the kernel configuration section of the
FreeBSD handbook (http://www.freebsd.org/handbook).
If you do decide to reduce your kernel configuration file, do not
remove the two lines below (in /sys/arch/i386/conf). They are both
required for X support:
@ -375,8 +426,8 @@ required for X support:
options XSERVER #Xserver
options UCONSOLE #X Console support
The generic FreeBSD 2.0 kernel is configured by default with the
syscons driver. To configure your kernel similarly it should have a
The generic FreeBSD 2.x kernel is configured by default with the
syscons driver. To configure your kernel similarly, it should have a
line like this in /usr/src/sys/i386/conf/GENERIC:
device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr

View file

@ -3,12 +3,8 @@ process is complete. At the minimum, you should probably set the
system manager's password and the system time zone.
For extra goodies like bash, emacs, pascal, etc., you should look at
the Packages item in this menu. Currently, the Packages option is
only useful if you have a CDROM or an existing packages collection
somewhere in the file system hierarchy where the package management
tool can locate it. The automatic transfer of packages via FTP is not
yet supported!
the Packages item in this menu.
For setting the timezone after the system is installed, type
``tzsetup''. For more information on the general system
``tzsetup''. For more information on the overall general system
configuration, see the ``/etc/sysconfig'' file.

View file

@ -1,5 +1,5 @@
An ``X-'' prefixed before a distribution set means that the XFree86
3.1.1u1 base distribution, libraries, manual pages, SVGA server and a
3.1.2-S base distribution, libraries, manual pages, SVGA server and a
set of default fonts will be selected in addition to the set itself.
If you select such a set, you will also be presented with a set of
@ -9,37 +9,32 @@ setup.
N.B. All references in this document to `complete source' mean the
complete source tree minus any legally encumbered cryptography code.
The current "canned" installations are as follows:
The current "canned" installations are provided:
Developer: Base ("bin") distribution, man pages, dictionary
files, profiling libraries and the complete source tree.
Kern-Developer: As above, but with only kernel sources instead of
the complete source tree.
User: The base distribution, man pages, dictionary files and
the FreeBSD 1.x and 2.0 compatibility sets.
Minimal: Only the base distribution.
Everything: The base distribution, man pages, dictionary files,
profiling libraries, the FreeBSD 1.x and the FreeBSD 2.0
compatibility libraries, the complete source tree,
games and your choice of XFree86 distribution components.
N.B. Still no cryptocraphy source code!
Note that the cryptocraphy source code is NOT included
in this collection. You will need to select that by
hand if you're inside the United States.
Custom: Allows you to modify or create your distribution set on
a piece-by-piece basis.
Reset: Clear all currently selected distributions.
---
When using Custom, most of the sub-distribution choices are fairly
@ -51,15 +46,6 @@ obvious, though two possible exceptions may be the "commerce" and
under special arrangement, limited functionality demos, shareware
products (you like it, you buy it), etc.
At the time of this writing, there are unfortunately not enough
commercial offerings to justify a fully split distribution set,
so each product is available both as a subdirectory and as part
of one large archive file. If you select "commerce" from the
distributions submenus then you'll get the big file containing
the entire collection copied to your hard disk. Don't do this
unless you've got at least 10MB to devote to it!
* The "xperimnt" directory contains, not surprisingly, experimental
offerings. Unfinished (or work-in-progress) features, special
purpose drivers and packages, strange proof-of-concept stuff,
@ -74,15 +60,18 @@ obvious, though two possible exceptions may be the "commerce" and
You may also notice that certain distributions, like "des" and "krb",
are marked "NOT FOR EXPORT!" This is because it's illegal to
export them from the United States (or any other country which
considers encryption technology to be on its restricted export
list). Since breaking this law only gets the _originating_ site
(US!) in trouble, please do not load these distributions from U.S.
servers!
are marked "NOT FOR EXPORT!" This is because it's illegal to export
them from the United States (or any other country which considers
encryption technology to be on its restricted export list). Since
breaking this law only gets the _originating_ site (US!) in trouble,
please do not load these distributions from U.S. servers! We don't
like these restrictions any more than you do, but can't do much about
it (write your U.S. congressperson!).
A number of "foreign" servers do exist for the benefit of
non-U.S. sites, one of which is "skeleton.mikom.csir.co.za".
non-U.S. sites, the official site being:
ftp://ftp.internat.freebsd.org/pub/FreeBSD
Please get all such export restricted software from there
if you are outside the U.S., thanks!

View file

@ -1,7 +1,7 @@
If you are going to actually install some portion of FreeBSD on a
drive then PLEASE BE VERY CERTAIN that the Geometry reported in the
Partition Editor (see Installation Menu) is the correct one for your
drive and controller combination!
Partition Editor is the correct one for your drive and controller
combination!
IDE drives often have a certain geometry set during the PC BIOS setup,
or (in the case of larger IDE drives) have their geometry "remapped"

View file

@ -1,11 +1,11 @@
Hardware Documentation Guide: $Id: hardware.hlp,v 1.12.2.1 1995/08/14 10:49:29 rgrimes Exp $
Hardware Documentation Guide: $Id: hardware.hlp,v 1.1.2.10 1995/11/04 08:48:00 jkh Exp $
Table of Contents
-----------------
0. Document Conventions
1. Using UserConfig to change FreeBSD kernel settings
2. Default Configuration (GENERIC kernel)
1. Default Configuration (GENERIC kernel)
2. Using UserConfig to change FreeBSD kernel settings
3. LINT - other possible configurations.
4. Known Hardware Problems.
@ -14,11 +14,114 @@ Table of Contents
0. Document Conventions
-- --------------------
We have `underlined' text which represents user input with `-'
symbols throughout this document to differentiate it from
the machine output.
We have `underlined' text which represents user input with `-' symbols
throughout this document to differentiate it from the machine output.
1. Using UserConfig to change FreeBSD kernel settings
1. Default (GENERIC) Configuration
-- -------------------------------
The following table contains a list of all of the devices that are
present in the GENERIC kernel, that being the kernel (the operating
system) that was placed in your root partition during the FreeBSD
installation process. A compressed version of the GENERIC kernel is
also used on the installation floppy diskette and DOS boot image.
The table describes the various parameters used by the driver to
communicate with the hardware in your system. There are four
parameters in the table, though not all are used by each and every
device.
Detail:
Port The starting I/O port used by the device, shown in hexadecimal.
IOMem The lowest (or starting) memory address used by the device,
also shown in hexadecimal.
IRQ The interrupt the device uses to alert the driver to an event,
given in decimal.
DRQ The DMA (direct memory access) channel the device uses to move
data to and from main memory, also given in decimal.
If an entry in the table has `n/a' for a value then it means that the
parameter in question does not apply to that device. A value of `dyn'
means that the correct value should be determined automatically by the
kernel when the system boots.
FreeBSD GENERIC kernel:
Port IRQ DRQ IOMem Description
---- --- --- ----- ---------------------------------
fdc0 3f0 6 2 n/a Floppy disk controller
wdc0 1f0 14 n/a n/a IDE/MFM/RLL disk controller
wdc1 170 15 n/a n/a IDE/MFM/RLL disk controller
ncr0 n/a n/a n/a n/a NCR PCI SCSI controller
ahc0 n/a n/a n/a n/a Adaptec 294x PCI SCSI controller
bt0 330 dyn dyn dyn Buslogic SCSI controller
uha0 330 dyn 6 dyn Ultrastore 14f
ahc1 dyn dyn dyn dyn Adaptec 274x/284x SCSI controller
ahb0 dyn dyn dyn dyn Adaptec 174x SCSI controller
aha0 330 dyn 5 dyn Adaptec 154x SCSI controller
aic0 340 11 dyn dyn Adaptec 152x/AIC-6360 SCSI
controller
nca0 1f88 10 dyn dyn ProAudioSpectrum cards
nca1 350 5 dyn dyn ProAudioSpectrum cards
sea0 dyn 5 dyn c8000 Seagate ST01/02 8 bit controller
wt0 300 5 1 dyn Wangtek and Archive QIC-02/QIC-36
mcd0 300 10 n/a n/a Mitsumi CD-ROM
mcd1 340 11 n/a n/a Mitsumi CD-ROM
matcd0 230 n/a n/a n/a Matsushita/Panasonic CD-ROM
scd0 230 n/a n/a n/a Sony CD-ROM
sio0 3f8 4 n/a n/a Serial Port 0 (COM1)
sio1 2f8 3 n/a n/a Serial Port 1 (COM2)
sio2 3e8 5 n/a n/a Serial Port 2 (COM3)
sio3 2e8 9 n/a n/a Serial Port 3 (COM4)
lpt0 dyn 7 n/a n/a Printer Port 0
lpt1 dyn dyn n/a n/a Printer Port 1
lpt2 dyn dyn n/a n/a Printer Port 2
de0 n/a n/a n/a n/a DEC DC21x40 PCI based cards
(including 21140 100bT cards)
ed0 280 5 dyn d8000 WD & SMC 80xx; Novell NE1000 &
NE2000; 3Com 3C503
ed1 300 5 dyn d8000 Same as ed0
eg0 310 5 dyn dyn 3Com 3C505
ep0 300 10 dyn dyn 3Com 3C509
ie0 360 7 dyn d0000 AT&T StarLAN 10 and EN100;
3Com 3C507; NI5210
ix0 300 10 dyn d0000 Intel EtherExpress cards
le0 300 5 dyn d0000 Digital Equipment EtherWorks
2 and EtherWorks 3
lnc0 280 10 n/a dyn Lance/PCnet cards
(Isolan, Novell NE2100, NE32-VL)
lnc1 300 10 n/a dyn See lnc0
ze0 300 5 dyn d8000 IBM/National Semiconductor
PCMCIA Ethernet Controller
zp0 300 10 dyn d8000 3Com PCMCIA Etherlink III
Ethernet Controller
--- End of table ---
If the hardware in your computer is not set to the same settings as
those shown in the table and the item in conflict is not marked 'dyn',
you will have to either reconfigure your hardware or use UserConfig
('-c' boot option) to reconfigure the kernel to match the way your
hardware is currently set (see the next section).
If the settings do not match, the kernel may be unable to locate
or reliably access the devices in your system.
2. Using UserConfig to change FreeBSD kernel settings
-- --------------------------------------------------
The UserConfig utility allows you to override various settings of
@ -69,6 +172,7 @@ flags <devname> <mask> Set device flags
enable <devname> Enable device
probe <devname> Return results of device probe
disable <devname> Disable device (will not be probed)
visual Go to visual mode
quit Exit this configuration utility
help This message
@ -76,13 +180,24 @@ help This message
You may alter nearly all of the default settings present in the FreeBSD
generic kernel. This includes reassigning IRQs, disabling troublesome
devices (or drivers that conflict with the hardware your system has),
setting special device flags, etc.
setting special device flags, etc.
Since people's tastes in user interface design vary widely, we have
provided two different interfaces to the UserConfig utility. If you
type `visual' you will be placed in the "GUI" oriented device
attributes editor. If you're someone who's more at home with
command-line flavored interfaces then simply don't type `visual' at
any point! :)
Since the visual interface pretty much describes itself, we'll use the
more verbose command line interface while describing UserConfig in the
following examples.
The most common use of UserConfig is to adjust or disable a driver
which is causing trouble. The "ls" command displays the current
settings for all the drivers present in the booted kernel, and
once you have located an entry of interest you may use the displayed
device name to change its settings or even disable the driver completely.
settings for all the drivers present in the booted kernel, and once
you have located an entry of interest you may use the displayed device
name to change its settings or even disable the driver completely.
For example, to change the memory address of network adapter 'ed0' to
the address 0xd4000, you would type
@ -134,109 +249,6 @@ sufficient free disk space to store and compile the kernel sources,
this is the option we most highly recommend.
2. Default (GENERIC) Configuration
-- -------------------------------
The following table contains a list of all of the devices that are present
in the GENERIC kernel, which is the kernel (the operating system) that was
placed on your computer during the FreeBSD installation process.
(A compressed version of the GENERIC kernel is also used on the
installation floppy diskettes.)
The table describes the various parameters used by the driver to communicate
with the hardware in your system. There are four parameters in the
table, but not all are used by each device. They are:
Port the starting I/O port used by the device, shown in hexadecimal.
IOMem the lowest (or starting) memory address used by the device,
also shown in hexadecimal.
IRQ the interrupt the device uses to alert the driver to an event,
given in decimal.
DRQ the DMA (direct memory access) channel the device uses to move
data to and from main memory, also given in decimal.
If an entry in the table has `n/a' for the value, it means that the
parameter does not apply to that device. A value of `dyn' means that the
correct value should be determined automatically by the kernel when the
system boots.
FreeBSD GENERIC kernel:
Port IRQ DRQ IOMem Description
---- --- --- ----- ---------------------------------
fdc0 3f0 6 2 n/a Floppy disk controller
wdc0 1f0 14 n/a n/a IDE/MFM/RLL disk controller
wdc1 170 15 n/a n/a IDE/MFM/RLL disk controller
ncr0 n/a n/a n/a n/a NCR PCI SCSI controller
ahc0 n/a n/a n/a n/a Adaptec 294x PCI SCSI controller
bt0 330 dyn dyn dyn Buslogic SCSI controller
uha0 330 dyn 6 dyn Ultrastore 14f
ahc1 dyn dyn dyn dyn Adaptec 274x/284x SCSI controller
ahb0 dyn dyn dyn dyn Adaptec 174x SCSI controller
aha0 330 dyn 5 dyn Adaptec 154x SCSI controller
aic0 340 11 dyn dyn Adaptec 152x/AIC-6360 SCSI
controller
nca0 1f88 10 dyn dyn ProAudioSpectrum cards
nca1 350 5 dyn dyn ProAudioSpectrum cards
sea0 dyn 5 dyn c8000 Seagate ST01/02 8 bit controller
wt0 300 5 1 dyn Wangtek and Archive QIC-02/QIC-36
mcd0 300 10 n/a n/a Mitsumi CD-ROM
mcd1 340 11 n/a n/a Mitsumi CD-ROM
matcd0 dyn n/a n/a n/a Matsushita/Panasonic CD-ROM
scd0 230 n/a n/a n/a Sony CD-ROM
sio0 3f8 4 n/a n/a Serial Port 0 (COM1)
sio1 2f8 3 n/a n/a Serial Port 1 (COM2)
sio2 3e8 5 n/a n/a Serial Port 2 (COM3)
sio3 2e8 9 n/a n/a Serial Port 3 (COM4)
lpt0 dyn 7 n/a n/a Printer Port 0
lpt1 dyn dyn n/a n/a Printer Port 1
lpt2 dyn dyn n/a n/a Printer Port 2
de0 DEC DC21x40 PCI based cards
(including 21140 100bT cards)
ed0 280 5 dyn d8000 WD & SMC 80xx; Novell NE1000 &
NE2000; 3Com 3C503
ed1 300 5 dyn d8000 Same as ed0
eg0 310 5 dyn dyn 3Com 3C505
ep0 300 10 dyn dyn 3Com 3C509
ie0 360 7 dyn d0000 AT&T StarLAN 10 and EN100;
3Com 3C507; NI5210
ix0 300 10 dyn d0000 Intel EtherExpress cards
le0 300 5 dyn d0000 Digital Equipment EtherWorks
2 and EtherWorks 3
lnc0 280 10 n/a dyn Lance/PCnet cards
(Isolan, Novell NE2100, NE32-VL)
lnc1 300 10 n/a dyn See lnc0
ze0 300 5 dyn d8000 IBM/National Semiconductor
PCMCIA Ethernet Controller
zp0 300 10 dyn d8000 3Com PCMCIA Etherlink III
Ethernet Controller
--- End of table ---
If the hardware in your computer is not set to the same settings as
those shown in this table and the item is not marked 'dyn', you will
have to either reconfigure your hardware, or use UserConfig ('-c' boot
option) to reconfigure the kernel to match the way your hardware is
currently set (see section 1.0).
If the settings do not match, the kernel may be unable to locate
or reliably access the devices in your system.
3. LINT - other possible configurations
-- ------------------------------------
@ -265,7 +277,6 @@ fpa: DEC DEFPA PCI FDDI adapter
gp: National Instruments AT-GPIB and AT-GPIB/TNT board
gsc: Genius GS-4500 hand scanner
gus: Gravis Ultrasound - Ultrasound, Ultrasound 16, Ultrasound MAX
gusmax: Gravis Ultrasound MAX (currently broken)
gusxvi: Gravis Ultrasound 16-bit PCM
joy: Joystick
labpc: National Instrument's Lab-PC and Lab-PC+
@ -281,7 +292,7 @@ rc: RISCom/8 multiport card
sb: SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum
sbmidi: SoundBlaster 16 MIDI interface
sbxvi: SoundBlaster 16
spigot: Create Labs Video Spigot video-acquisition board
spigot: Creative Labs Video Spigot video-acquisition board
uart: Stand-alone 6850 UART for MIDI
wds: Western Digital WD7000 IDE
@ -303,13 +314,10 @@ Q: The system finds my ed network card, but I keep getting device
timeout errors.
A: Your card is probably on a different IRQ from what is specified in the
kernel configuration. The ed driver will no longer use the `soft'
configuration by default (values entered using EZSETUP in DOS), but it
will use the software configuration if you specify `?' in the IRQ field
of your kernel config file. The reason for the change is because the
ed driver used to read and try to use the soft configuration information
even when the card was jumpered to use a hard configuration, and this
caused problems.
kernel configuration. The ed driver does not use the `soft' configuration
by default (values entered using EZSETUP in DOS), but it will use the
software configuration if you specify `?' in the IRQ field of your kernel
config file.
Either move the jumper on the card to a hard configuration setting
(altering the kernel settings if necessary), or specify the IRQ as
@ -318,7 +326,7 @@ A: Your card is probably on a different IRQ from what is specified in the
Another possibility is that your card is at IRQ 9, which is shared
by IRQ 2 and frequently a cause of problems (especially when you
have a VGA card using 2! :). You should not use IRQ 2 or 9 if at
have a VGA card using IRQ 2! :). You should not use IRQ 2 or 9 if at
all possible.
@ -337,17 +345,47 @@ A: The hard disk geometry was set incorrectly in the Partition editor when
program will see the DOS partition and try to infer the correct
geometry from it, which usually works.
If you are setting up a truly dedicated FreeBSD server or work-
station where you don't care for (future) compatibility with DOS,
Linux or another operating system, you've also got the option to use
the entire disk (`A' in the partition editor), selecting the
non-standard option where FreeBSD occupies the entire disk from
the very first to the very last sector. This will leave all geometry
considerations aside, but is somewhat limiting unless you're never
going to run anything other than FreeBSD on a disk.
Q: I have a Matsushita/Panasonic CD-ROM drive but it isn't recognized
by the system, even if I use UserConfig to change the Port address to
630, which is what my card uses.
Q: I have a Matsushita/Panasonic drive but it isn't recognized by the
system.
A: Not all of the companies that sell the Matsushita/Panasonic CR-562
and CR-563 drives use the same I/O ports and interface that the
matcd driver in FreeBSD expects. The only adapters that are supported
at this time are those that are 100% compatible with the Creative
Labs (SoundBlaster) host interface. See matcd.4 documentation for a
list of host adapters that are known to work.
A: Make certain that the I/O port that the matcd driver is set to is
correct for the host interface card you have. (Some SoundBlaster DOS
drivers report a hardware I/O port address for the CD-ROM interface
that is 0x10 lower than it really is.)
If you are unable to determine the settings for the card by examining
the board or documentation, you can use UserConfig to change the 'port'
address (I/O port) to -1 and start the system. This setting causes the
driver to look at a number of I/O ports that various manufacturers
use for their Matsushita/Panasonic/Creative CD-ROM interfaces.
Once the driver locates the address, you should run UserConfig again
and specify the correct address. Leaving the 'port' parameter set to -1
increases the amount of time that it takes the system to boot, and
this could interfere with other devices.
The double-speed Matsushita CR-562 and CR-563 are the only drives
that are supported.
Q: I have a Matsushita/Panasonic CR-522, a Matsushita/Panasonic CR-523 or
a TEAC CD55a drive, but it is not recognized even when the correct I/O
port is set.
A: These CD-ROM drives are currently not supported by FreeBSD. The command
sets for these drives are not compatible with the double-speed CR-562
and CR-563 drives.
The single-speed CR-522 and CR-523 drives can be identified by their
use of a CD-caddy.
Q: I'm trying to install from a tape drive but all I get is something like:
@ -381,10 +419,11 @@ A: This is not actually a hang, simply a very LONG "wdc0" probe that
To eliminate the problem, boot with the -c flag and eliminate the wdc0
device, or compile a custom kernel.
Q: My sytem can not find an Intel EtherExpress 16 card.
Q: My system can not find my Intel EtherExpress 16 card.
A: You must set your Intel EtherExpress 16 card to be memory mapped at
address 0xD0000, and set the amount of mapped memory to 32K using
the Intel supplied softset.exe program.
[ Please add more hardware tips to this Q&A section! ]

View file

@ -1,4 +1,4 @@
INSTALLATION GUIDE FOR FreeBSD 2.0.5
QUICK INSTALLATION GUIDE FOR FREEBSD 2.1
This manual documents the process of installing FreeBSD on your
machine. Please also see the Hardware Guide for hardware-specific
@ -26,6 +26,9 @@ Table of Contents:
3.0 Installing FreeBSD.
3.1 Repairing an existing FreeBSD installation.
3.2 Upgrading from FreeBSD 2.0.5
1.0 DOS user's Question and Answer section
@ -43,9 +46,15 @@ preserving the original partition and allowing you to install onto the
second free piece. You first "defrag" your DOS partition, using the
DOS 6.xx "DEFRAG" utility or the Norton Disk tools, then run FIPS. It
will prompt you for the rest of the information it needs. Afterwards,
you can reboot and install FreeBSD on the new free slice. See the
Distributions menu for an estimation of how much free space you'll
need for the kind of installation you want.
you can reboot and install FreeBSD on the new partition. Also note
that FIPS will create the second partition as a "clone" of the first,
so you'll actually see that you now have two DOS Primary partitions
where you formerly had one. Don't be alarmed! You can simply delete
the extra DOS Primary parititon (making sure it's the right one by
examining its size! :)
See the Distributions menu for an estimation of how much free space
you'll need for the kind of installation you want.
1.2 Can I use compressed DOS filesystems from FreeBSD?
@ -54,17 +63,17 @@ No. If you are using a utility such as Stacker(tm) or DoubleSpace(tm),
FreeBSD will only be able to use whatever portion of the filesystem
you leave uncompressed. The rest of the filesystem will show up as
one large file (the stacked/dblspaced file!). DO NOT REMOVE THAT
FILE! You will probably regret it greatly!
FILE as you will probably regret it greatly!
It is probably better to create another uncompressed DOS primary
partition and use this for communications between DOS and FreeBSD.
partition and use this for communications between DOS and FreeBSD if
such is your desire.
1.3 Can I mount my DOS extended partitions?
This feature isn't in FreeBSD 2.0.5 but should be in 2.1. We've laid
all the groundwork for making this happen, now we just need to do the
last 1% of the work involved.
Unfortunately, this remains unsupported. All the framework is in place
for doing so, but it didn't get done in time for the 2.1 installation.
1.4 Can I run DOS binaries under FreeBSD?
@ -75,10 +84,10 @@ DOSEMU utility may bring this much closer to being a reality sometime
soon. Send mail to hackers@freebsd.org if you're interested in
joining this effort!
However, there is a neat utility called "pcemu" in the ports collection
which emulates an 8088 and enough BIOS services to run DOS text mode
applications. It requires the X Window System (provided as
XFree86 3.1.1u1).
There is, however, a neat utility called "pcemu" in the ports
collection which emulates an 8088 and enough BIOS services to run DOS
text mode applications. It requires the X Window System (provided as
XFree86 3.1.2) to operate.
@ -87,64 +96,53 @@ XFree86 3.1.1u1).
2.1 Before installing from CDROM:
If your CDROM is of an unsupported type, such as an IDE CDROM, then
please skip to section 2.3: Before installing from a DOS partition.
If your CDROM is of an unsupported type, then please skip to section
2.3 which describes how to install from a DOS partition.
There is not a lot of preparatory work that needs to be done to
successfully install from one of Walnut Creek's FreeBSD CDROMs (other
CDROM distributions may work as well, we simply cannot say as we
have no hand or say in their creation). You can either boot into the
CD installation directly from DOS using Walnut Creek's supplied
``install.bat'' batch file or you can make a boot floppy with
the ``makeflp.bat'' command.
CDROM distributions may work as well, though we cannot say for certain
as we have no hand or say in how they're created). You can either
boot into the CD installation directly from DOS using Walnut Creek's
supplied ``install.bat'' batch file or you can make a boot floppy with
the ``makeflp.bat'' command [NOTE: If you're using an IDE CDROM, use
the inst_ide.bat or atapiflp.bat batch files instead].
For the easiest interface of all (from DOS), type "go". This
will bring up a DOS menu utility that leads you through all
the available options.
For the easiest interface of all (from DOS), type "view". This will
bring up a DOS menu utility that leads you through all the available
options.
If you're creating the boot floppy from a UNIX machine, you may find
that ``dd if=floppies/boot.flp of=/dev/rfd0'' or
``dd if=floppies/boot.flp of=/dev/floppy'' works well, depending on
your hardware and operating system environment.
Once you've booted from DOS or floppy, you should then be able to select
CDROM as the media type in the Media menu and load the entire
Once you've booted from DOS or floppy, you should then be able to
select CDROM as the media type in the Media menu and load the entire
distribution from CDROM. No other types of installation media should
be required.
After your system is fully installed and you have rebooted from the
hard disk, you should find the CD mounted on the directory /cdrom. A
utility called `lndir' comes with the XFree86 distribution which you
may also find useful: It allows you to create "link tree" directories
to things on Read-Only media like CDROM. One example might be
something like this:
hard disk, you can mount the cdrom at any time by typing: ``mount /cdrom''
Before removing the CD again, also note that it's necessary to first
type ``umount /cdrom''. Don't just remove it from the drive!
mkdir /usr/ports
lndir /cdrom/ports /usr/ports
SPECIAL NOTE: Before invoking the installation, be sure that the CDROM
is in the drive so that the "probe" can find it! This is also true if
you wish the CDROM to be added to the default system configuration
automatically during the install (whether or not you actually use it
as the installation media).
Which would allow you to then "cd /usr/ports; make" and get all the
sources from the CD, but yet create all the intermediate files in
/usr/ports, which is presumably on a more writable media! :-)
SPECIAL NOTE: Before invoking the installation, be sure that the
CDROM is in the drive so that the "probe" can find it!
This is also true if you wish the CDROM to be added to the default
system configuration automatically during the install (whether or
not you actually use it as the installation media). This will be
fixed for 2.1, but for now this simple work-around will ensure that
your CDROM is detected properly.
Finally, if you would like people to be able to FTP install
FreeBSD directly from the CDROM in your machine, you'll find
it quite easy. After the machine is fully installed, you simply
need to add the following line to the password file (using
the vipw command):
Finally, if you would like people to be able to FTP install FreeBSD
directly from the CDROM in your machine, you'll find it quite easy.
After the machine is fully installed, you simply need to add the
following line to the password file (using the vipw command):
ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent
No further work is necessary. The other installers will now be able
to chose a Media type of FTP and type in: ftp://<your machine>
after picking "Other" in the ftp sites menu!
Anyone else at your site will now be able to chose a Media type of FTP
and type in: ftp://<your machine> after picking "Other" in the ftp
sites menu to install from the CD in your machine!
2.2 Before installing from Floppy:
@ -153,41 +151,52 @@ If you must install from floppy disks, either due to unsupported
hardware or just because you enjoy doing things the hard way, you must
first prepare some floppies for the install.
The first floppy you'll need is ``floppies/root.flp'', which is
somewhat special in that it's not a DOS filesystem floppy at all, but
rather an "image" floppy (it's actually a gzip'd cpio file). You can
use the rawrite.exe program to do this under DOS, or ``dd'' to do it
on a UNIX Workstation (see notes in section 2.1 concerning the
``floppies/boot.flp'' image). Once this floppy is made, go on
to make the distribution set floppies:
The first floppy you'll need in addition to the boot.flp image is
``floppies/root.flp'', which is somewhat special in that it's not a
DOS filesystem floppy at all, but rather a floppy "image" (it's
actually a gzip'd cpio file). You can create this floppy in the same
way that you created the boot floppy (see notes in section 2.1). Once
this floppy is made, you can go on to make the distribution set
floppies using ordinary DOS or UFS (if you're preparing the floppies
on another FreeBSD machine) formatted diskettes.
You will need, at minimum, as many 1.44MB or 1.2MB floppies as it takes
to hold all files in the bin (binary distribution) directory. THESE
floppies *must* be formatted using MS-DOS, using the FORMAT command in
MS-DOS or the File Manager format command in Microsoft Windows(tm).
Don't trust Factory Preformatted floppies! Format them again yourself,
just to make sure!
You will need, at minimum, as many 1.44MB or 1.2MB floppies as it
takes to hold all files in the bin (binary distribution) directory.
If you're preparing these floppies under DOS, then THESE floppies
*must* be formatted using the MS-DOS FORMAT command. If you're using
Windows, use the Windows File Manager format command.
Many problems reported by our users in the past have resulted from the
use of improperly formatted media, so we simply take special care to
mention it here!
Don't trust Factory Preformatted floppies! Format them again
yourself, just to make sure! Many problems reported by our users in
the past have resulted from the use of improperly formatted media,
which is why I'm taking such special care to mention it here!
After you've DOS formatted the floppies, you'll need to copy the files
onto them. The distribution files are split into chunks conveniently
sized so that 5 of them will fit on a conventional 1.44MB floppy. Go
through all your floppies, packing as many files as will fit on each
one, until you've got all the distributions you want packed up in this
fashion. Each distribution should go into a subdirectory on the
floppy, e.g.: a:\bin\bin.aa, a:\bin\bin.ab, ...
If you're creating the floppies from another FreeBSD machine, a format
is still not a bad idea though you don't need to put a DOS filesystem
on each floppy. You can use the `disklabel' and `newfs' commands to
put a UFS filesystem on them instead, like so:
Once you come to the Media screen of the install, select
"Floppy" and you'll be prompted for the rest.
disklabel -w -r fd0 floppy3 (use floppy5 for 1.2MB disks)
newfs /dev/rfd0
Then you can mount and write to them like any other file system.
After you've formatted the floppies for DOS or UFS, you'll need to
copy the files onto them. The distribution files are split into
chunks conveniently sized so that 5 of them will fit on a conventional
1.44MB floppy. Go through all your floppies, packing as many files as
will fit on each one, until you've got all the distributions you want
packed up in this fashion. Each distribution should go into its own
subdirectory on the floppy, e.g.: a:\bin\bin.aa, a:\bin\bin.ab, ...
Once you come to the Media screen of the install, select "Floppy" and
you'll be prompted for the rest.
2.3 Before installing from a DOS partition:
To prepare for installation from an MS-DOS partition you should
simply copy the files from the distribution into a directory called
To prepare for installation from an MS-DOS partition you should simply
copy the files from the distribution into a directory called
"FREEBSD". For example, to do a minimal installation of FreeBSD from
DOS using files copied from the CDROM, you might do something like
this:
@ -209,17 +218,17 @@ BIN dist is only the minimal requirement.
2.4 Before installing from QIC/SCSI Tape:
Installing from tape is probably the easiest method, short of an
on-line install using FTP or a CDROM install. The installation program
on-line install using FTP or a CDROM. The installation program
expects the files to be simply tar'ed onto the tape, so after getting
all of the files for distribution you're interested in, simply tar
them onto the tape with a command like:
all of the files for the distributions you're interested in, simply
tar them onto the tape with a command like:
cd /freebsd/distdir
tar cvf /dev/rwt0 (or /dev/rst0) dist1 .. dist2
cd /where/you/have/your/dists
tar cvf /dev/rwt0 (or /dev/rst0) floppies dist1 .. dist2
Make sure that the `floppies/' directory is one of the "dists" given
above, since the installation will look for `floppies/root.flp' on
the tape.
It's important to make sure that the `floppies/' directory is
specified along with the dists because the installation will look for
`floppies/root.flp' on the tape.
When you go to do the installation, you should also make sure that you
leave enough room in some temporary directory (which you'll be allowed
@ -236,57 +245,61 @@ the drive *before* booting from the boot floppy. The installation
2.5 Before installing over a network:
You can do network installations over 3 types of communications links:
You can do network installations over 3 types of connections:
Serial port: SLIP / PPP
Parallel port: PLIP (laplink cable)
Parallel port: PLIP (using ``laplink'' style cable)
Ethernet: A standard ethernet controller (includes some PCMCIA).
SLIP support is rather primitive, and limited primarily to hard-wired
links, such as a serial cable running between a laptop computer and
another computer. The link should be hard-wired as the SLIP
installation doesn't currently offer a dialing capability; that
facility is provided with the PPP utility, which should be used in
preference to SLIP whenever possible.
SLIP support is rather primitive, and is limited primarily to
hard-wired links, such as a serial cable running between two
computers. The link must be hard-wired because the SLIP installation
doesn't currently offer a dialing capability. If you need to dial out
with a modem or otherwise dialog with the link before connecting to
it, then I recommend that the PPP utility be used instead.
If you're using a modem, then PPP is almost certainly your only
choice. Make sure that you have your service provider's information
handy as you'll need to know it fairly soon in the installation
process. You will need to know, at the minimum, your service
provider's IP address and possibly your own (though you can also leave
it blank and allow PPP to negotiate it with your ISP). You also need
to know how to use the various "AT commands" to dial the ISP with your
particular modem as the PPP dialer provides only a very simple
terminal emulator.
If you're using PPP, make sure that you have your Internet Service
Provider's IP address and DNS information handy as you'll need to know
it fairly early in the installation process. You may also need to
know your own IP address, though PPP supports dynamic address
negotiation and may be able to pick up this information directly from
your ISP if they support it.
You will also need to know how to use the various "AT commands" for
dialing out with your particular brand of modem as the PPP dialer
provides only a very simple terminal emulator.
If a hard-wired connection to another FreeBSD (2.0R or later) machine
is available, you might also consider installing over a "laplink"
parallel port cable. The data rate over the parallel port is much
higher than what is typically possible over a serial line (up to
style parallel port cable. The data rate over the parallel port is
much higher than what is typically possible over a serial line (up to
50k/sec), thus resulting in a quicker installation.
Finally, for the fastest possible network installation, an ethernet
adaptor is always a good choice! FreeBSD supports most common PC
ethernet cards, a table of supported cards (and their required
settings) is provided as part of the FreeBSD Hardware Guide - see the
Documentation menu on the boot floppy. If you are using one of the
supported PCMCIA ethernet cards, also be sure that it's plugged in
_before_ the laptop is powered on! FreeBSD does not, unfortunately,
currently support "hot insertion" of PCMCIA cards.
settings) being provided as part of the FreeBSD Hardware Guide (see
the Documentation menu on the boot floppy or the top level directory
of the CDROM). If you are using one of the supported PCMCIA ethernet
cards, also be sure that it's plugged in _before_ the laptop is
powered on! FreeBSD does not, unfortunately, currently support "hot
insertion" of PCMCIA cards.
You will also need to know your IP address on the network, the
"netmask" value for your address class, and the name of your machine.
Your system administrator can tell you which values to use for your
particular network setup. If you will be referring to other hosts by
name rather than IP address, you'll also need a name server and
possibly the address of a gateway (if you're using PPP, it's your
provider's IP address) to use in talking to it. If you do not know
the answers to all or most of these questions, then you should
really probably talk to your system administrator _first_ before
trying this type of installation!
"netmask" value for your address class and the name of your machine.
Your system administrator can tell you which values are appropriate to
your particular network setup. If you will be referring to other
hosts by name rather than IP address, you'll also need a name server
and possibly the address of a gateway (if you're using PPP, it's your
provider's IP address) to use in talking to it.
Once you have a network link of some sort working, the installation
can continue over NFS or FTP.
If you do not know the answers to these questions then you should
really probably talk to your system administrator _first_ before
trying this type of installation! Using a randomly chosen IP address
or netmask on a live network will almost certainly get you shot.
Once you have a network connection of some sort working, the
installation can continue over NFS or FTP.
2.5.1 Preparing for NFS installation:
@ -295,152 +308,271 @@ can continue over NFS or FTP.
and then point the NFS media selection at it.
If this server supports only "privileged port" access (as is
generally the default for Sun workstations), you will need to set
this option in the Options menu before installation can proceed.
generally the default for Sun and Linux workstations), you
will need to set this option in the Options menu before
installation can proceed.
If you have a poor quality ethernet card which suffers from very
slow transfer rates, you may also wish to toggle the appropriate
Options flag.
In order for NFS installation to work, the server must support
"subdir mounts"; e.g., if your FreeBSD 2.0.5 distribution directory
In order for NFS installation to work, the server must also support
"subdir mounts", e.g. if your FreeBSD 2.1 distribution directory
lives on: ziggy:/usr/archive/stuff/FreeBSD
Then ziggy will have to allow the direct mounting of
/usr/archive/stuff/FreeBSD, not just /usr or /usr/archive/stuff.
In FreeBSD's /etc/exports file, this is controlled by the
In FreeBSD's /etc/exports file this is controlled by the
``-alldirs'' option. Other NFS servers may have different
conventions. If you are getting `Permission Denied' messages
from the server then it's likely that you don't have this
enabled properly!
properly enabled!
2.5.2 Preparing for FTP Installation
FTP installation may be done from any mirror site containing a
reasonably up-to-date version of FreeBSD 2.0.5. A full menu of
reasonable choices from almost anywhere in the world is provided
by the FTP site menu.
reasonably up-to-date version of FreeBSD 2.1. A full menu of
reasonable choices for almost any location in the world is
provided in the FTP site menu.
If you are installing from some other FTP site not listed in this
menu, or you are having troubles getting your name server configured
properly, you can also specify your own URL by selecting the ``Other''
choice in that menu. A URL can also be a direct IP address, so
the following would work in the absence of a name server:
If you are installing from some other FTP site not listed in
this menu, or you are having troubles getting your name server
configured properly, you can also specify your own URL by
selecting the ``Other'' choice in that menu. A URL can
contain a hostname or an IP address, so the following would
work in the absence of a name server:
ftp://192.216.222.4/pub/FreeBSD/2.0.5-RELEASE
ftp://192.216.191.11/pub/FreeBSD/2.1.0-RELEASE
[Substitute "ALPHA" for "RELEASE" during the ALPHA test period!]
There are two FTP installation modes you can use:
If you are installing through a firewall then you should probably
select ``Passive mode'' ftp, which is the default. If you are
talking to a server which does not support passive mode for some
reason, see the Options menu to select Active mode transfers.
o FTP:
For all FTP transfers, use the standard "Active" mode for
transfers. This will not work through most firewalls but
will often work best with older ftp servers that do not
support passive mode. If your connection hangs with
passive mode, try this one!
o FTP Passive:
For all FTP transfers, use "Passive" mode. This allows
the user to pass through firewalls that do not allow
incoming connections on random port addresses.
NOTE: ACTIVE AND PASSIVE MODES ARE NOT THE SAME AS A `PROXY'
CONNECTIONS, WHERE A PROXY FTP SERVER IS LISTENING ON A
DIFFERENT PORT!
In such instances, you should specify the URL as something like:
ftp://foo.bar.com:1234/pub/FreeBSD
Where "1234" is the port number of the proxy ftp server.
3. Installing FreeBSD
-- ------------------
3.0 Installing FreeBSD
--- ------------------
Once you've taken note of the appropriate preinstallation steps, you
should be able to install FreeBSD without any further trouble.
Should this not be true, then you may wish to go back and re-read the
relevant preparation section (section 2.x) for the installation media
type you're trying to use - perhaps there's a helpful hint there that
you missed the first time? If you're having hardware trouble, or
FreeBSD refuses to boot at all, read the Hardware Guide provided on
the boot floppy for a list of possible solutions.
Should the installation fail at some stage, then you may wish to go
back and re-read the relevant preparation section (section 2.x) for
the installation media type you're trying to use. Perhaps there's a
helpful hint there that you missed the first time? If you're having
hardware trouble or FreeBSD refuses to boot at all, then read the
Hardware Guide again for a list of possible solutions.
The FreeBSD boot floppy contains all the on-line documentation you
should need to be able to navigate through an installation and if it
doesn't then I'd like to know what you found most confusing! It is
the objective of the FreeBSD installation program (sysinstall) to be
self-documenting enough that painful "step-by-step" guides are no
longer necessary. It may take us a little while to reach that
objective, but that's the objective!
should need to be able to navigate through an installation, and if it
doesn't then I'd like to know what you found most confusing so that I
can fix it in future releases! It is the objective of the FreeBSD
installation program (sysinstall) to be self-documenting enough that
painful "step-by-step" guides are no longer necessary.
Meanwhile, you may also find the following "typical installation sequence"
to be helpful:
You may also find the following "typical installation sequence" to be
useful reading:
o Boot the boot floppy. After a boot sequence which can take
anywhere from from 30 seconds to 3 minutes, depending on your
hardware, you should be presented with a menu of initial
choices. If the floppy doesn't boot at all, or the boot
anywhere from from 30 seconds to 3 minutes, depending on the
speed of your hardware, you should be presented with a menu of
initial choices. If the floppy doesn't boot at all, or the boot
hangs at some stage, go read the Q&A section of the Hardware
Guide for possible causes.
Guide for some possible causes.
o Press F1. You should see some basic usage instructions on
the menu system and general navigation. If you haven't used this
menu system before then PLEASE read this thoroughly!
the menu system and general navigation within it. If you haven't
used this installation system before then PLEASE read this
thoroughly!
o If English is not your native language, you may wish to proceed
directly to the Language option and set your preferred language.
This will bring up some of the documentation in that language
instead of english.
o Select the Novice installation and follow the instructions. Even
if you're moderately familiar with UNIX, chose the Novice install!
"Novice" in this context means new to the FreeBSD installer, not
computers in general! The other installation types (Custom and
Express) assume that you've installed FreeBSD using *this* version
of the installation utility and know *exactly* what you are doing!
o Select the Options item and set any special preferences you
may have.
Novice users and 25 year veterans of UNIX alike can benefit from the
tips provided by the Novice install, so don't be proud - be a novice! :)
o Select Proceed, bringing you to the Installation Menu.
Installation Menu:
Installation type overview:
o You can do anything you like in this menu without altering
your system _except_ for "Commit", which will perform any
requests to alter your system you may have made.
o Custom installation:
If you're confused at any point, the F1 key usually pulls
up the right information for the screen you're in.
You can do anything you like in this menu without altering your system
_except_ for "Commit", which will perform any pending actions you may
have selected. Some of the menu options will also have direct `Write'
commands available for commiting an operation immediately, but they
should only be used if you're *absolutely sure* it's necessary. It's
generally safer to stack up your changes and then commit them all at
once so that you're left with the option of changing your mind up to
the very last moment. In particular, the (W)rite options in the fdisk
and label screens WILL NOT WORK for a new installation! They're meant
for tweaking *existing* installations, not doing new ones. Use the
final commit option as there is no advantage whatsoever to be gained
in writing the information out stage by stage in a new installation.
o The first step is generally `Partition', which allows
If you're confused at any point, the F1 key will pull up what is
hopefully some helpful information for the screen you're in.
o Express installation:
This installation will invoke all the appropriate steps in order as if
you'd selected them one by one from the custom installation menu. It
assumes that you *know what you are doing* and have run the
installation at least once before. If this is not the case, the
Novice installation method is recommended.
o Novice installation:
As previously mentioned, the Novice installation leads you through the
required stages in the proper order and presents you with various
helpful prompts in between. Once the system is installed, it will
also present you with the opportunity to perform a variety of "post
install" actions.
A quick synopsis of the stages involved in a novice installation
follows:
o The first step is the `Partition Editor', which allows
you to chose how your drives will be used for FreeBSD.
If you're dedicating an entire drive to FreeBSD, the
`A' command is probably all you need to type here, otherwise
move to a partition marked `Unused' (or delete an existing one)
and use the `C' command to create a FreeBSD partition in its
place.
o Next, with the `Label' editor, you can specify how the space
in any allocated FreeBSD partitions should be used by FreeBSD,
or where to mount a non-FreeBSD partition (such as DOS).
o Next, with the `Label Editor', you can specify how the space
in any FreeBSD partitions should be used by FreeBSD. You
can also mount any non-FreeBSD partitions (such as DOS) in this
screen. If you want the standard layout, simply type `A' for
the defaults.
o Next, the `Distributions' menu allows you to specify which
parts of FreeBSD you wish to load. A good choice is
"User" for a small system or "Developer" for someone
wanting a bit more out of FreeBSD. If none of the existing
collections sound applicable, select Custom.
o Next, the `Distributions' menu allows you to specify how much
of FreeBSD you'd like to load. A good choice is the "User"
distribution for a small system or the "Developer" distribution
for someone wanting a more programmer-oriented configuration.
If none of the existing collections seem applicable, select
Custom to choose the component distributions yourself.
o Next, the `Media' menu allows you to specify what kind of
media you wish to install from. If a desired media choice is
found and configured automatically then this menu will simply
return, otherwise you'll be asked for additional details on
the media device type.
media you wish to install from. If a given media type requires
extra information, such as networking information for an FTP
or NFS install, it will also be asked for at this point.
o Finally, you'll be prompted to commit all of these actions at
once (nothing has been written to your disk so far, nor will
it until you give the final confirmation).
o Finally, the Commit command will actually perform all the
actions at once (nothing has been written to your disk
so far, nor will it until you give the final confirmation).
All new or changed partition information will be written
out, file systems will be created and/or non-destructively
labelled (depending on how you set their newfs flags in the
Label editor) and all selected distributions will be
Label Editor) and all selected distributions will be
extracted.
o The Configure menu choice allows you to furthur configure your
FreeBSD installation by giving you menu-driven access to
various system defaults. Some items, like networking, may
be especially important if you did a CDROM/Tape/Floppy
installation and have not yet configured your network
interfaces (assuming you have some). Properly configuring
your network here will allow FreeBSD to come up on the network
when you first reboot from the hard disk.
o After the system is fully installed, you'll then have the
option to configure the system in various ways, install a
WEB server, etc.
o Exit returns you to the top menu.
At this point, you're generally done with the sysinstall utility and
can reboot the system. If you elected to install the boot manager,
you should now see a small boot menu with an `F?' prompt. Press the
function key corresponding to the BSD partition and you should boot up
into FreeBSD off the hard disk.
If this fails to happen for some reason, see the Q & A section of the
Hardware Guide for possible clues! The most likely problem is a
mis-matched disk geometry, which will have to be corrected with a
second pass through the install, using the (G) command in the fdisk
menu to properly set the geometry the next time.
Should you wish to re-enter this installation later, you will find it
under /stand/sysinstall on the installed system.
Good luck! If you really get stuck, you may send mail to our support
mailing list - questions@FreeBSD.org. We'll do our best to help you!
At this point, you're generally done with the sysinstall utility and
can select the final `Quit'. If you're running it as an installer
(e.g., before the system is all the way up) then the system will now
reboot. If you selected the boot manager option, you will see a small
boot menu with an `F?' prompt. Press the function key for BSD (it
will be shown) and you should boot up into FreeBSD off the hard disk.
3.1 Repairing an existing FreeBSD installation.
--- -------------------------------------------
If this fails to happen for some reason, see the Q & A section
of the Hardware Guide for possible clues!
FreeBSD 2.1 now features a "Fixit" option in the top menu of the boot
floppy. To use it, you will also need a fixit.flp image floppy,
generated in the same fashion as the boot floppy.
To invoke fixit, simply boot the boot floppy, chose the "Fixit"
item and insert the fixit floppy when asked. You will then be placed
into a shell with a wide variety of commands available (in the /stand
and /mnt2/stand directories) for checking, repairing and examining file
systems and their contents. Some UNIX administration experience *is*
required to use the fixit option!
3.2 Upgrading from FreeBSD 2.0.5
--- ----------------------------
It must first be said that this upgrade DOES NOT take a particularly
sophisticated approach to the upgrade problem, it being more a question
of providing what seemed "good enough" at the time. A truly polished
upgrade that deals properly with the broad spectrum of installed 2.0.5
systems would be nice to have, but until that gets written what you get is
this - the brute-force approach!
What this upgrade will attempt to do is best summarized thusly:
1. fsck and mount all file systems chosen in the label editor.
2. Ask for a location to preserve your /etc directory into and do so.
3. Extract all selected distributions on top of your existing system.
4. Copy certain obvious files back from the preserved /etc, leaving the
rest of the /etc file merge up to the user.
5. Drop user in a shell so that they may perform that merge before
rebooting into the new system.
And that's it! This "upgrade" is not going to hold your hand in all
major respects, it's simply provided to make one PART of the upgrade
easier.
IMPORTANT NOTE: What this upgrade procedure may also do, in fact, is
completely destroy your system (though much more quickly than you
would have been able to destroy it yourself). It is simply impossible
to guarantee that this procedure's crude form of upgrade automation
will work in all cases and if you do this upgrade without proper
BACKUPS for any important data then you really must like living life
close to the edge, that's all we can say!
NOTE to 2.0 users: We're sorry, but the "slice" changes that were
added in FreeBSD 2.0.5 made automated upgrades pretty difficult due to
the fact that a complete reinstall is pretty much called for. Things
may still *work* after a 2.1 upgrade, but you will also no doubt
receive many warnings at boot time about non-aligned slices and such;
we really do recommend a fresh installation for 2.0 systems! (But
back up your user data first :-).
Jordan

View file

@ -1,29 +1,49 @@
You can install from the following types of media:
CDROM - requires one of the following supported CDROM drives:
CDROM requires one of the following supported CDROM drives:
Sony CDU 31/33A
Matushita/Panasonic "Sound Blaster" CDROM.
Mitsumi FX-001{A-D} (older non-IDE drives).
SCSI - Any standard SCSI CDROM drive hooked to
a supported controller (see Hardware Guide).
Sony CDU 31/33A
Matushita/Panasonic "Sound Blaster" CDROM.
Mitsumi FX-001{A-D} (older non-IDE drives).
SCSI - Any standard SCSI CDROM drive hooked to
a supported controller (see Hardware Guide).
DOS - A DOS primary partition with the required FreeBSD
distribution files copied onto it (e.g. C:\FREEBSD\)
DOS A DOS primary partition with the required FreeBSD
distribution files copied onto it (e.g. C:\FREEBSD\)
FS - Assuming a disk or partition with an existing
FreeBSD file system and distribution set on it,
get the distribution files from there.
Floppy - Get distribution files from one or more DOS formatted
floppies.
FS Assuming a disk or partition with an existing
FreeBSD file system and distribution set on it,
get the distribution files from there.
FTP - Get the distribution files from an anonymous ftp server
(you will be presented with a list).
NFS - Get the distribution files from an NFS server somewhere
(make sure that permissions on the server allow this!)
Floppy Get distribution files from one or more DOS or UFS
formatted floppies.
Tape - Extract distribution files from tape into a temporary
directory and install from there.
FTP Get the distribution files from an anonymous ftp server
(you will be presented with a list). Please note that
there are also two ways of invoking FTP in either
"Active" and "Passive" mode.
Active mode is the standard way of fetching files and
Passive mode is for use when you're behind a firewall or
some other security mechanism that blocks active FTP
connections. If you chose "other" in the FTP menu, please
also note that all paths are *relative* to the home
directory of the user being logged in as. By default, this
is the user "ftp" (anonymous ftp) but you may change this
in the Options screen.
NFS Get the distribution files from an NFS server somewhere
(make sure that permissions on the server allow this!).
If this install method hangs on you or refuses to work
properly, you may need to set some special options for
your NFS server. See the Options screen for more details.
Tape Extract distribution files from tape into a temporary
directory and install from there. If the tape was created
with blocksize other than 20, you may wish to change this
in the Options screen.

View file

@ -2,53 +2,55 @@ You can do network installations over 3 types of communications links:
Serial port: SLIP / PPP
Parallel port: PLIP (laplink cable)
Ethernet: A standard ethernet controller (includes some PCMCIA).
Ethernet: A standard ethernet controller (includes some
PCMCIA networking cards).
SLIP support is rather primitive and limited primarily to hard-wired
links, such as a serial cable running between a laptop computer and
another PC. The link must be hard-wired as the SLIP installation
doesn't currently offer a dialing capability; that facility is provided
with the PPP utility, which should be used in preference to SLIP
whenever possible. When you choose a serial port device, you'll
be given the option later to edit the slattach command before it's
run on the serial line. It is expected that you'll run slattach
(or some equivalent) on the other end of the link at this time and
bring up the line. FreeBSD will then install itself over the link
at speeds of up to 115.2K/baud (the recommended speed for a hardwired
cable).
SLIP support is rather primitive and limited primarily to directly
connected links, such as a serial cable running between a laptop
computer and another PC. The link must be hard-wired as the SLIP
installation doesn't currently offer a dialing capability (that
facility is offered by the PPP utility, which should be used in
preference to SLIP whenever possible). When you choose the SLIP
option, you'll be given the option of later editing the slattach
command before it's run on the serial line. It is expected that
you'll run slattach (or some equivalent command) on the other end of
the link at that time and bring up the line. FreeBSD will then
install itself at serial speeds of up to 115.2K/baud (the recommended
speed for a hardwired cable).
If you're using a modem then PPP is almost certainly your only
choice. Make sure that you have your service provider's information
handy as you'll need to know it fairly early in the installation
process. You will need to know, at the minimum, your service
provider's IP address and possibly your own (though you can also leave
it blank and allow PPP to negotiate it with your ISP). You will also
need to know how to use the various "AT commands" to dial the ISP with
your particular brand of modem as the PPP dialer provides only a very
simple terminal emulator and has no "modem capabilities database".
If you're using a modem then PPP is almost certainly your only choice.
Make sure that you have your service provider's information handy as
you'll need to know it fairly early in the installation process. You
will need to know, at the minimum, your service provider's IP address
and possibly your own (though you can also leave it blank and allow
PPP to negotiate it with your ISP if your ISP supports such dynamic
negotiation). You will also need to know how to use the various "AT
commands" to dial the ISP with your particular brand of modem as the
PPP dialer provides only a very simple terminal emulator and has no
"modem capabilities database".
If a hard-wired connection to another FreeBSD (2.0R or later) machine
is available, you might also consider installing over a "laplink"
parallel port cable. The data rate over the parallel port is much
higher than what is typically possible over a serial line with
speeds of up to 50k/sec.
higher than what is typically possible over a serial line, and speeds
of up to 50KB/sec are not uncommon.
Finally, for the fastest possible network installation, an ethernet
adaptor is always a good choice! FreeBSD supports most common PC
ethernet cards, a table of which is provided in the FreeBSD
Hardware Guide (see the Documentation menu on the boot floppy).
If you are using one of the supported PCMCIA ethernet cards, also be
sure that it's plugged in _before_ the laptop is powered on! FreeBSD
does not, unfortunately, currently support "hot insertion" of PCMCIA
cards.
ethernet cards, a table of which is provided in the FreeBSD Hardware
Guide (see the Documentation menu on the boot floppy). If you are
using one of the supported PCMCIA ethernet cards, also be sure that
it's plugged in _before_ the laptop is powered on! FreeBSD does not,
unfortunately, currently support "hot insertion" of PCMCIA cards.
You will also need to know your IP address on the network, the "netmask"
value for your address class, and the name of your machine.
You will also need to know your IP address on the network, the
"netmask" value for your address class, and the name of your machine.
Your system administrator can tell you which values to use for your
particular network setup. If you will be referring to other hosts by
name rather than IP address, you'll also need a name server and
possibly the address of a gateway (if you're using PPP, it's your
provider's IP address) to use in talking to it. If you do not know
the answers to all or most of these questions, then you should
really probably talk to your system administrator _first_ before
trying this type of installation!
the answers to all or most of these questions then you should really
probably talk to your system administrator _first_ before trying this
type of installation! Chosing the wrong IP address on a busy network
will NOT make you popular with your systems administrator! :-)

View file

@ -1,4 +1,5 @@
The following options may be set from this screen:
The following options may be set from this screen. Use the SPACE key
to toggle an option's value, Q to leave when you're done.
NFS Secure: NFS server talks only on a secure port
@ -14,46 +15,6 @@ NFS Slow: User is using a slow PC or ethernet card
the PC from becoming swamped with data.
FTP Abort: On transfer failure, abort
This is pretty self-explanatory. If you're transfering from a
host that drops the connection or cannot provide a file, abort
the installation of that piece.
FTP Reselect: On transfer failure, ask for another host
This is more useful to someone doing an interactive installation.
If the current host stops working, ask for a new ftp server to
resume the installation from. The install will attempt to pick
up from where it left off on the other server, if at all possible.
FTP Active: Use "active mode" for standard FTP
For all FTP transfers, use "Active" mode. This will not work
through firewalls, but will often work with older ftp servers
that do not support passive mode. If your connection hangs
with passive mode (the default), try active!
FTP Passive: Use "passive mode" for firewalled FTP
For all FTP transfers, use "Passive" mode. This allows the user
to pass through firewalls that do not allow incoming connections
on random port addresses.
NOTE: ACTIVE AND PASSIVE MODES ARE NOT THE SAME AS A `PROXY'
CONNECTION, WHERE A PROXY FTP SERVER IS LISTENING ON A DIFFERENT
PORT!
In such situations, you should specify the URL as something like:
ftp://foo.bar.com:1234/pub/FreeBSD
Where "1234" is the port number of the proxy ftp server.
Debugging: Turn on the extra debugging flag
This turns on a lot of extra noise over on the second screen
@ -69,27 +30,78 @@ Yes To All: Assume "Yes" answers to all non-critical dialogs
This flag should be used with caution. It will essentially
decide NOT to ask the user about any "boundry" conditions that
might not constitute actual errors but may be warnings indicative
of other problems.
of other problems. It's most useful to those who are doing unattended
installs.
FTP userpass: Specify username and password instead of anonymous.
FTP OnError: What to do when FTP transfer errors occur.
This is pretty self-explanatory. If you're transfering from a
host that drops the connection or cannot provide a file, you can
chose to Abort the connection, Retry the request (see next option)
or Reselect another FTP host, attempting to retry the request from
a new site. Pressing SPACE will toggle through these options.
FTP Retries: How many times to retry failing FTP requests.
If FTP OnError is set to `retry', this is the number of times to
loop on a failing request before giving up. If you're talking to a
site that's chronically overloaded (like ours!) you may wish to
simply set this to some large value and go to lunch or something.
FTP username: Specify username and password instead of anonymous.
By default, the installation attempts to log in as the
anonymous user. If you wish to log in as someone else,
specify the username and password with this option.
Clear: Clear All Option Flags
Tape Blocksize: Specify block size in 512 byte blocks of tape.
Reset all option flags back to their default values.
This defaults to 20 blocks, which should work with most
tape drive + tar combinations. It may not allow your particular
drive to win any records for speed, however, and the more
adventurous among you might try experimenting with larger sizes.
----
Some of these items, like "FTP Active" or "FTP Passive", are actually
mutually-exclusive even though you can turn all of them on or off at
once. This is a limitation of the menuing system, and is compensated
for by checks that ensure that the various flags are not in conflict.
If you re-enter the Options menu again after leaving it, you'll see
the settings it's actually using after checking for any possible
conflicts.
Extract Detail: How to show filenames on debug screen as they're extracted.
While a distribution is being extracted, the default detail level
of "high" will show the full file names as they're extracted.
If you would prefer a more terse form for this, namely dots, select
the "medium" detail level. If you want nothing to be printed
on the debugging screen during extraction, select "low".
Release Name: Which release to attempt to load from installation media.
You should only change this option if you're really sure you know
what you are doing! This will change the release name used by
sysinstall when fetching components of any distributions.
Browser Package: Which package to load for an HTML browser.
By default, this is set to lynx but may also be set to any other
text capable HTML browser for which a package exists. If you set this
to an X based browser, you will not be able to use it if you're running
in text mode! :)
Browser Exec: Which binary to run for the HTML browser.
The full pathname to the main executable in Browser Package
Media Type: Which media type is being used.
This is mostly informational and indicates which media type (if any)
was last selected in the Media menu. It's also a convenient short-cut
to the media menu itself.
Use Defaults: Use default values.
Reset all options back to their default values.

View file

@ -1,21 +1,50 @@
This is the FreeBSD DiskLabel Editor.
NOTE: If you're entering this editor from the update procedure then
you probably shouldn't (C)reate anything at all but rather use only
the (M)ount command to check and mount existing partitions for
upgrading.
If you would like the label editor to do most of the following for
you, simply type `A' for automatic partitioning of the disk.
If you wish to create partitions manually you may do so by moving the
highlighted selection bar with the arrow keys over the FreeBSD
partition(s) displayed at the top of the screen. Typing (C)reate
while a partition with available free space is selected will allow you
to create a BSD partition inside of it using some or all of its
available space.
Typing (M)ount over an existing partition entry (displayed in the
middle of the screen) will allow you to set a mount point for it
without initializing it. If you want it initialized, use the (T)oggle
command to flip the Newfs flag. When Newfs is set to "Y", the
filesystem in question will be ERASED and rebuilt from scratch!
NOTE: The (W)rite option is HIGHLY DANGEROUS and should NOT BE USED if
you're installing a new system! It's only for use in resurrecting
or changing an existing system, and will cause unpredictable things to
happen if you use it in any other circumstances. Don't do it! Wait
for the final commit dialog if you're express/novice installing, or
use the "Commit" menu item if you're custom installing, and do it there.
You should use this editor to create at least the following
filesystems:
Name Purpose Min Size? Optional?
---- ------- --------- ---------
/ Root filesystem 20MB No
swap Swap space 2 * MEM No
/usr System & user files 80MB or more Yes
Name Purpose Min Size? Optional?
---- ------- --------- ---------
/ Root filesystem 20MB No
swap Swap space 2 * MEM No
/usr System & user files 80MB or more Yes
Note: If you do not create a /usr filesystem then your / filesystem
will need to be bigger - at least 100MB. This is not recommended as
any media errors that may occur during disk I/O to user files will
corrupt the filesystem containing vital system files as well. It is
for this reason that / is generally kept on its own filesystem, where
it's basically considered "read only" by the system and hence a good
deal safer.
it should be considered essentially "read only" in your administration
of it.
Swap space is a little tricker, and the rule of "2 * MEM" is simply a
best-guess approximation and not necessarily accurate for your
@ -44,79 +73,88 @@ instead. You may therefore wish to make the / partition bigger if you
expect a lot of mail or news and do not want to make /var its own
partition.
If you're new to this installation, you might also want to read the
following explanation of how FreeBSD's new "slice" paradigm for
looking at disk storage works:
If you're new to this installation, you should also first understand
how FreeBSD 2.0.5's new "slices" paradigm for looking at disk storage
works. It's not very hard to grasp. A "fully qualified slice name",
that is the name of the file we open in /dev to talk to the slice, is
optionally broken into 3 parts:
First you have the disk name. Assume we have two SCSI
drives in our system, which gives us `sd0' and `sd1'.
In FreeBSD's new system, a device name can be broken up into up to 3
parts. Take a typical name like ``/dev/sd0s1a'':
Next you have the "Slice" (or "FDISK Partition") number,
as seen in the Partition Editor. Assume that our sd0 contains
two slices, a FreeBSD slice and a DOS slice. This gives us
sd0s1 and sd0s2. Let's also say that sd1 is completely devoted
to FreeBSD, so we have only one slice there: sd1s1.
The first three characters represent the drive name. If we had
a system with two SCSI drives on it then we'd see /dev/sd0 and
/dev/sd1 as the device entries representing the entire drives.
Next, if a slice is a FreeBSD slice, you have a number of
(confusingly named) "partitions" you can put inside of it.
These FreeBSD partitions are where various filesystems or swap
areas live, and using our hypothetical two-SCSI-disk machine
again, we might have something like the following layout on sd0:
Next you have the "slice" (or "FDISK Partition") number,
as seen in the Partition Editor. Assuming that our sd0
contained two slices, a FreeBSD slice and a DOS slice, that
would give us /dev/sd0s1 and /dev/sd0s2 as device entries pointing
to the entire slices.
Name Mountpoint
---- ----------
sd0s1a /
sd0s1b <swap space>
sd0s1e /usr
Next, if a slice is a FreeBSD slice, you can have a number of
(confusingly named) "partitions" inside of it.
Because of historical convention, there is also a short-cut,
or "compatibility slice", that is maintained for easy access
to the first FreeBSD slice on a disk for those programs which
still don't know how to deal with the new slice scheme.
The compatibility slice names for our filesystem above would
look like:
These partitions are where various filesystems or swap areas live,
and using our hypothetical two-SCSI-disk machine again, we might
have something like the following layout on sd0:
Name Mountpoint
---- ----------
sd0a /
sd0b <swap space>
sd0e /usr
Name Mountpoint
---- ----------
sd0s1a /
sd0s1b <swap space>
sd0s1e /usr
FreeBSD automatically maps the compatibility slice to the first
FreeBSD slice it finds (in this case, sd0s1). You may have multiple
FreeBSD slices on a drive, but only the first one may be the
compatibility slice!
Because of historical convention, there is also a short-cut,
or "compatibility slice", that is maintained for easy access
to the *first* FreeBSD slice on a disk. This gives some
backwards compatibility to utilities that still may not know
how to deal with the new slice scheme.
The compatibility slice will eventually be phased out, but
it is still important right now for several reasons:
The compatibility slice names for our filesystem above would
also look like:
1. Some programs, as mentioned before, still don't work
with the slice paradigm and need time to catch up.
Name Mountpoint
---- ----------
sd0a /
sd0b <swap space>
sd0e /usr
2. The FreeBSD boot blocks are unable to look for
a root file system in anything but a compatibility
slice right now. This means that our root will always
show up on "sd0a" in the above scenario, even though
it really lives over on sd0s1a and would otherwise be
referred to by its full slice name.
Again, let it be noted: FreeBSD automatically maps the
compatibility slice to the first FreeBSD slice it finds
(in this case, sd0s1). You may have multiple FreeBSD slices on a
drive, but only the first one will be mapped to the compatibility
slice!
Once you understand all this, then the label editor becomes fairly
simple. You're either carving up the FreeBSD slices displayed at the
top of the screen into smaller pieces (displayed in the middle of the
screen) and then putting FreeBSD file systems on them, Or you're just
mounting existing partitions/slices into your filesystem hierarchy;
this editor lets you do both. Since a DOS partition is also just
another slice as far as FreeBSD is concerned, you can mount one into
in your filesystem hierarchy just as easily with this editor. For
FreeBSD partitions you can also toggle the "newfs" state so that
the partitions are either (re)created from scratch or simply checked
and mounted (the contents are preserved).
The compatibility slice will eventually be phased out, but
it is still important right now for several reasons:
1. Some programs, as mentioned before, still don't work
with the slice paradigm and need time to catch up.
2. The FreeBSD boot blocks are unable to look for
a root file system in anything but a compatibility
slice right now. This means that our root will always
show up on "sd0a" in the above scenario, even though
it really lives over on sd0s1a and would otherwise be
referred to by its full slice name.
Once you understand all this, then the purpose of the label editor
becomes fairly clear: You're carving up the FreeBSD slices displayed
at the top of the screen into smaller pieces, which are displayed in
the middle of the screen, and then assigning FreeBSD file system names
(mount points) to them.
You can also use the label editor to mount existing partitions/slices
into your filesystem hierarchy, as is frequently done for DOS FAT
slices. For FreeBSD partitions, you can also toggle the "newfs" state
so that the partitions are either (re)created from scratch or simply
checked and mounted (the contents are preserved).
When you're done, type `Q' to exit.
No actual changes will be made to the disk until you (C)ommit from the
Install menu! You're working with what is essentially a copy of
the disk label(s), both here and in the FDISK Partition Editor.
Install menu or (W)rite directly from this one. You're working with
what is essentially a copy of the disk label(s), both here and in the
FDISK Partition Editor, and the actual on-disk labels won't be
affected by any changes you make until you explicitly say so.

View file

@ -1,19 +1,19 @@
-----------------------------------------
FreeBSD 2.0.5 --- RELEASE Version , ,
FreeBSD 2.1 --- RELEASE Version , ,
----------------------------------------- /( )`
\ \___ / |
Welcome to the 2.0.5 release of FreeBSD! 2.0.5 is /- _ `-/ '
an interim release of FreeBSD, filling a critical (/\/ \ \ /\
gap during the period between 2.0R (which was / / | ` \
released in Nov 94) and 2.1R, which will be O O ) / |
released in late July of '95. FreeBSD 2.0.5 `-^--'`< '
contains many substantial improvements from 2.0R, (_.) _ ) /
not least of which is greater stability (by `.___/` /
a considerable margin), dozens of new `-----' /
features and a greatly enhanced <----. __ / __ \
installation program. See the release <----|====O)))==) \) /====
notes for more details on what's new in <----' `--' `.__,' \
FreeBSD 2.0.5! | |
Welcome to the 2.1 release of FreeBSD! 2.1 is the /- _ `-/ '
stability release following FreeBSD 2.0.5 and con- (/\/ \ \ /\
sists primarily of bug fixes, documentation / / | ` \
updates and upgrades of several small non-critical O O ) / |
subsystems. The emphasis with 2.1 was to increase `-^--'`< '
system stability and applicability to "mission- (_.) _ ) /
critical" applications. No major features were `.___/` /
added or changed. As usual, for more `-----' /
information on what's changed between <----. __ / __ \
this release and the last one, please <----|====O)))==) \) /====
see the release notes! <----' `--' `.__,' \
| |
\ / /\
______( (_ / \______/
,' ,-----' |
@ -24,11 +24,10 @@ What is FreeBSD? FreeBSD is an operating system based on 4.4 BSD Lite
for Intel, AMD, Cyrix or NexGen "x86" based PC hardware. It works
with a very wide variety of PC peripherals and configurations and can
be used for everything from software development to Internet Service
Provision; the busiest site on the Internet, ftp.cdrom.com, is a
FreeBSD machine!
Provision.
This release of FreeBSD contains everything you need to run such a
system, plus full source code for everything. With the source
system, including full source code for everything. With the source
distribution installed you can literally recompile the entire system
from scratch with one command, making it ideal for students,
researchers or folks who simply want to see how it all works.
@ -36,26 +35,27 @@ researchers or folks who simply want to see how it all works.
A large collection of 3rd party ported software (the "ports
collection") is also provided to make it easier for you to obtain and
install all your favorite traditional UNIX utilities for FreeBSD.
Over 270 ports, from editors to programming languages to graphical
Over 350 ports, from editors to programming languages to graphical
applications, make FreeBSD a powerful and comprehensive operating
environment that rivals that of many large workstations for general utility
and power.
environment that extends far beyond what's provided by many commercial
versions of UNIX.
For more documentation on this system, it is recommended that you
For more documentation on this system it is recommended that you
purchase the 4.4BSD Document Set from O'Reilly Associates and the
USENIX Association, ISBN 1-56592-082-1. We have no connection with
O'Reilly, we're just satisfied customers!
You may also wish to read the HARDWARE GUIDE *before* proceeding any
further with the installation. Configuring PC hardware for anything
other than DOS/Windows (which don't actually make very significant
demands on the hardware) is actually quite a bit harder than it looks,
and if you think you understand PCs then you clearly haven't been
using them for long enough! :) This guide will give you some tips on
how to configure your hardware and what symptoms to watch for in case
of trouble. This guide is available in the Documentation menu of the
FreeBSD boot floppy.
If you're new to FreeBSD then you should also read EVERYTHING listed
in the Documentation menu on the boot floppy. It may seem like a lot
to read, but you should at least aquaint yourself with the types of
information available should you later get stuck. Once the system is
installed, you can also revisit this menu and use a WEB browser to
read the installed FAQ (Frequently Asked Questions) and Handbook HTML
documentation sets for FreeBSD. You can also use the browser to visit
other WEB sites on the net (such as http://www.freebsd.org) if you
have an Internet connection.
DISCLAIMER: While FreeBSD does its best to safeguard against accidental
loss of data, it's still more than possible to WIPE OUT YOUR ENTIRE DISK
@ -63,6 +63,8 @@ with this installation! Please do not proceed to the final FreeBSD
installation menu unless you've adequately backed up any important
data first! We really mean it!
o E-mail addresses and tech support info:
Technical comments on this release should be sent (in English!) to:
hackers@FreeBSD.org
@ -88,17 +90,32 @@ send-pr command are logged and tracked in our bugs database, and
you'll be kept informed of any changes in status during the life of
the bug (or feature request).
o WWW Resources:
Our WEB site, http://www.freebsd.org, is also a very good source for
updated information and provides a number of advanced documentation
facilities. You may use the BSDI version of Netscape for browsing the
World Wide Web directly from FreeBSD.
searching facilities. If you wish to use Netscape as your browser,
you may install the BSDI version from ftp://ftp.mcom.com or simply
type:
You may also wish to look in /usr/share/FAQ and /usr/share/doc for
further information on the system.
# cd /usr/ports/net/netscape
# make all install
If you have the Ports collection installed (see the Configuration menu
or enable the Ports collection when given the chance to do so during
the Novice installation).
Thanks for reading all of this, and we sincerely hope you enjoy this
release of FreeBSD!
Several other non-commercial browsers are also available in
/usr/ports/net and may be compiled and installed in the same fashion.
Many are also available as pre-compiled packages - see the Packages
entry in the Configuration menu for more details.
Jordan Hubbard,
for The FreeBSD Project
The Handbook and FAQ are also available as on-line documents in
/usr/share/doc and can be read using the ``file:/usr/share/doc''
syntax in any HTML capable browser.
We sincerely hope you enjoy this release of FreeBSD!
The FreeBSD Project

View file

@ -1,6 +1,6 @@
RELEASE NOTES
FreeBSD
Release 2.0.5
Release 2.1
1. Technical overview
---------------------
@ -10,16 +10,16 @@ for Intel i386/i486/Pentium (or compatible) based PC's. It is based
primarily on software from U.C. Berkeley's CSRG group, with some
enhancements from NetBSD, 386BSD, and the Free Software Foundation.
Since our release of FreeBSD 2.0 some 8 months ago, the performance,
feature set, and stability of FreeBSD has improved dramatically. The
Since our release of FreeBSD 2.0 over a year ago, the performance,
feature set and stability of FreeBSD has improved dramatically. The
largest change is a revamped VM system with a merged VM/file buffer
cache that not only increases performance, but reduces FreeBSD's
memory footprint, making a 4MB configuration a more acceptable
minimum. Other enhancements include full NIS client and server
support, transaction TCP support, dial-on-demand PPP, an improved SCSI
cache that not only increases performance but reduces FreeBSD's memory
footprint, making a 5MB configuration a more acceptable minimum.
Other enhancements include full NIS client and server support,
transaction TCP support, dial-on-demand PPP, an improved SCSI
subsystem, early ISDN support, support for FDDI and Fast Ethernet
(100Mbit) adapters, improved support for the Adaptec 2940 (WIDE and
narrow) and many hundreds of bug fixes.
narrow) and 3940 SCSI adaptors along with many hundreds of bug fixes.
We've also taken the comments and suggestions of many of our users to
heart and have attempted to provide what we hope is a more sane and
@ -27,63 +27,46 @@ easily understood installation process. Your feedback on this
(constantly evolving) process is especially welcome!
In addition to the base distributions, FreeBSD offers a new ported
software collection with some 270 commonly sought-after programs. The
software collection with over 350 commonly sought-after programs. The
list of ports ranges from http (WWW) servers, to games, languages,
editors and almost everything in between. The entire ports collection
requires only 10MB of storage, all ports being expressed as "deltas"
to their original sources. This makes it much easier for us to update
ports, and greatly reduces the disk space demands made by the older
1.0 ports collection. To compile a port, you simply change to the
directory of the program you wish to install, type make and let the
system do the rest. The full original distribution for each port you
build is retrieved dynamically off of CDROM or a local ftp site, so
you need only enough disk space to build the ports you want. (Almost)
every port is also provided as a pre-compiled "package" which can be
installed with a simple command (pkg_add) by those who do not wish to
compile their own ports from source. See the file:
/usr/share/FAQ/Text/ports.FAQ
for a more complete description of the ports collection.
ports and greatly reduces the disk space demands made by the ports
collection. To compile a port, you simply change to the directory of
the program you wish to install, type make and let the system do the
rest. The full original distribution for each port you build is
retrieved dynamically off of CDROM or a local ftp site, so you need
only enough disk space to build the ports you want. (Almost) every
port is also provided as a pre-compiled "package" which can be
installed with a simple command (pkg_add). See also the new Packages
option in the Configuration menu for an especially convenient interface
to the package collection.
Since our first release of FreeBSD 1.0 nearly two years ago, FreeBSD
has changed almost entirely. A new port from the Berkeley 4.4 code
base was done, which brought the legal status of the system out of the
shadows with the blessing of Novell (the new owners of USL and UNIX). The
port to 4.4 has also brought in a host of new features, filesystems
and enhanced driver support. With our new unencumbered code base, we
have every reason to hope that we'll be able to release quality
operating systems without further legal encumbrance for some time to
come!
A number of additional documents which you may find helpful in the
process of installing and using FreeBSD may now also be found in the
/usr/share/doc directory. You may view the manuals with any HTML
capable browser by saying:
FreeBSD 2.0.5 represents the culmination of 2 years of work and many
thousands of man hours put in by an international development team.
We hope you enjoy it!
To read the handbook:
<browser> file:/usr/share/doc/handbook/handbook.html
A number of additional documents which you may find very helpful in
the process of installing and using FreeBSD may also be found in
the "FAQ" directory, either under /usr/share/FAQ on an installed
system or at the top level of the CDROM or FTP distribution from
where you're reading this file. Please consult FAQ/Text/ROADMAP
for a brief description of the resources provided by the FAQ directory.
To read the FAQ:
<browser> file:/usr/share/doc/FAQ/freebsd-faq.html
For a list of contributors and a general project description, please see
the file "CONTRIB.FreeBSD" which should be bundled with your binary
distribution.
Also see the "REGISTER.FreeBSD" file for information on registering
with the "Free BSD user counter". This counter is for ALL freely
available variants of BSD, not just FreeBSD, and we urge you to register
yourself with it.
You can also visit the master (and most frequently updated) copies at
http://www.freebsd.org.
The core of FreeBSD does not contain DES code which would inhibit its
being exported outside the United States. There is an add-on package
to the core distribution, for use only in the United States, that
contains the programs that normally use DES. The auxiliary packages
provided separately can be used by anyone. A freely (from outside the
U.S.) exportable European distribution of DES for our non-U.S. users also
exists and is described in the FreeBSD FAQ.
provided separately can be used by anyone. A freely (from outside the
U.S.) exportable distribution of DES for our non-U.S. users also
exists at ftp://ftp.internat.freebsd.org/pub/FreeBSD.
If password security for FreeBSD is all you need, and you have no
If password security for FreeBSD is all you need and you have no
requirement for copying encrypted passwords from different hosts
(Suns, DEC machines, etc) into FreeBSD password entries, then
FreeBSD's MD5 based security may be all you require! We feel that our
@ -92,335 +75,6 @@ messy export issues to deal with. If you're outside (or even inside)
the U.S., give it a try!
1.1 What's new in 2.0.5?
------------------------
The following features were added or substantially improved between
the release of 2.0 and this 2.0.5 release. In order to facilitate
better communication, the person, or persons, responsible for each
enhancement is noted. Any questions regarding the new functionality
should be directed to them first.
KERNEL:
Merged VM-File Buffer Cache
---------------------------
A merged VM/buffer cache design greatly enhances overall system
performance and makes it possible to do a number of more optimal
memory allocation strategies that were not possible before.
Owner: David Greenman (davidg@FreeBSD.org) and
John Dyson (dyson@implode.root.com)
Network PCB hash optimization
-----------------------------
For systems with a great number of active TCP connections (WEB and ftp
servers, for example), this greatly speeds up the lookup time required
to match an incoming packet up to its associated connection.
Owner: David Greenman (davidg@FreeBSD.org)
Name cache optimization
-----------------------
The name-cache would cache all files of the same name to the same bucket,
which would put for instance all ".." entries in the same bucket. We added
the parent directory version to frustrate the hash, and improved the
management of the cache in various other ways while we were at it.
Owner: Poul-Henning Kamp (phk@FreeBSD.org)
David Greenman (davidg@FreeBSD.org)
Less restrictive swap-spaces
----------------------------
The need to compile the names of the swap devices into the kernel has been
removed. Now swapon will accept any block devices, up to the maximum
number of swap devices configured in the kernel.
Owner: Poul-Henning Kamp (phk@FreeBSD.org)
David Greenman (davidg@FreeBSD.org)
Hard Wired SCSI Devices
-----------------------
Prior to 2.0.5, FreeBSD performed dynamic assignment of unit numbers
to SCSI devices as they were probed, allowing a SCSI device failure to
possibly change unit number assignment and prevent filesystems on
still functioning disks from mounting. Hard wiring allows static
allocation of unit numbers (and hence device names) to scsi devices
based on SCSI ID and bus. SCSI configuration occurs in the kernel
config file. Samples of the configuration syntax can be found in the
scsi(4) man page or the LINT kernel config file.
Owner: Peter Dufault (dufault@hda.com)
Sources involved: sys/scsi/* usr.sbin/config/*
Slice Support
-------------
FreeBSD now supports a "slice" abstraction which makes it more
completely interoperable with other operating system partitions. This
support will allow FreeBSD to inhabit DOS extended partitions.
Owner: Bruce Evans (bde@FreeBSD.org)
Sources involved: sys/disklabel.h sys/diskslice.h sys/dkbad.h
kern/subr_diskslice.c kern/subr_dkbad.c
i386/isa/diskslice_machdep.c
i386/isa/wd.c scsi/sd.c dev/vn/vn.c
Support for Ontrack Disk Manager Version 6.0
--------------------------------------------
Support has been added for disks which use Ontrack Disk Manager. The
fdisk program does NOT know about it however, so make all changes
using the install program on the boot.flp or the Ontrack Disk Manager
tool under DOS.
Owner: Poul-Henning Kamp (phk@FreeBSD.org)
Bad144 is back and working
--------------------------
Bad144 works again, though the semantics are slightly different than
before in that the bad-spots are kept relative to the slice rather
than absolute on the disk.
Owner: Bruce Evans (bde@FreeBSD.org)
Poul-Henning Kamp (phk@FreeBSD.org)
NEW DEVICE SUPPORT:
SCSI and CDROM Devices
Matsushita/Panasonic (Creative) CD-ROM driver
---------------------------------------------
The Matsushita/Panasonic CR-562 and CR-563 drives are now supported
when connected to a Sound Blaster or 100% compatible host adapter. Up
to four host adapters are supported for a total of 16 CD-ROM drives.
The audio functions are supported, along with access to the raw (2352 byte)
data frames of any compact disc. Audio discs may be played using Karoke
variable speed functions.
Owner: Frank Durda IV bsdmail@nemesis.lonestar.org
Sources involved: isa/matcd
Adaptec 2742/2842/2940 SCSI driver
----------------------------------
The original 274x/284x driver has evolved considerably since the 2.0
release. We now offer full support for the 2940 series as well as the
Wide models of these cards. The arbitration bug (as well as many
others) that caused the driver problems with fast devices has been
corrected and there is even experimental tagged queuing support
(kernel option "AHC_TAGENABLE"). John Aycock has also released the
sequencer code under a "Berkeley style" copyright making the driver
entirely clean of the GPL.
Owner: Justin Gibbs (gibbs@FreeBSD.org)
Sources involved: isa/aic7770.c pci/aic7870.c i386/scsi/*
sys/dev/aic7xxx/*
NCR5380/NCR53400 SCSI ("ProAudio Spectrum") driver
--------------------------------------------------
Owner: core
Submitted by: Serge Vakulenko (vak@cronyx.ru)
Sources involved: isa/ncr5380.c
Sony CDROM driver
-----------------
Owner: core
Submitted by: Mikael Hybsch (micke@dynas.se)
Sources involved: isa/scd.c
Serial Devices
SDL Communications Riscom/8 Serial Board Driver
-----------------------------------------------
Owner: Andrey Chernov (ache@FreeBSD.org)
Sources involved: isa/rc.c isa/rcreg.h
Cyclades Cyclom-y Serial Board Driver
-------------------------------------
Owner: Bruce Evans (bde@FreeBSD.org)
Submitted by: Andrew Werple (andrew@werple.apana.org.au) and
Heikki Suonsivu (hsu@cs.hut.fi)
Obtained from: NetBSD
Sources involved: isa/cy.c
Cronyx/Sigma sync/async serial driver
-------------------------------------
Owner: core
Submitted by: Serge Vakulenko
Sources involved: isa/cronyx.c
Networking
Diskless booting
----------------
Diskless booting in 2.0.5 is much improved. The boot-program is in
src/sys/i386/boot/netboot, and can be run from an MSDOS system or
burned into an EPROM. Local swapping is also possible. WD, SMC, 3COM
and Novell ethernet cards are currently supported.
DEC DC21140 Fast Ethernet driver
--------------------------------
This driver supports any of the numerous NICs using the DC21140 chipset
including the 100Mb DEC DE-500-XA and SMC 9332.
Owner: core
Submitted by: Matt Thomas (thomas@lkg.dec.com)
Sources involved: pci/if_de.c pci/dc21040.h
DEC FDDI (DEFPA/DEFEA) driver
-----------------------------
Owner: core
Submitted by: Matt Thomas (thomas@lkg.dec.com)
Sources involved: pci/if_pdq.c pci/pdq.c pci/pdq_os.h pci/pdqreg.h
3Com 3c505 (Etherlink/+) NIC driver
-----------------------------------
Owner: core
Submitted by: Dean Huxley (dean@fsa.ca)
Obtained from: NetBSD
Sources involved: isa/if_eg.c
Fujitsu MB86960A family of NICs driver
-------------------------------------
Owner: core
Submitted by: M.S. (seki@sysrap.cs.fujitsu.co.jp)
Sources involved: isa/if_fe.c
Intel EtherExpress driver
-------------------------
Owner: Rodney W. Grimes (rgrimes@FreeBSD.org)
Sources involved: isa/if_ix.c isa/if_ixreg.h
3Com 3c589 driver
-----------------
Owner: core
Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
Seiji Murata (seiji@mt.cs.keio.ac.jp) and
Noriyuki Takahashi (hor@aecl.ntt.jp)
Sources involved: isa/if_zp.c
IBM Credit Card Adapter driver
------------------------------
Owner: core
Submitted by: "HOSOKAWA Tatsumi" (hosokawa@mt.cs.keio.ac.jp),
Sources involved: isa/pcic.c isa/pcic.h
EDSS1 and 1TR6 ISDN interface driver
------------------------------------
Owner: core
Submitted by: Dietmar Friede (dfriede@drnhh.neuhaus.de) and
Juergen Krause (jkr@saarlink.de)
Sources involved: gnu/isdn/*
Miscellaneous Drivers
Joystick driver
---------------
Owner: Jean-Marc Zucconi (jmz@FreeBSD.org)
Sources involved: isa/joy.c
National Instruments "LabPC" driver
-----------------------------------
Owner: Peter Dufault (dufault@hda.com)
Sources involved: isa/labpc.c
WD7000 driver
-------------
Owner: Olof Johansson (offe@ludd.luth.se)
Pcvt Console driver
-------------------
Owner: Joerg Wunsch (joerg@FreeBSD.org)
Submitted by: Hellmuth Michaelis (hm@altona.hamburg.com)
Sources involved: isa/pcvt/* usr.sbin/pcvt/*
BSD-audio emulator for VAT driver
---------------------------------
Owner: Amancio Hasty (ahasty@FreeBSD.org) and
Paul Traina (pst@FreeBSD.org)
Sources involved: isa/sound/vat_audio.c isa/sound/vat_audioio.h
National Instruments AT-GPIB and AT-GPIB/TNT GPIB driver
--------------------------------------------------------
Owner: core
Submitted by: Fred Cawthorne (fcawth@delphi.umd.edu)
Sources involved: isa/gpib.c isa/gpib.h isa/gpibreg.h
Genius GS-4500 hand scanner driver
----------------------------------
Owner: core
Submitted by: Gunther Schadow (gusw@fub46.zedat.fu-berlin.de)
Sources involved: isa/gsc.c isa/gscreg.h
CORTEX-I Frame Grabber
----------------------
Owner: core
Submitted by: Paul S. LaFollette, Jr.
Sources involved: isa/ctx.c isa/ctxreg.h
Video Spigot video capture card
-------------------------------
Owner: Jim Lowe
1.2 Experimental features
-------------------------
The unionfs and LFS file systems are known to be severely broken in
2.0.5. This is in part due to old bugs that we haven't had time to
resolve yet and the need to update these file systems to deal with the
new VM system. We hope to address these issues in a later release of
FreeBSD.
FreeBSD now supports running iBCS2 compatible binaries (currently SCO
UNIX 3.2.2 & 3.2.4 and ISC 2.2 COFF format are supported). The iBCS2
emulator is in its early stages, but it is functional, we haven't been
able to do exhaustive testing (lack of commercial apps), but almost
all of SCO's 3.2.2 binaries are working, so is an old INFORMIX-2.10
for SCO. Further testing is nessesary to complete this project. There
is also work under way for ELF & XOUT loaders, and most of the svr4
syscall wrappers have been written.
FreeBSD also implements enough of its Linux compatibility that we
can now run Linux DOOM! See the ``xperimnt'' directory (on your local
FTP server or CDROM) for full docs on how to set this up.
Owner: Soren Schmidt (sos) & Sean Eric Fagan (sef)
Sources involved: sys/i386/ibcs2/* + misc kernel changes.
2. Supported Configurations
---------------------------
@ -430,9 +84,9 @@ based PC's, ranging from 386sx to Pentium class machines (though the
configurations, various SCSI controller, network and serial cards is
also provided.
Following is a list of all disk controllers and ethernet cards currently
known to work with FreeBSD. Other configurations may very well work, and
we have simply not received any indication of this.
What follows is a list of all disk controllers and ethernet cards
currently known to work with FreeBSD. Other configurations may also
work, but we have simply not received any confirmation of this.
2.1. Disk Controllers
@ -446,17 +100,19 @@ ATA
Adaptec 152x series ISA SCSI controllers
Adaptec 154x series ISA SCSI controllers
Adaptec 174x series EISA SCSI controller in standard and enhanced mode.
Adaptec 274X/284X/2940 (Narrow/Wide/Twin) series ISA/EISA/PCI SCSI controllers
Adaptec 274X/284X/2940/3940 (Narrow/Wide/Twin) series ISA/EISA/PCI SCSI
controllers.
Adaptec AIC-6260 and AIC-6360 based boards, which includes
the AHA-152x and SoundBlaster SCSI cards.
** Note: You cannot boot from the SoundBlaster cards as they have no
on-board BIOS, which is necessary for mapping the boot device into the
on-board BIOS, such being necessary for mapping the boot device into the
system BIOS I/O vectors. They're perfectly usable for external tapes,
CDROMs, etc, however. The same goes for any other AIC-6x60 based card
without a boot ROM. Some systems DO have a boot ROM, which is generally
indicated by some sort of message when the system is first powered up
or reset. Check your system/board documentation for more details.
or reset, and in such cases you *will* also be able to boot from them.
Check your system/board documentation for more details.
[Note that Buslogic was formerly known as "Bustec"]
Buslogic 545S & 545c
@ -483,25 +139,14 @@ SCSI-I & SCSI-II peripherals, including Disks, tape drives (including
DAT) and CD ROM drives.
The following CD-ROM type systems are supported at this time:
(cd) SCSI (also includes ProAudio Spectrum and SoundBlaster SCSI)
(mcd) Mitsumi proprietary interface
(matcd) Matsushita/Panasonic (Creative) proprietary interface
(scd) Sony proprietary interface
Note: CD-Drives with IDE interfaces are not supported at this time.
Some controllers have limitations with the way they deal with >16MB of
memory, due to the fact that the ISA bus only has a DMA address space
of 24 bits. If you do your arithmetic, you'll see that this makes it
impossible to do direct DMA to any address >16MB. This limitation is
even true of some EISA controllers (which are normally 32 bit) when
they're configured to emulate an ISA card, which they then do in *all*
respects. This problem is avoided entirely by IDE controllers (which
do not use DMA), true EISA controllers (like the UltraStor, Adaptec
1742A or Adaptec 2742) and most VLB (local bus) controllers. In the
cases where it's necessary, the system will use "bounce buffers" to
talk to the controller so that you can still use more than 16Mb of
memory without difficulty.
(cd) SCSI interface (also includes ProAudio Spectrum and
SoundBlaster SCSI)
(mcd) Mitsumi proprietary interface (all models)
(matcd) Matsushita/Panasonic (Creative SoundBlaster) proprietary
interface (562/563 models)
(scd) Sony proprietary interface (all models)
(wcd) ATAPI IDE interface (experimental and should be considered ALPHA
quality!).
2.2. Ethernet cards
@ -541,6 +186,10 @@ Toshiba ethernet cards
PCMCIA ethernet cards from IBM and National Semiconductor are also
supported.
Note that NO token ring cards are supported at this time as we're
still waiting for someone to donate a driver for one of them. Any
takers?
2.3. Misc
---------
@ -555,20 +204,13 @@ Cyclades Cyclom-y Serial Board.
STB 4 port card using shared IRQ.
Mitsumi (all models) CDROM interface and drive.
SDL Communications Riscom/8 Serial Board.
SoundBlaster SCSI and ProAudio Spectrum SCSI CDROM interface and drive.
Matsushita/Panasonic (Creative SoundBlaster) CDROM interface and drive.
Adlib, SoundBlaster, SoundBlaster Pro, ProAudioSpectrum, Gravis UltraSound
and Roland MPU-401 sound cards.
FreeBSD currently does NOT support IBM's microchannel (MCA) bus, but
support is apparently close to materializing. Details will be posted
as the situation develops.
FreeBSD currently does NOT support IBM's microchannel (MCA) bus.
3. Obtaining FreeBSD
@ -582,21 +224,23 @@ You can ftp FreeBSD and any or all of its optional packages from
`ftp.freebsd.org' - the official FreeBSD release site.
For other locations that mirror the FreeBSD software see the file
MIRROR.SITES. Please ftp the distribution from the nearest site
to you netwise.
MIRROR.SITES. Please ftp the distribution from the site closest (in
networking terms) to you. Additional mirror sites are always welcome!
Contact admin@freebsd.org for more details if you'd like to become an
official mirror site.
If you do not have access to the internet and electronic mail is your
only recourse, then you may still fetch the files by sending mail to
`ftpmail@decwrl.dec.com' - putting the keyword "help" in your message
to get more information on how to fetch files from ftp.freebsd.org.
Note: This approach will end up sending many *tens of megabytes*
through the mail, and should only be employed as an absolute LAST
resort!
to get more information on how to fetch files using this mechanism.
Please do note, however, that this will end up sending many *tens of
megabytes* through the mail and should only be employed as an absolute
LAST resort!
2. CDROM
FreeBSD 2.0.5 may be ordered on CDROM from:
FreeBSD 2.1 may be ordered on CDROM from:
Walnut Creek CDROM
4041 Pike Lane, Suite D
@ -607,19 +251,21 @@ Or via the internet from orders@cdrom.com or http://www.cdrom.com.
Their current catalog can be obtained via ftp as:
ftp://ftp.cdrom.com/cdrom/catalog.
Cost per CD is $39.95, or $24.95 with a FreeBSD subscription. With
a subscription, you will automatically receive updates as they
are released. Your credit card will be billed when each disk is shipped
and you may cancel your subscription at any time without further obligation.
Cost per CD is $39.95 or $24.95 with a FreeBSD subscription. With a
subscription, you will automatically receive updates as they are
released. Your credit card will be billed when each disk is shipped
and you may cancel your subscription at any time without further
obligation.
Walnut Creek CDROM also sells a full line of FreeBSD related merchandise such
as T-shirts ($14.95, available in "child", Large and XL sizes), coffee mugs
($9.95), tattoos ($0.25 each) and posters ($3.00).
Walnut Creek CDROM also sells a full line of FreeBSD related
merchandise such as T-shirts ($14.95, available in "child", Large and
XL sizes), coffee mugs ($9.95), tattoos ($0.25 each) and posters
($3.00).
Shipping (per order not per disc) is $5 in the US, Canada or
Mexico and $9.00 overseas. They accept Visa, Mastercard, Discover,
American Express or checks in U.S. Dollars and ship COD within the
United States. California residents please add 8.25% sales tax.
Shipping (per order not per disc) is $5 in the US, Canada or Mexico
and $9.00 overseas. They accept Visa, Mastercard, Discover, American
Express or checks in U.S. Dollars and ship COD within the United
States. California residents please add 8.25% sales tax.
Should you be dissatisfied for any reason, the CD comes with an
unconditional return policy.
@ -630,13 +276,16 @@ Reporting problems, making suggestions, submitting code
Your suggestions, bug reports and contributions of code are always
valued - please do not hesitate to report any problems you may find
(preferably with a fix attached if you can!).
(preferably with a fix attached, if you can!).
The preferred method to submit bug reports from a machine with
internet mail connectivity is to use the send-pr command. Bug reports
will be dutifully filed by our faithful bugfiler program and you can
be sure that we'll do our best to respond to all reported bugs as soon
as possible.
as possible. Bugs filed in this way are also visible on our WEB site
in the support section and are therefore valuable both as bug reports
and as "signposts" for other users concerning potential problems to
watch out for.
If, for some reason, you are unable to use the send-pr command to
submit a bug report, you can try to send it to:
@ -648,17 +297,20 @@ Otherwise, for any questions or suggestions, please send mail to:
questions@FreeBSD.org
Additionally, being a volunteer effort, we are always happy to have
extra hands willing to help - there are already far more enhancements
to be done than we can ever manage to do by ourselves! To contact us
on technical matters, or with offers of help, you may send mail to:
extra hands willing to help - there are already far more desired
enhancements than we'll ever be able to manage by ourselves! To
contact us on technical matters, or with offers of help, please send
mail to:
hackers@FreeBSD.org
Since these mailing lists can experience significant amounts of
traffic, if you have slow or expensive mail access and you are
only interested in keeping up with significant FreeBSD events, you may
find it preferable to subscribe to:
Please note that these mailing lists can experience *significant*
amounts of traffic and if you have slow or expensive mail access and
are only interested in keeping up with significant FreeBSD events, you
may find it preferable to subscribe instead to:
announce@FreeBSD.org
@ -679,9 +331,11 @@ FreeBSD represents the cumulative work of many dozens, if not
hundreds, of individuals from around the world who have worked very
hard to bring you this release. It would be very difficult, if not
impossible, to enumerate everyone who's contributed to FreeBSD, but
nonetheless we shall try (in alphabetical order, of course). If your
name is not mentioned, please be assured that its omission is entirely
accidental.
nonetheless we shall try (in alphabetical order, of course). If you've
contributed something substantive to us and your name is not mentioned
here, please be assured that its omission is entirely accidental.
Please contact hackers@FreeBSD.org for any desired updates to the
lists that follow:
The Computer Systems Research Group (CSRG), U.C. Berkeley.
@ -691,21 +345,18 @@ Bill Jolitz, for his initial work with 386BSD.
The FreeBSD Core Team
(in alphabetical order by first name):
Andreas Schulz <ats@FreeBSD.org>
Andrey A. Chernov <ache@FreeBSD.org>
Bruce Evans <bde@FreeBSD.org>
David Greenman <davidg@FreeBSD.org>
Garrett A. Wollman <wollman@FreeBSD.org>
Gary Palmer <gpalmer@FreeBSD.org>
Geoff Rehmet <csgr@FreeBSD.org>
Jack Vogel <jackv@FreeBSD.org>
Jörg Wunsch <joerg@FreeBSD.org>
John Dyson <dyson@FreeBSD.org>
Jordan K. Hubbard <jkh@FreeBSD.org>
Justin Gibbs <gibbs@FreeBSD.org>
Paul Richards <paul@FreeBSD.org>
Peter Wemm <peter@FreeBSD.org>
Poul-Henning Kamp <phk@FreeBSD.org>
Rich Murphey <rich@FreeBSD.org>
Rodney W. Grimes <rgrimes@FreeBSD.org>
Satoshi Asami <asami@FreeBSD.org>
Søren Schmidt <sos@FreeBSD.org>
@ -719,29 +370,24 @@ Special mention to:
Additional FreeBSD helpers and beta testers:
J.T. Conklin Julian Elischer
Frank Durda IV Peter Dufault
Sean Eric Fagan Jeffrey Hsu
Terry Lambert L Jonas Olsson
Chris Provenzano Dave Rivers
Guido van Rooij Steven Wallace
Atsushi Murai Scott Mace
Nate Williams
Atsushi Murai Coranth Gryphon
Dave Rivers Frank Durda IV
Guido van Rooij Jeffrey Hsu
John Hay Julian Elischer
Kaleb S. Keithley Michael Smith
Nate Williams Peter Dufault
Peter Wemm Rod Grimes
Scott Mace Stefan Esser
Steven Wallace Terry Lambert
Wolfram Schneider
And everyone at Montana State University for their initial support.
And to the many thousands of FreeBSD users and testers all over the
world without whom this release simply would not have been possible.
Jordan would also like to give special thanks to Poul-Henning Kamp and
Gary Palmer, both of whom put in long hours helping him to construct
the new installation utility. Poul, being a proud new father, was
especially pressed for time and yet somehow managed to put in
a significant amount of effort anyway. This release could not have
happened without him! Thank you both!
Thanks also to everyone else who helped, especially those not
mentioned, and we sincerely hope you enjoy this release of FreeBSD!
We sincerely hope you enjoy this release of FreeBSD!
The FreeBSD Core Team
$Id: RELNOTES,v 1.10 1995/06/10 09:56:30 jkh Exp $
$Id: relnotes.hlp,v 1.1.2.10 1995/11/17 13:34:54 jkh Exp $

View file

@ -1,15 +1,23 @@
This is the Main Partition (or ``Slice'') Editor.
This is the Main Partition (or ``FDISK'') Editor.
Possible commands are printed at the bottom and the Master Boot Record
contents are shown at the top. You can move up and down with the
arrow keys and (C)reate a new partition whenever the highlighted
selection bar is over a partition whose type is marked as "unused."
You are expected to leave this screen with at least one partition
marked "FreeBSD." Note that unlike Linux, you don't need to create
multiple FreeBSD fdisk partition entries for different things like
swap, file systems, etc. The usual convention is to create ONE
FreeBSD partition per drive and then subsection this partition into
swap and file systems with the Label editor.
Possible commands are printed at the bottom, and the Master Boot Record
contents are at the top. You can move up and down with the arrow keys
and can (C)reate a new partition whenever the "bar" is over a partition
whose type is set to "unused".
The flags field has the following legend:
'=' -- Partition is properly aligned.
'>' -- The partition doesn't end before cylinder 1024
'R' -- Has been marked as containing the root (/) filesystem
'=' -- This partition is properly aligned.
'>' -- This partition doesn't end before cylinder 1024
'R' -- This partition contains the root (/) filesystem
'B' -- Partition employs BAD144 bad-spot handling
'C' -- This is the FreeBSD 2.0-compatibility partition (default)
'A' -- This partition is marked active.
@ -21,8 +29,39 @@ If no partition is marked Active, you will need to either install
a Boot Manager (the option for which will be presented later in the
installation) or set one Active before leaving this screen.
To leave this screen, type `Q'.
To leave the partition editor, type `Q'.
No actual changes will be made to the disk until you (C)ommit from the
Install menu! You're working with what is essentially a copy of
the disk label(s), both here and in the Label Editor.
Install menu or use the (W)rite option here! You're working with what
is essentially a copy of the disk label(s), both here and in the Label
Editor.
NOTE: The (W)rite option is HIGHLY DANGEROUS and should NOT BE USED if
you're installing a new system! It's only for use in resurrecting
or changing an existing system, and will cause unpredictable things to
happen if you use it in any other circumstances. Don't do it! Wait
for the final commit dialog if you're express/novice installing, or
use the "Commit" menu item if you're custom installing, and do it there.
If you want to use the entire disk for FreeBSD, type `A'. You'll be
asked whether or not you wish to keep the disk (potentially) compatible
with other operating systems, i.e. the information in the FDISK table
should be kept valid. If you select the default of `Yes', slices will be
aligned to fictitious cylinder boundaries and space will be reserved
in front of the FreeBSD slice for a [future] possible boot manager.
For the truly dedicated disk case, you can select `No' at the
compatibility prompt. In that case, all BIOS geometry considerations
will no longer be in effect and you can safely ignore any
``The detected geometry is invalid'' warning messages you may later
see. It is also not necessary in this case to set a partition bootable
or install an MBR boot manager as both things are then irrelevant.
The FreeBSD slice will start at absolute sector 0 of the disk (so that
FreeBSD's disk label is identical to the Master Boot Record) and
extend to the very last sector of the disk medium. Needless to say,
such a disk cannot have any sort of a boot manager, `disk manager',
or anything else that has to interact with the BIOS. This option is
therefore only considered safe for SCSI disks and most IDE disks and
is primarily intented for people who are going to set up a dedicated
FreeBSD server or workstation, not a typical `home PC'.

View file

@ -1,6 +1,9 @@
HOW TO USE THIS SYSTEM
======================
The following keys are recognised in most of the dialogs you'll
encounter during this installation:
KEY ACTION
--- ------
UP ARROW Move to previous item (or up, in a text field).
@ -12,18 +15,22 @@ LEFT ARROW Move to previous item or group (same as SHIFT-TAB).
RETURN Select item.
PAGE UP In text boxes, scrolls up one page.
PAGE DOWN In text boxes, scrolls down one page.
SPACE In "radio" or multiple choice menus, toggle the current item.
SPACE In "radio" or multiple choice menus, toggle the current
item. In help screens, scroll to next page of text.
F1 Help (in screens that provide it).
If you also see small "^(-)" or "v(+)" symbols at the edges of a menu,
it means that there are more items above or below the current one that
aren't being shown (due to insufficient screen space). Using the
up/down arrow keys will cause the menu to scroll. When a symbol
disappears, it means you are at the top (or bottom) of the menu.
In text fields, the amount of text above the current point will be
displayed as a percentage in the lower right corner. 100% means
you're at the bottom of the field.
you're at the bottom of the available text.
If you see small "^(-)" or "v(+)" symbols at the edges of a menu, it
means that there are more items above or below the current one that
aren't being shown (due to insufficient screen space). Using the
up/down arrow keys will cause the menu to scroll. The PageUp and
PageDown keys will scroll by entire screens.
When an arrow symbol disappears, it means you are at the top (or
bottom) of the menu.
Selecting OK in a menu will confirm whatever action it's controlling.
Selecting Cancel will cancel the operation and generally return you to
@ -35,20 +42,25 @@ SPECIAL FEATURES:
It is also possible to select a menu item by typing the first
character of its name, if unique. Such "accelerator" characters will
be specially highlighted in the item name.
be specially highlighted in the item name. Unfortunately, the
accellerators aren't always unique (a shortcoming of the dialog menu
library) so you'll only be able to get at the *first* unique menu
entry for a given accellerator.
The console driver also contains a scroll-back buffer for reviewing
things that may have scrolled off the screen. To use scroll-back,
press the "Scroll Lock" key on your keyboard and use the arrow or
Page Up/Page Down keys to move through the saved text. To leave
scroll-back mode, press the Scroll Lock key again. This feature
is most useful for dealing with sub-shells or other "wizard modes"
that don't use menus.
press the "Scroll Lock" key on your keyboard and use the arrow or Page
Up/Page Down keys to move through the saved text. To leave
scroll-back mode, press the Scroll Lock key again. This feature is
most useful for reading back through your boot messages (go ahead, try
it now!) though it's also useful when dealing with sub-shells or other
"wizard modes" that don't use menus and tend to scroll their output
off the top of the screen.
Once the system is fully installed and running "multi-user", you will
also find that you have multiple "virtual consoles" and can use them to
have several active sessions at once. Use ALT-F<n> to switch between
them, where `F<n>' is the function key corresponding to the screen you
wish to see. By default, the system comes with 3 virtual consoles enabled.
You can create more by editing the /etc/ttys file, once the system is up,
for a maximum of 12.
Once the system is fully installed and running multi-user you will
also find that you have multiple "virtual consoles" and can use them
to have several active sessions at once. Use ALT-F<n> to switch
between them, where `F<n>' is the function key corresponding to the
screen you wish to see. By default, the system comes with 3 virtual
consoles enabled. You can create more by editing the /etc/ttys file
(up to a maximum of 12).

File diff suppressed because it is too large Load diff

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.32.2.2 1995/07/21 11:45:39 rgrimes Exp $
* $Id: label.c,v 1.33 1995/09/18 16:52:28 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -45,8 +45,6 @@
#include <ctype.h>
#include <sys/disklabel.h>
#include <sys/param.h>
#undef TRUE
#undef FALSE
#include <sys/sysctl.h>
/*
@ -60,14 +58,20 @@
#define CHUNK_SLICE_START_ROW 2
#define CHUNK_PART_START_ROW 11
/* One MB worth of blocks */
#define ONE_MEG 2048
/* The smallest filesystem we're willing to create */
#define FS_MIN_SIZE ONE_MEG
/* The smallest root filesystem we're willing to create */
#define ROOT_MIN_SIZE (20 * ONE_MEG)
#define ROOT_MIN_SIZE 20
/* The smallest swap partition we want to create by default */
#define SWAP_MIN_SIZE 16
/* The smallest /usr partition we're willing to create by default */
#define USR_MIN_SIZE 80
/* The smallest /var partition we're willing to create by default */
#define VAR_MIN_SIZE 30
/* All the chunks currently displayed on the screen */
static struct {
@ -76,6 +80,118 @@ static struct {
} label_chunk_info[MAX_CHUNKS + 1];
static int here;
static int diskLabel(char *str);
static int scriptLabel(char *str);
static int
labelHook(char *str)
{
Device **devs = NULL;
/* Clip garbage off the ends */
string_prune(str);
str = string_skipwhite(str);
/* Try and open all the disks */
while (str) {
char *cp;
cp = index(str, '\n');
if (cp)
*cp++ = 0;
if (!*str) {
beep();
return 0;
}
devs = deviceFind(str, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("Unable to find disk %s!", str);
return 0;
}
else if (devs[1]) {
dialog_clear();
msgConfirm("Bizarre multiple match for %s!", str);
}
devs[0]->enabled = TRUE;
str = cp;
}
return devs ? 1 : 0;
}
int
diskLabelEditor(char *str)
{
Device **devs;
DMenu *menu;
int i, cnt;
char *cp;
cp = variable_get(VAR_DISK);
devs = deviceFind(cp, DEVICE_TYPE_DISK);
cnt = deviceCount(devs);
if (!cnt) {
dialog_clear();
msgConfirm("No disks found! Please verify that your disk controller is being\n"
"properly probed at boot time. See the Hardware Guide on the\n"
"Documentation menu for clues on diagnosing this type of problem.");
return RET_FAIL;
}
else if (cnt == 1 || variable_get(DISK_SELECTED)) {
devs[0]->enabled = TRUE;
if (str && !strcmp(str, "script"))
i = scriptLabel(str);
else
i = diskLabel(str);
}
else {
menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, labelHook);
if (!menu) {
dialog_clear();
msgConfirm("No devices suitable for installation found!\n\n"
"Please verify that your disk controller (and attached drives)\n"
"were detected properly. This can be done by pressing the\n"
"[Scroll Lock] key and using the Arrow keys to move back to\n"
"the boot messages. Press [Scroll Lock] again to return.");
i = RET_FAIL;
}
else {
if (!dmenuOpenSimple(menu))
i = RET_FAIL;
else
i = diskLabel(str);
free(menu);
}
}
return i;
}
int
diskLabelCommit(char *str)
{
char *cp;
int i;
/* Already done? */
if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes"))
i = RET_SUCCESS;
else if (!cp) {
dialog_clear();
msgConfirm("You must assign disk labels before this option can be used.");
i = RET_FAIL;
}
/* The routine will guard against redundant writes, just as this one does */
else if (diskPartitionWrite(str) != RET_SUCCESS)
i = RET_FAIL;
else if (installFilesystems(str) != RET_SUCCESS)
i = RET_FAIL;
else {
msgInfo("All filesystem information written successfully.");
variable_set2(DISK_LABELLED, "written");
i = RET_SUCCESS;
}
return i;
}
/* See if we're already using a desired partition name */
static Boolean
check_conflict(char *name)
@ -93,13 +209,12 @@ check_conflict(char *name)
static int
space_free(struct chunk *c)
{
struct chunk *c1 = c->part;
struct chunk *c1;
int sz = c->size;
while (c1) {
for (c1 = c->part; c1; c1 = c1->next) {
if (c1->type != unused)
sz -= c1->size;
c1 = c1->next;
}
if (sz < 0)
msgFatal("Partitions are larger than actual chunk??");
@ -108,19 +223,12 @@ space_free(struct chunk *c)
/* Snapshot the current situation into the displayed chunks structure */
static void
record_label_chunks()
record_label_chunks(Device **devs)
{
int i, j, p;
struct chunk *c1, *c2;
Device **devs;
Disk *d;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
msgConfirm("No disks found!");
return;
}
j = p = 0;
/* First buzz through and pick up the FreeBSD slices */
for (i = 0; devs[i]; i++) {
@ -139,6 +247,7 @@ record_label_chunks()
}
}
}
/* Now run through again and get the FreeBSD partition entries */
for (i = 0; devs[i]; i++) {
if (!devs[i]->enabled)
@ -198,7 +307,7 @@ new_part(char *mpoint, Boolean newfs, u_long size)
}
/* Get the mountpoint for a partition and save it away */
PartInfo *
static PartInfo *
get_mountpoint(struct chunk *old)
{
char *val;
@ -266,7 +375,9 @@ get_partition_type(void)
"A swap partition.",
};
i = dialog_menu("Please choose a partition type",
"If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL);
"If you want to use this partition for swap space, select Swap.\n"
"If you want to put a filesystem on it, choose FS.",
-1, -1, 2, 2, fs_types, selection, NULL, NULL);
if (!i) {
if (!strcmp(selection, "FS"))
return PART_FILESYSTEM;
@ -283,11 +394,124 @@ getNewfsCmd(PartInfo *p)
char *val;
val = msgGetInput(p->newfs_cmd,
"Please enter the newfs command and options you'd like to use in\ncreating this file system.");
"Please enter the newfs command and options you'd like to use in\n"
"creating this file system.");
if (val)
strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
}
static int
scriptLabel(char *str)
{
char *cp;
PartType type;
PartInfo *p;
u_long flags = 0;
int i, status;
Device **devs;
Disk *d;
status = RET_SUCCESS;
cp = variable_get(VAR_DISK);
if (!cp) {
dialog_clear();
msgConfirm("scriptLabel: No disk selected - can't label automatically.");
return RET_FAIL;
}
devs = deviceFind(cp, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("scriptLabel: No disk device %s found!", cp);
return RET_FAIL;
}
d = devs[0]->private;
record_label_chunks(devs);
for (i = 0; label_chunk_info[i].c; i++) {
Chunk *c1 = label_chunk_info[i].c;
if (label_chunk_info[i].type == PART_SLICE) {
if ((cp = variable_get(c1->name)) != NULL) {
int sz;
char typ[10], mpoint[50];
if (sscanf(cp, "%s %d %s", typ, &sz, mpoint) != 3) {
dialog_clear();
msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp);
status = RET_FAIL;
continue;
}
else {
Chunk *tmp;
if (!strcmp(typ, "swap")) {
type = PART_SWAP;
strcpy(mpoint, "<swap>");
}
else {
type = PART_FILESYSTEM;
if (!strcmp(mpoint, "/"))
flags |= CHUNK_IS_ROOT;
}
if (!sz)
sz = space_free(c1);
if (sz > space_free(c1)) {
dialog_clear();
msgConfirm("Not enough free space to create partition: %s", mpoint);
status = RET_FAIL;
continue;
}
if (!(tmp = Create_Chunk_DWIM(d, c1, sz, part,
(type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, flags))) {
dialog_clear();
msgConfirm("Unable to create from partition spec: %s. Too big?", cp);
status = RET_FAIL;
break;
}
else {
tmp->private = new_part(mpoint, TRUE, sz);
tmp->private_free = safe_free;
status = RET_SUCCESS;
}
}
}
}
else {
/* Must be something we can set a mountpoint */
cp = variable_get(c1->name);
if (cp) {
char mpoint[50], nwfs[8];
Boolean newfs = FALSE;
nwfs[0] = '\0';
if (sscanf(cp, "%s %s", mpoint, nwfs) != 2) {
dialog_clear();
msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp);
status = RET_FAIL;
continue;
}
newfs = toupper(nwfs[0]) == 'Y' ? TRUE : FALSE;
if (c1->private) {
p = c1->private;
p->newfs = newfs;
strcpy(p->mountpoint, mpoint);
}
else {
c1->private = new_part(mpoint, newfs, 0);
c1->private_free = safe_free;
}
if (!strcmp(mpoint, "/"))
c1->flags |= CHUNK_IS_ROOT;
else
c1->flags &= ~CHUNK_IS_ROOT;
}
}
}
if (status == RET_SUCCESS)
variable_set2(DISK_LABELLED, "yes");
return status;
}
#define MAX_MOUNT_NAME 12
@ -401,8 +625,8 @@ print_command_summary()
move(0, 0);
}
int
diskLabelEditor(char *str)
static int
diskLabel(char *str)
{
int sz, key = 0;
Boolean labeling;
@ -411,14 +635,17 @@ diskLabelEditor(char *str)
PartType type;
Device **devs;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("No disks found!");
return RET_FAIL;
}
labeling = TRUE;
keypad(stdscr, TRUE);
record_label_chunks();
record_label_chunks(devs);
if (!getenv(DISK_PARTITIONED)) {
msgConfirm("You need to partition your disk(s) before you can assign disk labels.");
return 0;
}
dialog_clear(); clear();
while (labeling) {
clear();
@ -426,6 +653,7 @@ diskLabelEditor(char *str)
print_command_summary();
if (msg) {
attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
clrtoeol();
beep();
msg = NULL;
}
@ -467,7 +695,7 @@ diskLabelEditor(char *str)
case KEY_F(1):
case '?':
systemDisplayFile("partition.hlp");
systemDisplayHelp("partition");
break;
case 'A':
@ -481,73 +709,105 @@ diskLabelEditor(char *str)
if (label_chunk_info[i++].type != PART_SLICE)
cnt++;
if (cnt == (CHUNK_COLUMN_MAX * 2) + 4) {
msgConfirm("Sorry, I can't fit any more partitions on the screen! You can get around\nthis limitation by partitioning your disks individually rather than all\nat once. This will be fixed just as soon as we get a scrolling partition\nbox written. Sorry for the inconvenience!");
dialog_clear();
msgConfirm("Sorry, I can't fit any more partitions on the screen! You can get around\n"
"this limitation by partitioning your disks individually rather than all\n"
"at once. This will be fixed just as soon as we get a scrolling partition\n"
"box written. Sorry for the inconvenience!");
break;
}
sz = space_free(label_chunk_info[here].c);
if (sz <= FS_MIN_SIZE) {
msg = "Not enough space to create additional FreeBSD partition";
msg = "Not enough space to create an additional FreeBSD partition";
break;
}
{
struct chunk *tmp;
int mib[2];
int physmem;
size_t size;
size_t size, swsize;
char *cp;
cp = variable_get(VAR_ROOT_SIZE);
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
32 * ONE_MEG, part, FS_BSDFFS,
(cp ? atoi(cp) : 32) * ONE_MEG, part, FS_BSDFFS,
CHUNK_IS_ROOT);
if (!tmp) {
dialog_clear();
msgConfirm("Unable to create the root partition. Too big?");
break;
}
tmp->private = new_part("/", TRUE, tmp->size);
tmp->private_free = safe_free;
record_label_chunks();
mib[0] = CTL_HW;
mib[1] = HW_PHYSMEM;
size = sizeof physmem;
sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
record_label_chunks(devs);
cp = variable_get(VAR_SWAP_SIZE);
if (cp)
swsize = atoi(cp) * ONE_MEG;
else {
mib[0] = CTL_HW;
mib[1] = HW_PHYSMEM;
size = sizeof physmem;
sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
swsize = 16 * ONE_MEG + (physmem * 2 / 512);
}
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
physmem * 2 / 512, part, FS_SWAP, 0);
swsize,
part, FS_SWAP, 0);
if (!tmp) {
dialog_clear();
msgConfirm("Unable to create the swap partition. Too big?");
break;
}
tmp->private = 0;
tmp->private_free = safe_free;
record_label_chunks();
record_label_chunks(devs);
cp = variable_get(VAR_VAR_SIZE);
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
16 * ONE_MEG, part, FS_BSDFFS, 0);
(cp ? atoi(cp) : VAR_MIN_SIZE) * ONE_MEG, part, FS_BSDFFS, 0);
if (!tmp) {
msgConfirm("Unable to create the /var partition. Too big?");
dialog_clear();
msgConfirm("Less than %dMB free for /var - you will need to\n"
"partition your disk manually with a custom install!", (cp ? atoi(cp) : VAR_MIN_SIZE));
break;
}
tmp->private = new_part("/var", TRUE, tmp->size);
tmp->private_free = safe_free;
record_label_chunks();
record_label_chunks(devs);
sz = space_free(label_chunk_info[here].c);
cp = variable_get(VAR_USR_SIZE);
if (cp)
sz = atoi(cp) * ONE_MEG;
else
sz = space_free(label_chunk_info[here].c);
if (!sz || sz < (USR_MIN_SIZE * ONE_MEG)) {
dialog_clear();
msgConfirm("Less than %dMB free for /usr - you will need to\n"
"partition your disk manually with a custom install!", USR_MIN_SIZE);
break;
}
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
sz, part, FS_BSDFFS, 0);
if (!tmp) {
msgConfirm("Unable to create the /usr partition. Too big?");
dialog_clear();
msgConfirm("Unable to create the /usr partition. Not enough space?\n"
"You will need to partition your disk manually with a custom install!");
break;
}
/* At this point, we're reasonably "labelled" */
variable_set2(DISK_LABELLED, "yes");
tmp->private = new_part("/usr", TRUE, tmp->size);
tmp->private_free = safe_free;
record_label_chunks();
record_label_chunks(devs);
}
break;
@ -564,13 +824,17 @@ diskLabelEditor(char *str)
if (label_chunk_info[i++].type != PART_SLICE)
cnt++;
if (cnt == (CHUNK_COLUMN_MAX * 2)) {
msgConfirm("Sorry, I can't fit any more partitions on the screen! You can get around\nthis limitation by partitioning your disks individually rather than all\nat once. This will be fixed just as soon as we get a scrolling partition\nbox written. Sorry for the inconvenience!");
dialog_clear();
msgConfirm("Sorry, I can't fit any more partitions on the screen! You can get around\n"
"this limitation by partitioning your disks individually rather than all\n"
"at once. This will be fixed just as soon as we get a scrolling partition\n"
"box written. Sorry for the inconvenience!");
break;
}
}
sz = space_free(label_chunk_info[here].c);
if (sz <= FS_MIN_SIZE) {
msg = "Not enough space to create additional FreeBSD partition";
msg = "Not enough space to create an additional FreeBSD partition";
break;
}
{
@ -581,7 +845,9 @@ diskLabelEditor(char *str)
u_long flags = 0;
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);
val = msgGetInput(osize, "Please specify the size for new FreeBSD partition in blocks, or\n"
"append a trailing `M' for megabytes (e.g. 20M) or `C' for cylinders.\n\n"
"Space free is %d blocks (%dMB)", sz, sz / ONE_MEG);
if (!val || (size = strtol(val, &cp, 0)) <= 0)
break;
@ -611,11 +877,17 @@ diskLabelEditor(char *str)
if ((flags & CHUNK_IS_ROOT)) {
if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) {
msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!");
msgConfirm("This region cannot be used for your root partition as the\n"
"FreeBSD boot code cannot deal with a root partition created\n"
"in that location. Please choose another location or smaller\n"
"size for your root partition and try again!");
break;
}
if (size < ROOT_MIN_SIZE)
msgConfirm("Warning: This is smaller than the recommended size for a\nroot partition. For a variety of reasons, root\npartitions should usually be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG);
if (size < (ROOT_MIN_SIZE * ONE_MEG)) {
msgConfirm("Warning: This is smaller than the recommended size for a\n"
"root partition. For a variety of reasons, root\n"
"partitions should usually be at least %dMB in size", ROOT_MIN_SIZE);
}
}
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
@ -627,7 +899,10 @@ diskLabelEditor(char *str)
break;
}
if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) {
msgConfirm("This region cannot be used for your root partition as it starts\nor extends past the 1024'th cylinder mark and is thus a\npoor location to boot from. Please choose another\nlocation for your root partition and try again!");
msgConfirm("This region cannot be used for your root partition as it starts\n"
"or extends past the 1024'th cylinder mark and is thus a\n"
"poor location to boot from. Please choose another\n"
"location (or smaller size) for your root partition and try again!");
Delete_Chunk(label_chunk_info[here].c->disk, tmp);
break;
}
@ -640,7 +915,8 @@ diskLabelEditor(char *str)
tmp->private = p;
}
tmp->private_free = safe_free;
record_label_chunks();
variable_set2(DISK_LABELLED, "yes");
record_label_chunks(devs);
}
break;
@ -654,7 +930,8 @@ diskLabelEditor(char *str)
break;
}
Delete_Chunk(label_chunk_info[here].c->disk, label_chunk_info[here].c);
record_label_chunks();
variable_set2(DISK_LABELLED, "yes");
record_label_chunks(devs);
break;
case 'M': /* mount */
@ -681,7 +958,8 @@ diskLabelEditor(char *str)
strcpy(p->mountpoint, "/bogus");
}
}
record_label_chunks();
variable_set2(DISK_LABELLED, "yes");
record_label_chunks(devs);
break;
default:
@ -704,33 +982,49 @@ diskLabelEditor(char *str)
label_chunk_info[here].c->private = new_part(pi ? pi->mountpoint : NULL, pi ? !pi->newfs : TRUE, label_chunk_info[here].c->size);
safe_free(pi);
label_chunk_info[here].c->private_free = safe_free;
variable_set2(DISK_LABELLED, "yes");
}
else
msg = MSG_NOT_APPLICABLE;
break;
case 'U':
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
clear();
if (msgYesNo("Are you SURE you want to Undo everything?"))
break;
variable_unset(DISK_PARTITIONED);
for (i = 0; devs[i]; i++) {
extern void diskPartition(Device *dev, Disk *d);
Disk *d;
if (!devs[i]->enabled)
continue;
else {
char *cp = devs[i]->name;
else if ((d = Open_Disk(devs[i]->name)) != NULL) {
Free_Disk(devs[i]->private);
devs[i]->private = Open_Disk(cp);
devs[i]->private = d;
diskPartition(devs[i], d);
}
}
record_label_chunks();
variable_unset(DISK_LABELLED);
record_label_chunks(devs);
break;
case 'W':
if (!msgYesNo("Are you sure that you wish to make and mount all filesystems\nat this time? You also have the option of doing it later in\none final 'commit' operation, and if you're at all unsure as\nto which option to chose, then chose No."))
diskLabelCommit(NULL);
if (!msgYesNo("Are you SURE that you wish to make and mount all filesystems\n"
"at this time? You also have the option of doing it later in\n"
"one final 'commit' operation, and if you're at all unsure as\n"
"to which option to chose, then PLEASE CHOSE NO! This option\n"
"is DANGEROUS if you're not EXACTLY sure what you are doing!")) {
variable_set2(DISK_LABELLED, "yes");
clear();
diskLabelCommit(NULL);
}
break;
case '|':
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!")) {
if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\n"
"This is an entirely undocumented feature which you are not\n"
"expected to understand!")) {
int i;
Device **devs;
@ -739,16 +1033,18 @@ diskLabelEditor(char *str)
DialogActive = FALSE;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
msgConfirm("Can't find any disk devicse!");
dialog_clear();
msgConfirm("Can't find any disk devices!");
break;
}
for (i = 0; devs[i] && ((Disk *)devs[i]->private); i++) {
if (devs[i]->enabled)
slice_wizard(((Disk *)devs[i]->private));
}
variable_set2(DISK_LABELLED, "yes");
DialogActive = TRUE;
dialog_clear();
record_label_chunks();
record_label_chunks(devs);
}
else
msg = "A most prudent choice!";
@ -764,17 +1060,6 @@ diskLabelEditor(char *str)
break;
}
}
variable_set2(DISK_LABELLED, "yes");
dialog_clear();
return 0;
}
int
diskLabelCommit(char *str)
{
if (!getenv(DISK_LABELLED))
msgConfirm("You must assign disk labels before this option can be used.");
else if (!installFilesystems())
msgConfirm("Failed to make/mount all filesystems. Please correct\nwhatever went wrong and try again.");
return 0;
return RET_SUCCESS;
}

View file

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: main.c,v 1.13 1995/06/11 19:30:02 rgrimes Exp $
* $Id: main.c,v 1.14 1995/09/18 16:52:29 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -43,12 +43,24 @@
#include "sysinstall.h"
#include <stdio.h>
#include <sys/signal.h>
static void
screech(int sig)
{
fprintf(stderr, "\007Fatal signal %d caught! I'm dead..\n", sig);
pause();
}
int
main(int argc, char **argv)
{
int choice, scroll, curr, max;
if (getpid() == 1) {
signal(SIGBUS, screech);
signal(SIGSEGV, screech);
}
if (geteuid() != 0) {
fprintf(stderr, "Warning: This utility should be run as root.\n");
sleep(1);
@ -64,21 +76,18 @@ main(int argc, char **argv)
/* Probe for all relevant devices on the system */
deviceGetAll();
/* Default to passive mode ftp since it's the only thing we currently support :-( */
OptFlags |= OPT_FTP_PASSIVE;
/* Set default flag and variable values */
installVarDefaults(NULL);
/* Begin user dialog at outer menu */
while (1) {
choice = scroll = curr = max = 0;
dmenuOpen(&MenuInitial, &choice, &scroll, &curr, &max);
if (getpid() != 1 || !msgYesNo("Are you sure you wish to exit? System will reboot."))
if (getpid() != 1 || !msgYesNo("Are you sure you wish to exit? The system will reboot\n"
"(be sure to remove any floppies from the drives)."))
break;
}
/* Write out any changes to /etc/sysconfig */
if (SystemWasInstalled)
configSysconfig();
/* Say goodnight, Gracie */
systemShutdown();

View file

@ -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.25.2.1 1995/07/21 10:53:58 rgrimes Exp $
* $Id: media.c,v 1.26 1995/09/18 16:52:31 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -72,6 +72,16 @@ cdromHook(char *str)
return genericHook(str, DEVICE_TYPE_CDROM);
}
char *
cpioVerbosity()
{
if (!strcmp(variable_get(VAR_CPIO_VERBOSITY), "high"))
return "-v";
else if (!strcmp(variable_get(VAR_CPIO_VERBOSITY), "medium"))
return "-V";
return "";
}
/*
* Return 1 if we successfully found and set the installation type to
* be a CD.
@ -82,11 +92,24 @@ mediaSetCDROM(char *str)
Device **devs;
int cnt;
if (!RunningAsInit) {
vsystem("mount /cdrom");
if (!file_readable("/cdrom/kernel")) {
msgConfirm("Can't find a FreeBSD CD in /cdrom?");
return RET_FAIL;
}
else
return RET_SUCCESS;
}
devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
cnt = deviceCount(devs);
if (!cnt) {
msgConfirm("No CDROM devices found! Please check that your system's\nconfiguration is correct and that the CDROM drive is of a supported\ntype. For more information, consult the hardware guide\nin the Doc menu.");
return 0;
dialog_clear();
msgConfirm("No CDROM devices found! Please check that your system's\n"
"configuration is correct and that the CDROM drive is of a supported\n"
"type. For more information, consult the hardware guide\n"
"in the Doc menu.");
return RET_FAIL;
}
else if (cnt > 1) {
DMenu *menu;
@ -98,11 +121,11 @@ mediaSetCDROM(char *str)
status = dmenuOpenSimple(menu);
free(menu);
if (!status)
return 0;
return RET_FAIL;
}
else
mediaDevice = devs[0];
return mediaDevice ? 1 : 0;
return mediaDevice ? RET_DONE : RET_FAIL;
}
static int
@ -124,8 +147,11 @@ mediaSetFloppy(char *str)
devs = deviceFind(NULL, DEVICE_TYPE_FLOPPY);
cnt = deviceCount(devs);
if (!cnt) {
msgConfirm("No floppy devices found! Please check that your system's\nconfiguration is correct. For more information, consult the hardware guide\nin the Doc menu.");
return 0;
dialog_clear();
msgConfirm("No floppy devices found! Please check that your system's configuration\n"
"is correct. For more information, consult the hardware guide in the Doc\n"
"menu.");
return RET_FAIL;
}
else if (cnt > 1) {
DMenu *menu;
@ -137,11 +163,11 @@ mediaSetFloppy(char *str)
status = dmenuOpenSimple(menu);
free(menu);
if (!status)
return 0;
return RET_FAIL;
}
else
mediaDevice = devs[0];
return mediaDevice ? 1 : 0;
return mediaDevice ? RET_DONE : RET_FAIL;
}
static int
@ -163,8 +189,9 @@ mediaSetDOS(char *str)
devs = deviceFind(NULL, DEVICE_TYPE_DOS);
cnt = deviceCount(devs);
if (!cnt) {
dialog_clear();
msgConfirm("No DOS primary partitions found! This installation method is unavailable");
return 0;
return RET_FAIL;
}
else if (cnt > 1) {
DMenu *menu;
@ -176,11 +203,11 @@ mediaSetDOS(char *str)
status = dmenuOpenSimple(menu);
free(menu);
if (!status)
return 0;
return RET_FAIL;
}
else
mediaDevice = devs[0];
return mediaDevice ? 1 : 0;
return mediaDevice ? RET_DONE : RET_FAIL;
}
static int
@ -202,8 +229,11 @@ mediaSetTape(char *str)
devs = deviceFind(NULL, DEVICE_TYPE_TAPE);
cnt = deviceCount(devs);
if (!cnt) {
msgConfirm("No tape drive devices found! Please check that your system's\nconfiguration is correct. For more information, consult the hardware guide\nin the Doc menu.");
return 0;
dialog_clear();
msgConfirm("No tape drive devices found! Please check that your system's configuration\n"
"is correct. For more information, consult the hardware guide in the Doc\n"
"menu.");
return RET_FAIL;
}
else if (cnt > 1) {
DMenu *menu;
@ -215,20 +245,24 @@ mediaSetTape(char *str)
status = dmenuOpenSimple(menu);
free(menu);
if (!status)
return 0;
return RET_FAIL;
}
else
mediaDevice = devs[0];
if (mediaDevice) {
char *val;
val = msgGetInput("/usr/tmp", "Please enter the name of a temporary directory containing\nsufficient space for holding the contents of this tape (or\ntapes). The contents of this directory will be removed\nafter installation, so be sure to specify a directory that\ncan be erased afterward!");
val = msgGetInput("/usr/tmp", "Please enter the name of a temporary directory containing\n"
"sufficient space for holding the contents of this tape (or\n"
"tapes). The contents of this directory will be removed\n"
"after installation, so be sure to specify a directory that\n"
"can be erased afterwards!\n");
if (!val)
mediaDevice = NULL;
else
mediaDevice->private = strdup(val);
}
return mediaDevice ? 1 : 0;
return mediaDevice ? RET_DONE : RET_FAIL;
}
/*
@ -241,24 +275,40 @@ mediaSetFTP(char *str)
static Device ftpDevice;
char *cp;
if (!dmenuOpenSimple(&MenuMediaFTP))
return 0;
cp = getenv("ftp");
if (!cp)
return 0;
if (!strcmp(cp, "other")) {
cp = msgGetInput("ftp://", "Please specify the URL of a FreeBSD distribution on a\nremote ftp site. This site must accept either anonymous\nftp or you should have set an ftp username and password\nin the Options Menu.\nA URL looks like this: ftp://<hostname>/<path>\nWhere <path> is relative to the anonymous ftp directory or the\nhome directory of the user being logged in as.");
if (!cp || strncmp("ftp://", cp, 6))
return 0;
if (!(str && !strcmp(str, "script") && (cp = variable_get(VAR_FTP_PATH)))) {
if (!dmenuOpenSimple(&MenuMediaFTP))
return RET_FAIL;
else
variable_set2("ftp", cp);
cp = variable_get(VAR_FTP_PATH);
}
if (!cp) {
dialog_clear();
msgConfirm("%s not set! Not setting an FTP installation path, OK?", VAR_FTP_PATH);
return RET_FAIL;
}
else if (!strcmp(cp, "other")) {
variable_set2(VAR_FTP_PATH, "ftp://");
cp = variable_get_value(VAR_FTP_PATH, "Please specify the URL of a FreeBSD distribution on a\n"
"remote ftp site. This site must accept either anonymous\n"
"ftp or you should have set an ftp username and password\n"
"in the Options screen.\n\n"
"A URL looks like this: ftp://<hostname>/<path>\n"
"Where <path> is relative to the anonymous ftp directory or the\n"
"home directory of the user being logged in as.");
if (!cp || !*cp)
return RET_FAIL;
}
if (strncmp("ftp://", cp, 6)) {
dialog_clear();
msgConfirm("Sorry, %s is an invalid URL!", cp);
return RET_FAIL;
}
strcpy(ftpDevice.name, cp);
/* XXX hack: if str == NULL, we were called by an ftp strategy routine and don't need to reinit all */
if (!str)
return 1;
if (!tcpDeviceSelect())
return 0;
/* If str == NULL || "script", we were called just to change FTP sites, not network devices */
if (str && strcmp(str, "script") && !tcpDeviceSelect())
return RET_FAIL;
ftpDevice.type = DEVICE_TYPE_FTP;
ftpDevice.init = mediaInitFTP;
ftpDevice.get = mediaGetFTP;
@ -266,20 +316,20 @@ mediaSetFTP(char *str)
ftpDevice.shutdown = mediaShutdownFTP;
ftpDevice.private = mediaDevice; /* Set to network device by tcpDeviceSelect() */
mediaDevice = &ftpDevice;
return 1;
return RET_DONE;
}
int
mediaSetFTPActive(char *str)
{
OptFlags &= OPT_FTP_ACTIVE;
variable_set2(VAR_FTP_STATE, "active");
return mediaSetFTP(str);
}
int
mediaSetFTPPassive(char *str)
{
OptFlags &= OPT_FTP_PASSIVE;
variable_set2(VAR_FTP_STATE, "passive");
return mediaSetFTP(str);
}
@ -289,9 +339,12 @@ mediaSetUFS(char *str)
static Device ufsDevice;
char *val;
val = msgGetInput(NULL, "Enter a fully qualified pathname for the directory\ncontaining the FreeBSD distribution files:");
if (!val)
return 0;
if (!(str && !strcmp(str, "script") && (val = variable_get(VAR_UFS_PATH)))) {
val = variable_get_value(VAR_UFS_PATH, "Enter a fully qualified pathname for the directory\n"
"containing the FreeBSD distribution files:");
if (!val)
return RET_FAIL;
}
strcpy(ufsDevice.name, "ufs");
ufsDevice.type = DEVICE_TYPE_UFS;
ufsDevice.init = dummyInit;
@ -300,21 +353,26 @@ mediaSetUFS(char *str)
ufsDevice.shutdown = dummyShutdown;
ufsDevice.private = strdup(val);
mediaDevice = &ufsDevice;
return 1;
return RET_DONE;
}
int
mediaSetNFS(char *str)
{
static Device nfsDevice;
char *val;
char *cp;
val = msgGetInput(NULL, "Please enter the full NFS file specification for the remote\nhost and directory containing the FreeBSD distribution files.\nThis should be in the format: hostname:/some/freebsd/dir");
if (!val)
return 0;
strncpy(nfsDevice.name, val, DEV_NAME_MAX);
if (!tcpDeviceSelect())
return 0;
if (!(str && !strcmp(str, "script") && (cp = variable_get(VAR_NFS_PATH)))) {
cp = variable_get_value(VAR_NFS_PATH, "Please enter the full NFS file specification for the remote\n"
"host and directory containing the FreeBSD distribution files.\n"
"This should be in the format: hostname:/some/freebsd/dir");
if (!cp)
return RET_FAIL;
}
strncpy(nfsDevice.name, cp, DEV_NAME_MAX);
/* str == NULL means we were just called to change NFS paths, not network interfaces */
if (str && strcmp(str, "script") && !tcpDeviceSelect())
return RET_FAIL;
nfsDevice.type = DEVICE_TYPE_NFS;
nfsDevice.init = mediaInitNFS;
nfsDevice.get = mediaGetNFS;
@ -322,7 +380,7 @@ mediaSetNFS(char *str)
nfsDevice.shutdown = mediaShutdownNFS;
nfsDevice.private = mediaDevice;
mediaDevice = &nfsDevice;
return 1;
return RET_DONE;
}
Boolean
@ -368,7 +426,7 @@ mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpid)
close(1); open("/dev/null", O_WRONLY);
dup2(1, 2);
}
i = execl("/stand/cpio", "/stand/cpio", "-iduVm", "-H", "tar", 0);
i = execl("/stand/cpio", "/stand/cpio", "-idum", cpioVerbosity(), "--block-size", mediaTapeBlocksize(), 0);
if (isDebug())
msgDebug("/stand/cpio command returns %d status\n", i);
exit(i);
@ -441,7 +499,7 @@ mediaExtractDist(char *dir, int fd)
close(1); open("/dev/null", O_WRONLY);
dup2(1, 2);
}
i = execl("/stand/cpio", "/stand/cpio", "-iduVm", "-H", "tar", 0);
i = execl("/stand/cpio", "/stand/cpio", "-idum", cpioVerbosity(), "--block-size", mediaTapeBlocksize(), 0);
if (isDebug())
msgDebug("/stand/cpio command returns %d status\n", i);
exit(i);
@ -466,12 +524,12 @@ mediaExtractDist(char *dir, int fd)
return TRUE;
}
Boolean
mediaGetType(void)
int
mediaGetType(char *unused)
{
if (!dmenuOpenSimple(&MenuMedia))
return FALSE;
return TRUE;
return RET_FAIL;
return RET_SUCCESS;
}
/* Return TRUE if all the media variables are set up correctly */
@ -479,8 +537,69 @@ Boolean
mediaVerify(void)
{
if (!mediaDevice) {
msgConfirm("Media type not set! Please select a media type\nfrom the Installation menu before proceeding.");
return FALSE;
dialog_clear();
msgConfirm("Media type not set! Please select a media type\n"
"from the Installation menu before proceeding.");
return mediaGetType(NULL) == RET_SUCCESS;
}
return TRUE;
}
/* Set FTP error behavior */
int
mediaSetFtpOnError(char *str)
{
char *cp = variable_get(VAR_FTP_ONERROR);
if (!cp) {
dialog_clear();
msgConfirm("FTP error handling is not set to anything!");
return RET_FAIL;
}
else {
if (!strcmp(cp, "abort"))
variable_set2(VAR_FTP_ONERROR, "retry");
else if (!strcmp(cp, "retry"))
variable_set2(VAR_FTP_ONERROR, "reselect");
else /* must be "reselect" - wrap around */
variable_set2(VAR_FTP_ONERROR, "abort");
}
return RET_SUCCESS;
}
/* Set the FTP username and password fields */
int
mediaSetFtpUserPass(char *str)
{
char *pass;
dialog_clear();
if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:"))
pass = variable_get_value(VAR_FTP_PASS, "Please enter the password for this user:");
else
pass = NULL;
dialog_clear();
return pass ? RET_SUCCESS : RET_FAIL;
}
/* Set CPIO verbosity level */
int
mediaSetCPIOVerbosity(char *str)
{
char *cp = variable_get(VAR_CPIO_VERBOSITY);
if (!cp) {
dialog_clear();
msgConfirm("CPIO Verbosity is not set to anything!");
return RET_FAIL;
}
else {
if (!strcmp(cp, "low"))
variable_set2(VAR_CPIO_VERBOSITY, "medium");
else if (!strcmp(cp, "medium"))
variable_set2(VAR_CPIO_VERBOSITY, "high");
else /* must be "high" - wrap around */
variable_set2(VAR_CPIO_VERBOSITY, "low");
}
return RET_SUCCESS;
}

View file

@ -1,838 +0,0 @@
/*
* The new sysinstall program.
*
* 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.27 1995/05/26 19:28:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer,
* verbatim and that no modifications are made prior to this
* point in the file.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Jordan Hubbard
* for the FreeBSD Project.
* 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include <stdio.h>
#include "sysinstall.h"
#include <ctype.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/dkbad.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "ftp.h"
#define MSDOSFS
#define CD9660
#define NFS
#include <sys/mount.h>
#undef MSDOSFS
#undef CD9660
#undef NFS
#define MAX_ATTRIBS 200
#define MAX_NAME 511
#define MAX_VALUE 4095
struct attribs {
char *name;
char *value;
};
static int lno;
static int num_attribs;
static int
attr_parse(struct attribs **attr, char *file)
{
char hold_n[MAX_NAME+1];
char hold_v[MAX_VALUE+1];
int n, v, ch = 0;
enum { LOOK, COMMENT, NAME, VALUE, COMMIT } state;
FILE *fp;
num_attribs = n = v = lno = 0;
state = LOOK;
if ((fp=fopen(file, "r")) == NULL)
{
msgConfirm("Cannot open the information file `%s': %s (%d)", file, strerror(errno), errno);
return 0;
}
while (state == COMMIT || (ch = fgetc(fp)) != EOF) {
/* Count lines */
if (ch == '\n')
++lno;
switch(state) {
case LOOK:
if (isspace(ch))
continue;
/* Allow shell or lisp style comments */
else if (ch == '#' || ch == ';') {
state = COMMENT;
continue;
}
else if (isalpha(ch)) {
hold_n[n++] = ch;
state = NAME;
}
else
msgFatal("Invalid character '%c' at line %d\n", ch, lno);
break;
case COMMENT:
if (ch == '\n')
state = LOOK;
break;
case NAME:
if (ch == '\n') {
hold_n[n] = '\0';
hold_v[v = 0] = '\0';
state = COMMIT;
}
else if (isspace(ch))
continue;
else if (ch == '=') {
hold_n[n] = '\0';
state = VALUE;
}
else
hold_n[n++] = ch;
break;
case VALUE:
if (v == 0 && isspace(ch))
continue;
else if (ch == '{') {
/* multiline value */
while ((ch = fgetc(fp)) != '}') {
if (ch == EOF)
msgFatal("Unexpected EOF on line %d", lno);
else {
if (v == MAX_VALUE)
msgFatal("Value length overflow at line %d", lno);
hold_v[v++] = ch;
}
}
hold_v[v] = '\0';
state = COMMIT;
}
else if (ch == '\n') {
hold_v[v] = '\0';
state = COMMIT;
}
else {
if (v == MAX_VALUE)
msgFatal("Value length overflow at line %d", lno);
else
hold_v[v++] = ch;
}
break;
case COMMIT:
(*attr)[num_attribs].name = strdup(hold_n);
(*attr)[num_attribs++].value = strdup(hold_v);
state = LOOK;
v = n = 0;
break;
default:
msgFatal("Unknown state at line %d??\n", lno);
}
}
fclose(fp);
return 1;
}
static const char *
attr_match(struct attribs *attr, char *name)
{
int n = 0;
while((strcasecmp(attr[n].name, name)!=0) && (n < num_attribs) && (n < 20))
n++;
if (strcasecmp(attr[n].name, name)==0)
return((const char *) attr[n].value);
return NULL;
}
static pid_t getDistpid = 0;
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;
}
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;
top:
fd = -1;
/* Floppy is always last-ditch device */
while (!mediaDevice && (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);
if (fd != -1)
return fd;
else
floppyDev = NULL;
}
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);
return(fd);
}
snprintf(buf, 512, "%s.aa", path);
if (stat(buf, &sb) != 0 && !prompt)
{
msgConfirm("Cannot find file(s) for distribution in ``%s''!\n", path);
return -1;
}
if (fd == -1 && prompt) {
if (mediaDevice->shutdown)
(*mediaDevice->shutdown)(mediaDevice);
if (mediaDevice->init)
if (!(*mediaDevice->init)(mediaDevice))
return -1;
msgConfirm("Please put distribution files for %s\nin %s and press return", path, mediaDevice->description);
goto top;
}
if (dist_attrib) {
tmp = attr_match(dist_attrib, "pieces");
numchunks = atoi(tmp);
}
else
numchunks = 1;
/* reap the previous child corpse - yuck! */
if (getDistpid) {
int i, j;
i = waitpid(getDistpid, &j, 0);
if (i < 0 || WEXITSTATUS(j)) {
msgNotify("Warning: Previous extraction returned status code %d.", WEXITSTATUS(j));
getDistpid = 0;
return -1;
}
getDistpid = 0;
}
msgDebug("Attempting to concatenate %u chunks\n", numchunks);
pipe(pfd);
getDistpid = fork();
if (!getDistpid) {
caddr_t memory;
int chunk;
int retval;
dup2(pfd[1], 1); close(pfd[1]);
close(pfd[0]);
for (chunk = 0; chunk < numchunks; chunk++) {
int fd;
unsigned long len, val;
retval = stat(buf, &sb);
if ((retval != 0) && (prompt != TRUE))
{
msgConfirm("Cannot find file(s) for distribution in ``%s''!\n", path);
return -1;
} else {
char *tmp = index(buf, '/');
tmp++;
while (retval != 0)
{
msgConfirm("Please insert the disk with the `%s' file on it\n", tmp);
retval = stat(buf, &sb);
}
}
snprintf(buf, 512, "%s.%c%c", path, (chunk / 26) + 'a', (chunk % 26) + 'a');
if ((fd = open(buf, O_RDONLY)) == -1)
msgFatal("Cannot find file `%s'!", buf);
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);
}
fstat(fd, &sb);
msgDebug("mmap()ing %s (%d)\n", buf, fd);
memory = mmap(0, sb.st_size, PROT_READ, MAP_SHARED, fd, (off_t) 0);
if (memory == (caddr_t) -1)
msgFatal("mmap error: %s\n", strerror(errno));
retval = write(1, memory, sb.st_size);
if (retval != sb.st_size)
{
msgConfirm("write didn't write out the complete file!\n(wrote %d bytes of %d bytes)", retval,
sb.st_size);
exit(1);
}
retval = munmap(memory, sb.st_size);
if (retval != 0)
{
msgConfirm("munmap() returned %d", retval);
exit(1);
}
close(fd);
}
close(1);
msgDebug("Extract of %s finished!!!\n", path);
exit(0);
}
close(pfd[1]);
return(pfd[0]);
}
/* Various media "strategy" routines */
static Boolean cdromMounted;
Boolean
mediaInitCDROM(Device *dev)
{
struct iso_args args;
struct stat sb;
if (cdromMounted)
return TRUE;
if (Mkdir("/cdrom", NULL))
return FALSE;
args.fspec = dev->devname;
args.flags = 0;
if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1)
{
msgConfirm("Error mounting %s on /cdrom: %s (%u)\n", dev, strerror(errno), errno);
return FALSE;
}
/* Do a very simple check to see if this looks roughly like a 2.0.5 CDROM
Unfortunately FreeBSD won't let us read the ``label'' AFAIK, which is one
sure way of telling the disc version :-( */
if (stat("/cdrom/dists", &sb))
{
if (errno == ENOENT)
{
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));
return FALSE;
}
}
cdromMounted = TRUE;
return TRUE;
}
int
mediaGetCDROM(char *dist, char *path)
{
char buf[PATH_MAX];
struct attribs *dist_attr;
int retval;
dist_attr = safe_malloc(sizeof(struct attribs) * MAX_ATTRIBS);
snprintf(buf, PATH_MAX, "/stand/info/%s.inf", dist);
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/%s%s", path ? path : "", dist);
retval = genericGetDist(buf, dist_attr, FALSE);
free(dist_attr);
return retval;
}
void
mediaShutdownCDROM(Device *dev)
{
msgDebug("In mediaShutdownCDROM\n");
if (getDistpid) {
int i, j;
i = waitpid(getDistpid, &j, 0);
if (i < 0 || WEXITSTATUS(j)) {
msgConfirm("Warning: Last extraction returned status code %d.", WEXITSTATUS(j));
getDistpid = 0;
}
getDistpid = 0;
}
if (unmount("/cdrom", 0) != 0)
msgConfirm("Could not unmount the CDROM: %s\n", strerror(errno));
msgDebug("Unmount returned\n");
cdromMounted = FALSE;
return;
}
static Boolean floppyMounted;
Boolean
mediaInitFloppy(Device *dev)
{
struct ufs_args ufsargs;
char mountpoint[FILENAME_MAX];
if (floppyMounted)
return TRUE;
memset(&ufsargs,0,sizeof ufsargs);
if (Mkdir("/mnt", NULL)) {
msgConfirm("Unable to make directory mountpoint for %s!", mountpoint);
return FALSE;
}
msgDebug("initFloppy: mount floppy %s on /mnt\n", dev->devname);
ufsargs.fspec = dev->devname;
if (mount(MOUNT_MSDOS, "/mnt", 0, (caddr_t)&ufsargs) == -1) {
msgConfirm("Error mounting floppy %s (%s) on /mnt : %s\n", dev->name,
dev->devname, mountpoint, strerror(errno));
return FALSE;
}
floppyMounted = TRUE;
return TRUE;
}
int
mediaGetFloppy(char *dist, char *path)
{
char buf[PATH_MAX];
char *fname;
struct attribs *dist_attr;
int retval;
dist_attr = safe_malloc(sizeof(struct attribs) * MAX_ATTRIBS);
snprintf(buf, PATH_MAX, "/stand/info/%s.inf", dist);
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);
retval = genericGetDist(buf, dist_attr, TRUE);
free(dist_attr);
return retval;
}
void
mediaShutdownFloppy(Device *dev)
{
if (floppyMounted) {
if (vsystem("umount /mnt") != 0)
msgDebug("Umount of floppy on /mnt failed: %s (%d)\n", strerror(errno), errno);
else
floppyMounted = FALSE;
}
}
Boolean
mediaInitTape(Device *dev)
{
return TRUE;
}
static Boolean networkInitialized;
Boolean
mediaInitNetwork(Device *dev)
{
int i;
char *rp;
if (networkInitialized)
return TRUE;
configResolv();
if (!strncmp("cuaa", dev->name, 4)) {
if (!tcpStartPPP(dev)) {
msgConfirm("Unable to start PPP! This installation method\ncannot be used.");
return FALSE;
}
}
else {
char *cp, ifconfig[64];
snprintf(ifconfig, 64, "%s%s", VAR_IFCONFIG, dev->name);
cp = getenv(ifconfig);
if (!cp) {
msgConfirm("The %s device is not configured. You will need to do so\nin the Networking configuration menu before proceeding.");
return FALSE;
}
i = vsystem("ifconfig %s %s", dev->name, cp);
if (i) {
msgConfirm("Unable to configure the %s interface!\nThis installation method cannot be used.", dev->name);
return FALSE;
}
}
rp = getenv(VAR_GATEWAY);
if (!rp)
msgConfirm("No gateway has been set. You will not be able to access hosts\n
not on the local network\n");
else
vsystem("route add default %s", rp);
networkInitialized = TRUE;
return TRUE;
}
int
mediaGetTape(char *dist, char *path)
{
return -1;
}
void
mediaShutdownTape(Device *dev)
{
return;
}
void
mediaShutdownNetwork(Device *dev)
{
char *cp;
if (!networkInitialized)
return;
if (!strncmp("cuaa", dev->name, 4)) {
msgConfirm("You may now go to the 3rd screen (ALT-F3) and shut down\nyour PPP connection. It shouldn't be needed any longer\n(unless you wish to create a shell by typing ESC and\nexperiment with it further, in which case go right ahead!)");
return;
}
else {
int i;
char ifconfig[64];
snprintf(ifconfig, 64, "%s%s", VAR_IFCONFIG, dev->name);
cp = getenv(ifconfig);
if (!cp)
return;
i = vsystem("ifconfig %s down", dev->name);
if (i)
msgConfirm("Warning: Unable to down the %s interface properly", dev->name);
}
cp = getenv(VAR_GATEWAY);
if (cp)
vsystem("route delete default");
networkInitialized = FALSE;
}
static FTP_t ftp;
Boolean
mediaInitFTP(Device *dev)
{
int i;
char *url, *hostname, *dir;
char *my_name, email[BUFSIZ];
Device *netDevice = (Device *)dev->private;
if (netDevice->init)
if (!(*netDevice->init)(netDevice))
return FALSE;
if ((ftp = FtpInit()) == NULL) {
msgConfirm("FTP initialisation failed!");
return FALSE;
}
url = getenv("ftp");
if (!url)
return FALSE;
my_name = getenv(VAR_HOSTNAME);
if (strncmp("ftp://", url, 6) != NULL) {
msgConfirm("Invalid URL (`%s') passed to FTP routines!\n(must start with `ftp://')", url);
return FALSE;
}
msgDebug("Using URL `%s'\n", url);
hostname = url + 6;
if ((dir = index(hostname, '/')) != NULL)
*(dir++) = '\0';
strcpy(dev->name, hostname);
msgDebug("hostname = `%s'\n", hostname);
msgDebug("dir = `%s'\n", dir ? dir : "/");
msgNotify("Looking up host %s..", hostname);
if ((gethostbyname(hostname) == NULL) && (inet_addr(hostname) == INADDR_NONE)) {
msgConfirm("Cannot resolve hostname `%s'! Are you sure your name server\nand/or gateway values are set properly?", hostname);
return FALSE;
}
snprintf(email, BUFSIZ, "installer@%s", my_name);
msgDebug("Using fake e-mail `%s'\n", email);
msgNotify("Logging in as anonymous.");
if ((i = FtpOpen(ftp, hostname, "anonymous", email)) != 0) {
msgConfirm("Couldn't open FTP connection to %s: %s (%u)\n", hostname, strerror(i), i);
return FALSE;
}
if (getenv("ftpPassive"))
FtpPassive(ftp, 1);
FtpBinary(ftp, 1);
if (dir && *dir != '\0') {
msgNotify("CD to distribution in ~ftp/%s", dir);
FtpChdir(ftp, dir);
}
msgDebug("leaving mediaInitFTP!\n");
return TRUE;
}
static pid_t ftppid = 0;
int
mediaGetFTP(char *dist, char *path)
{
int fd;
char buf[512];
int pfd[2], numchunks;
const char *tmp;
struct attribs *dist_attr;
if (!path)
path = "";
msgNotify("Attempting to retreive `%s' over FTP", dist);
snprintf(buf, PATH_MAX, "/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(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);
}
else
numchunks = 0;
msgDebug("Attempting to extract distribution from %u files\n", numchunks ? numchunks : 1);
/* Take the lack of an info file to mean we're a fully qualified name */
if (!numchunks) {
sprintf(buf, "%s%s", path, dist);
return(FtpGet(ftp, buf));
}
else if (numchunks == 1) {
snprintf(buf, 512, "%s%s.aa", path, dist);
return(FtpGet(ftp, buf));
}
/* reap the previous child corpse - yuck! */
if (ftppid) {
int i, j;
i = waitpid(ftppid, &j, 0);
if (i < 0 || WEXITSTATUS(j)) {
msgConfirm("Previous FTP transaction returned status code %d - aborting\ntransfer.", WEXITSTATUS(j));
ftppid = 0;
return -1;
}
ftppid = 0;
}
pipe(pfd);
ftppid = fork();
if (!ftppid) {
int chunk;
int retval;
dup2(pfd[1], 1); close(pfd[1]);
close(pfd[0]);
for (chunk = 0; chunk < numchunks; chunk++) {
char buffer[10240];
int n;
snprintf(buf, 512, "%s%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
fd = FtpGet(ftp, buf);
if (fd < 0)
{
msgConfirm("FtpGet failed to retreive piece `%s' in the %s distribution!\nAborting the transfer", chunk, dist);
exit(1);
}
while ((n = read(fd, buffer, 10240))>0)
{
retval = write(1, buffer, n);
if (retval != n)
{
msgConfirm("Write failure on transfer! (wrote %d bytes of %d bytes)", retval, n);
exit(1);
}
}
FtpEOF(ftp);
}
close(1);
msgDebug("Extract of %s finished with success!!!\n", dist);
exit(0);
}
close(pfd[1]);
return(pfd[0]);
}
void
mediaShutdownFTP(Device *dev)
{
Device *netdev = (Device *)dev->private;
if (ftp != NULL) {
FtpClose(ftp);
ftp = NULL;
}
if (ftppid) {
int i, j;
i = waitpid(ftppid, &j, 0);
if (i < 0 || WEXITSTATUS(j))
msgConfirm("Warning: Last FTP transaction returned status code %d.", WEXITSTATUS(j));
ftppid = 0;
}
if (netdev->shutdown)
(*netdev->shutdown)(netdev);
}
Boolean
mediaInitUFS(Device *dev)
{
return TRUE;
}
int
mediaGetUFS(char *dist, char *path)
{
return -1;
}
/* UFS has no Shutdown routine since this is handled at the device level */
Boolean
mediaInitDOS(Device *dev)
{
return TRUE;
}
int
mediaGetDOS(char *dist, char *path)
{
return -1;
}
void
mediaShutdownDOS(Device *dev)
{
}

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
* $Id: misc.c,v 1.11.2.2 1995/06/01 22:32:06 jkh Exp $
* $Id: misc.c,v 1.12.2.8 1995/11/04 15:08:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -45,6 +45,7 @@
#include <sys/errno.h>
#include <sys/file.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/mount.h>
@ -76,11 +77,25 @@ string_concat(char *one, char *two)
{
static char tmp[FILENAME_MAX];
/* Yes, we're deliberately cavalier about not checking for overflow */
strcpy(tmp, one);
strcat(tmp, two);
return tmp;
}
/* Concatenate three strings into static storage */
char *
string_concat3(char *one, char *two, char *three)
{
static char tmp[FILENAME_MAX];
/* Yes, we're deliberately cavalier about not checking for overflow */
strcpy(tmp, one);
strcat(tmp, two);
strcat(tmp, three);
return tmp;
}
/* Clip the whitespace off the end of a string */
char *
string_prune(char *str)
@ -101,6 +116,53 @@ string_skipwhite(char *str)
return str;
}
/* copy optionally and allow second arg to be null */
char *
string_copy(char *s1, char *s2)
{
if (!s1)
return NULL;
if (!s2)
s1[0] = '\0';
else
strcpy(s1, s2);
return s1;
}
Boolean
directoryExists(const char *dirname)
{
DIR *tptr;
if (!dirname)
return FALSE;
if (!strlen(dirname))
return FALSE;
tptr = opendir(dirname);
if (!tptr)
return (FALSE);
closedir(tptr);
return (TRUE);
}
char *
pathBaseName(const char *path)
{
char *pt;
char *ret = (char *)path;
pt = strrchr(path,(int)'/');
if (pt != 0) /* if there is a slash */
{
ret = ++pt; /* start the file after it */
}
return(ret);
}
/* A free guaranteed to take NULL ptrs */
void
safe_free(void *ptr)
@ -120,6 +182,7 @@ safe_malloc(size_t size)
ptr = malloc(size);
if (!ptr)
msgFatal("Out of memory!");
bzero(ptr, size);
return ptr;
}
@ -179,8 +242,8 @@ Mkdir(char *ipath, void *data)
int final=0;
char *p, *path;
if (access(ipath, R_OK) == 0)
return 0;
if (file_readable(ipath))
return RET_SUCCESS;
path = strdup(ipath);
if (isDebug())
@ -196,20 +259,22 @@ Mkdir(char *ipath, void *data)
*p = '\0';
if (stat(path, &sb)) {
if (errno != ENOENT) {
dialog_clear();
msgConfirm("Couldn't stat directory %s: %s", path, strerror(errno));
return 1;
return RET_FAIL;
}
if (isDebug())
msgDebug("mkdir(%s..)\n", path);
if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
dialog_clear();
msgConfirm("Couldn't create directory %s: %s", path,strerror(errno));
return 1;
return RET_FAIL;
}
}
*p = '/';
}
free(path);
return 0;
return RET_SUCCESS;
}
int
@ -230,16 +295,18 @@ Mount(char *mountp, void *dev)
memset(&ufsargs,0,sizeof ufsargs);
if (Mkdir(mountpoint, NULL)) {
dialog_clear();
msgConfirm("Unable to make directory mountpoint for %s!", mountpoint);
return 1;
return RET_FAIL;
}
if (isDebug())
msgDebug("mount %s %s\n", device, mountpoint);
bzero(&ufsargs, sizeof(ufsargs));
ufsargs.fspec = device;
if (mount(MOUNT_UFS, mountpoint, 0, (caddr_t)&ufsargs) == -1) {
msgConfirm("Error mounting %s on %s : %s\n", device, mountpoint, strerror(errno));
return 1;
dialog_clear();
msgConfirm("Error mounting %s on %s : %s", device, mountpoint, strerror(errno));
return RET_FAIL;
}
return 0;
return RET_SUCCESS;
}

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: msg.c,v 1.28.2.2 1995/06/02 15:31:31 jkh Exp $
* $Id: msg.c,v 1.29.2.8 1995/10/22 21:38:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -52,9 +52,9 @@
Boolean
isDebug(void)
{
if (OptFlags & OPT_DEBUG)
return TRUE;
return FALSE;
char *cp;
return (cp = variable_get(VAR_DEBUG)) && strcmp(cp, "no");
}
/* Whack up an informational message on the status line, in stand-out */
@ -216,7 +216,7 @@ msgConfirm(char *fmt, ...)
use_helpfile(NULL);
w = dupwin(newscr);
if (OnVTY) {
msgDebug("Switching back to VTY 0\n");
msgDebug("Switching back to VTY1\n");
ioctl(0, VT_ACTIVATE, 1);
msgInfo(NULL);
}
@ -264,7 +264,7 @@ msgYesNo(char *fmt, ...)
use_helpfile(NULL);
w = dupwin(newscr);
if (OnVTY) {
msgDebug("Switching back to VTY 0\n");
msgDebug("Switching back to VTY1\n");
ioctl(0, VT_ACTIVATE, 1); /* Switch back */
msgInfo(NULL);
}
@ -298,7 +298,7 @@ msgGetInput(char *buf, char *fmt, ...)
input_buffer[0] = '\0';
w = dupwin(newscr);
if (OnVTY) {
msgDebug("Switching back to VTY 0\n");
msgDebug("Switching back to VTY1\n");
ioctl(0, VT_ACTIVATE, 1); /* Switch back */
msgInfo(NULL);
}
@ -349,5 +349,20 @@ msgWeHaveOutput(char *fmt, ...)
dialog_msgbox("Information Dialog", errstr, -1, -1, 0);
free(errstr);
if (OnVTY)
msgInfo("Command output is on debugging screen - type ALT-F2 to see it");
msgInfo("Command output is on VTY2 - type ALT-F2 to see it");
}
/* Simple versions of msgConfirm() and msgNotify() for calling from scripts */
int
msgSimpleConfirm(char *str)
{
msgConfirm(str);
return RET_SUCCESS;
}
int
msgSimpleNotify(char *str)
{
msgNotify(str);
return RET_SUCCESS;
}

View file

@ -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: network.c,v 1.7.2.2 1995/07/21 10:57:33 rgrimes Exp $
* $Id: network.c,v 1.8 1995/09/18 16:52:33 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -44,12 +44,12 @@
/* These routines deal with getting things off of network media */
#include "sysinstall.h"
#include <sys/fcntl.h>
#include <signal.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
static Boolean networkInitialized;
static pid_t pppPid;
static pid_t startPPP(Device *devp);
Boolean
@ -58,15 +58,27 @@ mediaInitNetwork(Device *dev)
int i;
char *rp;
char *cp, ifconfig[64];
char ifname[255];
if (!RunningAsInit || networkInitialized || (dev->flags & OPT_LEAVE_NETWORK_UP))
if (!RunningAsInit || networkInitialized)
return TRUE;
configResolv();
msgDebug("Init routine called for network device %s.\n", dev->name);
if (!file_readable("/etc/resolv.conf"))
configResolv();
/* Old process lying around? */
if (dev->private) {
kill((pid_t)dev->private, SIGTERM);
dev->private = NULL;
}
if (!strncmp("cuaa", dev->name, 4)) {
if (!msgYesNo("You have selected a serial-line network interface.\nDo you want to use PPP with it?")) {
dialog_clear();
if (!msgYesNo("You have selected a serial-line network interface.\n"
"Do you want to use PPP with it?")) {
if (!(dev->private = (void *)startPPP(dev))) {
msgConfirm("Unable to start PPP! This installation method\ncannot be used.");
dialog_clear();
msgConfirm("Unable to start PPP! This installation method cannot be used.");
return FALSE;
}
networkInitialized = TRUE;
@ -78,37 +90,59 @@ mediaInitNetwork(Device *dev)
/* Cheesy slip attach */
snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname);
val = msgGetInput(attach, "Warning: SLIP is rather poorly supported in this revision\nof the installation due to the lack of a dialing utility.\nIf you can use PPP for this instead then you're much better\noff doing so, otherwise SLIP works fairly well for *hardwired*\nlinks. Please edit the following slattach command for\ncorrectness (default here is VJ compression, Hardware flow-control,\nignore carrier and 9600 baud data rate) and hit return to execute it.");
val = msgGetInput(attach,
"Warning: SLIP is rather poorly supported in this revision\n"
"of the installation due to the lack of a dialing utility.\n"
"If you can use PPP for this instead then you're much better\n"
"off doing so, otherwise SLIP works fairly well for *hardwired*\n"
"links. Please edit the following slattach command for\n"
"correctness (default here is: VJ compression, Hardware flow-\n"
"control, ignore carrier and 9600 baud data rate). When you're\n"
"ready, press [ENTER] to execute it.");
if (!val)
return FALSE;
else
strcpy(attach, val);
if (!vsystem(attach))
dev->private = NULL;
else {
msgConfirm("slattach returned a bad status! Please verify that\nthe command is correct and try again.");
if (vsystem(attach)) {
dialog_clear();
msgConfirm("slattach returned a bad status! Please verify that\n"
"the command is correct and try again.");
return FALSE;
}
}
strcpy(ifname, "sl0");
}
snprintf(ifconfig, 64, "%s%s", VAR_IFCONFIG, dev->name);
cp = getenv(ifconfig);
if (!cp) {
msgConfirm("The %s device is not configured. You will need to do so\nin the Networking configuration menu before proceeding.");
return FALSE;
}
i = vsystem("ifconfig %s %s", "sl0", cp);
if (i) {
msgConfirm("Unable to configure the %s interface!\nThis installation method cannot be used.", dev->name);
return FALSE;
}
rp = getenv(VAR_GATEWAY);
if (!rp || *rp == '0')
msgConfirm("No gateway has been set. You may be unable to access hosts\nnot on your local network\n");
else
strcpy(ifname, dev->name);
snprintf(ifconfig, 255, "%s%s", VAR_IFCONFIG, dev->name);
cp = variable_get(ifconfig);
if (!cp) {
dialog_clear();
msgConfirm("The %s device is not configured. You will need to do so\n"
"in the Networking configuration menu before proceeding.", ifname);
return FALSE;
}
msgNotify("Configuring network device %s.", ifname);
i = vsystem("ifconfig %s %s", ifname, cp);
if (i) {
dialog_clear();
msgConfirm("Unable to configure the %s interface!\n"
"This installation method cannot be used.", ifname);
return FALSE;
}
rp = variable_get(VAR_GATEWAY);
if (!rp || *rp == '0') {
dialog_clear();
msgConfirm("No gateway has been set. You may be unable to access hosts\n"
"not on your local network");
}
else {
msgNotify("Adding default route to %s.", rp);
vsystem("route add default %s", rp);
}
msgDebug("Network initialized successfully.\n");
networkInitialized = TRUE;
return TRUE;
}
@ -118,28 +152,36 @@ mediaShutdownNetwork(Device *dev)
{
char *cp;
if (!RunningAsInit || !networkInitialized || (dev->flags & OPT_LEAVE_NETWORK_UP))
if (!RunningAsInit || !networkInitialized)
return;
msgDebug("Shutdown called for network device %s\n", dev->name);
if (strncmp("cuaa", dev->name, 4)) {
int i;
char ifconfig[64];
char ifconfig[255];
snprintf(ifconfig, 64, "%s%s", VAR_IFCONFIG, dev->name);
cp = getenv(ifconfig);
snprintf(ifconfig, 255, "%s%s", VAR_IFCONFIG, dev->name);
cp = variable_get(ifconfig);
if (!cp)
return;
msgNotify("Shutting interface %s down.", dev->name);
i = vsystem("ifconfig %s down", dev->name);
if (i)
if (i) {
dialog_clear();
msgConfirm("Warning: Unable to down the %s interface properly", dev->name);
cp = getenv(VAR_GATEWAY);
if (cp)
}
cp = variable_get(VAR_GATEWAY);
if (cp) {
msgNotify("Deleting default route.");
vsystem("route delete default");
}
networkInitialized = FALSE;
}
else if (pppPid != 0) {
kill(pppPid, SIGTERM);
pppPid = 0;
else if (dev->private) {
msgNotify("Killing PPP process %d.", (int)dev->private);
kill((pid_t)dev->private, SIGTERM);
dev->private = NULL;
networkInitialized = FALSE;
}
}
@ -147,29 +189,30 @@ mediaShutdownNetwork(Device *dev)
static pid_t
startPPP(Device *devp)
{
int vfd, fd2;
int fd2;
FILE *fp;
char *val;
pid_t pid;
char myaddr[16], provider[16], speed[16];
/* We're going over to VTY2 */
vfd = open("/dev/ttyv2", O_RDWR);
if (vfd == -1)
return 0;
/* These are needed to make ppp work */
Mkdir("/var/log", NULL);
Mkdir("/var/spool/lock", NULL);
Mkdir("/etc/ppp", NULL);
if (!variable_get(VAR_SERIAL_SPEED))
variable_set2(VAR_SERIAL_SPEED, "115200");
/* Get any important user values */
val = msgGetInput("115200",
"Enter the baud rate for your modem - this can be higher than the actual\nmaximum data rate since most modems can talk at one speed to the\ncomputer and at another speed to the remote end.\n\nIf you're not sure what to put here, just select the default.");
strcpy(speed, val ? val : "115200");
val = variable_get_value(VAR_SERIAL_SPEED,
"Enter the baud rate for your modem - this can be higher than the actual\n"
"maximum data rate since most modems can talk at one speed to the\n"
"computer and at another speed to the remote end.\n\n"
"If you're not sure what to put here, just select the default.");
strcpy(speed, (val && *val) ? val : "115200");
strcpy(provider, getenv(VAR_GATEWAY) ? getenv(VAR_GATEWAY) : "0");
val = msgGetInput(provider, "Enter the IP address of your service provider or 0 if you\ndon't know it and would prefer to negotiate it dynamically.");
strcpy(provider, variable_get(VAR_GATEWAY) ? variable_get(VAR_GATEWAY) : "0");
val = msgGetInput(provider, "Enter the IP address of your service provider or 0 if you\n"
"don't know it and would prefer to negotiate it dynamically.");
strcpy(provider, val ? val : "0");
if (devp->private && ((DevInfo *)devp->private)->ipaddr[0])
@ -187,11 +230,12 @@ startPPP(Device *devp)
}
fd2 = open("/etc/ppp/ppp.secret", O_CREAT);
if (fd2 != -1) {
fchmod(fd2, 0755);
fchmod(fd2, 0700);
close(fd2);
}
fp = fopen("/etc/ppp/ppp.conf", "w");
if (!fp) {
dialog_clear();
msgConfirm("Couldn't open /etc/ppp/ppp.conf file! This isn't going to work");
return 0;
}
@ -201,19 +245,47 @@ startPPP(Device *devp)
fprintf(fp, " set ifaddr %s %s\n", myaddr, provider);
fclose(fp);
if (isDebug())
msgDebug("Creating /dev/tun0 device.\n");
if (!file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) {
dialog_clear();
msgConfirm("Warning: No /dev/tun0 device. PPP will not work!");
return 0;
}
if (!(pid = fork())) {
dup2(vfd, 0);
dup2(vfd, 1);
dup2(vfd, 2);
execl("/stand/ppp", "/stand/ppp", (char *)NULL);
int i, fd;
struct termios foo;
extern int login_tty(int);
for (i = 0; i < 64; i++)
close(i);
/* We're going over to VTY2 */
DebugFD = fd = open("/dev/ttyv2", O_RDWR);
ioctl(0, TIOCSCTTY, &fd);
dup2(0, 1);
dup2(0, 2);
if (login_tty(fd) == -1)
msgDebug("ppp: Can't set the controlling terminal.\n");
signal(SIGTTOU, SIG_IGN);
if (tcgetattr(fd, &foo) != -1) {
foo.c_cc[VERASE] = '\010';
if (tcsetattr(fd, TCSANOW, &foo) == -1)
msgDebug("ppp: Unable to set the erase character.\n");
}
else
msgDebug("ppp: Unable to get the terminal attributes!\n");
execlp("ppp", "ppp", (char *)NULL);
msgDebug("PPP process failed to exec!\n");
exit(1);
}
msgConfirm("The PPP command is now started on screen 3 (type ALT-F3 to\ninteract with it, ALT-F1 to switch back here). The only command\nyou'll probably want or need to use is the \"term\" command\nwhich starts a terminal emulator you can use to talk to your\nmodem and dial the service provider. Once you're connected,\ncome back to this screen and press return. DO NOT PRESS RETURN\nHERE UNTIL THE CONNECTION IS FULLY ESTABLISHED!");
else {
dialog_clear();
msgConfirm("The PPP command is now started on VTY3 (type ALT-F3 to\n"
"interact with it, ALT-F1 to switch back here). The only command\n"
"you'll probably want or need to use is the \"term\" command\n"
"which starts a terminal emulator you can use to talk to your\n"
"modem and dial the service provider. Once you're connected,\n"
"come back to this screen and press return. DO NOT PRESS [ENTER]\n"
"HERE UNTIL THE CONNECTION IS FULLY ESTABLISHED!");
}
return pid;
}

View file

@ -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: nfs.c,v 1.4.2.6 1995/06/10 02:21:40 jkh Exp $
* $Id: nfs.c,v 1.5.2.15 1995/11/04 11:09:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -58,46 +58,59 @@ mediaInitNFS(Device *dev)
if (NFSMounted)
return TRUE;
if (!(*netDevice->init)(netDevice))
if (!netDevice->init(netDevice))
return FALSE;
if (Mkdir("/nfs", NULL))
if (Mkdir("/dist", NULL))
return FALSE;
if (vsystem("mount_nfs %s %s %s /nfs", (OptFlags & OPT_SLOW_ETHER) ? "-r 1024 -w 1024" : "",
(OptFlags & OPT_NFS_SECURE) ? "-P" : "", dev->name)) {
msgConfirm("Error mounting %s on /nfs: %s (%u)\n", dev->name, strerror(errno), errno);
msgNotify("Mounting %s over NFS.", dev->name);
if (vsystem("mount_nfs %s %s %s /dist",
variable_get(VAR_SLOW_ETHER) ? "-r 1024 -w 1024" : "",
variable_get(VAR_NFS_SECURE) ? "-P" : "", dev->name)) {
dialog_clear();
msgConfirm("Error mounting %s on /dist: %s (%u)", dev->name, strerror(errno), errno);
netDevice->shutdown(netDevice);
return FALSE;
}
NFSMounted = TRUE;
msgDebug("Mounted NFS device %s onto /dist\n", dev->name);
return TRUE;
}
int
mediaGetNFS(Device *dev, char *file, Attribs *dist_attrs)
mediaGetNFS(Device *dev, char *file, Boolean tentative)
{
char buf[PATH_MAX];
char buf[PATH_MAX];
snprintf(buf, PATH_MAX, "/nfs/%s", file);
if (!access(buf, R_OK))
msgDebug("Request for %s from NFS\n", file);
snprintf(buf, PATH_MAX, "/dist/%s", file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/nfs/dists/%s", file);
snprintf(buf, PATH_MAX, "/dist/dists/%s", file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/dist/%s/%s", variable_get(VAR_RELNAME), file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/dist/%s/dists/%s", variable_get(VAR_RELNAME), file);
return open(buf, O_RDONLY);
}
void
mediaShutdownNFS(Device *dev)
{
Device *netdev = (Device *)dev->private;
/* Device *netdev = (Device *)dev->private; */
if (!NFSMounted)
return;
msgDebug("Unmounting /nfs\n");
if (unmount("/nfs", MNT_FORCE) != 0)
msgConfirm("Could not unmount the NFS partition: %s\n", strerror(errno));
if (isDebug())
msgDebug("Unmount returned\n");
(*netdev->shutdown)(netdev);
msgNotify("Unmounting NFS partition on /dist");
if (unmount("/dist", MNT_FORCE) != 0) {
dialog_clear();
msgConfirm("Could not unmount the NFS partition: %s", strerror(errno));
}
msgDebug("Unmount of NFS partition successful\n");
/* (*netdev->shutdown)(netdev); */
NFSMounted = FALSE;
return;
}

View file

@ -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.42.2.1 1995/07/21 10:54:06 rgrimes Exp $
* $Id: sysinstall.h,v 1.43 1995/09/18 16:52:35 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -49,8 +49,11 @@
#include <string.h>
#include <unistd.h>
#include <dialog.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "libdisk.h"
#include "dist.h"
#include "version.h"
/*** Defines ***/
@ -66,10 +69,14 @@
#define VAR_VALUE_MAX 1024
/* device limits */
#define DEV_NAME_MAX 128 /* The maximum length of a device name */
#define DEV_MAX 200 /* The maximum number of devices we'll deal with */
#define DEV_NAME_MAX 64 /* The maximum length of a device name */
#define DEV_MAX 100 /* The maximum number of devices we'll deal with */
#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
#define MAX_FTP_RETRIES 3 /* How many times to beat our heads against the wall */
#define MAX_FTP_RETRIES "4" /* How many times to beat our heads against the wall */
#define RET_FAIL -1
#define RET_SUCCESS 0
#define RET_DONE 1
/*
* I make some pretty gross assumptions about having a max of 50 chunks
@ -79,36 +86,65 @@
* For 2.1 I'll revisit this and try to make it more dynamic, but since
* this will catch 99.99% of all possible cases, I'm not too worried.
*/
#define MAX_CHUNKS 50
#define MAX_CHUNKS 40
/* Internal flag variables */
/* Internal environment variable names */
#define DISK_PARTITIONED "_diskPartitioned"
#define DISK_LABELLED "_diskLabelled"
#define DISK_SELECTED "_diskSelected"
#define SYSTEM_STATE "_systemState"
#define RUNNING_ON_ROOT "_runningOnRoot"
#define TCP_CONFIGURED "_tcpConfigured"
#define FTP_USER "_ftpUser"
#define FTP_PASS "_ftpPass"
/* Ones that can be tweaked from config files */
#define VAR_BLANKTIME "blanktime"
#define VAR_BOOTMGR "bootManager"
#define VAR_BROWSER_BINARY "browserBinary"
#define VAR_BROWSER_PACKAGE "browserPackage"
#define VAR_CONFIG_FILE "configFile"
#define VAR_CPIO_VERBOSITY "cpioVerbose"
#define VAR_DEBUG "debug"
#define VAR_DISK "disk"
#define VAR_DISKSPACE "diskSpace"
#define VAR_DOMAINNAME "domainname"
#define VAR_EXTRAS "ifconfig_"
#define VAR_FTP_ONERROR "ftpOnError"
#define VAR_FTP_PASS "ftpPass"
#define VAR_FTP_PATH "ftp"
#define VAR_FTP_RETRIES "ftpRetryCount"
#define VAR_FTP_STATE "ftpState"
#define VAR_FTP_USER "ftpUser"
#define VAR_GATEWAY "defaultrouter"
#define VAR_GEOMETRY "geometry"
#define VAR_HOSTNAME "hostname"
#define VAR_IFCONFIG "ifconfig_"
#define VAR_INTERFACES "network_interfaces"
#define VAR_IPADDR "ipaddr"
#define VAR_LABEL "label"
#define VAR_LABEL_COUNT "labelCount"
#define VAR_MEDIA_TYPE "mediaType"
#define VAR_NAMESERVER "nameserver"
#define VAR_NETMASK "netmask"
#define VAR_NFS_PATH "nfs"
#define VAR_NFS_SECURE "nfsSecure"
#define VAR_NO_CONFIRM "noConfirm"
#define VAR_NTPDATE "ntpDate"
#define VAR_PORTS_PATH "ports"
#define VAR_RELNAME "releaseName"
#define VAR_ROOT_SIZE "rootSize"
#define VAR_ROUTEDFLAGS "routedflags"
#define VAR_SLOW_ETHER "slowEthernetCard"
#define VAR_SWAP_SIZE "swapSize"
#define VAR_TAPE_BLOCKSIZE "tapeBlocksize"
#define VAR_UFS_PATH "ufs"
#define VAR_USR_SIZE "usrSize"
#define VAR_VAR_SIZE "varSize"
#define VAR_SERIAL_SPEED "serialSpeed"
#define OPT_NO_CONFIRM 0x0001
#define OPT_NFS_SECURE 0x0002
#define OPT_DEBUG 0x0004
#define OPT_FTP_ACTIVE 0x0008
#define OPT_FTP_PASSIVE 0x0010
#define OPT_FTP_RESELECT 0x0020
#define OPT_FTP_ABORT 0x0040
#define OPT_SLOW_ETHER 0x0080
#define OPT_EXPLORATORY_GET 0x0100
#define OPT_LEAVE_NETWORK_UP 0x0200
#define DEFAULT_TAPE_BLOCKSIZE "20"
#define VAR_HOSTNAME "hostname"
#define VAR_DOMAINNAME "domainname"
#define VAR_NAMESERVER "nameserver"
#define VAR_GATEWAY "defaultrouter"
#define VAR_IPADDR "ipaddr"
#define VAR_IFCONFIG "ifconfig_"
#define VAR_INTERFACES "network_interfaces"
/* One MB worth of blocks */
#define ONE_MEG 2048
/* The help file for the TCP/IP setup screen */
#define TCP_HELPFILE "tcp"
@ -136,7 +172,7 @@ typedef struct _dmenuItem {
char *prompt; /* Our prompt */
DMenuItemType type; /* What type of item we are */
void *ptr; /* Generic data ptr */
u_long parm; /* Parameter for above */
int parm; /* Parameter for above */
Boolean disabled; /* Are we temporarily disabled? */
char * (*check)(struct _dmenuItem *); /* Our state */
} DMenuItem;
@ -157,13 +193,14 @@ typedef struct _variable {
char value[VAR_VALUE_MAX];
} Variable;
/* For attribs */
#define MAX_ATTRIBS 200
#define MAX_NAME 511
#define MAX_VALUE 4095
#define MAX_NAME 64
#define MAX_VALUE 256
typedef struct _attribs {
char *name;
char *value;
char name[MAX_NAME];
char value[MAX_VALUE];
} Attribs;
typedef enum {
@ -188,7 +225,7 @@ typedef struct _device {
DeviceType type;
Boolean enabled;
Boolean (*init)(struct _device *dev);
int (*get)(struct _device *dev, char *file, Attribs *dist_attrs);
int (*get)(struct _device *dev, char *file, Boolean tentative);
Boolean (*close)(struct _device *dev, int fd);
void (*shutdown)(struct _device *dev);
void *private;
@ -213,11 +250,49 @@ typedef struct _part_info {
char newfs_cmd[NEWFS_CMD_MAX];
} PartInfo;
/* An option */
typedef struct _opt {
char *name;
char *desc;
enum { OPT_IS_STRING, OPT_IS_INT, OPT_IS_FUNC, OPT_IS_VAR } type;
void *data;
void *aux;
char *(*check)();
} Option;
/* Weird index nodey things we use for keeping track of package information */
typedef enum { PACKAGE, PLACE } node_type; /* Types of nodes */
typedef struct _pkgnode { /* A node in the reconstructed hierarchy */
struct _pkgnode *next; /* My next sibling */
node_type type; /* What am I? */
char *name; /* My name */
char *desc; /* My description (Hook) */
struct _pkgnode *kids; /* My little children */
void *data; /* A place to hang my data */
} PkgNode;
typedef PkgNode *PkgNodePtr;
/* A single package */
typedef struct _indexEntry { /* A single entry in an INDEX file */
char *name; /* name */
char *path; /* full path to port */
char *prefix; /* port prefix */
char *comment; /* one line description */
char *descrfile; /* path to description file */
char *maintainer; /* maintainer */
} IndexEntry;
typedef IndexEntry *IndexEntryPtr;
typedef int (*commandFunc)(char *key, void *data);
#define HOSTNAME_FIELD_LEN 256
#define HOSTNAME_FIELD_LEN 128
#define IPADDR_FIELD_LEN 16
#define EXTRAS_FIELD_LEN 256
#define EXTRAS_FIELD_LEN 128
/* Verbosity levels for CPIO as expressed by cpio arguments - yuck */
#define CPIO_VERBOSITY (!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "low") ? "" : \
!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "medium") ? "-V" : "-v")
/* This is the structure that Network devices carry around in their private, erm, structures */
typedef struct _devPriv {
@ -242,9 +317,7 @@ extern unsigned int SrcDists; /* Which src distributions we want */
extern unsigned int XF86Dists; /* Which XFree86 dists we want */
extern unsigned int XF86ServerDists; /* The XFree86 servers we want */
extern unsigned int XF86FontDists; /* The XFree86 fonts we want */
extern unsigned int OptFlags; /* Global options */
extern int BootMgr; /* Which boot manager to use */
extern char *InstallPrefix; /* A location bias */
extern DMenu MenuInitial; /* Initial installation menu */
@ -255,6 +328,7 @@ extern DMenu MenuFTPOptions; /* FTP Installation options */
extern DMenu MenuOptions; /* Installation options */
extern DMenu MenuOptionsLanguage; /* Language options menu */
extern DMenu MenuMedia; /* Media type menu */
extern DMenu MenuMouse; /* Mouse type menu */
extern DMenu MenuMediaCDROM; /* CDROM media menu */
extern DMenu MenuMediaDOS; /* DOS media menu */
extern DMenu MenuMediaFloppy; /* Floppy media menu */
@ -268,8 +342,8 @@ extern DMenu MenuSysconsKeyrate; /* System console keyrate configuration menu *
extern DMenu MenuSysconsSaver; /* System console saver configuration menu */
extern DMenu MenuNetworking; /* Network configuration menu */
extern DMenu MenuInstallCustom; /* Custom Installation menu */
extern DMenu MenuInstallType; /* Installation type menu */
extern DMenu MenuDistributions; /* Distribution menu */
extern DMenu MenuSubDistributions; /* Custom distribution menu */
extern DMenu MenuDESDistributions; /* DES distribution menu */
extern DMenu MenuSrcDistributions; /* Source distribution menu */
extern DMenu MenuXF86; /* XFree86 main menu */
@ -278,17 +352,25 @@ extern DMenu MenuXF86SelectCore; /* XFree86 core distribution menu */
extern DMenu MenuXF86SelectServer; /* XFree86 server distribution menu */
extern DMenu MenuXF86SelectFonts; /* XFree86 font selection menu */
extern DMenu MenuDiskDevices; /* Disk devices menu */
extern DMenu MenuHTMLDoc; /* HTML Documentation menu */
/*** Prototypes ***/
/* apache.c */
extern int configApache(char *str);
/* anonFTP.c */
extern int configAnonFTP(char *unused);
/* attrs.c */
extern const char *attr_match(Attribs *attr, char *name);
extern int attr_parse(Attribs **attr, char *file);
extern char *attr_match(Attribs *attr, char *name);
extern int attr_parse_file(Attribs *attr, char *file);
extern int attr_parse(Attribs *attr, int fd);
/* cdrom.c */
extern Boolean mediaInitCDROM(Device *dev);
extern int mediaGetCDROM(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetCDROM(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownCDROM(Device *dev);
/* command.c */
@ -299,7 +381,7 @@ extern void command_shell_add(char *key, char *fmt, ...);
extern void command_func_add(char *key, commandFunc func, void *data);
/* config.c */
extern void configFstab(void);
extern int configFstab(void);
extern void configSysconfig(void);
extern void configResolv(void);
extern int configPorts(char *str);
@ -313,8 +395,8 @@ extern int crc(int, unsigned long *, unsigned long *);
/* decode.c */
extern DMenuItem *decode(DMenu *menu, char *name);
extern Boolean dispatch(DMenuItem *tmp, char *name);
extern Boolean decode_and_dispatch_multiple(DMenu *menu, char *names);
extern int dispatch(DMenuItem *tmp, char *name);
extern int decode_and_dispatch_multiple(DMenu *menu, char *names);
/* devices.c */
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)());
@ -323,11 +405,11 @@ 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)(Device *dev, char *file, Attribs *dist_attrs),
Boolean (*init)(Device *mediadev), int (*get)(Device *dev, char *file, Boolean tentative),
Boolean (*close)(Device *mediadev, int fd), void (*shutDown)(Device *mediadev),
void *private);
extern Boolean dummyInit(Device *dev);
extern int dummyGet(Device *dev, char *dist, Attribs *dist_attrs);
extern int dummyGet(Device *dev, char *dist, Boolean tentative);
extern Boolean dummyClose(Device *dev, int fd);
extern void dummyShutdown(Device *dev);
@ -337,6 +419,7 @@ extern int diskPartitionWrite(char *unused);
/* dist.c */
extern int distReset(char *str);
extern int distSetCustom(char *str);
extern int distSetDeveloper(char *str);
extern int distSetXDeveloper(char *str);
extern int distSetKernDeveloper(char *str);
@ -356,49 +439,66 @@ extern char *dmenuVarCheck(DMenuItem *item);
extern char *dmenuFlagCheck(DMenuItem *item);
extern char *dmenuRadioCheck(DMenuItem *item);
/* doc.c */
extern int docBrowser(char *junk);
extern int docShowDocument(char *str);
/* dos.c */
extern Boolean mediaInitDOS(Device *dev);
extern int mediaGetDOS(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetDOS(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownDOS(Device *dev);
/* floppy.c */
extern int getRootFloppy(void);
extern Boolean mediaInitFloppy(Device *dev);
extern int mediaGetFloppy(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetFloppy(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownFloppy(Device *dev);
/* ftp_strat.c */
extern Boolean mediaCloseFTP(Device *dev, int fd);
extern Boolean mediaInitFTP(Device *dev);
extern int mediaGetFTP(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetFTP(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownFTP(Device *dev);
extern int mediaSetFtpUserPass(char *str);
/* globals.c */
extern void globalsInit(void);
/* index.c */
int index_get(char *fname, PkgNodePtr papa);
int index_read(int fd, PkgNodePtr papa);
int index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll);
void index_init(PkgNodePtr top, PkgNodePtr plist);
void index_node_free(PkgNodePtr top, PkgNodePtr plist);
void index_sort(PkgNodePtr top);
void index_print(PkgNodePtr top, int level);
int index_extract(Device *dev, PkgNodePtr plist);
/* install.c */
extern int installCommit(char *str);
extern int installExpress(char *str);
extern Boolean installFilesystems(void);
extern int installNovice(char *str);
extern int installFixit(char *str);
extern int installFixup(char *str);
extern int installUpgrade(char *str);
extern int installPreconfig(char *str);
extern int installFilesystems(char *str);
extern int installVarDefaults(char *str);
extern Boolean copySelf(void);
extern Boolean rootExtract(void);
/* lang.c */
extern void lang_set_Danish(char *str);
extern void lang_set_Dutch(char *str);
extern void lang_set_English(char *str);
extern void lang_set_French(char *str);
extern void lang_set_German(char *str);
extern void lang_set_Italian(char *str);
extern void lang_set_Japanese(char *str);
extern void lang_set_Norwegian(char *str);
extern void lang_set_Russian(char *str);
extern void lang_set_Spanish(char *str);
extern void lang_set_Swedish(char *str);
/* installFinal.c */
extern int configGated(char *unused);
extern int configSamba(char *unused);
extern int configPCNFSD(char *unused);
extern int configNFSServer(char *unused);
/* label.c */
extern int diskLabelEditor(char *str);
extern int diskLabelCommit(char *str);
/* lndir.c */
extern int lndir(char *from, char *to);
/* makedevs.c (auto-generated) */
extern const char termcap_vt100[];
extern const char termcap_cons25[];
@ -414,6 +514,7 @@ extern const u_char koi8_r2cp866[];
extern u_char default_scrnmap[];
/* media.c */
extern char *cpioVerbosity(void);
extern int mediaSetCDROM(char *str);
extern int mediaSetFloppy(char *str);
extern int mediaSetDOS(char *str);
@ -423,7 +524,10 @@ extern int mediaSetFTPActive(char *str);
extern int mediaSetFTPPassive(char *str);
extern int mediaSetUFS(char *str);
extern int mediaSetNFS(char *str);
extern Boolean mediaGetType(void);
extern int mediaSetFtpOnError(char *str);
extern int mediaSetFtpUserPass(char *str);
extern int mediaSetCPIOVerbosity(char *str);
extern int mediaGetType(char *str);
extern Boolean mediaExtractDist(char *dir, int fd);
extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic);
extern Boolean mediaExtractDistEnd(int zpid, int cpid);
@ -432,9 +536,13 @@ extern Boolean mediaVerify(void);
/* misc.c */
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
extern Boolean directoryExists(const char *dirname);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
extern char *string_prune(char *str);
extern char *string_skipwhite(char *str);
extern char *string_copy(char *s1, char *s2);
extern char *pathBaseName(const char *path);
extern void safe_free(void *ptr);
extern void *safe_malloc(size_t size);
extern void *safe_realloc(void *orig, size_t size);
@ -458,6 +566,8 @@ extern void msgNotify(char *fmt, ...);
extern void msgWeHaveOutput(char *fmt, ...);
extern int msgYesNo(char *fmt, ...);
extern char *msgGetInput(char *buf, char *fmt, ...);
extern int msgSimpleConfirm(char *);
extern int msgSimpleNotify(char *);
/* network.c */
extern Boolean mediaInitNetwork(Device *dev);
@ -465,30 +575,42 @@ extern void mediaShutdownNetwork(Device *dev);
/* nfs.c */
extern Boolean mediaInitNFS(Device *dev);
extern int mediaGetNFS(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetNFS(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownNFS(Device *dev);
/* options.c */
extern int optionsEditor(char *str);
/* package.c */
extern int package_add(char *name);
extern int package_extract(Device *dev, char *name);
/* system.c */
extern void systemInitialize(int argc, char **argv);
extern void systemShutdown(void);
extern int execExecute(char *cmd, char *name);
extern int systemExecute(char *cmd);
extern int systemDisplayFile(char *file);
extern int systemDisplayHelp(char *file);
extern char *systemHelpFile(char *file, char *buf);
extern void systemChangeFont(const u_char font[]);
extern void systemChangeLang(char *lang);
extern void systemChangeTerminal(char *color, const u_char c_termcap[],
char *mono, const u_char m_termcap[]);
extern void systemChangeTerminal(char *color, const u_char c_termcap[], char *mono, const u_char m_termcap[]);
extern void systemChangeScreenmap(const u_char newmap[]);
extern void systemCreateHoloshell(void);
extern int vsystem(char *fmt, ...);
extern int docBrowser(char *junk);
extern int docShowDocument(char *str);
/* tape.c */
extern char *mediaTapeBlocksize(void);
extern Boolean mediaInitTape(Device *dev);
extern int mediaGetTape(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetTape(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownTape(Device *dev);
/* tcpip.c */
extern int tcpOpenDialog(Device *dev);
extern int tcpMenuSelect(char *str);
extern int tcpInstallDevice(char *str);
extern Boolean tcpDeviceSelect(void);
/* termcap.c */
@ -497,11 +619,14 @@ extern int set_termcap(void);
/* ufs.c */
extern void mediaShutdownUFS(Device *dev);
extern Boolean mediaInitUFS(Device *dev);
extern int mediaGetUFS(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetUFS(Device *dev, char *file, Boolean tentative);
/* variables.c */
/* variable.c */
extern void variable_set(char *var);
extern void variable_set2(char *name, char *value);
extern char *variable_get(char *var);
extern void variable_unset(char *var);
extern char *variable_get_value(char *var, char *prompt);
/* wizard.c */
extern void slice_wizard(Disk *d);

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: system.c,v 1.44 1995/06/11 19:30:10 rgrimes Exp $
* $Id: system.c,v 1.45 1995/09/18 16:52:36 peter Exp $
*
* Jordan Hubbard
*
@ -70,6 +70,9 @@ systemInitialize(int argc, char **argv)
/* If we haven't crashed I guess dialog is running ! */
DialogActive = TRUE;
/* Make sure HOME is set for those utilities that need it */
if (!getenv("HOME"))
setenv("HOME", "/", 1);
signal(SIGINT, handle_intr);
}
@ -85,7 +88,7 @@ systemShutdown(void)
if (RunningAsInit) {
/* Put the console back */
ioctl(0, VT_ACTIVATE, 2);
reboot(RB_HALT);
reboot(0);
}
else
exit(1);
@ -96,11 +99,16 @@ int
systemExecute(char *command)
{
int status;
struct termios foo;
dialog_clear();
dialog_update();
end_dialog();
DialogActive = FALSE;
if (tcgetattr(0, &foo) != -1) {
foo.c_cc[VERASE] = '\010';
tcsetattr(0, TCSANOW, &foo);
}
status = system(command);
DialogActive = TRUE;
dialog_clear();
@ -108,9 +116,9 @@ systemExecute(char *command)
return status;
}
/* Display a file in a filebox */
/* Display a help file in a filebox */
int
systemDisplayFile(char *file)
systemDisplayHelp(char *file)
{
char *fname = NULL;
char buf[FILENAME_MAX];
@ -189,8 +197,8 @@ vsystem(char *fmt, ...)
pid_t pid;
int omask;
sig_t intsave, quitsave;
char *cmd,*p;
int i,magic=0;
char *cmd;
int i;
cmd = (char *)malloc(FILENAME_MAX);
cmd[0] = '\0';
@ -198,67 +206,72 @@ vsystem(char *fmt, ...)
vsnprintf(cmd, FILENAME_MAX, fmt, args);
va_end(args);
/* Find out if this command needs the wizardry of the shell */
for (p="<>|'`=\"()" ; *p; p++)
if (strchr(cmd, *p))
magic++;
omask = sigblock(sigmask(SIGCHLD));
if (isDebug())
msgDebug("Executing command `%s' (Magic=%d)\n", cmd, magic);
switch(pid = fork()) {
case -1: /* error */
msgDebug("Executing command `%s'\n", cmd);
pid = fork();
if (pid == -1) {
(void)sigsetmask(omask);
i = 127;
case 0: /* child */
}
else if (!pid) { /* Junior */
(void)sigsetmask(omask);
if (DebugFD != -1) {
if (OnVTY && isDebug())
msgInfo("Command output is on debugging screen - type ALT-F2 to see it");
msgInfo("Command output is on VTY2 - type ALT-F2 to see it");
dup2(DebugFD, 0);
dup2(DebugFD, 1);
dup2(DebugFD, 2);
}
#ifdef NOT_A_GOOD_IDEA_CRUNCHED_BINARY
if (magic) {
char *argv[100];
i = 0;
argv[i++] = "crunch";
argv[i++] = "sh";
argv[i++] = "-c";
argv[i++] = cmd;
argv[i] = 0;
exit(crunched_main(i,argv));
} else {
char *argv[100];
i = 0;
argv[i++] = "crunch";
while (cmd && *cmd) {
argv[i] = strsep(&cmd," \t");
if (*argv[i])
i++;
}
argv[i] = 0;
if (crunched_here(argv[1]))
exit(crunched_main(i,argv));
else
execvp(argv[1],argv+1);
kill(getpid(),9);
}
#else /* !CRUNCHED_BINARY */
execl("/stand/sh", "sh", "-c", cmd, (char *)NULL);
kill(getpid(),9);
#endif /* CRUNCHED_BINARY */
exit(1);
}
else {
intsave = signal(SIGINT, SIG_IGN);
quitsave = signal(SIGQUIT, SIG_IGN);
pid = waitpid(pid, &pstat, 0);
(void)sigsetmask(omask);
(void)signal(SIGINT, intsave);
(void)signal(SIGQUIT, quitsave);
i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
if (isDebug())
msgDebug("Command `%s' returns status of %d\n", cmd, i);
free(cmd);
}
intsave = signal(SIGINT, SIG_IGN);
quitsave = signal(SIGQUIT, SIG_IGN);
pid = waitpid(pid, &pstat, 0);
(void)sigsetmask(omask);
(void)signal(SIGINT, intsave);
(void)signal(SIGQUIT, quitsave);
i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
if (isDebug())
msgDebug("Command `%s' returns status of %d\n", cmd, i);
free(cmd);
return i;
}
void
systemCreateHoloshell(void)
{
if (OnVTY) {
if (!fork()) {
int i, fd;
struct termios foo;
extern int login_tty(int);
for (i = 0; i < 64; i++)
close(i);
DebugFD = fd = open("/dev/ttyv3", O_RDWR);
ioctl(0, TIOCSCTTY, &fd);
dup2(0, 1);
dup2(0, 2);
if (login_tty(fd) == -1)
msgDebug("Doctor: I can't set the controlling terminal.\n");
signal(SIGTTOU, SIG_IGN);
if (tcgetattr(fd, &foo) != -1) {
foo.c_cc[VERASE] = '\010';
if (tcsetattr(fd, TCSANOW, &foo) == -1)
msgDebug("Doctor: I'm unable to set the erase character.\n");
}
else
msgDebug("Doctor: I'm unable to get the terminal attributes!\n");
printf("Warning: This shell is chroot()'d to /mnt\n");
execlp("sh", "-sh", 0);
msgDebug("Was unable to execute sh for Holographic shell!\n");
exit(1);
}
else
msgNotify("Starting an emergency holographic shell on VTY4");
}
}

View file

@ -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: tape.c,v 1.6 1995/06/11 19:30:11 rgrimes Exp $
* $Id: tape.c,v 1.6.2.11 1995/11/15 06:59:52 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -49,42 +49,61 @@
static Boolean tapeInitted;
char *
mediaTapeBlocksize(void)
{
char *cp = variable_get(VAR_TAPE_BLOCKSIZE);
return cp ? cp : DEFAULT_TAPE_BLOCKSIZE;
}
Boolean
mediaInitTape(Device *dev)
{
int i;
if (tapeInitted)
return TRUE;
msgDebug("Tape init routine called for %s (private dir is %s)\n", dev->name, dev->private);
Mkdir(dev->private, NULL);
if (chdir(dev->private))
return FALSE;
msgConfirm("Insert tape into %s and press return", dev->description);
return FALSE;
/* We know the tape is already in the drive, so go for it */
msgNotify("Attempting to extract from %s...", dev->description);
if (!strcmp(dev->name, "ft0"))
i = vsystem("ft | cpio -iduVm -H tar");
if (!strcmp(dev->name, "rft0"))
i = vsystem("ft | cpio -idum %s --block-size %s", cpioVerbosity(), mediaTapeBlocksize());
else
i = vsystem("cpio -iduVm -H tar -I %s", dev->devname);
i = vsystem("cpio -idum %s --block-size %s -I %s", cpioVerbosity(), mediaTapeBlocksize(), dev->devname);
if (!i) {
tapeInitted = TRUE;
msgDebug("Tape initialized successfully.\n");
return TRUE;
}
else
else {
dialog_clear();
msgConfirm("Tape extract command failed with status %d!", i);
}
return FALSE;
}
int
mediaGetTape(Device *dev, char *file, Attribs *dist_attrs)
mediaGetTape(Device *dev, char *file, Boolean tentative)
{
char buf[PATH_MAX];
int fd;
sprintf(buf, "%s/%s", (char *)dev->private, file);
msgDebug("Request for %s from tape (looking in %s)\n", file, buf);
if (file_readable(buf))
return open(buf, O_RDONLY);
sprintf(buf, "%s/dists/%s", (char *)dev->private, file);
return open(buf, O_RDONLY);
fd = open(buf, O_RDONLY);
else {
sprintf(buf, "%s/dists/%s", (char *)dev->private, file);
fd = open(buf, O_RDONLY);
}
/* Nuke the files behind us to save space */
if (fd != -1)
unlink(buf);
return fd;
}
void
@ -92,7 +111,8 @@ mediaShutdownTape(Device *dev)
{
if (!tapeInitted)
return;
if (!access(dev->private, X_OK)) {
msgDebug("Shutdown of tape device - %s will be cleaned\n", dev->private);
if (file_readable(dev->private)) {
msgNotify("Cleaning up results of tape extract..");
(void)vsystem("rm -rf %s", (char *)dev->private);
}

View file

@ -1,5 +1,5 @@
/*
* $Id: tcpip.c,v 1.30.2.1 1995/07/21 10:02:59 rgrimes Exp $
* $Id: tcpip.c,v 1.31 1995/09/18 16:52:38 peter Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@ -52,15 +52,14 @@
#include "dir.h"
#include "dialog.priv.h"
#include "colors.h"
#include "rc.h"
#include "sysinstall.h"
/* These are nasty, but they make the layout structure a lot easier ... */
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[IPADDR_FIELD_LEN], netmask[IPADDR_FIELD_LEN], extras[EXTRAS_FIELD_LEN];
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[IPADDR_FIELD_LEN], netmask[IPADDR_FIELD_LEN], extras[EXTRAS_FIELD_LEN];
/* What the screen size is meant to be */
#define TCP_DIALOG_Y 0
@ -104,25 +103,25 @@ static Layout layout[] = {
"IP Address:",
"The IP address to be used for this interface",
ipaddr, STRINGOBJ, NULL },
#define LAYOUT_IPADDR 5
#define LAYOUT_IPADDR 4
{ 10, 35, 18, IPADDR_FIELD_LEN - 1,
"Netmask:",
"The netmask for this interfaace, e.g. 0xffffff00 for a class C network",
"The netmask for this interface, e.g. 0xffffff00 for a class C network",
netmask, STRINGOBJ, NULL },
#define LAYOUT_NETMASK 6
#define LAYOUT_NETMASK 5
{ 14, 10, 37, HOSTNAME_FIELD_LEN - 1,
"Extra options to ifconfig:",
"Any interface-specific options to ifconfig you would like to use",
extras, STRINGOBJ, NULL },
#define LAYOUT_EXTRAS 7
#define LAYOUT_EXTRAS 6
{ 19, 15, 0, 0,
"OK", "Select this if you are happy with these settings",
&okbutton, BUTTONOBJ, NULL },
#define LAYOUT_OKBUTTON 8
#define LAYOUT_OKBUTTON 7
{ 19, 35, 0, 0,
"CANCEL", "Select this if you wish to cancel this screen",
&cancelbutton, BUTTONOBJ, NULL },
#define LAYOUT_CANCELBUTTON 9
#define LAYOUT_CANCELBUTTON 8
{ NULL },
};
@ -171,6 +170,61 @@ verifySettings(void)
return 0;
}
int
tcpInstallDevice(char *str)
{
Device **devs;
Device *dp = NULL;
/* Clip garbage off the ends */
string_prune(str);
str = string_skipwhite(str);
if (!*str)
return RET_FAIL;
devs = deviceFind(str, DEVICE_TYPE_NETWORK);
if (devs && (dp = devs[0])) {
char temp[512], ifn[255];
if (!dp->private) {
DevInfo *di;
char *ipaddr, *netmask, *extras;
di = dp->private = (DevInfo *)malloc(sizeof(DevInfo));
if ((ipaddr = variable_get(string_concat3(VAR_IPADDR, "_", dp->name))) == NULL)
ipaddr = variable_get(VAR_IPADDR);
if ((netmask = variable_get(string_concat3(VAR_NETMASK, "_", dp->name))) == NULL)
netmask = variable_get(VAR_NETMASK);
if ((extras = variable_get(string_concat3(VAR_EXTRAS, "_", dp->name))) == NULL)
extras = variable_get(VAR_EXTRAS);
string_copy(di->ipaddr, ipaddr);
string_copy(di->netmask, netmask);
string_copy(di->extras, extras);
if (ipaddr) {
char *ifaces;
sprintf(temp, "inet %s %s netmask %s", ipaddr, extras ? extras : "", netmask);
sprintf(ifn, "%s%s", VAR_IFCONFIG, dp->name);
variable_set2(ifn, temp);
ifaces = variable_get(VAR_INTERFACES);
if (!ifaces)
variable_set2(VAR_INTERFACES, ifaces = "lo0");
/* Only add it if it's not there already */
if (!strstr(ifaces, dp->name)) {
sprintf(ifn, "%s %s", dp->name, ifaces);
variable_set2(VAR_INTERFACES, ifn);
}
}
}
mediaDevice = dp;
}
return dp ? RET_SUCCESS : RET_FAIL;
}
/* This is it - how to get TCP setup values */
int
tcpOpenDialog(Device *devp)
@ -211,26 +265,45 @@ tcpOpenDialog(Device *devp)
strcpy(netmask, di->netmask);
strcpy(extras, di->extras);
}
else
ipaddr[0] = netmask[0] = extras[0] = '\0';
else { /* See if there are any defaults */
char *cp;
if (!ipaddr[0]) {
if ((cp = variable_get(VAR_IPADDR)) != NULL)
strcpy(ipaddr, cp);
else if ((cp = variable_get(string_concat3(devp->name, "_", VAR_IPADDR))) != NULL)
strcpy(ipaddr, cp);
}
if (!netmask[0]) {
if ((cp = variable_get(VAR_NETMASK)) != NULL)
strcpy(netmask, cp);
else if ((cp = variable_get(string_concat3(devp->name, "_", VAR_NETMASK))) != NULL)
strcpy(netmask, cp);
}
if (!extras[0]) {
if ((cp = variable_get(VAR_EXTRAS)) != NULL)
strcpy(extras, cp);
else if ((cp = variable_get(string_concat3(devp->name, "_", VAR_EXTRAS))) != NULL)
strcpy(extras, cp);
}
}
/* Look up values already recorded with the system, or blank the string variables ready to accept some new data */
tmp = getenv(VAR_HOSTNAME);
tmp = variable_get(VAR_HOSTNAME);
if (tmp)
strcpy(hostname, tmp);
else
bzero(hostname, sizeof(hostname));
tmp = getenv(VAR_DOMAINNAME);
tmp = variable_get(VAR_DOMAINNAME);
if (tmp)
strcpy(domainname, tmp);
else
bzero(domainname, sizeof(domainname));
tmp = getenv(VAR_GATEWAY);
tmp = variable_get(VAR_GATEWAY);
if (tmp)
strcpy(gateway, tmp);
else
bzero(gateway, sizeof(gateway));
tmp = getenv(VAR_NAMESERVER);
tmp = variable_get(VAR_NAMESERVER);
if (tmp)
strcpy(nameserver, tmp);
else
@ -268,8 +341,7 @@ tcpOpenDialog(Device *devp)
/* Find the first object in the list */
first = obj;
while (first->prev)
first = first->prev;
for (first = obj; first->prev; first = first->prev);
/* Some more initialisation before we go into the main input loop */
n = 0;
@ -290,15 +362,30 @@ tcpOpenDialog(Device *devp)
/* Ask for libdialog to do its stuff */
ret = PollObj(&obj);
/* We are in the Hostname field - calculate the domainname */
if (n == 0) {
if (n == LAYOUT_HOSTNAME) {
/* We are in the Hostname field - calculate the domainname */
if ((tmp = index(hostname, '.')) != NULL) {
strncpy(domainname, tmp + 1, strlen(tmp + 1));
domainname[strlen(tmp+1)] = '\0';
RefreshStringObj(layout[1].obj);
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
}
}
else if (n == LAYOUT_IPADDR) {
/* Insert a default value for the netmask, 0xffffff00 is
the most appropriate one (entire class C, or subnetted
class A/B network). */
if(netmask[0] == '\0') {
strcpy(netmask, "255.255.255.0");
RefreshStringObj(layout[LAYOUT_NETMASK].obj);
}
}
else if (n == LAYOUT_DOMAINNAME) {
if (!index(hostname, '.') && domainname[0]) {
strcat(hostname, ".");
strcat(hostname, domainname);
RefreshStringObj(layout[LAYOUT_HOSTNAME].obj);
}
}
/* Handle special case stuff that libdialog misses. Sigh */
switch (ret) {
/* Bail out */
@ -391,7 +478,7 @@ tcpOpenDialog(Device *devp)
if (!cancel) {
DevInfo *di;
char temp[512], ifn[64];
char temp[512], ifn[255];
char *ifaces;
variable_set2(VAR_HOSTNAME, hostname);
@ -412,7 +499,7 @@ tcpOpenDialog(Device *devp)
sprintf(temp, "inet %s %s netmask %s", ipaddr, extras, netmask);
sprintf(ifn, "%s%s", VAR_IFCONFIG, devp->name);
variable_set2(ifn, temp);
ifaces = getenv(VAR_INTERFACES);
ifaces = variable_get(VAR_INTERFACES);
if (!ifaces)
variable_set2(VAR_INTERFACES, ifaces = "lo0");
/* Only add it if it's not there already */
@ -422,9 +509,9 @@ tcpOpenDialog(Device *devp)
}
if (ipaddr[0])
variable_set2(VAR_IPADDR, ipaddr);
return 0;
return RET_SUCCESS;
}
return 1;
return RET_FAIL;
}
static int
@ -436,13 +523,13 @@ netHook(char *str)
string_prune(str);
str = string_skipwhite(str);
if (!*str)
return 0;
return RET_FAIL;
devs = deviceFind(str, DEVICE_TYPE_NETWORK);
if (devs) {
tcpOpenDialog(devs[0]);
mediaDevice = devs[0];
}
return devs ? 1 : 0;
return devs ? RET_DONE : RET_FAIL;
}
/* Get a network device */
@ -460,13 +547,14 @@ tcpDeviceSelect(void)
msgConfirm("No network devices available!");
status = FALSE;
}
else if (cnt == 1) {
tcpOpenDialog(devs[0]);
else if (cnt == 1 || !RunningAsInit) {
/* If we're running in user mode, assume network already up */
if (RunningAsInit)
tcpOpenDialog(devs[0]);
mediaDevice = devs[0];
status = TRUE;
}
else {
menu = deviceCreateMenu(&MenuNetworkDevice, DEVICE_TYPE_NETWORK, netHook);
if (!menu)
msgFatal("Unable to create network device menu! Argh!");
@ -482,5 +570,5 @@ tcpMenuSelect(char *str)
{
(void)tcpDeviceSelect();
configResolv();
return 0;
return RET_SUCCESS;
}

View file

@ -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: ufs.c,v 1.4.2.2 1995/06/05 12:04:09 jkh Exp $
* $Id: ufs.c,v 1.5.2.4 1995/10/22 01:33:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -50,13 +50,20 @@
/* No init or shutdown routines necessary - all done in mediaSetUFS() */
int
mediaGetUFS(Device *dev, char *file, Attribs *dist_attrs)
mediaGetUFS(Device *dev, char *file, Boolean tentative)
{
char buf[PATH_MAX];
msgDebug("Request for %s from UFS\n", file);
snprintf(buf, PATH_MAX, "%s/%s", dev->private, file);
if (!access(buf, R_OK))
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "%s/dists/%s", dev->private, file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "%s/%s/%s", dev->private, variable_get(VAR_RELNAME), file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "%s/%s/dists/%s", dev->private, variable_get(VAR_RELNAME), file);
return open(buf, O_RDONLY);
}

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: variable.c,v 1.5.2.2 1995/06/01 21:04:03 jkh Exp $
* $Id: variable.c,v 1.6.2.7 1995/10/26 08:56:18 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -50,21 +50,23 @@ make_variable(char *var, char *value)
{
Variable *newvar;
/* First search to see if it's already there */
/* Put it in the environment in any case */
setenv(var, value, 1);
/* Now search to see if it's already in the list */
for (newvar = VarHead; newvar; newvar = newvar->next) {
if (!strcmp(newvar->name, var)) {
strncpy(newvar->value, value, VAR_VALUE_MAX);
setenv(var, value, 1);
return;
}
}
setenv(var, value, 1);
/* No? Create a new one */
newvar = (Variable *)safe_malloc(sizeof(Variable));
strncpy(newvar->name, var, VAR_NAME_MAX);
strncpy(newvar->value, value, VAR_VALUE_MAX);
newvar->next = VarHead;
VarHead = newvar;
setenv(newvar->name, newvar->value, 1);
if (isDebug())
msgDebug("Setting variable %s to %s\n", newvar->name, newvar->value);
}
@ -74,6 +76,10 @@ variable_set(char *var)
{
char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
if (!var)
msgFatal("NULL variable name & value passed.");
else if (!*var)
msgDebug("Warning: Zero length name & value passed to variable_set()\n");
strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
if ((cp = index(tmp, '=')) == NULL)
msgFatal("Invalid variable format: %s", var);
@ -86,5 +92,55 @@ variable_set2(char *var, char *value)
{
if (!var || !value)
msgFatal("Null name or value passed to set_variable2!");
else if (!*var || !*value)
msgDebug("Warning: Zero length name or value passed to variable_set2()\n");
make_variable(var, value);
}
char *
variable_get(char *var)
{
return getenv(var);
}
void
variable_unset(char *var)
{
Variable *vp;
unsetenv(var);
/* Now search to see if it's in our list, if we have one.. */
if (!VarHead)
return;
else if (!VarHead->next && !strcmp(VarHead->name, var)) {
free(VarHead);
VarHead = NULL;
}
else {
for (vp = VarHead; vp; vp = vp->next) {
if (!strcmp(vp->name, var)) {
Variable *save = vp->next;
*vp = *save;
safe_free(save);
break;
}
}
}
}
/* Prompt user for the name of a variable */
char *
variable_get_value(char *var, char *prompt)
{
char *cp;
dialog_clear();
if ((cp = msgGetInput(variable_get(var), prompt)) != NULL)
variable_set2(var, cp);
else
cp = NULL;
dialog_clear();
return cp;
}

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: wizard.c,v 1.5.2.1 1995/06/05 02:25:27 jkh Exp $
* $Id: wizard.c,v 1.6.2.1 1995/09/20 10:43:13 jkh Exp $
*
*/
@ -155,7 +155,11 @@ slice_wizard(Disk *d)
continue;
}
if (!strcasecmp(*cmds,"allfreebsd")) {
All_FreeBSD(d);
All_FreeBSD(d, 0);
continue;
}
if (!strcasecmp(*cmds,"dedicate")) {
All_FreeBSD(d, 1);
continue;
}
if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
@ -213,6 +217,7 @@ slice_wizard(Disk *d)
printf("\007ERROR\n");
printf("CMDS:\n");
printf("allfreebsd\t\t");
printf("dedicate\t\t");
printf("bios cyl hd sect\n");
printf("collapse [pointer]\t\t");
printf("create offset size enum subtype flags\n");

View file

@ -4,14 +4,14 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum
SRCS= attr.c cdrom.c command.c config.c decode.c devices.c disks.c dist.c \
dmenu.c dos.c floppy.c ftp.c ftp_strat.c globals.c install.c label.c \
main.c makedevs.c media.c menus.c misc.c msg.c network.c nfs.c system.c tape.c \
tcpip.c termcap.c ufs.c variable.c wizard.c
SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c decode.c \
devices.c disks.c dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
ftp_strat.c globals.c index.c install.c installFinal.c \
installPreconfig.c installUpgrade.c label.c lndir.c main.c \
makedevs.c media.c menus.c misc.c msg.c network.c nfs.c options.c \
package.c system.c tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
CFLAGS+= -Wall -I${.CURDIR}/../libdisk \
-I${.CURDIR}/../../gnu/lib/libdialog
CFLAGS+= -Wall -I${.CURDIR}/../libdisk -I${.CURDIR}/../../gnu/lib/libdialog
LDADD= -ldialog -lncurses -lmytinfo -lutil
.if exists(${.CURDIR}/../libdisk/obj)
@ -55,4 +55,3 @@ testftp: ftp.c
cc -o testftp -I../libdisk -DSTANDALONE_FTP ftp.c
.include <bsd.prog.mk>

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: command.c,v 1.11.4.1 1995/07/21 11:45:35 rgrimes Exp $
* $Id: command.c,v 1.12 1995/09/18 16:52:21 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -77,7 +77,7 @@ addit(char *key, int type, void *cmd, void *data)
{
int i;
/* First, look for the key already present and add a command to it */
/* First, look for the key already present and add a command to it if found */
for (i = 0; i < numCommands; i++) {
if (!strcmp(commandStack[i]->key, key)) {
if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
@ -98,7 +98,8 @@ addit(char *key, int type, void *cmd, void *data)
commandStack[numCommands]->ncmds = 1;
commandStack[numCommands]->cmds[0].type = type;
commandStack[numCommands]->cmds[0].ptr = cmd;
commandStack[numCommands++]->cmds[0].data = data;
commandStack[numCommands]->cmds[0].data = data;
++numCommands;
}
/* Add a shell command under a given key */
@ -108,9 +109,9 @@ command_shell_add(char *key, char *fmt, ...)
va_list args;
char *cmd;
cmd = (char *)safe_malloc(1024);
cmd = (char *)safe_malloc(256);
va_start(args, fmt);
vsnprintf(cmd, 1024, fmt, args);
vsnprintf(cmd, 256, fmt, args);
va_end(args);
addit(key, CMD_SHELL, cmd, NULL);
@ -123,17 +124,36 @@ command_func_add(char *key, commandFunc func, void *data)
addit(key, CMD_FUNCTION, func, data);
}
/* arg to sort */
static int
sort_compare(const void *p1, const void *p2)
sort_compare(Command *p1, Command *p2)
{
return strcmp(((Command *)p1)->key, ((Command *)p2)->key);
if (!p1 && !p2)
return 0;
else if (!p1 && p2) /* NULL has a "greater" value for commands */
return 1;
else if (p1 && !p2)
return -1;
else
return strcmp(p1->key, p2->key);
}
void
command_sort(void)
{
qsort(commandStack, numCommands, sizeof(Command *), sort_compare);
int i, j;
commandStack[numCommands] = NULL;
/* Just do a crude bubble sort since the list is small */
for (i = 0; i < numCommands; i++) {
for (j = 0; j < numCommands; j++) {
if (sort_compare(commandStack[j], commandStack[j + 1]) > 0) {
Command *tmp = commandStack[j];
commandStack[j] = commandStack[j + 1];
commandStack[j + 1] = tmp;
}
}
}
}
/* Run all accumulated commands in sorted order */
@ -155,7 +175,8 @@ command_execute(void)
else {
/* It's a function pointer - call it with the key and the data */
func = (commandFunc)commandStack[i]->cmds[j].ptr;
msgNotify("%x: Execute(%s, %s)", func, commandStack[i]->key, commandStack[i]->cmds[j].data);
if (isDebug())
msgDebug("%x: Execute(%s, %s)", func, commandStack[i]->key, commandStack[i]->cmds[j].data);
ret = (*func)(commandStack[i]->key, commandStack[i]->cmds[j].data);
if (isDebug())
msgDebug("Function @ %x returns status %d\n", commandStack[i]->cmds[j].ptr, ret);

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.16.2.2 1995/07/21 11:45:36 rgrimes Exp $
* $Id: config.c,v 1.17 1995/09/18 16:52:22 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -50,34 +50,53 @@ static int nchunks;
/* arg to sort */
static int
chunk_compare(const void *p1, const void *p2)
chunk_compare(Chunk *c1, Chunk *c2)
{
Chunk *c1, *c2;
c1 = (Chunk *)p1;
c2 = (Chunk *)p2;
if (!c1->private && !c2->private)
if (!c1 && !c2)
return 0;
else if (!c1 && c2)
return 1;
else if (c1 && !c2)
return -1;
else if (!c1->private && !c2->private)
return 0;
else if (c1->private && !c2->private)
return -1;
else if (!c1->private && c2->private)
return 1;
else if (!c1->private && c2->private)
return -1;
else
return strcmp(((PartInfo *)c1->private)->mountpoint, ((PartInfo *)c2->private)->mountpoint);
return strcmp(((PartInfo *)(c1->private))->mountpoint, ((PartInfo *)(c2->private))->mountpoint);
}
static void
chunk_sort(void)
{
int i, j;
for (i = 0; i < nchunks; i++) {
for (j = 0; j < nchunks; j++) {
if (chunk_compare(chunk_list[j], chunk_list[j + 1]) > 0) {
Chunk *tmp = chunk_list[j];
chunk_list[j] = chunk_list[j + 1];
chunk_list[j + 1] = tmp;
}
}
}
}
static char *
nameof(Chunk *c1)
name_of(Chunk *c1)
{
static char rootname[64];
static char rootname[32];
/* Our boot blocks can't deal with root partitions on slices - need the compatbility name */
if (c1->type == part && c1->flags & CHUNK_IS_ROOT) {
sprintf(rootname, "%sa", c1->disk->name);
return rootname;
sprintf(rootname, "%sa", c1->disk->name);
return rootname;
}
else
return c1->name;
return c1->name;
}
static char *
@ -126,7 +145,7 @@ seq_num(Chunk *c1)
return 0;
}
void
int
configFstab(void)
{
Device **devs;
@ -137,14 +156,20 @@ configFstab(void)
if (!RunningAsInit) {
if (file_readable("/etc/fstab"))
return;
else
msgConfirm("Attempting to rebuild your /etc/fstab file.\nWarning: If you had any CD devices in use before running\nsysinstall then they may NOT be found in this run!");
return RET_SUCCESS;
else {
dialog_clear();
msgConfirm("Attempting to rebuild your /etc/fstab file. Warning: If you had\n"
"any CD devices in use before running sysinstall then they may NOT\n"
"be found by this run!");
}
}
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("No disks found!");
return;
return RET_FAIL;
}
/* Record all the chunks */
@ -166,20 +191,21 @@ configFstab(void)
chunk_list[nchunks++] = c1;
}
}
/* Sort them puppies! */
qsort(chunk_list, nchunks, sizeof(Chunk *), chunk_compare);
chunk_list[nchunks] = 0;
chunk_sort();
fstab = fopen("/etc/fstab", "w");
if (!fstab) {
msgConfirm("Unable to create a new /etc/fstab file!\nManual intervention will be required.");
return;
dialog_clear();
msgConfirm("Unable to create a new /etc/fstab file! Manual intervention\n"
"will be required.");
return RET_FAIL;
}
/* Go for the burn */
msgDebug("Generating /etc/fstab file\n");
for (i = 0; i < nchunks; i++)
fprintf(fstab, "/dev/%s\t\t\t%s\t\t%s\t%s %d %d\n", nameof(chunk_list[i]), mount_point(chunk_list[i]),
fprintf(fstab, "/dev/%s\t\t\t%s\t\t%s\t%s %d %d\n", name_of(chunk_list[i]), mount_point(chunk_list[i]),
fstype(chunk_list[i]), fstype_short(chunk_list[i]), seq_num(chunk_list[i]), seq_num(chunk_list[i]));
Mkdir("/proc", NULL);
fprintf(fstab, "proc\t\t\t\t/proc\t\tprocfs\trw 0 0\n");
@ -190,8 +216,12 @@ configFstab(void)
/* Write the first one out as /cdrom */
if (cnt) {
Mkdir("/cdrom", NULL);
fprintf(fstab, "/dev/%s\t\t\t/cdrom\t\tcd9660\tro 0 0\n", devs[0]->name);
if (Mkdir("/cdrom", NULL)) {
dialog_clear();
msgConfirm("Unable to make mount point for: /cdrom");
}
else
fprintf(fstab, "/dev/%s\t\t\t/cdrom\t\tcd9660\tro,noauto 0 0\n", devs[0]->name);
}
/* Write the others out as /cdrom<n> */
@ -199,185 +229,308 @@ configFstab(void)
char cdname[10];
sprintf(cdname, "/cdrom%d", i);
Mkdir(cdname, NULL);
fprintf(fstab, "/dev/%s\t\t\t%s\t\tcd9660\tro 0 0\n", devs[i]->name, cdname);
if (Mkdir(cdname, NULL)) {
dialog_clear();
msgConfirm("Unable to make mount point for: %s", cdname);
}
else
fprintf(fstab, "/dev/%s\t\t\t%s\t\tcd9660\tro,noauto 0 0\n", devs[i]->name, cdname);
}
fclose(fstab);
if (isDebug())
msgDebug("Wrote out /etc/fstab file\n");
return RET_SUCCESS;
}
/*
* This sucks in /etc/sysconfig, substitutes anything needing substitution, then
* writes it all back out. It's pretty gross and needs re-writing at some point.
*/
#define MAX_LINES 2000 /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */
void
configSysconfig(void)
{
FILE *fp;
char *lines[5001]; /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */
char *lines[MAX_LINES], *cp;
char line[256];
Variable *v;
int i, nlines = 0;
int i, nlines;
fp = fopen("/etc/sysconfig", "r");
if (!fp) {
msgConfirm("Unable to open /etc/sysconfig file! Things may work\nrather strangely as a result of this.");
dialog_clear();
msgConfirm("Unable to open /etc/sysconfig file! Things may work\n"
"rather strangely as a result of this.");
return;
}
for (i = 0; i < 5000; i++) {
msgNotify("Writing configuration changes to /etc/sysconfig file..");
nlines = 0;
/* Read in the entire file */
for (i = 0; i < MAX_LINES; i++) {
if (!fgets(line, 255, fp))
break;
lines[nlines++] = strdup(line);
}
lines[nlines] = NULL;
fclose(fp);
msgDebug("Read %d lines from sysconfig.\n", nlines);
/* Now do variable substitutions */
for (v = VarHead; v; v = v->next) {
for (i = 0; i < nlines; i++) {
char modify[256], *cp;
char tmp[256];
if (lines[i][0] == '#' || lines[i][0] == ';')
/* Skip the comments */
if (lines[i][0] == '#')
continue;
strncpy(modify, lines[i], 255);
cp = index(modify, '=');
strcpy(tmp, lines[i]);
cp = index(tmp, '=');
if (!cp)
continue;
*(cp++) = '\0';
if (!strcmp(modify, v->name)) {
if (!strcmp(tmp, v->name)) {
free(lines[i]);
lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 3);
lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + 5);
sprintf(lines[i], "%s=\"%s\"\n", v->name, v->value);
msgDebug("Variable substitution on: %s\n", lines[i]);
}
}
}
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]);
free(lines[i]);
/* Now write it all back out again */
fclose(fp);
fp = fopen("/etc/sysconfig", "w");
for (i = 0; i < nlines; i++) {
static Boolean firstTime = TRUE;
fprintf(fp, lines[i]);
/* Stand by for bogus special case handling - we try to dump the interface specs here */
if (!strncmp(lines[i], VAR_INTERFACES, strlen(VAR_INTERFACES))) {
if (firstTime && !strncmp(lines[i], VAR_INTERFACES, strlen(VAR_INTERFACES))) {
Device **devp;
int j, cnt;
devp = deviceFind(NULL, DEVICE_TYPE_NETWORK);
cnt = deviceCount(devp);
for (j = 0; j < cnt; j++) {
if (devp[j]->private && strncmp(devp[j]->name, "cuaa", 4)) {
char iname[64];
char iname[255];
snprintf(iname, 64, "%s%s", VAR_IFCONFIG, devp[j]->name);
if (getenv(iname))
fprintf(fp, "%s=\"%s\"\n", iname, getenv(iname));
snprintf(iname, 255, "%s%s", VAR_IFCONFIG, devp[j]->name);
if ((cp = variable_get(iname))) {
fprintf(fp, "%s=\"%s\"\n", iname, cp);
}
}
firstTime = FALSE;
}
free(lines[i]);
}
fclose(fp);
/* If we're an NFS server, we need an exports file */
if (getenv("nfs_server") && !file_readable("/etc/exports")) {
msgConfirm("You have chosen to be an NFS server but have not yet configured\nthe /etc/exports file. The format for an exports entry is:\n <mountpoint> <opts> <host [..host]>\nWhere <mounpoint> is the name of a filesystem as specified\nin the Label editor, <opts> is a list of special options we\nwon't concern ourselves with here (``man exports'' when the\nsystem is fully installed) and <host> is one or more host\nnames who are allowed to mount this file system. Press\n[ENTER] now to invoke the editor on /etc/exports");
systemExecute("vi /etc/exports");
}
}
int
configSaverTimeout(char *str)
{
char *val;
val = msgGetInput("60", "Enter time-out period in seconds for screen saver");
if (val)
variable_set2("blanktime", val);
return 0;
return variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver")
? RET_SUCCESS : RET_FAIL;
}
int
configNTP(char *str)
{
char *val;
val = msgGetInput(NULL, "Enter the name of an NTP server");
if (val)
variable_set2("ntpdate", val);
return 0;
return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") ? RET_SUCCESS : RET_FAIL;
}
void
configResolv(void)
{
FILE *fp;
char *cp;
char *cp, *dp, *hp;
if (!RunningAsInit && file_readable("/etc/resolv.conf"))
return;
if (!getenv(VAR_NAMESERVER)) {
if (mediaDevice && (mediaDevice->type == DEVICE_TYPE_NFS || mediaDevice->type == DEVICE_TYPE_FTP))
msgConfirm("Warning: Missing name server value - network operations\nmay fail as a result!");
if (!variable_get(VAR_NAMESERVER)) {
if (mediaDevice && (mediaDevice->type == DEVICE_TYPE_NFS || mediaDevice->type == DEVICE_TYPE_FTP)) {
dialog_clear();
msgConfirm("Warning: Missing name server value - network operations\n"
"may fail as a result!");
}
goto skip;
}
Mkdir("/etc", NULL);
if (Mkdir("/etc", NULL)) {
dialog_clear();
msgConfirm("Unable to create /etc directory. Network configuration\n"
"files will therefore not be written!");
return;
}
fp = fopen("/etc/resolv.conf", "w");
if (!fp) {
dialog_clear();
msgConfirm("Unable to open /etc/resolv.conf! You will need to do this manually.");
return;
}
if (getenv(VAR_DOMAINNAME))
fprintf(fp, "domain\t%s\n", getenv(VAR_DOMAINNAME));
fprintf(fp, "nameserver\t%s\n", getenv(VAR_NAMESERVER));
if (variable_get(VAR_DOMAINNAME))
fprintf(fp, "domain\t%s\n", variable_get(VAR_DOMAINNAME));
fprintf(fp, "nameserver\t%s\n", variable_get(VAR_NAMESERVER));
fclose(fp);
if (isDebug())
msgDebug("Wrote out /etc/resolv.conf\n");
skip:
/* Tack ourselves at the end of /etc/hosts */
cp = getenv(VAR_IPADDR);
if (cp && *cp != '0' && getenv(VAR_HOSTNAME)) {
fp = fopen("/etc/hosts", "a");
fprintf(fp, "%s\t\t%s\n", cp, getenv(VAR_HOSTNAME));
/* Tack ourselves into /etc/hosts */
cp = variable_get(VAR_IPADDR);
dp = variable_get(VAR_DOMAINNAME);
if (cp && *cp != '0' && (hp = variable_get(VAR_HOSTNAME))) {
char cp2[255];
(void)vsystem("hostname %s", hp);
fp = fopen("/etc/hosts", "w");
if (!index(hp, '.'))
cp2[0] = '\0';
else {
strcpy(cp2, hp);
*(index(cp2, '.')) = '\0';
}
fprintf(fp, "127.0.0.1\t\tlocalhost.%s localhost\n", dp ? dp : "my.domain");
fprintf(fp, "%s\t\t%s %s\n", cp, hp, cp2);
fclose(fp);
if (isDebug())
msgDebug("Appended entry for %s to /etc/hosts\n", cp);
msgDebug("Wrote entry for %s to /etc/hosts\n", cp);
}
}
int
configRoutedFlags(char *str)
{
char *val;
val = msgGetInput("-q", "Specify the flags for routed; -q is the default, -s is\na good choice for gateway machines.");
if (val)
variable_set2("routedflags", val);
return 0;
return variable_get_value(VAR_ROUTEDFLAGS,
"Specify the flags for routed; -q is the default, -s is\n"
"a good choice for gateway machines.") ? RET_SUCCESS : RET_FAIL;
}
int
configPackages(char *str)
{
Boolean onCD;
PkgNode top, plist;
int fd;
/* If we're running as init, we know that a CD in the drive is probably ours */
onCD = file_readable("/cdrom/packages");
if (!onCD && RunningAsInit) {
if (mediaSetCDROM(NULL)) {
if ((*mediaDevice->init)(mediaDevice))
onCD = TRUE;
if (!mediaVerify())
return RET_FAIL;
if (!mediaDevice->init(mediaDevice))
return RET_FAIL;
msgNotify("Attempting to fetch packages/INDEX file from selected media.");
fd = mediaDevice->get(mediaDevice, "packages/INDEX", TRUE);
if (fd < 0) {
dialog_clear();
msgConfirm("Unable to get packages/INDEX file from selected media.\n"
"This may be because the packages collection is not available at\n"
"on the distribution media you've chosen (most likely an FTP site\n"
"without the packages collection mirrored). Please verify media\n"
"(or path to media) and try again. If your local site does not\n"
"carry the packages collection, then we recommend either a CD\n"
"distribution or the master distribution on ftp.freebsd.org.");
return RET_FAIL;
}
msgNotify("Got INDEX successfully, now building packages menu..");
index_init(&top, &plist);
if (index_read(fd, &top)) {
dialog_clear();
msgConfirm("I/O or format error on packages/INDEX file.\n"
"Please verify media (or path to media) and try again.");
mediaDevice->close(mediaDevice, fd);
return RET_FAIL;
}
mediaDevice->close(mediaDevice, fd);
index_sort(&top);
while (1) {
int ret, pos, scroll;
/* Bring up the packages menu */
pos = scroll = 0;
index_menu(&top, &plist, &pos, &scroll);
if (plist.kids) {
/* Now show the packing list menu */
pos = scroll = 0;
ret = index_menu(&plist, NULL, &pos, &scroll);
if (ret == RET_DONE)
break;
else if (ret != RET_FAIL) {
index_extract(mediaDevice, &plist);
break;
}
}
else {
dialog_clear();
msgConfirm("No packages were selected for extraction.");
break;
}
}
/* XXX Construct some sort of menu here using an INDEX file from /cdrom/packages XXX */
return 0;
index_node_free(&top, &plist);
mediaDevice->shutdown(mediaDevice);
return RET_SUCCESS;
}
int
configPorts(char *str)
{
return 0;
char *cp, *dist = NULL; /* Shut up compiler */
if (!variable_get(VAR_PORTS_PATH))
variable_set2(VAR_PORTS_PATH, dist = "/cdrom/ports");
while (!directoryExists(dist)) {
dist = variable_get_value(VAR_PORTS_PATH,
"Unable to locate a ports tree on CDROM. Please specify the\n"
"location of the master ports directory you wish to create the\n"
"link tree to.");
if (!dist)
break;
}
if (dist) {
cp = msgGetInput("/usr/ports",
"Where would you like to create the link tree?\n"
"(press [ENTER] for default location). The link tree should\n"
"reside in a directory with as much free space as possible,\n"
"as you'll need space to compile any ports.");
if (!cp || !*cp)
return RET_FAIL;
if (Mkdir(cp, NULL)) {
dialog_clear();
msgConfirm("Unable to make the %s directory!", cp);
return RET_FAIL;
}
else {
if (strcmp(cp, "/usr/ports")) {
unlink("/usr/ports");
if (symlink(cp, "/usr/ports") == -1) {
msgConfirm("Unable to create a symlink from /usr/ports to %s!\n"
"I can't continue, sorry!", cp);
return RET_FAIL;
}
else {
msgConfirm("NOTE: This directory is also now symlinked to /usr/ports\n"
"which, for a variety of reasons, is the directory the ports\n"
"framework expects to find its files in. You should refer to\n"
"/usr/ports instead of %s directly when you're working in the\n"
"ports collection.", cp);
}
}
msgNotify("Making a link tree from %s to %s.", dist, cp);
if (lndir(dist, cp) != RET_SUCCESS) {
dialog_clear();
msgConfirm("The lndir function returned an error status and may not have.\n"
"successfully generated the link tree. You may wish to inspect\n"
"the /usr/ports directory carefully for any missing link files.");
}
else {
msgConfirm("The /usr/ports directory is now ready to use. When the system comes\n"
"up fully, you can cd to this directory and type `make' in any sub-\n"
"directory for which you'd like to compile a port. You can also\n"
"cd to /usr/ports and type `make print-index' for a complete list of all\n"
"ports in the hierarchy.");
}
}
}
else
return RET_FAIL;
return RET_SUCCESS;
}

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: devices.c,v 1.35.2.9 1995/06/05 12:03:46 jkh Exp $
* $Id: devices.c,v 1.36.2.11 1995/11/15 06:57:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -82,16 +82,20 @@ static struct {
{ DEVICE_TYPE_CDROM, "scd1a", "Sony CDROM drive - CDU31/33A type (2nd unit)" },
{ DEVICE_TYPE_CDROM, "matcd0a", "Matsushita CDROM ('sound blaster' type)" },
{ DEVICE_TYPE_CDROM, "matcd1a", "Matsushita CDROM (2nd unit)" },
{ DEVICE_TYPE_CDROM, "wcd0c", "ATAPI IDE CDROM" },
{ DEVICE_TYPE_CDROM, "wcd1c", "ATAPI IDE CDROM (2nd unit)" },
{ DEVICE_TYPE_TAPE, "rst0", "SCSI tape drive" },
{ DEVICE_TYPE_TAPE, "rst1", "SCSI tape drive (2nd unit)" },
{ DEVICE_TYPE_TAPE, "ft0", "Floppy tape drive (QIC-02)" },
{ DEVICE_TYPE_TAPE, "wt0", "Wangtek tape drive" },
{ DEVICE_TYPE_TAPE, "rft0", "Floppy tape drive (QIC-02)" },
{ DEVICE_TYPE_TAPE, "rwt0", "Wangtek tape drive" },
{ DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
{ DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
{ DEVICE_TYPE_FLOPPY, "fd0", "floppy drive unit A" },
{ DEVICE_TYPE_FLOPPY, "fd1", "floppy drive unit B" },
{ DEVICE_TYPE_NETWORK, "cuaa0", "Serial port (COM1) - possible PPP/SLIP device" },
{ DEVICE_TYPE_NETWORK, "cuaa1", "Serial port (COM2) - possible PPP/SLIP device" },
{ DEVICE_TYPE_NETWORK, "cuaa2", "Serial port (COM3) - possible PPP/SLIP device" },
{ DEVICE_TYPE_NETWORK, "cuaa3", "Serial port (COM4) - possible PPP/SLIP device" },
{ DEVICE_TYPE_NETWORK, "lp0", "Parallel Port IP (PLIP) using laplink cable" },
{ DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" },
{ DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" },
@ -126,18 +130,21 @@ new_device(char *name)
Boolean
dummyInit(Device *dev)
{
msgDebug("Dummy init called for %s\n", dev->name);
return TRUE;
}
int
dummyGet(Device *dev, char *dist, Attribs *dist_attrs)
dummyGet(Device *dev, char *dist, Boolean tentative)
{
msgDebug("Dummy get called for %s\n", dev->name);
return -1;
}
Boolean
dummyClose(Device *dev, int fd)
{
msgDebug("Dummy [default] close called for %s with fd of %d.\n", dev->name, fd);
if (!close(fd))
return TRUE;
return FALSE;
@ -146,6 +153,7 @@ dummyClose(Device *dev, int fd)
void
dummyShutdown(Device *dev)
{
msgDebug("Dummy shutdown called for %s\n", dev->name);
return;
}
@ -166,7 +174,7 @@ deviceTry(char *name, char *try)
/* 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)(Device *, char *, Attribs *),
Boolean (*init)(Device *), int (*get)(Device *, char *, Boolean),
Boolean (*close)(Device *, int), void (*shutdown)(Device *), void *private)
{
Device *newdev;
@ -294,10 +302,12 @@ deviceGetAll(void)
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
dialog_clear();
msgConfirm("ifconfig: socket");
return;
}
if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) {
dialog_clear();
msgConfirm("ifconfig (SIOCGIFCONF)");
return;
}
@ -316,6 +326,7 @@ deviceGetAll(void)
msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name);
close(s);
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
dialog_clear();
msgConfirm("ifconfig: socket");
continue;
}

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.31.2.2 1995/07/21 11:45:38 rgrimes Exp $
* $Id: disks.c,v 1.32 1995/09/18 16:52:23 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -49,7 +49,7 @@
#define CHUNK_START_ROW 5
/* Where we keep track of MBR chunks */
static struct chunk *chunk_info[10];
static struct chunk *chunk_info[16];
static int current_chunk;
static void
@ -60,15 +60,13 @@ record_chunks(Disk *d)
int last_free = 0;
if (!d->chunks)
msgFatal("No chunk list found for %s!", d->name);
c1 = d->chunks->part;
current_chunk = 0;
while (c1) {
for (c1 = d->chunks->part; c1; c1 = c1->next) {
if (c1->type == unused && c1->size > last_free) {
last_free = c1->size;
current_chunk = i;
}
chunk_info[i++] = c1;
c1 = c1->next;
}
chunk_info[i] = NULL;
}
@ -79,16 +77,32 @@ print_chunks(Disk *d)
int row;
int i;
if ((!d->bios_cyl || d->bios_cyl > 65536) || (!d->bios_hd || d->bios_hd > 256) || (!d->bios_sect || d->bios_sect >= 64))
msgConfirm("WARNING: The detected geometry is incorrect! Please adjust it to\nthe correct values manually with the (G)eometry command. If you are\nunsure about the correct geometry (which may be \"translated\"), please\nconsult the Hardware Guide in the Documentation submenu.");
if ((!d->bios_cyl || d->bios_cyl > 65536) || (!d->bios_hd || d->bios_hd > 256) || (!d->bios_sect || d->bios_sect >= 64)) {
int sz;
dialog_clear();
msgConfirm("WARNING: The current geometry for %s is incorrect. Using\n"
"a default geometry of 64 heads and 32 sectors. If this geometry\n"
"is incorrect or you are unsure as to whether or not it's correct,\n"
"please consult the Hardware Guide in the Documentation submenu\n"
"or use the (G)eometry command to change it now.", d->name);
d->bios_hd = 64;
d->bios_sect = 32;
sz = 0;
for (i = 0; chunk_info[i]; i++)
sz += chunk_info[i]->size;
if (sz)
d->bios_cyl = sz / ONE_MEG;
else
msgConfirm("Couldn't set geometry! You'll have to do it by hand.");
}
attrset(A_NORMAL);
mvaddstr(0, 0, "Disk name:\t");
clrtobot();
attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
attrset(A_REVERSE); mvaddstr(0, 55, "FDISK Partition Editor"); attrset(A_NORMAL);
mvprintw(1, 0,
"BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
"DISK Geometry:\t%lu cyls/%lu heads/%lu sectors",
d->bios_cyl, d->bios_hd, d->bios_sect);
mvprintw(3, 1, "%10s %10s %10s %8s %8s %8s %8s %8s",
"Offset", "Size", "End", "Name", "PType", "Desc",
@ -111,7 +125,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(17, 0, "D = Delete Partition G = Set Drive Geometry S = Set Bootable");
mvprintw(18, 0, "U = Undo All Changes Q = Finish W = Write Changes");
mvprintw(20, 0, "The currently selected partition is displayed in ");
attrset(A_REVERSE); addstr("reverse"); attrset(A_NORMAL); addstr(" video.");
@ -119,17 +133,142 @@ print_command_summary()
move(0, 0);
}
static Disk *
diskPartition(Disk *d)
/* Partition a disk based wholly on which variables are set */
static void
scriptPartition(Device *dev, Disk *d)
{
char *cp;
int i, sz;
record_chunks(d);
cp = variable_get(VAR_GEOMETRY);
if (cp) {
msgDebug("Setting geometry from script to: %s\n", cp);
d->bios_cyl = strtol(cp, &cp, 0);
d->bios_hd = strtol(cp + 1, &cp, 0);
d->bios_sect = strtol(cp + 1, 0, 0);
}
cp = variable_get(VAR_DISKSPACE);
if (cp) {
if (!strcmp(cp, "free")) {
/* Do free disk space case */
for (i = 0; chunk_info[i]; i++) {
/* If a chunk is at least 10MB in size, use it. */
if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size, freebsd, 3,
(chunk_info[i]->flags & CHUNK_ALIGN));
variable_set2(DISK_PARTITIONED, "yes");
break;
}
}
if (!chunk_info[i]) {
dialog_clear();
msgConfirm("Unable to find any free space on this disk!");
return;
}
}
else if (!strcmp(cp, "all")) {
/* Do all disk space case */
msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
All_FreeBSD(d, FALSE);
}
else if (!strcmp(cp, "exclusive")) {
/* Do really-all-the-disk-space case */
msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
All_FreeBSD(d, TRUE);
}
else if ((sz = strtol(cp, &cp, 0))) {
/* Look for sz bytes free */
if (*cp && toupper(*cp) == 'M')
sz *= ONE_MEG;
for (i = 0; chunk_info[i]; i++) {
/* If a chunk is at least sz MB, use it. */
if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3, (chunk_info[i]->flags & CHUNK_ALIGN));
variable_set2(DISK_PARTITIONED, "yes");
break;
}
}
if (!chunk_info[i]) {
dialog_clear();
msgConfirm("Unable to find %d free blocks on this disk!", sz);
return;
}
}
else if (!strcmp(cp, "existing")) {
/* Do existing FreeBSD case */
for (i = 0; chunk_info[i]; i++) {
if (chunk_info[i]->type == freebsd)
break;
}
if (!chunk_info[i]) {
dialog_clear();
msgConfirm("Unable to find any existing FreeBSD partitions on this disk!");
return;
}
}
else {
dialog_clear();
msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_DISKSPACE);
return;
}
variable_set2(DISK_PARTITIONED, "yes");
}
}
static u_char *
getBootMgr(char *dname)
{
extern u_char mbr[], bteasy17[];
char str[80];
char *cp;
int i = 0;
cp = variable_get(VAR_BOOTMGR);
if (!cp) {
/* Figure out what kind of MBR the user wants */
sprintf(str, "Install Boot Manager for drive %s?", dname);
MenuMBRType.title = str;
dialog_clear();
i = dmenuOpenSimple(&MenuMBRType);
}
else {
if (!strncmp(cp, "boot", 4))
BootMgr = 0;
else if (!strcmp(cp, "standard"))
BootMgr = 1;
else
BootMgr = 2;
}
if (cp || i) {
switch (BootMgr) {
case 0:
return bteasy17;
case 1:
return mbr;
case 2:
default:
break;
}
}
return NULL;
}
void
diskPartition(Device *dev, Disk *d)
{
char *p;
int key = 0;
Boolean chunking;
char *msg = NULL;
char name[40];
u_char *mbrContents;
chunking = TRUE;
strncpy(name, d->name, 40);
keypad(stdscr, TRUE);
clear();
@ -148,6 +287,7 @@ diskPartition(Disk *d)
case '\014': /* ^L */
clear();
print_command_summary();
continue;
case KEY_UP:
@ -175,23 +315,46 @@ diskPartition(Disk *d)
case KEY_F(1):
case '?':
systemDisplayFile("slice.hlp");
systemDisplayHelp("slice");
break;
case 'A':
All_FreeBSD(d);
case 'A': {
int rv;
rv = msgYesNo("Do you want to do this with a true partition entry\n"
"so as to remain cooperative with any future possible\n"
"operating systems on the drive(s)?");
if (rv) {
rv = !msgYesNo("This is dangerous in that it will make the drive totally\n"
"uncooperative with other potential operating systems on the\n"
"same disk. It will lead instead to a totally dedicated disk,\n"
"starting at the very first sector, bypassing all BIOS geometry\n"
"considerations.\n"
"You will run into serious trouble with ST-506 and ESDI drives\n"
"and possibly some IDE drives (e.g. drives running under the\n"
"control of sort of disk manager). SCSI drives are considerably\n"
"less at risk.\n\n"
"Do you insist on dedicating the entire disk this way?");
}
All_FreeBSD(d, rv);
if (rv)
d->bios_hd = d->bios_sect = d->bios_cyl = 1;
variable_set2(DISK_PARTITIONED, "yes");
record_chunks(d);
}
break;
case 'B':
if (chunk_info[current_chunk]->type != freebsd)
msg = "Can only scan for bad blocks in FreeBSD partition.";
else if (strncmp(name, "sd", 2) ||
!msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\nAre you sure you want to do this on a SCSI disk?"))
else if (strncmp(d->name, "sd", 2) ||
!msgYesNo("This typically makes sense only for ESDI, IDE or MFM drives.\n"
"Are you sure you want to do this on a SCSI disk?")) {
if (chunk_info[current_chunk]->flags & CHUNK_BAD144)
chunk_info[current_chunk]->flags &= ~CHUNK_BAD144;
else
chunk_info[current_chunk]->flags |= CHUNK_BAD144;
}
break;
case 'C':
@ -202,12 +365,14 @@ diskPartition(Disk *d)
int size;
snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
val = msgGetInput(tmp, "Please specify the size for new FreeBSD partition in blocks, or append\n"
"a trailing `M' for megabytes (e.g. 20M).");
if (val && (size = strtol(val, &cp, 0)) > 0) {
if (*cp && toupper(*cp) == 'M')
size *= 2048;
size *= ONE_MEG;
Create_Chunk(d, chunk_info[current_chunk]->offset, size, freebsd, 3,
(chunk_info[current_chunk]->flags & CHUNK_ALIGN));
variable_set2(DISK_PARTITIONED, "yes");
record_chunks(d);
}
}
@ -218,6 +383,7 @@ diskPartition(Disk *d)
msg = "Partition is already unused!";
else {
Delete_Chunk(d, chunk_info[current_chunk]);
variable_set2(DISK_PARTITIONED, "yes");
record_chunks(d);
}
break;
@ -226,40 +392,74 @@ diskPartition(Disk *d)
char *val, geometry[80];
snprintf(geometry, 80, "%lu/%lu/%lu", d->bios_cyl, d->bios_hd, d->bios_sect);
val = msgGetInput(geometry,
"Please specify the new geometry in cyl/hd/sect format.\nDon't forget to use the two slash (/) separator characters!\nIt's not possible to parse the field without them.");
val = msgGetInput(geometry, "Please specify the new geometry in cyl/hd/sect format.\n"
"Don't forget to use the two slash (/) separator characters!\n"
"It's not possible to parse the field without them.");
if (val) {
d->bios_cyl = strtol(val, &val, 0);
d->bios_hd = strtol(val + 1, &val, 0);
d->bios_sect = strtol(val + 1, 0, 0);
}
}
break;
break;
case 'S':
/* Set Bootable */
chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
break;
case 'U':
Free_Disk(d);
d = Open_Disk(name);
if (!d)
msgFatal("Can't reopen disk %s!", name);
case 'S':
/* Set Bootable */
chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
break;
case 'U':
clear();
if (msgYesNo("Are you SURE you want to Undo everything?"))
break;
d = Open_Disk(d->name);
if (!d) {
dialog_clear();
msgConfirm("Can't reopen disk %s! Internal state is probably corrupted", d->name);
return;
}
Free_Disk(dev->private);
dev->private = d;
variable_unset(DISK_PARTITIONED);
record_chunks(d);
break;
case 'W':
if (!msgYesNo("Are you sure you want to write this now? You do also\nhave the option of not modifying the disk until *all*\nconfiguration information has been entered, at which\npoint you can do it all at once. If you're unsure, then\nchoose No at this dialog."))
diskPartitionWrite(NULL);
if (!msgYesNo("Are you SURE you want to write this now? You do also\n"
"have the option of not modifying the disk until *all*\n"
"configuration information has been entered, at which\n"
"point you can do it all at once. If you're unsure, then\n"
"PLEASE CHOOSE NO at this dialog! This option is DANGEROUS\n"
"if you do not know EXACTLY what you are doing!")) {
variable_set2(DISK_PARTITIONED, "yes");
clear();
/* Don't trash the MBR if the first (and therefore only) chunk is marked for a truly dedicated
* disk (i.e., the disklabel starts at sector 0), even in cases where the user has requested
* booteasy or a "standard" MBR -- both would be fatal in this case.
*/
if ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL
&& (mbrContents = getBootMgr(d->name)) != NULL)
Set_Boot_Mgr(d, mbrContents);
if (diskPartitionWrite(NULL) != RET_SUCCESS) {
dialog_clear();
msgConfirm("Disk partition write returned an error status!");
}
else {
msgConfirm("Wrote FDISK partition information out successfully.");
}
}
break;
case '|':
if (!msgYesNo("Are you sure you want to go into Wizard mode?\nNo seat belts whatsoever are provided!")) {
if (!msgYesNo("Are you SURE you want to go into Wizard mode?\n"
"No seat belts whatsoever are provided!")) {
dialog_clear();
end_dialog();
DialogActive = FALSE;
slice_wizard(d);
variable_set2(DISK_PARTITIONED, "yes");
dialog_clear();
DialogActive = TRUE;
record_chunks(d);
@ -270,6 +470,14 @@ diskPartition(Disk *d)
case 'Q':
chunking = FALSE;
clear();
/* Don't trash the MBR if the first (and therefore only) chunk is marked for a truly dedicated
* disk (i.e., the disklabel starts at sector 0), even in cases where the user has requested
* booteasy or a "standard" MBR -- both would be fatal in this case.
*/
if ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL
&& (mbrContents = getBootMgr(d->name)) != NULL)
Set_Boot_Mgr(d, mbrContents);
break;
default:
@ -280,12 +488,11 @@ diskPartition(Disk *d)
}
p = CheckRules(d);
if (p) {
dialog_clear();
msgConfirm(p);
free(p);
}
dialog_clear();
variable_set2(DISK_PARTITIONED, "yes");
return d;
}
static int
@ -309,13 +516,16 @@ partitionHook(char *str)
}
devs = deviceFind(str, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("Unable to find disk %s!", str);
return 0;
}
else if (devs[1])
else if (devs[1]) {
dialog_clear();
msgConfirm("Bizarre multiple match for %s!", str);
devs[0]->private = diskPartition((Disk *)devs[0]->private);
}
devs[0]->enabled = TRUE;
diskPartition(devs[0], (Disk *)devs[0]->private);
str = cp;
}
return devs ? 1 : 0;
@ -326,65 +536,73 @@ diskPartitionEditor(char *str)
{
DMenu *menu;
Device **devs;
int cnt;
int i, cnt;
char *cp;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
cp = variable_get(VAR_DISK);
devs = deviceFind(cp, DEVICE_TYPE_DISK);
cnt = deviceCount(devs);
if (!cnt) {
msgConfirm("No disks found! Please verify that your disk controller is being\nproperly probed at boot time. See the Hardware Guide on the Documentation menu\nfor clues on diagnosing this type of problem.");
return 0;
dialog_clear();
msgConfirm("No disks found! Please verify that your disk controller is being\n"
"properly probed at boot time. See the Hardware Guide on the\n"
"Documentation menu for clues on diagnosing this type of problem.");
i = RET_FAIL;
}
else if (cnt == 1) {
devs[0]->private = diskPartition((Disk *)devs[0]->private);
devs[0]->enabled = TRUE;
if (str && !strcmp(str, "script"))
scriptPartition(devs[0], (Disk *)devs[0]->private);
else
diskPartition(devs[0], (Disk *)devs[0]->private);
i = RET_SUCCESS;
variable_set2(DISK_SELECTED, "yes");
}
else {
menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook);
if (!menu)
msgConfirm("No devices suitable for installation found!\n\nPlease verify that your disk controller (and attached drives) were detected properly. This can be done by selecting the ``Bootmsg'' option on the main menu and reviewing the boot messages carefully.");
if (!menu) {
dialog_clear();
msgConfirm("No devices suitable for installation found!\n\n"
"Please verify that your disk controller (and attached drives)\n"
"were detected properly. This can be done by pressing the\n"
"[Scroll Lock] key and using the Arrow keys to move back to\n"
"the boot messages. Press [Scroll Lock] again to return.");
i = RET_FAIL;
}
else {
dmenuOpenSimple(menu);
if (!dmenuOpenSimple(menu))
i = RET_FAIL;
else {
i = RET_SUCCESS;
variable_set2(DISK_SELECTED, "yes");
}
free(menu);
}
}
return 0;
}
static u_char *
getBootMgr(void)
{
extern u_char mbr[], bteasy17[];
/* Figure out what kind of MBR the user wants */
if (dmenuOpenSimple(&MenuMBRType)) {
switch (BootMgr) {
case 0:
return bteasy17;
case 1:
return mbr;
case 2:
default:
break;
}
}
return NULL;
return i;
}
int
diskPartitionWrite(char *str)
{
extern u_char boot1[], boot2[];
u_char *mbrContents;
Device **devs;
char *cp;
int i;
mbrContents = getBootMgr();
if ((cp = variable_get(DISK_PARTITIONED)) && strcmp(cp, "yes"))
return RET_SUCCESS;
else if (!cp) {
dialog_clear();
msgConfirm("You must partition the disk(s) before this option can be used.");
return RET_FAIL;
}
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("Unable to find any disks to write to??");
return 0;
return RET_FAIL;
}
for (i = 0; devs[i]; i++) {
@ -394,16 +612,13 @@ diskPartitionWrite(char *str)
if (!devs[i]->enabled)
continue;
/* Do it once so that it only goes on the first drive */
if (mbrContents) {
Set_Boot_Mgr(d, mbrContents);
mbrContents = NULL;
}
Set_Boot_Blocks(d, boot1, boot2);
msgNotify("Writing partition information to drive %s", d->name);
Write_Disk(d);
if (Write_Disk(d)) {
dialog_clear();
msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
return RET_FAIL;
}
/* Now scan for bad blocks, if necessary */
for (c1 = d->chunks->part; c1; c1 = c1->next) {
if (c1->flags & CHUNK_BAD144) {
@ -411,13 +626,19 @@ diskPartitionWrite(char *str)
msgNotify("Running bad block scan on partition %s", c1->name);
ret = vsystem("bad144 -v /dev/r%s 1234", c1->name);
if (ret)
if (ret) {
dialog_clear();
msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret);
}
ret = vsystem("bad144 -v -s /dev/r%s", c1->name);
if (ret)
if (ret) {
dialog_clear();
msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret);
}
}
}
}
return 0;
/* Now it's not "yes", but "written" */
variable_set2(DISK_PARTITIONED, "written");
return RET_SUCCESS;
}

View file

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: dmenu.c,v 1.11.2.11 1995/06/10 19:44:54 jkh Exp $
* $Id: dmenu.c,v 1.12.2.5 1995/10/19 15:55:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -44,7 +44,7 @@
#include "sysinstall.h"
#include <sys/types.h>
#define MAX_MENU 8
#define MAX_MENU 15
/* Traverse menu but give user no control over positioning */
Boolean
@ -68,19 +68,24 @@ dmenuFlagCheck(DMenuItem *item)
char *
dmenuVarCheck(DMenuItem *item)
{
char *cp, *cp2, tmp[256];
char *w, *cp, *cp2, tmp[256];
strncpy(tmp, (char *)item->ptr, 256);
w = (char *)item->parm;
if (!w)
w = (char *)item->ptr;
if (!w)
return "OFF";
strncpy(tmp, w, 256);
if ((cp = index(tmp, '=')) != NULL) {
*(cp++) = '\0';
cp2 = getenv(tmp);
if (cp2)
return !strcmp(cp, cp2) ? "ON" : "OFF";
else
return "OFF";
*(cp++) = '\0';
cp2 = getenv(tmp);
if (cp2)
return !strcmp(cp, cp2) ? "ON" : "OFF";
else
return "OFF";
}
else
return getenv(tmp) ? "ON" : "OFF";
return getenv(tmp) ? "ON" : "OFF";
}
char *
@ -100,6 +105,19 @@ checkHookVal(DMenuItem *item)
return (*item->check)(item);
}
static int
menu_height(DMenu *menu, int n)
{
int max;
char *t;
for (t = menu->title, max = MAX_MENU; *t; t++) {
if (*t == '\n')
--max;
}
return n > max ? max : n;
}
/* Traverse over an internal menu */
Boolean
dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
@ -128,18 +146,17 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
use_helpfile(systemHelpFile(menu->helpfile, buf));
/* Pop up that dialog! */
if (menu->options & DMENU_NORMAL_TYPE) {
if (menu->options & DMENU_NORMAL_TYPE)
rval = dialog_menu((u_char *)menu->title, (u_char *)menu->prompt, -1, -1,
n > MAX_MENU ? MAX_MENU : n, n, (u_char **)nitems, (u_char *)result, choice, scroll);
}
else if (menu->options & DMENU_RADIO_TYPE) {
menu_height(menu, n), n, (u_char **)nitems, (u_char *)result, choice, scroll);
else if (menu->options & DMENU_RADIO_TYPE)
rval = dialog_radiolist((u_char *)menu->title, (u_char *)menu->prompt, -1, -1,
n > MAX_MENU ? MAX_MENU : n, n, (u_char **)nitems, (u_char *)result);
}
else if (menu->options & DMENU_MULTIPLE_TYPE) {
menu_height(menu, n), n, (u_char **)nitems, (u_char *)result);
else if (menu->options & DMENU_MULTIPLE_TYPE)
rval = dialog_checklist((u_char *)menu->title, (u_char *)menu->prompt, -1, -1,
n > MAX_MENU ? MAX_MENU : n, n, (u_char **)nitems, (u_char *)result);
}
menu_height(menu, n), n, (u_char **)nitems, (u_char *)result);
/* This seems to be the only technique that works for getting the display to look right */
dialog_clear();
@ -149,8 +166,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
if (menu->options & DMENU_CALL_FIRST)
tmp = &(menu->items[0]);
else {
if (decode_and_dispatch_multiple(menu, result) ||
menu->options & DMENU_SELECTION_RETURNS) {
if (decode_and_dispatch_multiple(menu, result) || menu->options & DMENU_SELECTION_RETURNS) {
items_free(nitems, curr, max);
return TRUE;
}
@ -160,7 +176,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
if ((tmp = decode(menu, result)) == NULL)
return FALSE;
}
if (dispatch(tmp, result) || (menu->options & DMENU_SELECTION_RETURNS)) {
if (dispatch(tmp, result) == RET_DONE || (menu->options & DMENU_SELECTION_RETURNS)) {
items_free(nitems, curr, max);
return TRUE;
}

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: globals.c,v 1.9.2.2 1995/06/05 03:15:38 jkh Exp $
* $Id: globals.c,v 1.10.2.1 1995/10/21 14:06:41 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -55,9 +55,7 @@ Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
Device *mediaDevice; /* Where we're installing from */
unsigned int OptFlags; /* Option flags */
int BootMgr;
char *InstallPrefix; /* Always install under here */
/*
* Yes, I know some of these are already automatically initialized as
@ -73,6 +71,4 @@ globalsInit(void)
VarHead = NULL;
mediaDevice = NULL;
RunningAsInit = FALSE;
OptFlags = 0;
InstallPrefix = NULL;
}

View file

@ -1,21 +1,50 @@
This is the FreeBSD DiskLabel Editor.
NOTE: If you're entering this editor from the update procedure then
you probably shouldn't (C)reate anything at all but rather use only
the (M)ount command to check and mount existing partitions for
upgrading.
If you would like the label editor to do most of the following for
you, simply type `A' for automatic partitioning of the disk.
If you wish to create partitions manually you may do so by moving the
highlighted selection bar with the arrow keys over the FreeBSD
partition(s) displayed at the top of the screen. Typing (C)reate
while a partition with available free space is selected will allow you
to create a BSD partition inside of it using some or all of its
available space.
Typing (M)ount over an existing partition entry (displayed in the
middle of the screen) will allow you to set a mount point for it
without initializing it. If you want it initialized, use the (T)oggle
command to flip the Newfs flag. When Newfs is set to "Y", the
filesystem in question will be ERASED and rebuilt from scratch!
NOTE: The (W)rite option is HIGHLY DANGEROUS and should NOT BE USED if
you're installing a new system! It's only for use in resurrecting
or changing an existing system, and will cause unpredictable things to
happen if you use it in any other circumstances. Don't do it! Wait
for the final commit dialog if you're express/novice installing, or
use the "Commit" menu item if you're custom installing, and do it there.
You should use this editor to create at least the following
filesystems:
Name Purpose Min Size? Optional?
---- ------- --------- ---------
/ Root filesystem 20MB No
swap Swap space 2 * MEM No
/usr System & user files 80MB or more Yes
Name Purpose Min Size? Optional?
---- ------- --------- ---------
/ Root filesystem 20MB No
swap Swap space 2 * MEM No
/usr System & user files 80MB or more Yes
Note: If you do not create a /usr filesystem then your / filesystem
will need to be bigger - at least 100MB. This is not recommended as
any media errors that may occur during disk I/O to user files will
corrupt the filesystem containing vital system files as well. It is
for this reason that / is generally kept on its own filesystem, where
it's basically considered "read only" by the system and hence a good
deal safer.
it should be considered essentially "read only" in your administration
of it.
Swap space is a little tricker, and the rule of "2 * MEM" is simply a
best-guess approximation and not necessarily accurate for your
@ -44,79 +73,88 @@ instead. You may therefore wish to make the / partition bigger if you
expect a lot of mail or news and do not want to make /var its own
partition.
If you're new to this installation, you might also want to read the
following explanation of how FreeBSD's new "slice" paradigm for
looking at disk storage works:
If you're new to this installation, you should also first understand
how FreeBSD 2.0.5's new "slices" paradigm for looking at disk storage
works. It's not very hard to grasp. A "fully qualified slice name",
that is the name of the file we open in /dev to talk to the slice, is
optionally broken into 3 parts:
First you have the disk name. Assume we have two SCSI
drives in our system, which gives us `sd0' and `sd1'.
In FreeBSD's new system, a device name can be broken up into up to 3
parts. Take a typical name like ``/dev/sd0s1a'':
Next you have the "Slice" (or "FDISK Partition") number,
as seen in the Partition Editor. Assume that our sd0 contains
two slices, a FreeBSD slice and a DOS slice. This gives us
sd0s1 and sd0s2. Let's also say that sd1 is completely devoted
to FreeBSD, so we have only one slice there: sd1s1.
The first three characters represent the drive name. If we had
a system with two SCSI drives on it then we'd see /dev/sd0 and
/dev/sd1 as the device entries representing the entire drives.
Next, if a slice is a FreeBSD slice, you have a number of
(confusingly named) "partitions" you can put inside of it.
These FreeBSD partitions are where various filesystems or swap
areas live, and using our hypothetical two-SCSI-disk machine
again, we might have something like the following layout on sd0:
Next you have the "slice" (or "FDISK Partition") number,
as seen in the Partition Editor. Assuming that our sd0
contained two slices, a FreeBSD slice and a DOS slice, that
would give us /dev/sd0s1 and /dev/sd0s2 as device entries pointing
to the entire slices.
Name Mountpoint
---- ----------
sd0s1a /
sd0s1b <swap space>
sd0s1e /usr
Next, if a slice is a FreeBSD slice, you can have a number of
(confusingly named) "partitions" inside of it.
Because of historical convention, there is also a short-cut,
or "compatibility slice", that is maintained for easy access
to the first FreeBSD slice on a disk for those programs which
still don't know how to deal with the new slice scheme.
The compatibility slice names for our filesystem above would
look like:
These partitions are where various filesystems or swap areas live,
and using our hypothetical two-SCSI-disk machine again, we might
have something like the following layout on sd0:
Name Mountpoint
---- ----------
sd0a /
sd0b <swap space>
sd0e /usr
Name Mountpoint
---- ----------
sd0s1a /
sd0s1b <swap space>
sd0s1e /usr
FreeBSD automatically maps the compatibility slice to the first
FreeBSD slice it finds (in this case, sd0s1). You may have multiple
FreeBSD slices on a drive, but only the first one may be the
compatibility slice!
Because of historical convention, there is also a short-cut,
or "compatibility slice", that is maintained for easy access
to the *first* FreeBSD slice on a disk. This gives some
backwards compatibility to utilities that still may not know
how to deal with the new slice scheme.
The compatibility slice will eventually be phased out, but
it is still important right now for several reasons:
The compatibility slice names for our filesystem above would
also look like:
1. Some programs, as mentioned before, still don't work
with the slice paradigm and need time to catch up.
Name Mountpoint
---- ----------
sd0a /
sd0b <swap space>
sd0e /usr
2. The FreeBSD boot blocks are unable to look for
a root file system in anything but a compatibility
slice right now. This means that our root will always
show up on "sd0a" in the above scenario, even though
it really lives over on sd0s1a and would otherwise be
referred to by its full slice name.
Again, let it be noted: FreeBSD automatically maps the
compatibility slice to the first FreeBSD slice it finds
(in this case, sd0s1). You may have multiple FreeBSD slices on a
drive, but only the first one will be mapped to the compatibility
slice!
Once you understand all this, then the label editor becomes fairly
simple. You're either carving up the FreeBSD slices displayed at the
top of the screen into smaller pieces (displayed in the middle of the
screen) and then putting FreeBSD file systems on them, Or you're just
mounting existing partitions/slices into your filesystem hierarchy;
this editor lets you do both. Since a DOS partition is also just
another slice as far as FreeBSD is concerned, you can mount one into
in your filesystem hierarchy just as easily with this editor. For
FreeBSD partitions you can also toggle the "newfs" state so that
the partitions are either (re)created from scratch or simply checked
and mounted (the contents are preserved).
The compatibility slice will eventually be phased out, but
it is still important right now for several reasons:
1. Some programs, as mentioned before, still don't work
with the slice paradigm and need time to catch up.
2. The FreeBSD boot blocks are unable to look for
a root file system in anything but a compatibility
slice right now. This means that our root will always
show up on "sd0a" in the above scenario, even though
it really lives over on sd0s1a and would otherwise be
referred to by its full slice name.
Once you understand all this, then the purpose of the label editor
becomes fairly clear: You're carving up the FreeBSD slices displayed
at the top of the screen into smaller pieces, which are displayed in
the middle of the screen, and then assigning FreeBSD file system names
(mount points) to them.
You can also use the label editor to mount existing partitions/slices
into your filesystem hierarchy, as is frequently done for DOS FAT
slices. For FreeBSD partitions, you can also toggle the "newfs" state
so that the partitions are either (re)created from scratch or simply
checked and mounted (the contents are preserved).
When you're done, type `Q' to exit.
No actual changes will be made to the disk until you (C)ommit from the
Install menu! You're working with what is essentially a copy of
the disk label(s), both here and in the FDISK Partition Editor.
Install menu or (W)rite directly from this one. You're working with
what is essentially a copy of the disk label(s), both here and in the
FDISK Partition Editor, and the actual on-disk labels won't be
affected by any changes you make until you explicitly say so.

View file

@ -1,15 +1,23 @@
This is the Main Partition (or ``Slice'') Editor.
This is the Main Partition (or ``FDISK'') Editor.
Possible commands are printed at the bottom and the Master Boot Record
contents are shown at the top. You can move up and down with the
arrow keys and (C)reate a new partition whenever the highlighted
selection bar is over a partition whose type is marked as "unused."
You are expected to leave this screen with at least one partition
marked "FreeBSD." Note that unlike Linux, you don't need to create
multiple FreeBSD fdisk partition entries for different things like
swap, file systems, etc. The usual convention is to create ONE
FreeBSD partition per drive and then subsection this partition into
swap and file systems with the Label editor.
Possible commands are printed at the bottom, and the Master Boot Record
contents are at the top. You can move up and down with the arrow keys
and can (C)reate a new partition whenever the "bar" is over a partition
whose type is set to "unused".
The flags field has the following legend:
'=' -- Partition is properly aligned.
'>' -- The partition doesn't end before cylinder 1024
'R' -- Has been marked as containing the root (/) filesystem
'=' -- This partition is properly aligned.
'>' -- This partition doesn't end before cylinder 1024
'R' -- This partition contains the root (/) filesystem
'B' -- Partition employs BAD144 bad-spot handling
'C' -- This is the FreeBSD 2.0-compatibility partition (default)
'A' -- This partition is marked active.
@ -21,8 +29,39 @@ If no partition is marked Active, you will need to either install
a Boot Manager (the option for which will be presented later in the
installation) or set one Active before leaving this screen.
To leave this screen, type `Q'.
To leave the partition editor, type `Q'.
No actual changes will be made to the disk until you (C)ommit from the
Install menu! You're working with what is essentially a copy of
the disk label(s), both here and in the Label Editor.
Install menu or use the (W)rite option here! You're working with what
is essentially a copy of the disk label(s), both here and in the Label
Editor.
NOTE: The (W)rite option is HIGHLY DANGEROUS and should NOT BE USED if
you're installing a new system! It's only for use in resurrecting
or changing an existing system, and will cause unpredictable things to
happen if you use it in any other circumstances. Don't do it! Wait
for the final commit dialog if you're express/novice installing, or
use the "Commit" menu item if you're custom installing, and do it there.
If you want to use the entire disk for FreeBSD, type `A'. You'll be
asked whether or not you wish to keep the disk (potentially) compatible
with other operating systems, i.e. the information in the FDISK table
should be kept valid. If you select the default of `Yes', slices will be
aligned to fictitious cylinder boundaries and space will be reserved
in front of the FreeBSD slice for a [future] possible boot manager.
For the truly dedicated disk case, you can select `No' at the
compatibility prompt. In that case, all BIOS geometry considerations
will no longer be in effect and you can safely ignore any
``The detected geometry is invalid'' warning messages you may later
see. It is also not necessary in this case to set a partition bootable
or install an MBR boot manager as both things are then irrelevant.
The FreeBSD slice will start at absolute sector 0 of the disk (so that
FreeBSD's disk label is identical to the Master Boot Record) and
extend to the very last sector of the disk medium. Needless to say,
such a disk cannot have any sort of a boot manager, `disk manager',
or anything else that has to interact with the BIOS. This option is
therefore only considered safe for SCSI disks and most IDE disks and
is primarily intented for people who are going to set up a dedicated
FreeBSD server or workstation, not a typical `home PC'.

File diff suppressed because it is too large Load diff

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.32.2.2 1995/07/21 11:45:39 rgrimes Exp $
* $Id: label.c,v 1.33 1995/09/18 16:52:28 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -45,8 +45,6 @@
#include <ctype.h>
#include <sys/disklabel.h>
#include <sys/param.h>
#undef TRUE
#undef FALSE
#include <sys/sysctl.h>
/*
@ -60,14 +58,20 @@
#define CHUNK_SLICE_START_ROW 2
#define CHUNK_PART_START_ROW 11
/* One MB worth of blocks */
#define ONE_MEG 2048
/* The smallest filesystem we're willing to create */
#define FS_MIN_SIZE ONE_MEG
/* The smallest root filesystem we're willing to create */
#define ROOT_MIN_SIZE (20 * ONE_MEG)
#define ROOT_MIN_SIZE 20
/* The smallest swap partition we want to create by default */
#define SWAP_MIN_SIZE 16
/* The smallest /usr partition we're willing to create by default */
#define USR_MIN_SIZE 80
/* The smallest /var partition we're willing to create by default */
#define VAR_MIN_SIZE 30
/* All the chunks currently displayed on the screen */
static struct {
@ -76,6 +80,118 @@ static struct {
} label_chunk_info[MAX_CHUNKS + 1];
static int here;
static int diskLabel(char *str);
static int scriptLabel(char *str);
static int
labelHook(char *str)
{
Device **devs = NULL;
/* Clip garbage off the ends */
string_prune(str);
str = string_skipwhite(str);
/* Try and open all the disks */
while (str) {
char *cp;
cp = index(str, '\n');
if (cp)
*cp++ = 0;
if (!*str) {
beep();
return 0;
}
devs = deviceFind(str, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("Unable to find disk %s!", str);
return 0;
}
else if (devs[1]) {
dialog_clear();
msgConfirm("Bizarre multiple match for %s!", str);
}
devs[0]->enabled = TRUE;
str = cp;
}
return devs ? 1 : 0;
}
int
diskLabelEditor(char *str)
{
Device **devs;
DMenu *menu;
int i, cnt;
char *cp;
cp = variable_get(VAR_DISK);
devs = deviceFind(cp, DEVICE_TYPE_DISK);
cnt = deviceCount(devs);
if (!cnt) {
dialog_clear();
msgConfirm("No disks found! Please verify that your disk controller is being\n"
"properly probed at boot time. See the Hardware Guide on the\n"
"Documentation menu for clues on diagnosing this type of problem.");
return RET_FAIL;
}
else if (cnt == 1 || variable_get(DISK_SELECTED)) {
devs[0]->enabled = TRUE;
if (str && !strcmp(str, "script"))
i = scriptLabel(str);
else
i = diskLabel(str);
}
else {
menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, labelHook);
if (!menu) {
dialog_clear();
msgConfirm("No devices suitable for installation found!\n\n"
"Please verify that your disk controller (and attached drives)\n"
"were detected properly. This can be done by pressing the\n"
"[Scroll Lock] key and using the Arrow keys to move back to\n"
"the boot messages. Press [Scroll Lock] again to return.");
i = RET_FAIL;
}
else {
if (!dmenuOpenSimple(menu))
i = RET_FAIL;
else
i = diskLabel(str);
free(menu);
}
}
return i;
}
int
diskLabelCommit(char *str)
{
char *cp;
int i;
/* Already done? */
if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes"))
i = RET_SUCCESS;
else if (!cp) {
dialog_clear();
msgConfirm("You must assign disk labels before this option can be used.");
i = RET_FAIL;
}
/* The routine will guard against redundant writes, just as this one does */
else if (diskPartitionWrite(str) != RET_SUCCESS)
i = RET_FAIL;
else if (installFilesystems(str) != RET_SUCCESS)
i = RET_FAIL;
else {
msgInfo("All filesystem information written successfully.");
variable_set2(DISK_LABELLED, "written");
i = RET_SUCCESS;
}
return i;
}
/* See if we're already using a desired partition name */
static Boolean
check_conflict(char *name)
@ -93,13 +209,12 @@ check_conflict(char *name)
static int
space_free(struct chunk *c)
{
struct chunk *c1 = c->part;
struct chunk *c1;
int sz = c->size;
while (c1) {
for (c1 = c->part; c1; c1 = c1->next) {
if (c1->type != unused)
sz -= c1->size;
c1 = c1->next;
}
if (sz < 0)
msgFatal("Partitions are larger than actual chunk??");
@ -108,19 +223,12 @@ space_free(struct chunk *c)
/* Snapshot the current situation into the displayed chunks structure */
static void
record_label_chunks()
record_label_chunks(Device **devs)
{
int i, j, p;
struct chunk *c1, *c2;
Device **devs;
Disk *d;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
msgConfirm("No disks found!");
return;
}
j = p = 0;
/* First buzz through and pick up the FreeBSD slices */
for (i = 0; devs[i]; i++) {
@ -139,6 +247,7 @@ record_label_chunks()
}
}
}
/* Now run through again and get the FreeBSD partition entries */
for (i = 0; devs[i]; i++) {
if (!devs[i]->enabled)
@ -198,7 +307,7 @@ new_part(char *mpoint, Boolean newfs, u_long size)
}
/* Get the mountpoint for a partition and save it away */
PartInfo *
static PartInfo *
get_mountpoint(struct chunk *old)
{
char *val;
@ -266,7 +375,9 @@ get_partition_type(void)
"A swap partition.",
};
i = dialog_menu("Please choose a partition type",
"If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL);
"If you want to use this partition for swap space, select Swap.\n"
"If you want to put a filesystem on it, choose FS.",
-1, -1, 2, 2, fs_types, selection, NULL, NULL);
if (!i) {
if (!strcmp(selection, "FS"))
return PART_FILESYSTEM;
@ -283,11 +394,124 @@ getNewfsCmd(PartInfo *p)
char *val;
val = msgGetInput(p->newfs_cmd,
"Please enter the newfs command and options you'd like to use in\ncreating this file system.");
"Please enter the newfs command and options you'd like to use in\n"
"creating this file system.");
if (val)
strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
}
static int
scriptLabel(char *str)
{
char *cp;
PartType type;
PartInfo *p;
u_long flags = 0;
int i, status;
Device **devs;
Disk *d;
status = RET_SUCCESS;
cp = variable_get(VAR_DISK);
if (!cp) {
dialog_clear();
msgConfirm("scriptLabel: No disk selected - can't label automatically.");
return RET_FAIL;
}
devs = deviceFind(cp, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("scriptLabel: No disk device %s found!", cp);
return RET_FAIL;
}
d = devs[0]->private;
record_label_chunks(devs);
for (i = 0; label_chunk_info[i].c; i++) {
Chunk *c1 = label_chunk_info[i].c;
if (label_chunk_info[i].type == PART_SLICE) {
if ((cp = variable_get(c1->name)) != NULL) {
int sz;
char typ[10], mpoint[50];
if (sscanf(cp, "%s %d %s", typ, &sz, mpoint) != 3) {
dialog_clear();
msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp);
status = RET_FAIL;
continue;
}
else {
Chunk *tmp;
if (!strcmp(typ, "swap")) {
type = PART_SWAP;
strcpy(mpoint, "<swap>");
}
else {
type = PART_FILESYSTEM;
if (!strcmp(mpoint, "/"))
flags |= CHUNK_IS_ROOT;
}
if (!sz)
sz = space_free(c1);
if (sz > space_free(c1)) {
dialog_clear();
msgConfirm("Not enough free space to create partition: %s", mpoint);
status = RET_FAIL;
continue;
}
if (!(tmp = Create_Chunk_DWIM(d, c1, sz, part,
(type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, flags))) {
dialog_clear();
msgConfirm("Unable to create from partition spec: %s. Too big?", cp);
status = RET_FAIL;
break;
}
else {
tmp->private = new_part(mpoint, TRUE, sz);
tmp->private_free = safe_free;
status = RET_SUCCESS;
}
}
}
}
else {
/* Must be something we can set a mountpoint */
cp = variable_get(c1->name);
if (cp) {
char mpoint[50], nwfs[8];
Boolean newfs = FALSE;
nwfs[0] = '\0';
if (sscanf(cp, "%s %s", mpoint, nwfs) != 2) {
dialog_clear();
msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp);
status = RET_FAIL;
continue;
}
newfs = toupper(nwfs[0]) == 'Y' ? TRUE : FALSE;
if (c1->private) {
p = c1->private;
p->newfs = newfs;
strcpy(p->mountpoint, mpoint);
}
else {
c1->private = new_part(mpoint, newfs, 0);
c1->private_free = safe_free;
}
if (!strcmp(mpoint, "/"))
c1->flags |= CHUNK_IS_ROOT;
else
c1->flags &= ~CHUNK_IS_ROOT;
}
}
}
if (status == RET_SUCCESS)
variable_set2(DISK_LABELLED, "yes");
return status;
}
#define MAX_MOUNT_NAME 12
@ -401,8 +625,8 @@ print_command_summary()
move(0, 0);
}
int
diskLabelEditor(char *str)
static int
diskLabel(char *str)
{
int sz, key = 0;
Boolean labeling;
@ -411,14 +635,17 @@ diskLabelEditor(char *str)
PartType type;
Device **devs;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
dialog_clear();
msgConfirm("No disks found!");
return RET_FAIL;
}
labeling = TRUE;
keypad(stdscr, TRUE);
record_label_chunks();
record_label_chunks(devs);
if (!getenv(DISK_PARTITIONED)) {
msgConfirm("You need to partition your disk(s) before you can assign disk labels.");
return 0;
}
dialog_clear(); clear();
while (labeling) {
clear();
@ -426,6 +653,7 @@ diskLabelEditor(char *str)
print_command_summary();
if (msg) {
attrset(A_REVERSE); mvprintw(23, 0, msg); attrset(A_NORMAL);
clrtoeol();
beep();
msg = NULL;
}
@ -467,7 +695,7 @@ diskLabelEditor(char *str)
case KEY_F(1):
case '?':
systemDisplayFile("partition.hlp");
systemDisplayHelp("partition");
break;
case 'A':
@ -481,73 +709,105 @@ diskLabelEditor(char *str)
if (label_chunk_info[i++].type != PART_SLICE)
cnt++;
if (cnt == (CHUNK_COLUMN_MAX * 2) + 4) {
msgConfirm("Sorry, I can't fit any more partitions on the screen! You can get around\nthis limitation by partitioning your disks individually rather than all\nat once. This will be fixed just as soon as we get a scrolling partition\nbox written. Sorry for the inconvenience!");
dialog_clear();
msgConfirm("Sorry, I can't fit any more partitions on the screen! You can get around\n"
"this limitation by partitioning your disks individually rather than all\n"
"at once. This will be fixed just as soon as we get a scrolling partition\n"
"box written. Sorry for the inconvenience!");
break;
}
sz = space_free(label_chunk_info[here].c);
if (sz <= FS_MIN_SIZE) {
msg = "Not enough space to create additional FreeBSD partition";
msg = "Not enough space to create an additional FreeBSD partition";
break;
}
{
struct chunk *tmp;
int mib[2];
int physmem;
size_t size;
size_t size, swsize;
char *cp;
cp = variable_get(VAR_ROOT_SIZE);
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
32 * ONE_MEG, part, FS_BSDFFS,
(cp ? atoi(cp) : 32) * ONE_MEG, part, FS_BSDFFS,
CHUNK_IS_ROOT);
if (!tmp) {
dialog_clear();
msgConfirm("Unable to create the root partition. Too big?");
break;
}
tmp->private = new_part("/", TRUE, tmp->size);
tmp->private_free = safe_free;
record_label_chunks();
mib[0] = CTL_HW;
mib[1] = HW_PHYSMEM;
size = sizeof physmem;
sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
record_label_chunks(devs);
cp = variable_get(VAR_SWAP_SIZE);
if (cp)
swsize = atoi(cp) * ONE_MEG;
else {
mib[0] = CTL_HW;
mib[1] = HW_PHYSMEM;
size = sizeof physmem;
sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
swsize = 16 * ONE_MEG + (physmem * 2 / 512);
}
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
physmem * 2 / 512, part, FS_SWAP, 0);
swsize,
part, FS_SWAP, 0);
if (!tmp) {
dialog_clear();
msgConfirm("Unable to create the swap partition. Too big?");
break;
}
tmp->private = 0;
tmp->private_free = safe_free;
record_label_chunks();
record_label_chunks(devs);
cp = variable_get(VAR_VAR_SIZE);
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
16 * ONE_MEG, part, FS_BSDFFS, 0);
(cp ? atoi(cp) : VAR_MIN_SIZE) * ONE_MEG, part, FS_BSDFFS, 0);
if (!tmp) {
msgConfirm("Unable to create the /var partition. Too big?");
dialog_clear();
msgConfirm("Less than %dMB free for /var - you will need to\n"
"partition your disk manually with a custom install!", (cp ? atoi(cp) : VAR_MIN_SIZE));
break;
}
tmp->private = new_part("/var", TRUE, tmp->size);
tmp->private_free = safe_free;
record_label_chunks();
record_label_chunks(devs);
sz = space_free(label_chunk_info[here].c);
cp = variable_get(VAR_USR_SIZE);
if (cp)
sz = atoi(cp) * ONE_MEG;
else
sz = space_free(label_chunk_info[here].c);
if (!sz || sz < (USR_MIN_SIZE * ONE_MEG)) {
dialog_clear();
msgConfirm("Less than %dMB free for /usr - you will need to\n"
"partition your disk manually with a custom install!", USR_MIN_SIZE);
break;
}
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
sz, part, FS_BSDFFS, 0);
if (!tmp) {
msgConfirm("Unable to create the /usr partition. Too big?");
dialog_clear();
msgConfirm("Unable to create the /usr partition. Not enough space?\n"
"You will need to partition your disk manually with a custom install!");
break;
}
/* At this point, we're reasonably "labelled" */
variable_set2(DISK_LABELLED, "yes");
tmp->private = new_part("/usr", TRUE, tmp->size);
tmp->private_free = safe_free;
record_label_chunks();
record_label_chunks(devs);
}
break;
@ -564,13 +824,17 @@ diskLabelEditor(char *str)
if (label_chunk_info[i++].type != PART_SLICE)
cnt++;
if (cnt == (CHUNK_COLUMN_MAX * 2)) {
msgConfirm("Sorry, I can't fit any more partitions on the screen! You can get around\nthis limitation by partitioning your disks individually rather than all\nat once. This will be fixed just as soon as we get a scrolling partition\nbox written. Sorry for the inconvenience!");
dialog_clear();
msgConfirm("Sorry, I can't fit any more partitions on the screen! You can get around\n"
"this limitation by partitioning your disks individually rather than all\n"
"at once. This will be fixed just as soon as we get a scrolling partition\n"
"box written. Sorry for the inconvenience!");
break;
}
}
sz = space_free(label_chunk_info[here].c);
if (sz <= FS_MIN_SIZE) {
msg = "Not enough space to create additional FreeBSD partition";
msg = "Not enough space to create an additional FreeBSD partition";
break;
}
{
@ -581,7 +845,9 @@ diskLabelEditor(char *str)
u_long flags = 0;
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);
val = msgGetInput(osize, "Please specify the size for new FreeBSD partition in blocks, or\n"
"append a trailing `M' for megabytes (e.g. 20M) or `C' for cylinders.\n\n"
"Space free is %d blocks (%dMB)", sz, sz / ONE_MEG);
if (!val || (size = strtol(val, &cp, 0)) <= 0)
break;
@ -611,11 +877,17 @@ diskLabelEditor(char *str)
if ((flags & CHUNK_IS_ROOT)) {
if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) {
msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!");
msgConfirm("This region cannot be used for your root partition as the\n"
"FreeBSD boot code cannot deal with a root partition created\n"
"in that location. Please choose another location or smaller\n"
"size for your root partition and try again!");
break;
}
if (size < ROOT_MIN_SIZE)
msgConfirm("Warning: This is smaller than the recommended size for a\nroot partition. For a variety of reasons, root\npartitions should usually be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG);
if (size < (ROOT_MIN_SIZE * ONE_MEG)) {
msgConfirm("Warning: This is smaller than the recommended size for a\n"
"root partition. For a variety of reasons, root\n"
"partitions should usually be at least %dMB in size", ROOT_MIN_SIZE);
}
}
tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
label_chunk_info[here].c,
@ -627,7 +899,10 @@ diskLabelEditor(char *str)
break;
}
if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) {
msgConfirm("This region cannot be used for your root partition as it starts\nor extends past the 1024'th cylinder mark and is thus a\npoor location to boot from. Please choose another\nlocation for your root partition and try again!");
msgConfirm("This region cannot be used for your root partition as it starts\n"
"or extends past the 1024'th cylinder mark and is thus a\n"
"poor location to boot from. Please choose another\n"
"location (or smaller size) for your root partition and try again!");
Delete_Chunk(label_chunk_info[here].c->disk, tmp);
break;
}
@ -640,7 +915,8 @@ diskLabelEditor(char *str)
tmp->private = p;
}
tmp->private_free = safe_free;
record_label_chunks();
variable_set2(DISK_LABELLED, "yes");
record_label_chunks(devs);
}
break;
@ -654,7 +930,8 @@ diskLabelEditor(char *str)
break;
}
Delete_Chunk(label_chunk_info[here].c->disk, label_chunk_info[here].c);
record_label_chunks();
variable_set2(DISK_LABELLED, "yes");
record_label_chunks(devs);
break;
case 'M': /* mount */
@ -681,7 +958,8 @@ diskLabelEditor(char *str)
strcpy(p->mountpoint, "/bogus");
}
}
record_label_chunks();
variable_set2(DISK_LABELLED, "yes");
record_label_chunks(devs);
break;
default:
@ -704,33 +982,49 @@ diskLabelEditor(char *str)
label_chunk_info[here].c->private = new_part(pi ? pi->mountpoint : NULL, pi ? !pi->newfs : TRUE, label_chunk_info[here].c->size);
safe_free(pi);
label_chunk_info[here].c->private_free = safe_free;
variable_set2(DISK_LABELLED, "yes");
}
else
msg = MSG_NOT_APPLICABLE;
break;
case 'U':
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
clear();
if (msgYesNo("Are you SURE you want to Undo everything?"))
break;
variable_unset(DISK_PARTITIONED);
for (i = 0; devs[i]; i++) {
extern void diskPartition(Device *dev, Disk *d);
Disk *d;
if (!devs[i]->enabled)
continue;
else {
char *cp = devs[i]->name;
else if ((d = Open_Disk(devs[i]->name)) != NULL) {
Free_Disk(devs[i]->private);
devs[i]->private = Open_Disk(cp);
devs[i]->private = d;
diskPartition(devs[i], d);
}
}
record_label_chunks();
variable_unset(DISK_LABELLED);
record_label_chunks(devs);
break;
case 'W':
if (!msgYesNo("Are you sure that you wish to make and mount all filesystems\nat this time? You also have the option of doing it later in\none final 'commit' operation, and if you're at all unsure as\nto which option to chose, then chose No."))
diskLabelCommit(NULL);
if (!msgYesNo("Are you SURE that you wish to make and mount all filesystems\n"
"at this time? You also have the option of doing it later in\n"
"one final 'commit' operation, and if you're at all unsure as\n"
"to which option to chose, then PLEASE CHOSE NO! This option\n"
"is DANGEROUS if you're not EXACTLY sure what you are doing!")) {
variable_set2(DISK_LABELLED, "yes");
clear();
diskLabelCommit(NULL);
}
break;
case '|':
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!")) {
if (!msgYesNo("Are you sure you want to go into Wizard mode?\n\n"
"This is an entirely undocumented feature which you are not\n"
"expected to understand!")) {
int i;
Device **devs;
@ -739,16 +1033,18 @@ diskLabelEditor(char *str)
DialogActive = FALSE;
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
if (!devs) {
msgConfirm("Can't find any disk devicse!");
dialog_clear();
msgConfirm("Can't find any disk devices!");
break;
}
for (i = 0; devs[i] && ((Disk *)devs[i]->private); i++) {
if (devs[i]->enabled)
slice_wizard(((Disk *)devs[i]->private));
}
variable_set2(DISK_LABELLED, "yes");
DialogActive = TRUE;
dialog_clear();
record_label_chunks();
record_label_chunks(devs);
}
else
msg = "A most prudent choice!";
@ -764,17 +1060,6 @@ diskLabelEditor(char *str)
break;
}
}
variable_set2(DISK_LABELLED, "yes");
dialog_clear();
return 0;
}
int
diskLabelCommit(char *str)
{
if (!getenv(DISK_LABELLED))
msgConfirm("You must assign disk labels before this option can be used.");
else if (!installFilesystems())
msgConfirm("Failed to make/mount all filesystems. Please correct\nwhatever went wrong and try again.");
return 0;
return RET_SUCCESS;
}

View file

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: main.c,v 1.13 1995/06/11 19:30:02 rgrimes Exp $
* $Id: main.c,v 1.14 1995/09/18 16:52:29 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -43,12 +43,24 @@
#include "sysinstall.h"
#include <stdio.h>
#include <sys/signal.h>
static void
screech(int sig)
{
fprintf(stderr, "\007Fatal signal %d caught! I'm dead..\n", sig);
pause();
}
int
main(int argc, char **argv)
{
int choice, scroll, curr, max;
if (getpid() == 1) {
signal(SIGBUS, screech);
signal(SIGSEGV, screech);
}
if (geteuid() != 0) {
fprintf(stderr, "Warning: This utility should be run as root.\n");
sleep(1);
@ -64,21 +76,18 @@ main(int argc, char **argv)
/* Probe for all relevant devices on the system */
deviceGetAll();
/* Default to passive mode ftp since it's the only thing we currently support :-( */
OptFlags |= OPT_FTP_PASSIVE;
/* Set default flag and variable values */
installVarDefaults(NULL);
/* Begin user dialog at outer menu */
while (1) {
choice = scroll = curr = max = 0;
dmenuOpen(&MenuInitial, &choice, &scroll, &curr, &max);
if (getpid() != 1 || !msgYesNo("Are you sure you wish to exit? System will reboot."))
if (getpid() != 1 || !msgYesNo("Are you sure you wish to exit? The system will reboot\n"
"(be sure to remove any floppies from the drives)."))
break;
}
/* Write out any changes to /etc/sysconfig */
if (SystemWasInstalled)
configSysconfig();
/* Say goodnight, Gracie */
systemShutdown();

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
* $Id: misc.c,v 1.11.2.2 1995/06/01 22:32:06 jkh Exp $
* $Id: misc.c,v 1.12.2.8 1995/11/04 15:08:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -45,6 +45,7 @@
#include <sys/errno.h>
#include <sys/file.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/mount.h>
@ -76,11 +77,25 @@ string_concat(char *one, char *two)
{
static char tmp[FILENAME_MAX];
/* Yes, we're deliberately cavalier about not checking for overflow */
strcpy(tmp, one);
strcat(tmp, two);
return tmp;
}
/* Concatenate three strings into static storage */
char *
string_concat3(char *one, char *two, char *three)
{
static char tmp[FILENAME_MAX];
/* Yes, we're deliberately cavalier about not checking for overflow */
strcpy(tmp, one);
strcat(tmp, two);
strcat(tmp, three);
return tmp;
}
/* Clip the whitespace off the end of a string */
char *
string_prune(char *str)
@ -101,6 +116,53 @@ string_skipwhite(char *str)
return str;
}
/* copy optionally and allow second arg to be null */
char *
string_copy(char *s1, char *s2)
{
if (!s1)
return NULL;
if (!s2)
s1[0] = '\0';
else
strcpy(s1, s2);
return s1;
}
Boolean
directoryExists(const char *dirname)
{
DIR *tptr;
if (!dirname)
return FALSE;
if (!strlen(dirname))
return FALSE;
tptr = opendir(dirname);
if (!tptr)
return (FALSE);
closedir(tptr);
return (TRUE);
}
char *
pathBaseName(const char *path)
{
char *pt;
char *ret = (char *)path;
pt = strrchr(path,(int)'/');
if (pt != 0) /* if there is a slash */
{
ret = ++pt; /* start the file after it */
}
return(ret);
}
/* A free guaranteed to take NULL ptrs */
void
safe_free(void *ptr)
@ -120,6 +182,7 @@ safe_malloc(size_t size)
ptr = malloc(size);
if (!ptr)
msgFatal("Out of memory!");
bzero(ptr, size);
return ptr;
}
@ -179,8 +242,8 @@ Mkdir(char *ipath, void *data)
int final=0;
char *p, *path;
if (access(ipath, R_OK) == 0)
return 0;
if (file_readable(ipath))
return RET_SUCCESS;
path = strdup(ipath);
if (isDebug())
@ -196,20 +259,22 @@ Mkdir(char *ipath, void *data)
*p = '\0';
if (stat(path, &sb)) {
if (errno != ENOENT) {
dialog_clear();
msgConfirm("Couldn't stat directory %s: %s", path, strerror(errno));
return 1;
return RET_FAIL;
}
if (isDebug())
msgDebug("mkdir(%s..)\n", path);
if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
dialog_clear();
msgConfirm("Couldn't create directory %s: %s", path,strerror(errno));
return 1;
return RET_FAIL;
}
}
*p = '/';
}
free(path);
return 0;
return RET_SUCCESS;
}
int
@ -230,16 +295,18 @@ Mount(char *mountp, void *dev)
memset(&ufsargs,0,sizeof ufsargs);
if (Mkdir(mountpoint, NULL)) {
dialog_clear();
msgConfirm("Unable to make directory mountpoint for %s!", mountpoint);
return 1;
return RET_FAIL;
}
if (isDebug())
msgDebug("mount %s %s\n", device, mountpoint);
bzero(&ufsargs, sizeof(ufsargs));
ufsargs.fspec = device;
if (mount(MOUNT_UFS, mountpoint, 0, (caddr_t)&ufsargs) == -1) {
msgConfirm("Error mounting %s on %s : %s\n", device, mountpoint, strerror(errno));
return 1;
dialog_clear();
msgConfirm("Error mounting %s on %s : %s", device, mountpoint, strerror(errno));
return RET_FAIL;
}
return 0;
return RET_SUCCESS;
}

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: msg.c,v 1.28.2.2 1995/06/02 15:31:31 jkh Exp $
* $Id: msg.c,v 1.29.2.8 1995/10/22 21:38:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -52,9 +52,9 @@
Boolean
isDebug(void)
{
if (OptFlags & OPT_DEBUG)
return TRUE;
return FALSE;
char *cp;
return (cp = variable_get(VAR_DEBUG)) && strcmp(cp, "no");
}
/* Whack up an informational message on the status line, in stand-out */
@ -216,7 +216,7 @@ msgConfirm(char *fmt, ...)
use_helpfile(NULL);
w = dupwin(newscr);
if (OnVTY) {
msgDebug("Switching back to VTY 0\n");
msgDebug("Switching back to VTY1\n");
ioctl(0, VT_ACTIVATE, 1);
msgInfo(NULL);
}
@ -264,7 +264,7 @@ msgYesNo(char *fmt, ...)
use_helpfile(NULL);
w = dupwin(newscr);
if (OnVTY) {
msgDebug("Switching back to VTY 0\n");
msgDebug("Switching back to VTY1\n");
ioctl(0, VT_ACTIVATE, 1); /* Switch back */
msgInfo(NULL);
}
@ -298,7 +298,7 @@ msgGetInput(char *buf, char *fmt, ...)
input_buffer[0] = '\0';
w = dupwin(newscr);
if (OnVTY) {
msgDebug("Switching back to VTY 0\n");
msgDebug("Switching back to VTY1\n");
ioctl(0, VT_ACTIVATE, 1); /* Switch back */
msgInfo(NULL);
}
@ -349,5 +349,20 @@ msgWeHaveOutput(char *fmt, ...)
dialog_msgbox("Information Dialog", errstr, -1, -1, 0);
free(errstr);
if (OnVTY)
msgInfo("Command output is on debugging screen - type ALT-F2 to see it");
msgInfo("Command output is on VTY2 - type ALT-F2 to see it");
}
/* Simple versions of msgConfirm() and msgNotify() for calling from scripts */
int
msgSimpleConfirm(char *str)
{
msgConfirm(str);
return RET_SUCCESS;
}
int
msgSimpleNotify(char *str)
{
msgNotify(str);
return RET_SUCCESS;
}

View file

@ -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.42.2.1 1995/07/21 10:54:06 rgrimes Exp $
* $Id: sysinstall.h,v 1.43 1995/09/18 16:52:35 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -49,8 +49,11 @@
#include <string.h>
#include <unistd.h>
#include <dialog.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "libdisk.h"
#include "dist.h"
#include "version.h"
/*** Defines ***/
@ -66,10 +69,14 @@
#define VAR_VALUE_MAX 1024
/* device limits */
#define DEV_NAME_MAX 128 /* The maximum length of a device name */
#define DEV_MAX 200 /* The maximum number of devices we'll deal with */
#define DEV_NAME_MAX 64 /* The maximum length of a device name */
#define DEV_MAX 100 /* The maximum number of devices we'll deal with */
#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
#define MAX_FTP_RETRIES 3 /* How many times to beat our heads against the wall */
#define MAX_FTP_RETRIES "4" /* How many times to beat our heads against the wall */
#define RET_FAIL -1
#define RET_SUCCESS 0
#define RET_DONE 1
/*
* I make some pretty gross assumptions about having a max of 50 chunks
@ -79,36 +86,65 @@
* For 2.1 I'll revisit this and try to make it more dynamic, but since
* this will catch 99.99% of all possible cases, I'm not too worried.
*/
#define MAX_CHUNKS 50
#define MAX_CHUNKS 40
/* Internal flag variables */
/* Internal environment variable names */
#define DISK_PARTITIONED "_diskPartitioned"
#define DISK_LABELLED "_diskLabelled"
#define DISK_SELECTED "_diskSelected"
#define SYSTEM_STATE "_systemState"
#define RUNNING_ON_ROOT "_runningOnRoot"
#define TCP_CONFIGURED "_tcpConfigured"
#define FTP_USER "_ftpUser"
#define FTP_PASS "_ftpPass"
/* Ones that can be tweaked from config files */
#define VAR_BLANKTIME "blanktime"
#define VAR_BOOTMGR "bootManager"
#define VAR_BROWSER_BINARY "browserBinary"
#define VAR_BROWSER_PACKAGE "browserPackage"
#define VAR_CONFIG_FILE "configFile"
#define VAR_CPIO_VERBOSITY "cpioVerbose"
#define VAR_DEBUG "debug"
#define VAR_DISK "disk"
#define VAR_DISKSPACE "diskSpace"
#define VAR_DOMAINNAME "domainname"
#define VAR_EXTRAS "ifconfig_"
#define VAR_FTP_ONERROR "ftpOnError"
#define VAR_FTP_PASS "ftpPass"
#define VAR_FTP_PATH "ftp"
#define VAR_FTP_RETRIES "ftpRetryCount"
#define VAR_FTP_STATE "ftpState"
#define VAR_FTP_USER "ftpUser"
#define VAR_GATEWAY "defaultrouter"
#define VAR_GEOMETRY "geometry"
#define VAR_HOSTNAME "hostname"
#define VAR_IFCONFIG "ifconfig_"
#define VAR_INTERFACES "network_interfaces"
#define VAR_IPADDR "ipaddr"
#define VAR_LABEL "label"
#define VAR_LABEL_COUNT "labelCount"
#define VAR_MEDIA_TYPE "mediaType"
#define VAR_NAMESERVER "nameserver"
#define VAR_NETMASK "netmask"
#define VAR_NFS_PATH "nfs"
#define VAR_NFS_SECURE "nfsSecure"
#define VAR_NO_CONFIRM "noConfirm"
#define VAR_NTPDATE "ntpDate"
#define VAR_PORTS_PATH "ports"
#define VAR_RELNAME "releaseName"
#define VAR_ROOT_SIZE "rootSize"
#define VAR_ROUTEDFLAGS "routedflags"
#define VAR_SLOW_ETHER "slowEthernetCard"
#define VAR_SWAP_SIZE "swapSize"
#define VAR_TAPE_BLOCKSIZE "tapeBlocksize"
#define VAR_UFS_PATH "ufs"
#define VAR_USR_SIZE "usrSize"
#define VAR_VAR_SIZE "varSize"
#define VAR_SERIAL_SPEED "serialSpeed"
#define OPT_NO_CONFIRM 0x0001
#define OPT_NFS_SECURE 0x0002
#define OPT_DEBUG 0x0004
#define OPT_FTP_ACTIVE 0x0008
#define OPT_FTP_PASSIVE 0x0010
#define OPT_FTP_RESELECT 0x0020
#define OPT_FTP_ABORT 0x0040
#define OPT_SLOW_ETHER 0x0080
#define OPT_EXPLORATORY_GET 0x0100
#define OPT_LEAVE_NETWORK_UP 0x0200
#define DEFAULT_TAPE_BLOCKSIZE "20"
#define VAR_HOSTNAME "hostname"
#define VAR_DOMAINNAME "domainname"
#define VAR_NAMESERVER "nameserver"
#define VAR_GATEWAY "defaultrouter"
#define VAR_IPADDR "ipaddr"
#define VAR_IFCONFIG "ifconfig_"
#define VAR_INTERFACES "network_interfaces"
/* One MB worth of blocks */
#define ONE_MEG 2048
/* The help file for the TCP/IP setup screen */
#define TCP_HELPFILE "tcp"
@ -136,7 +172,7 @@ typedef struct _dmenuItem {
char *prompt; /* Our prompt */
DMenuItemType type; /* What type of item we are */
void *ptr; /* Generic data ptr */
u_long parm; /* Parameter for above */
int parm; /* Parameter for above */
Boolean disabled; /* Are we temporarily disabled? */
char * (*check)(struct _dmenuItem *); /* Our state */
} DMenuItem;
@ -157,13 +193,14 @@ typedef struct _variable {
char value[VAR_VALUE_MAX];
} Variable;
/* For attribs */
#define MAX_ATTRIBS 200
#define MAX_NAME 511
#define MAX_VALUE 4095
#define MAX_NAME 64
#define MAX_VALUE 256
typedef struct _attribs {
char *name;
char *value;
char name[MAX_NAME];
char value[MAX_VALUE];
} Attribs;
typedef enum {
@ -188,7 +225,7 @@ typedef struct _device {
DeviceType type;
Boolean enabled;
Boolean (*init)(struct _device *dev);
int (*get)(struct _device *dev, char *file, Attribs *dist_attrs);
int (*get)(struct _device *dev, char *file, Boolean tentative);
Boolean (*close)(struct _device *dev, int fd);
void (*shutdown)(struct _device *dev);
void *private;
@ -213,11 +250,49 @@ typedef struct _part_info {
char newfs_cmd[NEWFS_CMD_MAX];
} PartInfo;
/* An option */
typedef struct _opt {
char *name;
char *desc;
enum { OPT_IS_STRING, OPT_IS_INT, OPT_IS_FUNC, OPT_IS_VAR } type;
void *data;
void *aux;
char *(*check)();
} Option;
/* Weird index nodey things we use for keeping track of package information */
typedef enum { PACKAGE, PLACE } node_type; /* Types of nodes */
typedef struct _pkgnode { /* A node in the reconstructed hierarchy */
struct _pkgnode *next; /* My next sibling */
node_type type; /* What am I? */
char *name; /* My name */
char *desc; /* My description (Hook) */
struct _pkgnode *kids; /* My little children */
void *data; /* A place to hang my data */
} PkgNode;
typedef PkgNode *PkgNodePtr;
/* A single package */
typedef struct _indexEntry { /* A single entry in an INDEX file */
char *name; /* name */
char *path; /* full path to port */
char *prefix; /* port prefix */
char *comment; /* one line description */
char *descrfile; /* path to description file */
char *maintainer; /* maintainer */
} IndexEntry;
typedef IndexEntry *IndexEntryPtr;
typedef int (*commandFunc)(char *key, void *data);
#define HOSTNAME_FIELD_LEN 256
#define HOSTNAME_FIELD_LEN 128
#define IPADDR_FIELD_LEN 16
#define EXTRAS_FIELD_LEN 256
#define EXTRAS_FIELD_LEN 128
/* Verbosity levels for CPIO as expressed by cpio arguments - yuck */
#define CPIO_VERBOSITY (!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "low") ? "" : \
!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "medium") ? "-V" : "-v")
/* This is the structure that Network devices carry around in their private, erm, structures */
typedef struct _devPriv {
@ -242,9 +317,7 @@ extern unsigned int SrcDists; /* Which src distributions we want */
extern unsigned int XF86Dists; /* Which XFree86 dists we want */
extern unsigned int XF86ServerDists; /* The XFree86 servers we want */
extern unsigned int XF86FontDists; /* The XFree86 fonts we want */
extern unsigned int OptFlags; /* Global options */
extern int BootMgr; /* Which boot manager to use */
extern char *InstallPrefix; /* A location bias */
extern DMenu MenuInitial; /* Initial installation menu */
@ -255,6 +328,7 @@ extern DMenu MenuFTPOptions; /* FTP Installation options */
extern DMenu MenuOptions; /* Installation options */
extern DMenu MenuOptionsLanguage; /* Language options menu */
extern DMenu MenuMedia; /* Media type menu */
extern DMenu MenuMouse; /* Mouse type menu */
extern DMenu MenuMediaCDROM; /* CDROM media menu */
extern DMenu MenuMediaDOS; /* DOS media menu */
extern DMenu MenuMediaFloppy; /* Floppy media menu */
@ -268,8 +342,8 @@ extern DMenu MenuSysconsKeyrate; /* System console keyrate configuration menu *
extern DMenu MenuSysconsSaver; /* System console saver configuration menu */
extern DMenu MenuNetworking; /* Network configuration menu */
extern DMenu MenuInstallCustom; /* Custom Installation menu */
extern DMenu MenuInstallType; /* Installation type menu */
extern DMenu MenuDistributions; /* Distribution menu */
extern DMenu MenuSubDistributions; /* Custom distribution menu */
extern DMenu MenuDESDistributions; /* DES distribution menu */
extern DMenu MenuSrcDistributions; /* Source distribution menu */
extern DMenu MenuXF86; /* XFree86 main menu */
@ -278,17 +352,25 @@ extern DMenu MenuXF86SelectCore; /* XFree86 core distribution menu */
extern DMenu MenuXF86SelectServer; /* XFree86 server distribution menu */
extern DMenu MenuXF86SelectFonts; /* XFree86 font selection menu */
extern DMenu MenuDiskDevices; /* Disk devices menu */
extern DMenu MenuHTMLDoc; /* HTML Documentation menu */
/*** Prototypes ***/
/* apache.c */
extern int configApache(char *str);
/* anonFTP.c */
extern int configAnonFTP(char *unused);
/* attrs.c */
extern const char *attr_match(Attribs *attr, char *name);
extern int attr_parse(Attribs **attr, char *file);
extern char *attr_match(Attribs *attr, char *name);
extern int attr_parse_file(Attribs *attr, char *file);
extern int attr_parse(Attribs *attr, int fd);
/* cdrom.c */
extern Boolean mediaInitCDROM(Device *dev);
extern int mediaGetCDROM(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetCDROM(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownCDROM(Device *dev);
/* command.c */
@ -299,7 +381,7 @@ extern void command_shell_add(char *key, char *fmt, ...);
extern void command_func_add(char *key, commandFunc func, void *data);
/* config.c */
extern void configFstab(void);
extern int configFstab(void);
extern void configSysconfig(void);
extern void configResolv(void);
extern int configPorts(char *str);
@ -313,8 +395,8 @@ extern int crc(int, unsigned long *, unsigned long *);
/* decode.c */
extern DMenuItem *decode(DMenu *menu, char *name);
extern Boolean dispatch(DMenuItem *tmp, char *name);
extern Boolean decode_and_dispatch_multiple(DMenu *menu, char *names);
extern int dispatch(DMenuItem *tmp, char *name);
extern int decode_and_dispatch_multiple(DMenu *menu, char *names);
/* devices.c */
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)());
@ -323,11 +405,11 @@ 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)(Device *dev, char *file, Attribs *dist_attrs),
Boolean (*init)(Device *mediadev), int (*get)(Device *dev, char *file, Boolean tentative),
Boolean (*close)(Device *mediadev, int fd), void (*shutDown)(Device *mediadev),
void *private);
extern Boolean dummyInit(Device *dev);
extern int dummyGet(Device *dev, char *dist, Attribs *dist_attrs);
extern int dummyGet(Device *dev, char *dist, Boolean tentative);
extern Boolean dummyClose(Device *dev, int fd);
extern void dummyShutdown(Device *dev);
@ -337,6 +419,7 @@ extern int diskPartitionWrite(char *unused);
/* dist.c */
extern int distReset(char *str);
extern int distSetCustom(char *str);
extern int distSetDeveloper(char *str);
extern int distSetXDeveloper(char *str);
extern int distSetKernDeveloper(char *str);
@ -356,49 +439,66 @@ extern char *dmenuVarCheck(DMenuItem *item);
extern char *dmenuFlagCheck(DMenuItem *item);
extern char *dmenuRadioCheck(DMenuItem *item);
/* doc.c */
extern int docBrowser(char *junk);
extern int docShowDocument(char *str);
/* dos.c */
extern Boolean mediaInitDOS(Device *dev);
extern int mediaGetDOS(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetDOS(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownDOS(Device *dev);
/* floppy.c */
extern int getRootFloppy(void);
extern Boolean mediaInitFloppy(Device *dev);
extern int mediaGetFloppy(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetFloppy(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownFloppy(Device *dev);
/* ftp_strat.c */
extern Boolean mediaCloseFTP(Device *dev, int fd);
extern Boolean mediaInitFTP(Device *dev);
extern int mediaGetFTP(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetFTP(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownFTP(Device *dev);
extern int mediaSetFtpUserPass(char *str);
/* globals.c */
extern void globalsInit(void);
/* index.c */
int index_get(char *fname, PkgNodePtr papa);
int index_read(int fd, PkgNodePtr papa);
int index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll);
void index_init(PkgNodePtr top, PkgNodePtr plist);
void index_node_free(PkgNodePtr top, PkgNodePtr plist);
void index_sort(PkgNodePtr top);
void index_print(PkgNodePtr top, int level);
int index_extract(Device *dev, PkgNodePtr plist);
/* install.c */
extern int installCommit(char *str);
extern int installExpress(char *str);
extern Boolean installFilesystems(void);
extern int installNovice(char *str);
extern int installFixit(char *str);
extern int installFixup(char *str);
extern int installUpgrade(char *str);
extern int installPreconfig(char *str);
extern int installFilesystems(char *str);
extern int installVarDefaults(char *str);
extern Boolean copySelf(void);
extern Boolean rootExtract(void);
/* lang.c */
extern void lang_set_Danish(char *str);
extern void lang_set_Dutch(char *str);
extern void lang_set_English(char *str);
extern void lang_set_French(char *str);
extern void lang_set_German(char *str);
extern void lang_set_Italian(char *str);
extern void lang_set_Japanese(char *str);
extern void lang_set_Norwegian(char *str);
extern void lang_set_Russian(char *str);
extern void lang_set_Spanish(char *str);
extern void lang_set_Swedish(char *str);
/* installFinal.c */
extern int configGated(char *unused);
extern int configSamba(char *unused);
extern int configPCNFSD(char *unused);
extern int configNFSServer(char *unused);
/* label.c */
extern int diskLabelEditor(char *str);
extern int diskLabelCommit(char *str);
/* lndir.c */
extern int lndir(char *from, char *to);
/* makedevs.c (auto-generated) */
extern const char termcap_vt100[];
extern const char termcap_cons25[];
@ -414,6 +514,7 @@ extern const u_char koi8_r2cp866[];
extern u_char default_scrnmap[];
/* media.c */
extern char *cpioVerbosity(void);
extern int mediaSetCDROM(char *str);
extern int mediaSetFloppy(char *str);
extern int mediaSetDOS(char *str);
@ -423,7 +524,10 @@ extern int mediaSetFTPActive(char *str);
extern int mediaSetFTPPassive(char *str);
extern int mediaSetUFS(char *str);
extern int mediaSetNFS(char *str);
extern Boolean mediaGetType(void);
extern int mediaSetFtpOnError(char *str);
extern int mediaSetFtpUserPass(char *str);
extern int mediaSetCPIOVerbosity(char *str);
extern int mediaGetType(char *str);
extern Boolean mediaExtractDist(char *dir, int fd);
extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic);
extern Boolean mediaExtractDistEnd(int zpid, int cpid);
@ -432,9 +536,13 @@ extern Boolean mediaVerify(void);
/* misc.c */
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
extern Boolean directoryExists(const char *dirname);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
extern char *string_prune(char *str);
extern char *string_skipwhite(char *str);
extern char *string_copy(char *s1, char *s2);
extern char *pathBaseName(const char *path);
extern void safe_free(void *ptr);
extern void *safe_malloc(size_t size);
extern void *safe_realloc(void *orig, size_t size);
@ -458,6 +566,8 @@ extern void msgNotify(char *fmt, ...);
extern void msgWeHaveOutput(char *fmt, ...);
extern int msgYesNo(char *fmt, ...);
extern char *msgGetInput(char *buf, char *fmt, ...);
extern int msgSimpleConfirm(char *);
extern int msgSimpleNotify(char *);
/* network.c */
extern Boolean mediaInitNetwork(Device *dev);
@ -465,30 +575,42 @@ extern void mediaShutdownNetwork(Device *dev);
/* nfs.c */
extern Boolean mediaInitNFS(Device *dev);
extern int mediaGetNFS(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetNFS(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownNFS(Device *dev);
/* options.c */
extern int optionsEditor(char *str);
/* package.c */
extern int package_add(char *name);
extern int package_extract(Device *dev, char *name);
/* system.c */
extern void systemInitialize(int argc, char **argv);
extern void systemShutdown(void);
extern int execExecute(char *cmd, char *name);
extern int systemExecute(char *cmd);
extern int systemDisplayFile(char *file);
extern int systemDisplayHelp(char *file);
extern char *systemHelpFile(char *file, char *buf);
extern void systemChangeFont(const u_char font[]);
extern void systemChangeLang(char *lang);
extern void systemChangeTerminal(char *color, const u_char c_termcap[],
char *mono, const u_char m_termcap[]);
extern void systemChangeTerminal(char *color, const u_char c_termcap[], char *mono, const u_char m_termcap[]);
extern void systemChangeScreenmap(const u_char newmap[]);
extern void systemCreateHoloshell(void);
extern int vsystem(char *fmt, ...);
extern int docBrowser(char *junk);
extern int docShowDocument(char *str);
/* tape.c */
extern char *mediaTapeBlocksize(void);
extern Boolean mediaInitTape(Device *dev);
extern int mediaGetTape(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetTape(Device *dev, char *file, Boolean tentative);
extern void mediaShutdownTape(Device *dev);
/* tcpip.c */
extern int tcpOpenDialog(Device *dev);
extern int tcpMenuSelect(char *str);
extern int tcpInstallDevice(char *str);
extern Boolean tcpDeviceSelect(void);
/* termcap.c */
@ -497,11 +619,14 @@ extern int set_termcap(void);
/* ufs.c */
extern void mediaShutdownUFS(Device *dev);
extern Boolean mediaInitUFS(Device *dev);
extern int mediaGetUFS(Device *dev, char *file, Attribs *dist_attrs);
extern int mediaGetUFS(Device *dev, char *file, Boolean tentative);
/* variables.c */
/* variable.c */
extern void variable_set(char *var);
extern void variable_set2(char *name, char *value);
extern char *variable_get(char *var);
extern void variable_unset(char *var);
extern char *variable_get_value(char *var, char *prompt);
/* wizard.c */
extern void slice_wizard(Disk *d);

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: system.c,v 1.44 1995/06/11 19:30:10 rgrimes Exp $
* $Id: system.c,v 1.45 1995/09/18 16:52:36 peter Exp $
*
* Jordan Hubbard
*
@ -70,6 +70,9 @@ systemInitialize(int argc, char **argv)
/* If we haven't crashed I guess dialog is running ! */
DialogActive = TRUE;
/* Make sure HOME is set for those utilities that need it */
if (!getenv("HOME"))
setenv("HOME", "/", 1);
signal(SIGINT, handle_intr);
}
@ -85,7 +88,7 @@ systemShutdown(void)
if (RunningAsInit) {
/* Put the console back */
ioctl(0, VT_ACTIVATE, 2);
reboot(RB_HALT);
reboot(0);
}
else
exit(1);
@ -96,11 +99,16 @@ int
systemExecute(char *command)
{
int status;
struct termios foo;
dialog_clear();
dialog_update();
end_dialog();
DialogActive = FALSE;
if (tcgetattr(0, &foo) != -1) {
foo.c_cc[VERASE] = '\010';
tcsetattr(0, TCSANOW, &foo);
}
status = system(command);
DialogActive = TRUE;
dialog_clear();
@ -108,9 +116,9 @@ systemExecute(char *command)
return status;
}
/* Display a file in a filebox */
/* Display a help file in a filebox */
int
systemDisplayFile(char *file)
systemDisplayHelp(char *file)
{
char *fname = NULL;
char buf[FILENAME_MAX];
@ -189,8 +197,8 @@ vsystem(char *fmt, ...)
pid_t pid;
int omask;
sig_t intsave, quitsave;
char *cmd,*p;
int i,magic=0;
char *cmd;
int i;
cmd = (char *)malloc(FILENAME_MAX);
cmd[0] = '\0';
@ -198,67 +206,72 @@ vsystem(char *fmt, ...)
vsnprintf(cmd, FILENAME_MAX, fmt, args);
va_end(args);
/* Find out if this command needs the wizardry of the shell */
for (p="<>|'`=\"()" ; *p; p++)
if (strchr(cmd, *p))
magic++;
omask = sigblock(sigmask(SIGCHLD));
if (isDebug())
msgDebug("Executing command `%s' (Magic=%d)\n", cmd, magic);
switch(pid = fork()) {
case -1: /* error */
msgDebug("Executing command `%s'\n", cmd);
pid = fork();
if (pid == -1) {
(void)sigsetmask(omask);
i = 127;
case 0: /* child */
}
else if (!pid) { /* Junior */
(void)sigsetmask(omask);
if (DebugFD != -1) {
if (OnVTY && isDebug())
msgInfo("Command output is on debugging screen - type ALT-F2 to see it");
msgInfo("Command output is on VTY2 - type ALT-F2 to see it");
dup2(DebugFD, 0);
dup2(DebugFD, 1);
dup2(DebugFD, 2);
}
#ifdef NOT_A_GOOD_IDEA_CRUNCHED_BINARY
if (magic) {
char *argv[100];
i = 0;
argv[i++] = "crunch";
argv[i++] = "sh";
argv[i++] = "-c";
argv[i++] = cmd;
argv[i] = 0;
exit(crunched_main(i,argv));
} else {
char *argv[100];
i = 0;
argv[i++] = "crunch";
while (cmd && *cmd) {
argv[i] = strsep(&cmd," \t");
if (*argv[i])
i++;
}
argv[i] = 0;
if (crunched_here(argv[1]))
exit(crunched_main(i,argv));
else
execvp(argv[1],argv+1);
kill(getpid(),9);
}
#else /* !CRUNCHED_BINARY */
execl("/stand/sh", "sh", "-c", cmd, (char *)NULL);
kill(getpid(),9);
#endif /* CRUNCHED_BINARY */
exit(1);
}
else {
intsave = signal(SIGINT, SIG_IGN);
quitsave = signal(SIGQUIT, SIG_IGN);
pid = waitpid(pid, &pstat, 0);
(void)sigsetmask(omask);
(void)signal(SIGINT, intsave);
(void)signal(SIGQUIT, quitsave);
i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
if (isDebug())
msgDebug("Command `%s' returns status of %d\n", cmd, i);
free(cmd);
}
intsave = signal(SIGINT, SIG_IGN);
quitsave = signal(SIGQUIT, SIG_IGN);
pid = waitpid(pid, &pstat, 0);
(void)sigsetmask(omask);
(void)signal(SIGINT, intsave);
(void)signal(SIGQUIT, quitsave);
i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
if (isDebug())
msgDebug("Command `%s' returns status of %d\n", cmd, i);
free(cmd);
return i;
}
void
systemCreateHoloshell(void)
{
if (OnVTY) {
if (!fork()) {
int i, fd;
struct termios foo;
extern int login_tty(int);
for (i = 0; i < 64; i++)
close(i);
DebugFD = fd = open("/dev/ttyv3", O_RDWR);
ioctl(0, TIOCSCTTY, &fd);
dup2(0, 1);
dup2(0, 2);
if (login_tty(fd) == -1)
msgDebug("Doctor: I can't set the controlling terminal.\n");
signal(SIGTTOU, SIG_IGN);
if (tcgetattr(fd, &foo) != -1) {
foo.c_cc[VERASE] = '\010';
if (tcsetattr(fd, TCSANOW, &foo) == -1)
msgDebug("Doctor: I'm unable to set the erase character.\n");
}
else
msgDebug("Doctor: I'm unable to get the terminal attributes!\n");
printf("Warning: This shell is chroot()'d to /mnt\n");
execlp("sh", "-sh", 0);
msgDebug("Was unable to execute sh for Holographic shell!\n");
exit(1);
}
else
msgNotify("Starting an emergency holographic shell on VTY4");
}
}

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: variable.c,v 1.5.2.2 1995/06/01 21:04:03 jkh Exp $
* $Id: variable.c,v 1.6.2.7 1995/10/26 08:56:18 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -50,21 +50,23 @@ make_variable(char *var, char *value)
{
Variable *newvar;
/* First search to see if it's already there */
/* Put it in the environment in any case */
setenv(var, value, 1);
/* Now search to see if it's already in the list */
for (newvar = VarHead; newvar; newvar = newvar->next) {
if (!strcmp(newvar->name, var)) {
strncpy(newvar->value, value, VAR_VALUE_MAX);
setenv(var, value, 1);
return;
}
}
setenv(var, value, 1);
/* No? Create a new one */
newvar = (Variable *)safe_malloc(sizeof(Variable));
strncpy(newvar->name, var, VAR_NAME_MAX);
strncpy(newvar->value, value, VAR_VALUE_MAX);
newvar->next = VarHead;
VarHead = newvar;
setenv(newvar->name, newvar->value, 1);
if (isDebug())
msgDebug("Setting variable %s to %s\n", newvar->name, newvar->value);
}
@ -74,6 +76,10 @@ variable_set(char *var)
{
char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
if (!var)
msgFatal("NULL variable name & value passed.");
else if (!*var)
msgDebug("Warning: Zero length name & value passed to variable_set()\n");
strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
if ((cp = index(tmp, '=')) == NULL)
msgFatal("Invalid variable format: %s", var);
@ -86,5 +92,55 @@ variable_set2(char *var, char *value)
{
if (!var || !value)
msgFatal("Null name or value passed to set_variable2!");
else if (!*var || !*value)
msgDebug("Warning: Zero length name or value passed to variable_set2()\n");
make_variable(var, value);
}
char *
variable_get(char *var)
{
return getenv(var);
}
void
variable_unset(char *var)
{
Variable *vp;
unsetenv(var);
/* Now search to see if it's in our list, if we have one.. */
if (!VarHead)
return;
else if (!VarHead->next && !strcmp(VarHead->name, var)) {
free(VarHead);
VarHead = NULL;
}
else {
for (vp = VarHead; vp; vp = vp->next) {
if (!strcmp(vp->name, var)) {
Variable *save = vp->next;
*vp = *save;
safe_free(save);
break;
}
}
}
}
/* Prompt user for the name of a variable */
char *
variable_get_value(char *var, char *prompt)
{
char *cp;
dialog_clear();
if ((cp = msgGetInput(variable_get(var), prompt)) != NULL)
variable_set2(var, cp);
else
cp = NULL;
dialog_clear();
return cp;
}

View file

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: wizard.c,v 1.5.2.1 1995/06/05 02:25:27 jkh Exp $
* $Id: wizard.c,v 1.6.2.1 1995/09/20 10:43:13 jkh Exp $
*
*/
@ -155,7 +155,11 @@ slice_wizard(Disk *d)
continue;
}
if (!strcasecmp(*cmds,"allfreebsd")) {
All_FreeBSD(d);
All_FreeBSD(d, 0);
continue;
}
if (!strcasecmp(*cmds,"dedicate")) {
All_FreeBSD(d, 1);
continue;
}
if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
@ -213,6 +217,7 @@ slice_wizard(Disk *d)
printf("\007ERROR\n");
printf("CMDS:\n");
printf("allfreebsd\t\t");
printf("dedicate\t\t");
printf("bios cyl hd sect\n");
printf("collapse [pointer]\t\t");
printf("create offset size enum subtype flags\n");

View file

@ -4,14 +4,14 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum
SRCS= attr.c cdrom.c command.c config.c decode.c devices.c disks.c dist.c \
dmenu.c dos.c floppy.c ftp.c ftp_strat.c globals.c install.c label.c \
main.c makedevs.c media.c menus.c misc.c msg.c network.c nfs.c system.c tape.c \
tcpip.c termcap.c ufs.c variable.c wizard.c
SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c decode.c \
devices.c disks.c dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
ftp_strat.c globals.c index.c install.c installFinal.c \
installPreconfig.c installUpgrade.c label.c lndir.c main.c \
makedevs.c media.c menus.c misc.c msg.c network.c nfs.c options.c \
package.c system.c tape.c tcpip.c termcap.c ufs.c variable.c wizard.c
CFLAGS+= -Wall -I${.CURDIR}/../libdisk \
-I${.CURDIR}/../../gnu/lib/libdialog
CFLAGS+= -Wall -I${.CURDIR}/../libdisk -I${.CURDIR}/../../gnu/lib/libdialog
LDADD= -ldialog -lncurses -lmytinfo -lutil
.if exists(${.CURDIR}/../libdisk/obj)
@ -55,4 +55,3 @@ testftp: ftp.c
cc -o testftp -I../libdisk -DSTANDALONE_FTP ftp.c
.include <bsd.prog.mk>

View file

@ -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: cdrom.c,v 1.7.2.2 1995/07/21 11:45:32 rgrimes Exp $
* $Id: cdrom.c,v 1.8 1995/09/18 16:52:20 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -58,13 +58,16 @@
#include <sys/mount.h>
#undef CD9660
static Boolean cdromMounted;
/* This isn't static, like the others, since it's often useful to know whether or not we have a CDROM
available in some of the other installation screens. */
Boolean cdromMounted;
Boolean
mediaInitCDROM(Device *dev)
{
struct iso_args args;
struct stat sb;
char specialrel[80];
if (!RunningAsInit || cdromMounted)
return TRUE;
@ -77,38 +80,51 @@ mediaInitCDROM(Device *dev)
args.flags = 0;
if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
msgConfirm("Error mounting %s on /cdrom: %s (%u)\n", dev, strerror(errno), errno);
dialog_clear();
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
return FALSE;
}
/*
* Do a very simple check to see if this looks roughly like a 2.0.5 CDROM
* Do a very simple check to see if this looks roughly like a FreeBSD CDROM
* Unfortunately FreeBSD won't let us read the ``label'' AFAIK, which is one
* sure way of telling the disc version :-(
*/
if (stat("/cdrom/dists", &sb)) {
snprintf(specialrel, 80, "/cdrom/%s/dists", variable_get(VAR_RELNAME));
if (stat("/cdrom/dists", &sb) && stat(specialrel, &sb)) {
if (errno == ENOENT) {
msgConfirm("Couldn't locate the directory `dists' on the CD.\nIs this a FreeBSD CDROM?\n");
dialog_clear();
msgConfirm("Couldn't locate the directory `dists' anywhere on the CD.\n"
"Is this a FreeBSD CDROM? Is the release version set properly\n"
"in the Options editor?");
return FALSE;
}
else {
msgConfirm("Couldn't stat directory %s: %s", "/cdrom/dists", strerror(errno));
dialog_clear();
msgConfirm("Error trying to stat the CDROM's dists directory: %s", strerror(errno));
return FALSE;
}
}
cdromMounted = TRUE;
msgDebug("Mounted CDROM device %s on /cdrom\n", dev->devname);
return TRUE;
}
int
mediaGetCDROM(Device *dev, char *file, Attribs *dist_attrs)
mediaGetCDROM(Device *dev, char *file, Boolean tentative)
{
char buf[PATH_MAX];
char buf[PATH_MAX];
msgDebug("Request for %s from CDROM\n", file);
snprintf(buf, PATH_MAX, "/cdrom/%s", file);
if (!access(buf,R_OK))
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/cdrom/dists/%s", file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/cdrom/%s/%s", variable_get(VAR_RELNAME), file);
if (file_readable(buf))
return open(buf, O_RDONLY);
snprintf(buf, PATH_MAX, "/cdrom/%s/dists/%s", variable_get(VAR_RELNAME), file);
return open(buf, O_RDONLY);
}
@ -117,10 +133,12 @@ mediaShutdownCDROM(Device *dev)
{
if (!RunningAsInit || !cdromMounted)
return;
msgDebug("Unmounting /cdrom\n");
if (unmount("/cdrom", MNT_FORCE) != 0)
msgConfirm("Could not unmount the CDROM: %s\n", strerror(errno));
msgDebug("Unmount returned\n");
msgDebug("Unmounting %s from /cdrom\n", dev->devname);
if (unmount("/cdrom", MNT_FORCE) != 0) {
dialog_clear();
msgConfirm("Could not unmount the CDROM from /cdrom: %s", strerror(errno));
}
msgDebug("Unmount successful\n");
cdromMounted = FALSE;
return;
}

Some files were not shown because too many files have changed in this diff Show more