diff options
author | jkh <jkh@FreeBSD.org> | 1995-05-06 09:34:24 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-05-06 09:34:24 +0000 |
commit | 370e7434c73c9695fba43a15fcdb2e1d640fea6e (patch) | |
tree | 71f9887a978b7f631a093d04c9fcbb976bbb6206 /usr.sbin | |
parent | db62fdd3485bf81f00ceb2dde0c646287afcb44a (diff) | |
download | FreeBSD-src-370e7434c73c9695fba43a15fcdb2e1d640fea6e.zip FreeBSD-src-370e7434c73c9695fba43a15fcdb2e1d640fea6e.tar.gz |
Some fairly serious cleanup. The proper offset should now be used in
creating partitions. Still need to get the mount points displaying carefully,
but I need to get this into my tree on time so that I can work on that.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sade/devices.c | 15 | ||||
-rw-r--r-- | usr.sbin/sade/disks.c | 71 | ||||
-rw-r--r-- | usr.sbin/sade/globals.c | 6 | ||||
-rw-r--r-- | usr.sbin/sade/install.c | 52 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 17 | ||||
-rw-r--r-- | usr.sbin/sade/system.c | 21 | ||||
-rw-r--r-- | usr.sbin/sade/termcap.c | 3 | ||||
-rw-r--r-- | usr.sbin/sysinstall/devices.c | 15 | ||||
-rw-r--r-- | usr.sbin/sysinstall/disks.c | 71 | ||||
-rw-r--r-- | usr.sbin/sysinstall/globals.c | 6 | ||||
-rw-r--r-- | usr.sbin/sysinstall/install.c | 52 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 17 | ||||
-rw-r--r-- | usr.sbin/sysinstall/system.c | 21 | ||||
-rw-r--r-- | usr.sbin/sysinstall/termcap.c | 3 |
14 files changed, 254 insertions, 116 deletions
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c index 69e1be2..6260b78 100644 --- a/usr.sbin/sade/devices.c +++ b/usr.sbin/sade/devices.c @@ -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.2 1995/05/04 03:51:14 jkh Exp $ + * $Id: devices.c,v 1.5 1995/05/05 23:47:38 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -133,11 +133,10 @@ print_command_summary() int b_attr = ColorDisplay ? A_BOLD : A_UNDERLINE; mvprintw(14, 0, "The following commands are supported (in upper or lower case):"); - mvprintw(16, 0, "A = Use Entire Disk B = Scan For Bad Blocks"); - mvprintw(17, 0, "C = Create New Partition D = Delete Partition"); - mvprintw(18, 0, "G = Set BIOS Geometry U = Undo All Changes"); - mvprintw(19, 0, "W = `Wizard' Mode ESC = Proceed to next screen"); - mvprintw(21, 0, "The currently selected partition is displayed in "); + mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition"); + mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable"); + mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Proceed to next screen"); + mvprintw(20, 0, "The currently selected partition is displayed in "); attrset(b_attr); addstr(ColorDisplay ? "bold" : "underline"); attrset(A_NORMAL); move(0, 0); } @@ -245,6 +244,10 @@ device_slice_disk(struct disk *d) /* Set geometry */ break; + case 'S': + /* Set Bootable */ + break; + case 'U': Free_Disk(d); d = Open_Disk(name); diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c index be7d803..7d843a1 100644 --- a/usr.sbin/sade/disks.c +++ b/usr.sbin/sade/disks.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id$ + * $Id: disks.c,v 1.2 1995/05/05 23:47:40 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -43,6 +43,7 @@ #include "sysinstall.h" #include <ctype.h> +#include <sys/disklabel.h> /* * I make some pretty gross assumptions about having a max of 50 chunks @@ -55,8 +56,6 @@ #define MAX_CHUNKS 50 -#define FS_SWAP 1 - /* Where to start printing the freebsd slices */ #define CHUNK_SLICE_START_ROW 2 #define CHUNK_PART_START_ROW 10 @@ -64,18 +63,11 @@ /* The smallest filesystem we're willing to create */ #define FS_MIN_SIZE 2048 -typedef enum { PART_NONE, PART_SLICE, PART_SWAP, PART_FILESYSTEM } part_type; - -struct part_info { - Boolean newfs; - char mountpoint[FILENAME_MAX]; -}; - static struct { struct disk *d; struct chunk *c; - struct part_info *p; - part_type type; + PartInfo *p; + PartType type; } fbsd_chunk_info[MAX_CHUNKS + 1]; static int current_chunk; @@ -176,7 +168,7 @@ int get_mountpoint(struct chunk *c) { char *val; - struct part_info *part; + PartInfo *part; val = msgGetInput(c->private, "Please specify mount point for new partition"); @@ -193,7 +185,7 @@ msgConfirm("This region cannot be used for your root partition as\nit is past th return 1; } safe_free(c->private); - part = (struct part_info *)malloc(sizeof(struct part_info)); + part = (PartInfo *)malloc(sizeof(PartInfo)); strncpy(part->mountpoint, val, FILENAME_MAX); part->newfs = TRUE; c->private = (void *)part; @@ -203,15 +195,15 @@ msgConfirm("This region cannot be used for your root partition as\nit is past th return 1; } -static part_type +static PartType get_partition_type(struct chunk *c) { char selection[20]; static unsigned char *fs_types[] = { - "Swap", - "A swap partition.", "FS", "A file system", + "Swap", + "A swap partition.", }; if (!dialog_menu("Please choose a partition type", @@ -280,8 +272,8 @@ print_fbsd_chunks(void) char *mountpoint, *newfs; if (fbsd_chunk_info[i].c->private) { - mountpoint = ((struct part_info *)fbsd_chunk_info[i].c->private)->mountpoint; - newfs = ((struct part_info *)fbsd_chunk_info[i].c->private)->newfs ? "Y" : "N"; + mountpoint = ((PartInfo *)fbsd_chunk_info[i].c->private)->mountpoint; + newfs = ((PartInfo *)fbsd_chunk_info[i].c->private)->newfs ? "Y" : "N"; } else { mountpoint = "?"; @@ -383,7 +375,7 @@ partition_disks(struct disk **disks) snprintf(tmp, 20, "%d", sz); val = msgGetInput(tmp, "Please specify size for new FreeBSD partition"); if (val && (size = strtol(val, 0, 0)) > 0) { - part_type type; + PartType type; if (get_mountpoint(fbsd_chunk_info[current_chunk].c)) break; @@ -391,7 +383,8 @@ partition_disks(struct disk **disks) if (type == PART_NONE) break; Create_Chunk(fbsd_chunk_info[current_chunk].d, - fbsd_chunk_info[current_chunk].c->offset, + fbsd_chunk_info[current_chunk].c->offset + + sz - size, size, part, type == PART_SWAP ? FS_SWAP : freebsd, @@ -400,7 +393,16 @@ partition_disks(struct disk **disks) } } break; - + + case 'D': + if (fbsd_chunk_info[current_chunk].type == PART_SLICE) { + msg = "Use the Master Partition Editor to delete one of these"; + break; + } + Delete_Chunk(fbsd_chunk_info[current_chunk].d, + fbsd_chunk_info[current_chunk].c); + break; + case 27: /* ESC */ partitioning = FALSE; break; @@ -416,11 +418,11 @@ write_disks(struct disk **disks) extern u_char mbr[], bteasy17[]; dialog_clear(); - if (!msgYesNo("Last Chance! Are you sure you want to write your changes to disk?")) { + if (!msgYesNo("Last Chance! Are you sure you want to write out\nall your changes to disk?")) { for (i = 0; disks[i]; i++) { if (contains_root_partition(disks[i])) Set_Boot_Blocks(disks[i], boot1, boot2); - if (i == 0 && !msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, as well as boot from a driver other than the first.")) + if (i == 0 && !msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, or boot from a disk other than the first.")) Set_Boot_Mgr(disks[i], bteasy17); else if (i == 0 && !msgYesNo("Would you like to remove an existing boot manager?")) Set_Boot_Mgr(disks[i], mbr); @@ -432,24 +434,3 @@ write_disks(struct disk **disks) } return 1; } - -void -make_filesystems(struct disk **disks) -{ -} - -void -cpio_extract(struct disk **disks) -{ -} - -void -extract_dists(struct disk **disks) -{ -} - -void -do_final_setup(struct disk **disks) -{ -} - diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c index 9d52ff3..587ffe6 100644 --- a/usr.sbin/sade/globals.c +++ b/usr.sbin/sade/globals.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id$ + * $Id: globals.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -53,6 +53,8 @@ int DebugFD; /* Where diagnostic output goes */ Boolean OnCDROM; /* Are we running off of a CDROM? */ Boolean OnSerial; /* Are we on a serial console? */ Boolean DialogActive; +Boolean ColorDisplay; +Boolean OnVTY; Variable *VarHead; /* The head of the variable chain */ /* @@ -66,6 +68,8 @@ globalsInit(void) DebugFD = -1; OnCDROM = FALSE; OnSerial = FALSE; + ColorDisplay = FALSE; + OnVTY = FALSE; DialogActive = FALSE; VarHead = NULL; } diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 8bb677c..8ec4bb3 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -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: install.c,v 1.8 1995/05/05 23:47:40 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -42,6 +42,7 @@ */ #include "sysinstall.h" +#include<sys/disklabel.h> Boolean SystemWasInstalled; @@ -87,6 +88,7 @@ installHook(char *str) make_filesystems(disks); cpio_extract(disks); extract_dists(disks); + install_configuration_files(disks); do_final_setup(disks); SystemWasInstalled = TRUE; break; @@ -147,3 +149,51 @@ installMaint(char *str) msgConfirm("Sorry, maintainance mode is not implemented in this version."); return 0; } + +/* Go newfs and/or mount all the filesystems we've been asked to */ +void +make_filesystems(struct disk **disks) +{ + int i; + + for (i = 0; disks[i]; i++) { + struct chunk *c1; + + if (!disks[i]->chunks) + msgFatal("No chunk list found for %s!", disks[i]->name); + c1 = disks[i]->chunks->part; + while (c1) { + if (c1->type == freebsd) { + struct chunk *c2 = c1->part; + + while (c2) { + if (c2->type == part && c2->subtype != FS_SWAP) + vsystem("newfs %s", c2->name); + c2 = c2->next; + } + } + c1 = c1->next; + } + } +} + +void +cpio_extract(struct disk **disks) +{ +} + +void +extract_dists(struct disk **disks) +{ +} + +void +install_configuration_files(struct disk **disks) +{ +} + +void +do_final_setup(struct disk **disks) +{ +} + diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index dc207f9..285bf70 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -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.5 1995/05/04 03:51:22 jkh Exp $ + * $Id: sysinstall.h,v 1.8 1995/05/05 23:47:45 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -169,6 +169,19 @@ typedef struct _device { DeviceType type; } Device; +/* Some internal representations of partitions */ +typedef enum { + PART_NONE, + PART_SLICE, + PART_SWAP, + PART_FILESYSTEM +} PartType; + +typedef struct _part_info { + Boolean newfs; + char mountpoint[FILENAME_MAX]; +} PartInfo; + /*** Externs ***/ extern int CpioFD; /* The file descriptor for our CPIO floppy */ @@ -215,6 +228,7 @@ extern void systemChangeLang(char *lang); 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 int vsystem(char *fmt, ...); /* disks.c */ extern void partition_disks(struct disk **disks); @@ -222,6 +236,7 @@ extern int write_disks(struct disk **disks); extern void make_filesystems(struct disk **disks); extern void cpio_extract(struct disk **disks); extern void extract_dists(struct disk **disks); +extern void install_configuration_files(struct disk **disks); extern void do_final_setup(struct disk **disks); /* dmenu.c */ diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index 9fac4e8..aad9887 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.3 1995/05/01 21:56:31 jkh Exp $ + * $Id: system.c,v 1.5 1995/05/05 23:47:46 jkh Exp $ * * Jordan Hubbard * @@ -257,3 +257,22 @@ systemChangeScreenmap(const u_char newmap[]) getenv("LANG")); } } + +/* Execute a system command, with varargs */ +int +vsystem(char *fmt, ...) +{ + va_list args; + char *cmd; + int i; + + cmd = (char *)malloc(FILENAME_MAX); + cmd[0] = '\0'; + va_start(args, fmt); + vsnprintf((char *)(cmd + strlen(cmd)), FILENAME_MAX, fmt, args); + va_end(args); + msgNotify("Executing command: %s", cmd); + i = system(cmd); + free(cmd); + return i; +} diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c index cb2eca2..8b2a5f9 100644 --- a/usr.sbin/sade/termcap.c +++ b/usr.sbin/sade/termcap.c @@ -22,9 +22,6 @@ #include "sysinstall.h" -Boolean ColorDisplay; -Boolean OnVTY; - int set_termcap(void) { diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index 69e1be2..6260b78 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/devices.c @@ -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.2 1995/05/04 03:51:14 jkh Exp $ + * $Id: devices.c,v 1.5 1995/05/05 23:47:38 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -133,11 +133,10 @@ print_command_summary() int b_attr = ColorDisplay ? A_BOLD : A_UNDERLINE; mvprintw(14, 0, "The following commands are supported (in upper or lower case):"); - mvprintw(16, 0, "A = Use Entire Disk B = Scan For Bad Blocks"); - mvprintw(17, 0, "C = Create New Partition D = Delete Partition"); - mvprintw(18, 0, "G = Set BIOS Geometry U = Undo All Changes"); - mvprintw(19, 0, "W = `Wizard' Mode ESC = Proceed to next screen"); - mvprintw(21, 0, "The currently selected partition is displayed in "); + mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition"); + mvprintw(17, 0, "D = Delete Partition G = Set BIOS Geometry S = Set Bootable"); + mvprintw(18, 0, "U = Undo All Changes W = `Wizard' Mode ESC = Proceed to next screen"); + mvprintw(20, 0, "The currently selected partition is displayed in "); attrset(b_attr); addstr(ColorDisplay ? "bold" : "underline"); attrset(A_NORMAL); move(0, 0); } @@ -245,6 +244,10 @@ device_slice_disk(struct disk *d) /* Set geometry */ break; + case 'S': + /* Set Bootable */ + break; + case 'U': Free_Disk(d); d = Open_Disk(name); diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index be7d803..7d843a1 100644 --- a/usr.sbin/sysinstall/disks.c +++ b/usr.sbin/sysinstall/disks.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id$ + * $Id: disks.c,v 1.2 1995/05/05 23:47:40 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -43,6 +43,7 @@ #include "sysinstall.h" #include <ctype.h> +#include <sys/disklabel.h> /* * I make some pretty gross assumptions about having a max of 50 chunks @@ -55,8 +56,6 @@ #define MAX_CHUNKS 50 -#define FS_SWAP 1 - /* Where to start printing the freebsd slices */ #define CHUNK_SLICE_START_ROW 2 #define CHUNK_PART_START_ROW 10 @@ -64,18 +63,11 @@ /* The smallest filesystem we're willing to create */ #define FS_MIN_SIZE 2048 -typedef enum { PART_NONE, PART_SLICE, PART_SWAP, PART_FILESYSTEM } part_type; - -struct part_info { - Boolean newfs; - char mountpoint[FILENAME_MAX]; -}; - static struct { struct disk *d; struct chunk *c; - struct part_info *p; - part_type type; + PartInfo *p; + PartType type; } fbsd_chunk_info[MAX_CHUNKS + 1]; static int current_chunk; @@ -176,7 +168,7 @@ int get_mountpoint(struct chunk *c) { char *val; - struct part_info *part; + PartInfo *part; val = msgGetInput(c->private, "Please specify mount point for new partition"); @@ -193,7 +185,7 @@ msgConfirm("This region cannot be used for your root partition as\nit is past th return 1; } safe_free(c->private); - part = (struct part_info *)malloc(sizeof(struct part_info)); + part = (PartInfo *)malloc(sizeof(PartInfo)); strncpy(part->mountpoint, val, FILENAME_MAX); part->newfs = TRUE; c->private = (void *)part; @@ -203,15 +195,15 @@ msgConfirm("This region cannot be used for your root partition as\nit is past th return 1; } -static part_type +static PartType get_partition_type(struct chunk *c) { char selection[20]; static unsigned char *fs_types[] = { - "Swap", - "A swap partition.", "FS", "A file system", + "Swap", + "A swap partition.", }; if (!dialog_menu("Please choose a partition type", @@ -280,8 +272,8 @@ print_fbsd_chunks(void) char *mountpoint, *newfs; if (fbsd_chunk_info[i].c->private) { - mountpoint = ((struct part_info *)fbsd_chunk_info[i].c->private)->mountpoint; - newfs = ((struct part_info *)fbsd_chunk_info[i].c->private)->newfs ? "Y" : "N"; + mountpoint = ((PartInfo *)fbsd_chunk_info[i].c->private)->mountpoint; + newfs = ((PartInfo *)fbsd_chunk_info[i].c->private)->newfs ? "Y" : "N"; } else { mountpoint = "?"; @@ -383,7 +375,7 @@ partition_disks(struct disk **disks) snprintf(tmp, 20, "%d", sz); val = msgGetInput(tmp, "Please specify size for new FreeBSD partition"); if (val && (size = strtol(val, 0, 0)) > 0) { - part_type type; + PartType type; if (get_mountpoint(fbsd_chunk_info[current_chunk].c)) break; @@ -391,7 +383,8 @@ partition_disks(struct disk **disks) if (type == PART_NONE) break; Create_Chunk(fbsd_chunk_info[current_chunk].d, - fbsd_chunk_info[current_chunk].c->offset, + fbsd_chunk_info[current_chunk].c->offset + + sz - size, size, part, type == PART_SWAP ? FS_SWAP : freebsd, @@ -400,7 +393,16 @@ partition_disks(struct disk **disks) } } break; - + + case 'D': + if (fbsd_chunk_info[current_chunk].type == PART_SLICE) { + msg = "Use the Master Partition Editor to delete one of these"; + break; + } + Delete_Chunk(fbsd_chunk_info[current_chunk].d, + fbsd_chunk_info[current_chunk].c); + break; + case 27: /* ESC */ partitioning = FALSE; break; @@ -416,11 +418,11 @@ write_disks(struct disk **disks) extern u_char mbr[], bteasy17[]; dialog_clear(); - if (!msgYesNo("Last Chance! Are you sure you want to write your changes to disk?")) { + if (!msgYesNo("Last Chance! Are you sure you want to write out\nall your changes to disk?")) { for (i = 0; disks[i]; i++) { if (contains_root_partition(disks[i])) Set_Boot_Blocks(disks[i], boot1, boot2); - if (i == 0 && !msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, as well as boot from a driver other than the first.")) + if (i == 0 && !msgYesNo("Would you like to install a boot manager?\n\nThis will allow you to easily select between other operating systems\non the first disk, or boot from a disk other than the first.")) Set_Boot_Mgr(disks[i], bteasy17); else if (i == 0 && !msgYesNo("Would you like to remove an existing boot manager?")) Set_Boot_Mgr(disks[i], mbr); @@ -432,24 +434,3 @@ write_disks(struct disk **disks) } return 1; } - -void -make_filesystems(struct disk **disks) -{ -} - -void -cpio_extract(struct disk **disks) -{ -} - -void -extract_dists(struct disk **disks) -{ -} - -void -do_final_setup(struct disk **disks) -{ -} - diff --git a/usr.sbin/sysinstall/globals.c b/usr.sbin/sysinstall/globals.c index 9d52ff3..587ffe6 100644 --- a/usr.sbin/sysinstall/globals.c +++ b/usr.sbin/sysinstall/globals.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id$ + * $Id: globals.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -53,6 +53,8 @@ int DebugFD; /* Where diagnostic output goes */ Boolean OnCDROM; /* Are we running off of a CDROM? */ Boolean OnSerial; /* Are we on a serial console? */ Boolean DialogActive; +Boolean ColorDisplay; +Boolean OnVTY; Variable *VarHead; /* The head of the variable chain */ /* @@ -66,6 +68,8 @@ globalsInit(void) DebugFD = -1; OnCDROM = FALSE; OnSerial = FALSE; + ColorDisplay = FALSE; + OnVTY = FALSE; DialogActive = FALSE; VarHead = NULL; } diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 8bb677c..8ec4bb3 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -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: install.c,v 1.8 1995/05/05 23:47:40 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -42,6 +42,7 @@ */ #include "sysinstall.h" +#include<sys/disklabel.h> Boolean SystemWasInstalled; @@ -87,6 +88,7 @@ installHook(char *str) make_filesystems(disks); cpio_extract(disks); extract_dists(disks); + install_configuration_files(disks); do_final_setup(disks); SystemWasInstalled = TRUE; break; @@ -147,3 +149,51 @@ installMaint(char *str) msgConfirm("Sorry, maintainance mode is not implemented in this version."); return 0; } + +/* Go newfs and/or mount all the filesystems we've been asked to */ +void +make_filesystems(struct disk **disks) +{ + int i; + + for (i = 0; disks[i]; i++) { + struct chunk *c1; + + if (!disks[i]->chunks) + msgFatal("No chunk list found for %s!", disks[i]->name); + c1 = disks[i]->chunks->part; + while (c1) { + if (c1->type == freebsd) { + struct chunk *c2 = c1->part; + + while (c2) { + if (c2->type == part && c2->subtype != FS_SWAP) + vsystem("newfs %s", c2->name); + c2 = c2->next; + } + } + c1 = c1->next; + } + } +} + +void +cpio_extract(struct disk **disks) +{ +} + +void +extract_dists(struct disk **disks) +{ +} + +void +install_configuration_files(struct disk **disks) +{ +} + +void +do_final_setup(struct disk **disks) +{ +} + diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index dc207f9..285bf70 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -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.5 1995/05/04 03:51:22 jkh Exp $ + * $Id: sysinstall.h,v 1.8 1995/05/05 23:47:45 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -169,6 +169,19 @@ typedef struct _device { DeviceType type; } Device; +/* Some internal representations of partitions */ +typedef enum { + PART_NONE, + PART_SLICE, + PART_SWAP, + PART_FILESYSTEM +} PartType; + +typedef struct _part_info { + Boolean newfs; + char mountpoint[FILENAME_MAX]; +} PartInfo; + /*** Externs ***/ extern int CpioFD; /* The file descriptor for our CPIO floppy */ @@ -215,6 +228,7 @@ extern void systemChangeLang(char *lang); 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 int vsystem(char *fmt, ...); /* disks.c */ extern void partition_disks(struct disk **disks); @@ -222,6 +236,7 @@ extern int write_disks(struct disk **disks); extern void make_filesystems(struct disk **disks); extern void cpio_extract(struct disk **disks); extern void extract_dists(struct disk **disks); +extern void install_configuration_files(struct disk **disks); extern void do_final_setup(struct disk **disks); /* dmenu.c */ diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index 9fac4e8..aad9887 100644 --- a/usr.sbin/sysinstall/system.c +++ b/usr.sbin/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.3 1995/05/01 21:56:31 jkh Exp $ + * $Id: system.c,v 1.5 1995/05/05 23:47:46 jkh Exp $ * * Jordan Hubbard * @@ -257,3 +257,22 @@ systemChangeScreenmap(const u_char newmap[]) getenv("LANG")); } } + +/* Execute a system command, with varargs */ +int +vsystem(char *fmt, ...) +{ + va_list args; + char *cmd; + int i; + + cmd = (char *)malloc(FILENAME_MAX); + cmd[0] = '\0'; + va_start(args, fmt); + vsnprintf((char *)(cmd + strlen(cmd)), FILENAME_MAX, fmt, args); + va_end(args); + msgNotify("Executing command: %s", cmd); + i = system(cmd); + free(cmd); + return i; +} diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c index cb2eca2..8b2a5f9 100644 --- a/usr.sbin/sysinstall/termcap.c +++ b/usr.sbin/sysinstall/termcap.c @@ -22,9 +22,6 @@ #include "sysinstall.h" -Boolean ColorDisplay; -Boolean OnVTY; - int set_termcap(void) { |