Another sync up for Poul. Added a lot more error checking.

This commit is contained in:
Jordan K. Hubbard 1995-05-07 23:37:34 +00:00
parent 020531ce67
commit 27e3eb523c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8336
9 changed files with 144 additions and 18 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: disks.c,v 1.6 1995/05/07 05:58:56 jkh Exp $
* $Id: disks.c,v 1.7 1995/05/07 22:07:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -198,6 +198,7 @@ new_part(char *mpoint, Boolean newfs)
ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
strcpy(ret->newfs_cmd, "newfs");
ret->newfs = newfs;
return ret;
}
@ -258,6 +259,18 @@ get_partition_type(void)
return PART_NONE;
}
static void
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.");
if (val)
strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
}
#define MAX_MOUNT_NAME 12
#define PART_PART_COL 0
@ -322,8 +335,10 @@ print_fbsd_chunks(void)
memset(onestr, ' ', PART_OFF - 1);
onestr[PART_OFF - 1] = '\0';
/* Go for two columns */
if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX))
if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX)) {
pcol = PART_OFF;
prow = CHUNK_PART_START_ROW;
}
else
pcol = 0;
memcpy(onestr + PART_PART_COL, fbsd_chunk_info[i].c->name,
@ -517,9 +532,29 @@ partition_disks(struct disk **disks)
}
break;
case 'N': /* Set newfs options */
if (fbsd_chunk_info[current_chunk].c->private &&
((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs)
getNewfsCmd(fbsd_chunk_info[current_chunk].c->private);
else
msg = "newfs options not applicable for this partition";
break;
case 'T': /* Toggle newfs state */
if (fbsd_chunk_info[current_chunk].c->private)
((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs = !((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs;
else
msg = "Set a mount point first.";
break;
case 27: /* ESC */
partitioning = FALSE;
break;
default:
beep();
msg = "Type F1 or ? for help";
break;
}
}
}

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.8 1995/05/05 23:47:40 jkh Exp $
* $Id: install.c,v 1.9 1995/05/06 09:34:18 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -167,8 +167,10 @@ make_filesystems(struct disk **disks)
struct chunk *c2 = c1->part;
while (c2) {
if (c2->type == part && c2->subtype != FS_SWAP)
vsystem("newfs %s", c2->name);
if (c2->type == part && c2->subtype != FS_SWAP &&
c2->private && ((PartInfo *)c2->private)->newfs)
vsystem("%s %s", ((PartInfo *)c2->private)->newfs_cmd,
c2->name);
c2 = c2->next;
}
}
@ -180,6 +182,7 @@ make_filesystems(struct disk **disks)
void
cpio_extract(struct disk **disks)
{
}
void

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.9 1995/05/06 09:34:20 jkh Exp $
* $Id: sysinstall.h,v 1.10 1995/05/07 02:04:29 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -177,9 +177,13 @@ typedef enum {
PART_FILESYSTEM
} PartType;
/* The longest newfs command we'll hand to system() */
#define NEWFS_CMD_MAX 256
typedef struct _part_info {
Boolean newfs;
char mountpoint[FILENAME_MAX];
char newfs_cmd[NEWFS_CMD_MAX];
} PartInfo;

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.6 1995/05/07 05:58:56 jkh Exp $
* $Id: disks.c,v 1.7 1995/05/07 22:07:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -198,6 +198,7 @@ new_part(char *mpoint, Boolean newfs)
ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
strcpy(ret->newfs_cmd, "newfs");
ret->newfs = newfs;
return ret;
}
@ -258,6 +259,18 @@ get_partition_type(void)
return PART_NONE;
}
static void
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.");
if (val)
strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
}
#define MAX_MOUNT_NAME 12
#define PART_PART_COL 0
@ -322,8 +335,10 @@ print_fbsd_chunks(void)
memset(onestr, ' ', PART_OFF - 1);
onestr[PART_OFF - 1] = '\0';
/* Go for two columns */
if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX))
if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX)) {
pcol = PART_OFF;
prow = CHUNK_PART_START_ROW;
}
else
pcol = 0;
memcpy(onestr + PART_PART_COL, fbsd_chunk_info[i].c->name,
@ -517,9 +532,29 @@ partition_disks(struct disk **disks)
}
break;
case 'N': /* Set newfs options */
if (fbsd_chunk_info[current_chunk].c->private &&
((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs)
getNewfsCmd(fbsd_chunk_info[current_chunk].c->private);
else
msg = "newfs options not applicable for this partition";
break;
case 'T': /* Toggle newfs state */
if (fbsd_chunk_info[current_chunk].c->private)
((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs = !((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs;
else
msg = "Set a mount point first.";
break;
case 27: /* ESC */
partitioning = FALSE;
break;
default:
beep();
msg = "Type F1 or ? for help";
break;
}
}
}

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.8 1995/05/05 23:47:40 jkh Exp $
* $Id: install.c,v 1.9 1995/05/06 09:34:18 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -167,8 +167,10 @@ make_filesystems(struct disk **disks)
struct chunk *c2 = c1->part;
while (c2) {
if (c2->type == part && c2->subtype != FS_SWAP)
vsystem("newfs %s", c2->name);
if (c2->type == part && c2->subtype != FS_SWAP &&
c2->private && ((PartInfo *)c2->private)->newfs)
vsystem("%s %s", ((PartInfo *)c2->private)->newfs_cmd,
c2->name);
c2 = c2->next;
}
}
@ -180,6 +182,7 @@ make_filesystems(struct disk **disks)
void
cpio_extract(struct disk **disks)
{
}
void

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.9 1995/05/06 09:34:20 jkh Exp $
* $Id: sysinstall.h,v 1.10 1995/05/07 02:04:29 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -177,9 +177,13 @@ typedef enum {
PART_FILESYSTEM
} PartType;
/* The longest newfs command we'll hand to system() */
#define NEWFS_CMD_MAX 256
typedef struct _part_info {
Boolean newfs;
char mountpoint[FILENAME_MAX];
char newfs_cmd[NEWFS_CMD_MAX];
} PartInfo;

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.6 1995/05/07 05:58:56 jkh Exp $
* $Id: disks.c,v 1.7 1995/05/07 22:07:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -198,6 +198,7 @@ new_part(char *mpoint, Boolean newfs)
ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
strncpy(ret->mountpoint, mpoint, FILENAME_MAX);
strcpy(ret->newfs_cmd, "newfs");
ret->newfs = newfs;
return ret;
}
@ -258,6 +259,18 @@ get_partition_type(void)
return PART_NONE;
}
static void
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.");
if (val)
strncpy(p->newfs_cmd, val, NEWFS_CMD_MAX);
}
#define MAX_MOUNT_NAME 12
#define PART_PART_COL 0
@ -322,8 +335,10 @@ print_fbsd_chunks(void)
memset(onestr, ' ', PART_OFF - 1);
onestr[PART_OFF - 1] = '\0';
/* Go for two columns */
if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX))
if (prow == (CHUNK_PART_START_ROW + CHUNK_COLUMN_MAX)) {
pcol = PART_OFF;
prow = CHUNK_PART_START_ROW;
}
else
pcol = 0;
memcpy(onestr + PART_PART_COL, fbsd_chunk_info[i].c->name,
@ -517,9 +532,29 @@ partition_disks(struct disk **disks)
}
break;
case 'N': /* Set newfs options */
if (fbsd_chunk_info[current_chunk].c->private &&
((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs)
getNewfsCmd(fbsd_chunk_info[current_chunk].c->private);
else
msg = "newfs options not applicable for this partition";
break;
case 'T': /* Toggle newfs state */
if (fbsd_chunk_info[current_chunk].c->private)
((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs = !((PartInfo *)fbsd_chunk_info[current_chunk].c->private)->newfs;
else
msg = "Set a mount point first.";
break;
case 27: /* ESC */
partitioning = FALSE;
break;
default:
beep();
msg = "Type F1 or ? for help";
break;
}
}
}

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.8 1995/05/05 23:47:40 jkh Exp $
* $Id: install.c,v 1.9 1995/05/06 09:34:18 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -167,8 +167,10 @@ make_filesystems(struct disk **disks)
struct chunk *c2 = c1->part;
while (c2) {
if (c2->type == part && c2->subtype != FS_SWAP)
vsystem("newfs %s", c2->name);
if (c2->type == part && c2->subtype != FS_SWAP &&
c2->private && ((PartInfo *)c2->private)->newfs)
vsystem("%s %s", ((PartInfo *)c2->private)->newfs_cmd,
c2->name);
c2 = c2->next;
}
}
@ -180,6 +182,7 @@ make_filesystems(struct disk **disks)
void
cpio_extract(struct disk **disks)
{
}
void

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.9 1995/05/06 09:34:20 jkh Exp $
* $Id: sysinstall.h,v 1.10 1995/05/07 02:04:29 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -177,9 +177,13 @@ typedef enum {
PART_FILESYSTEM
} PartType;
/* The longest newfs command we'll hand to system() */
#define NEWFS_CMD_MAX 256
typedef struct _part_info {
Boolean newfs;
char mountpoint[FILENAME_MAX];
char newfs_cmd[NEWFS_CMD_MAX];
} PartInfo;