Sync these up so that they'll get into my CVS tree at home, where I'll continue

working on the distribution extract stuff.
This commit is contained in:
Jordan K. Hubbard 1995-05-08 21:39:40 +00:00
parent 255aed5d97
commit f9a1c2dee2
17 changed files with 255 additions and 44 deletions

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: devices.c,v 1.10 1995/05/08 01:27:06 jkh Exp $
* $Id: devices.c,v 1.11 1995/05/08 10:20:46 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -47,6 +47,14 @@
/* Where we start displaying chunk information on the screen */
#define CHUNK_START_ROW 5
static char *cdrom_table[] = {
"cd0a", "cd1a", /* SCSI */
"mcd0a", "mcd1a", /* Mitsumi (old model) */
"scd0a", "scd1a", /* Sony CDROM */
"matcd0a", "matcd1a", /* Matsushita (SB) */
NULL,
};
/* Get all device information for a given device class */
static Device *
device_get_all(DeviceType which, int *ndevs)
@ -66,11 +74,27 @@ device_get_all(DeviceType which, int *ndevs)
strcpy(devs[i].name, names[i]);
devs[i].type = DEVICE_TYPE_DISK;
}
devs[i].name[0] = '\0';
free(names);
}
}
/* put detection for other classes here just as soon as I figure out how */
if (which == DEVICE_TYPE_CDROM || which == DEVICE_TYPE_ANY) {
char try[FILENAME_MAX];
int i, fd;
for (i = 0; cdrom_table[i]; i++) {
snprintf(try, FILENAME_MAX, "/mnt/dev/%s", cdrom_table[i]);
fd = open(try);
if (fd > 0) {
close(fd);
devs = safe_realloc(devs, sizeof(Device) * (*ndevs + 2));
strcpy(devs[*ndevs].name, cdrom_table[i]);
devs[(*ndevs)++].type = DEVICE_TYPE_CDROM;
break;
}
}
}
/* Terminate the devices array */
devs[*ndevs].name[0] = '\0';
return devs;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: install.c,v 1.5 1995/05/04 03:51:16 jkh Exp $
* $Id: dist.c,v 1.1 1995/05/04 19:48:10 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -90,3 +90,44 @@ distSetEverything(char *str)
SrcDists = DIST_SRC_ALL;
return 0;
}
struct {
char *my_name;
unsigned int my_bit;
} DistTable[] = {
{ "bin", DIST_BIN },
{ "games", DIST_GAMES },
{ "manpages", DIST_MANPAGES },
{ "proflibs", DIST_PROFLIBS },
{ "dict", DIST_DICT },
{ "src", DIST_SRC },
{ "des", DIST_DES },
{ "compat1x", DIST_COMPAT1X },
{ "xf86311l", DIST_XFREE86 },
{ NULL, 0 },
};
Boolean
dist_extract(char *name)
{
int fd;
return FALSE;
}
void
distExtractAll(void)
{
int i, fd;
while (Dists) {
for (i = 0; DistTable[i].my_name; i++) {
if (Dists & DistTable[i].my_bit) {
if (dist_extract(DistTable[i].my_name))
Dists &= ~DistTable[i].my_bit;
else
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: globals.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
* $Id: globals.c,v 1.2 1995/05/06 09:34:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -56,6 +56,8 @@ Boolean DialogActive;
Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
DeviceType MediaType; /* Where we're installing from */
char *MediaDevice; /* More detail on how to find it */
/*
* Yes, I know some of these are already automatically initialized as
@ -72,5 +74,7 @@ globalsInit(void)
OnVTY = FALSE;
DialogActive = FALSE;
VarHead = NULL;
MediaType = DEVICE_TYPE_NONE;
MediaDevice = NULL;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: install.c,v 1.11 1995/05/08 06:06:25 jkh Exp $
* $Id: install.c,v 1.12 1995/05/08 10:20:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -86,8 +86,10 @@ installHook(char *str)
for (i = 0; Disks[i]; i++)
Disks[i] = device_slice_disk(Disks[i]);
/* Whap partitions on all the FreeBSD slices created */
partition_disks();
/* Try and write it out */
if (!write_disks()) {
int scroll, choice, curr, max;
@ -95,7 +97,7 @@ installHook(char *str)
scroll = choice = curr = max = 0;
dmenuOpen(&MenuInstall, &choice, &scroll, &curr, &max);
cpio_extract();
extract_dists();
distExtractAll();
install_configuration_files();
do_final_setup();
SystemWasInstalled = TRUE;
@ -242,11 +244,6 @@ cpio_extract(void)
i, j, cpid, zpid, strerror(errno));
}
void
extract_dists(void)
{
}
void
install_configuration_files(void)
{

View File

@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
* $Id: misc.c,v 1.2 1995/04/29 19:33:04 jkh Exp $
* $Id: misc.c,v 1.3 1995/05/01 21:56:27 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -104,12 +104,28 @@ safe_malloc(size_t size)
{
void *ptr;
if (size <= 0)
msgFatal("Invalid malloc size of %d!", size);
ptr = malloc(size);
if (!ptr)
msgFatal("Out of memory!");
return ptr;
}
/* A realloc that checks errors */
void *
safe_realloc(void *orig, size_t size)
{
void *ptr;
if (size <= 0)
msgFatal("Invalid realloc size of %d!", size);
ptr = realloc(orig, size);
if (!ptr)
msgFatal("Out of memory!");
return ptr;
}
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().

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.12 1995/05/08 06:06:28 jkh Exp $
* $Id: sysinstall.h,v 1.13 1995/05/08 10:20:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -153,7 +153,7 @@ typedef struct _variable {
} Variable;
typedef enum {
DEVICE_TYPE_ANY,
DEVICE_TYPE_NONE,
DEVICE_TYPE_DISK,
DEVICE_TYPE_FLOPPY,
DEVICE_TYPE_NETWORK,
@ -161,6 +161,7 @@ typedef enum {
DEVICE_TYPE_TAPE,
DEVICE_TYPE_SERIAL,
DEVICE_TYPE_PARALLEL,
DEVICE_TYPE_ANY,
} DeviceType;
/* A "device" from sysinstall's point of view */
@ -284,6 +285,7 @@ extern char *string_prune(char *str);
extern char *string_skipwhite(char *str);
extern void safe_free(void *ptr);
extern void *safe_malloc(size_t size);
extern void *safe_realloc(void *orig, size_t size);
extern char **item_add(char **list, char *item, int *curr, int *max);
extern char **item_add_pair(char **list, char *item1, char *item2,
int *curr, int *max);

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.10 1995/05/08 01:27:06 jkh Exp $
* $Id: devices.c,v 1.11 1995/05/08 10:20:46 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -47,6 +47,14 @@
/* Where we start displaying chunk information on the screen */
#define CHUNK_START_ROW 5
static char *cdrom_table[] = {
"cd0a", "cd1a", /* SCSI */
"mcd0a", "mcd1a", /* Mitsumi (old model) */
"scd0a", "scd1a", /* Sony CDROM */
"matcd0a", "matcd1a", /* Matsushita (SB) */
NULL,
};
/* Get all device information for a given device class */
static Device *
device_get_all(DeviceType which, int *ndevs)
@ -66,11 +74,27 @@ device_get_all(DeviceType which, int *ndevs)
strcpy(devs[i].name, names[i]);
devs[i].type = DEVICE_TYPE_DISK;
}
devs[i].name[0] = '\0';
free(names);
}
}
/* put detection for other classes here just as soon as I figure out how */
if (which == DEVICE_TYPE_CDROM || which == DEVICE_TYPE_ANY) {
char try[FILENAME_MAX];
int i, fd;
for (i = 0; cdrom_table[i]; i++) {
snprintf(try, FILENAME_MAX, "/mnt/dev/%s", cdrom_table[i]);
fd = open(try);
if (fd > 0) {
close(fd);
devs = safe_realloc(devs, sizeof(Device) * (*ndevs + 2));
strcpy(devs[*ndevs].name, cdrom_table[i]);
devs[(*ndevs)++].type = DEVICE_TYPE_CDROM;
break;
}
}
}
/* Terminate the devices array */
devs[*ndevs].name[0] = '\0';
return devs;
}

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.1.1.1 1995/04/27 12:50:34 jkh Exp $
* $Id: globals.c,v 1.2 1995/05/06 09:34:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -56,6 +56,8 @@ Boolean DialogActive;
Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
DeviceType MediaType; /* Where we're installing from */
char *MediaDevice; /* More detail on how to find it */
/*
* Yes, I know some of these are already automatically initialized as
@ -72,5 +74,7 @@ globalsInit(void)
OnVTY = FALSE;
DialogActive = FALSE;
VarHead = NULL;
MediaType = DEVICE_TYPE_NONE;
MediaDevice = NULL;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: install.c,v 1.11 1995/05/08 06:06:25 jkh Exp $
* $Id: install.c,v 1.12 1995/05/08 10:20:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -86,8 +86,10 @@ installHook(char *str)
for (i = 0; Disks[i]; i++)
Disks[i] = device_slice_disk(Disks[i]);
/* Whap partitions on all the FreeBSD slices created */
partition_disks();
/* Try and write it out */
if (!write_disks()) {
int scroll, choice, curr, max;
@ -95,7 +97,7 @@ installHook(char *str)
scroll = choice = curr = max = 0;
dmenuOpen(&MenuInstall, &choice, &scroll, &curr, &max);
cpio_extract();
extract_dists();
distExtractAll();
install_configuration_files();
do_final_setup();
SystemWasInstalled = TRUE;
@ -242,11 +244,6 @@ cpio_extract(void)
i, j, cpid, zpid, strerror(errno));
}
void
extract_dists(void)
{
}
void
install_configuration_files(void)
{

View File

@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
* $Id: misc.c,v 1.2 1995/04/29 19:33:04 jkh Exp $
* $Id: misc.c,v 1.3 1995/05/01 21:56:27 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -104,12 +104,28 @@ safe_malloc(size_t size)
{
void *ptr;
if (size <= 0)
msgFatal("Invalid malloc size of %d!", size);
ptr = malloc(size);
if (!ptr)
msgFatal("Out of memory!");
return ptr;
}
/* A realloc that checks errors */
void *
safe_realloc(void *orig, size_t size)
{
void *ptr;
if (size <= 0)
msgFatal("Invalid realloc size of %d!", size);
ptr = realloc(orig, size);
if (!ptr)
msgFatal("Out of memory!");
return ptr;
}
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().

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.12 1995/05/08 06:06:28 jkh Exp $
* $Id: sysinstall.h,v 1.13 1995/05/08 10:20:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -153,7 +153,7 @@ typedef struct _variable {
} Variable;
typedef enum {
DEVICE_TYPE_ANY,
DEVICE_TYPE_NONE,
DEVICE_TYPE_DISK,
DEVICE_TYPE_FLOPPY,
DEVICE_TYPE_NETWORK,
@ -161,6 +161,7 @@ typedef enum {
DEVICE_TYPE_TAPE,
DEVICE_TYPE_SERIAL,
DEVICE_TYPE_PARALLEL,
DEVICE_TYPE_ANY,
} DeviceType;
/* A "device" from sysinstall's point of view */
@ -284,6 +285,7 @@ extern char *string_prune(char *str);
extern char *string_skipwhite(char *str);
extern void safe_free(void *ptr);
extern void *safe_malloc(size_t size);
extern void *safe_realloc(void *orig, size_t size);
extern char **item_add(char **list, char *item, int *curr, int *max);
extern char **item_add_pair(char **list, char *item1, char *item2,
int *curr, int *max);

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.10 1995/05/08 01:27:06 jkh Exp $
* $Id: devices.c,v 1.11 1995/05/08 10:20:46 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -47,6 +47,14 @@
/* Where we start displaying chunk information on the screen */
#define CHUNK_START_ROW 5
static char *cdrom_table[] = {
"cd0a", "cd1a", /* SCSI */
"mcd0a", "mcd1a", /* Mitsumi (old model) */
"scd0a", "scd1a", /* Sony CDROM */
"matcd0a", "matcd1a", /* Matsushita (SB) */
NULL,
};
/* Get all device information for a given device class */
static Device *
device_get_all(DeviceType which, int *ndevs)
@ -66,11 +74,27 @@ device_get_all(DeviceType which, int *ndevs)
strcpy(devs[i].name, names[i]);
devs[i].type = DEVICE_TYPE_DISK;
}
devs[i].name[0] = '\0';
free(names);
}
}
/* put detection for other classes here just as soon as I figure out how */
if (which == DEVICE_TYPE_CDROM || which == DEVICE_TYPE_ANY) {
char try[FILENAME_MAX];
int i, fd;
for (i = 0; cdrom_table[i]; i++) {
snprintf(try, FILENAME_MAX, "/mnt/dev/%s", cdrom_table[i]);
fd = open(try);
if (fd > 0) {
close(fd);
devs = safe_realloc(devs, sizeof(Device) * (*ndevs + 2));
strcpy(devs[*ndevs].name, cdrom_table[i]);
devs[(*ndevs)++].type = DEVICE_TYPE_CDROM;
break;
}
}
}
/* Terminate the devices array */
devs[*ndevs].name[0] = '\0';
return devs;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: install.c,v 1.5 1995/05/04 03:51:16 jkh Exp $
* $Id: dist.c,v 1.1 1995/05/04 19:48:10 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -90,3 +90,44 @@ distSetEverything(char *str)
SrcDists = DIST_SRC_ALL;
return 0;
}
struct {
char *my_name;
unsigned int my_bit;
} DistTable[] = {
{ "bin", DIST_BIN },
{ "games", DIST_GAMES },
{ "manpages", DIST_MANPAGES },
{ "proflibs", DIST_PROFLIBS },
{ "dict", DIST_DICT },
{ "src", DIST_SRC },
{ "des", DIST_DES },
{ "compat1x", DIST_COMPAT1X },
{ "xf86311l", DIST_XFREE86 },
{ NULL, 0 },
};
Boolean
dist_extract(char *name)
{
int fd;
return FALSE;
}
void
distExtractAll(void)
{
int i, fd;
while (Dists) {
for (i = 0; DistTable[i].my_name; i++) {
if (Dists & DistTable[i].my_bit) {
if (dist_extract(DistTable[i].my_name))
Dists &= ~DistTable[i].my_bit;
else
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: globals.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
* $Id: globals.c,v 1.2 1995/05/06 09:34:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -56,6 +56,8 @@ Boolean DialogActive;
Boolean ColorDisplay;
Boolean OnVTY;
Variable *VarHead; /* The head of the variable chain */
DeviceType MediaType; /* Where we're installing from */
char *MediaDevice; /* More detail on how to find it */
/*
* Yes, I know some of these are already automatically initialized as
@ -72,5 +74,7 @@ globalsInit(void)
OnVTY = FALSE;
DialogActive = FALSE;
VarHead = NULL;
MediaType = DEVICE_TYPE_NONE;
MediaDevice = NULL;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: install.c,v 1.11 1995/05/08 06:06:25 jkh Exp $
* $Id: install.c,v 1.12 1995/05/08 10:20:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -86,8 +86,10 @@ installHook(char *str)
for (i = 0; Disks[i]; i++)
Disks[i] = device_slice_disk(Disks[i]);
/* Whap partitions on all the FreeBSD slices created */
partition_disks();
/* Try and write it out */
if (!write_disks()) {
int scroll, choice, curr, max;
@ -95,7 +97,7 @@ installHook(char *str)
scroll = choice = curr = max = 0;
dmenuOpen(&MenuInstall, &choice, &scroll, &curr, &max);
cpio_extract();
extract_dists();
distExtractAll();
install_configuration_files();
do_final_setup();
SystemWasInstalled = TRUE;
@ -242,11 +244,6 @@ cpio_extract(void)
i, j, cpid, zpid, strerror(errno));
}
void
extract_dists(void)
{
}
void
install_configuration_files(void)
{

View File

@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
* $Id: misc.c,v 1.2 1995/04/29 19:33:04 jkh Exp $
* $Id: misc.c,v 1.3 1995/05/01 21:56:27 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -104,12 +104,28 @@ safe_malloc(size_t size)
{
void *ptr;
if (size <= 0)
msgFatal("Invalid malloc size of %d!", size);
ptr = malloc(size);
if (!ptr)
msgFatal("Out of memory!");
return ptr;
}
/* A realloc that checks errors */
void *
safe_realloc(void *orig, size_t size)
{
void *ptr;
if (size <= 0)
msgFatal("Invalid realloc size of %d!", size);
ptr = realloc(orig, size);
if (!ptr)
msgFatal("Out of memory!");
return ptr;
}
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().

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.12 1995/05/08 06:06:28 jkh Exp $
* $Id: sysinstall.h,v 1.13 1995/05/08 10:20:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -153,7 +153,7 @@ typedef struct _variable {
} Variable;
typedef enum {
DEVICE_TYPE_ANY,
DEVICE_TYPE_NONE,
DEVICE_TYPE_DISK,
DEVICE_TYPE_FLOPPY,
DEVICE_TYPE_NETWORK,
@ -161,6 +161,7 @@ typedef enum {
DEVICE_TYPE_TAPE,
DEVICE_TYPE_SERIAL,
DEVICE_TYPE_PARALLEL,
DEVICE_TYPE_ANY,
} DeviceType;
/* A "device" from sysinstall's point of view */
@ -284,6 +285,7 @@ extern char *string_prune(char *str);
extern char *string_skipwhite(char *str);
extern void safe_free(void *ptr);
extern void *safe_malloc(size_t size);
extern void *safe_realloc(void *orig, size_t size);
extern char **item_add(char **list, char *item, int *curr, int *max);
extern char **item_add_pair(char **list, char *item1, char *item2,
int *curr, int *max);