mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
My latest round of changes - make the "slices" editor work.
This commit is contained in:
parent
9b4d8c3412
commit
2e363cad34
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8262
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
|
* $Id: devices.c,v 1.1 1995/05/01 21:56:19 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -44,6 +44,9 @@
|
|||||||
#include "sysinstall.h"
|
#include "sysinstall.h"
|
||||||
#include "libdisk.h"
|
#include "libdisk.h"
|
||||||
|
|
||||||
|
/* Where we start displaying chunk information on the screen */
|
||||||
|
#define CHUNK_START_ROW 5
|
||||||
|
|
||||||
/* Get all device information for a given device class */
|
/* Get all device information for a given device class */
|
||||||
Device *
|
Device *
|
||||||
device_get_all(DeviceType which, int *ndevs)
|
device_get_all(DeviceType which, int *ndevs)
|
||||||
@ -71,26 +74,78 @@ device_get_all(DeviceType which, int *ndevs)
|
|||||||
return devs;
|
return devs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static struct chunk *chunk_info[10];
|
||||||
device_print_chunk(struct chunk *c1, int offset, int *row)
|
static int current_chunk;
|
||||||
{
|
|
||||||
CHAR_N
|
|
||||||
|
|
||||||
if (!c1)
|
static void
|
||||||
return;
|
record_chunks(char *disk, struct disk *d)
|
||||||
mvprintw(*row++, offset, "%10lu %10lu %10lu %-8s %d %-8s %4d %lx",
|
{
|
||||||
c1->offset, c1->size, c1->end, c1->name, c1->type,
|
struct chunk *c1;
|
||||||
chunk_n[c1->type], c1->subtype, c1->flags);
|
int i = 0;
|
||||||
device_print_chunk(c1->part, offset + 2, row);
|
int last_free = 0;
|
||||||
device_print_chunk(c1->next, offset, row);
|
if (!d->chunks)
|
||||||
|
msgFatal("No chunk list found for %s!", disk);
|
||||||
|
c1 = d->chunks->part;
|
||||||
|
while (c1) {
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static void
|
||||||
|
print_chunks(char *disk, struct disk *d)
|
||||||
|
{
|
||||||
|
int row;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
mvaddstr(0, 0, "Disk name:\t");
|
||||||
|
attrset(A_BOLD); addstr(disk); attrset(A_NORMAL);
|
||||||
|
mvprintw(1, 0,
|
||||||
|
"BIOS 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",
|
||||||
|
"Subtype", "Flags");
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
|
||||||
|
if (i == current_chunk)
|
||||||
|
attrset(A_BOLD);
|
||||||
|
mvprintw(row, 2, "%10lu %10lu %10lu %8s %8d %8s %8d %6lx",
|
||||||
|
chunk_info[i]->offset, chunk_info[i]->size,
|
||||||
|
chunk_info[i]->end, chunk_info[i]->name,
|
||||||
|
chunk_info[i]->type, chunk_n[chunk_info[i]->type],
|
||||||
|
chunk_info[i]->subtype, chunk_info[i]->flags);
|
||||||
|
if (i == current_chunk)
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_command_summary()
|
||||||
|
{
|
||||||
|
mvprintw(15, 0, "The following commands are supported (in upper or lower case):");
|
||||||
|
mvprintw(17, 0, "C = Create New Partition D = Delete Partition");
|
||||||
|
mvprintw(18, 0, "B = Scan For Bad Blocks U = Undo All Changes");
|
||||||
|
mvprintw(19, 0, "ESC = Proceed to next screen");
|
||||||
|
mvprintw(21, 0, "The currently selected partition is displayed in ");
|
||||||
|
attrset(A_BOLD); addstr("bold"); attrset(A_NORMAL);
|
||||||
|
move(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct disk *
|
||||||
device_slice_disk(char *disk)
|
device_slice_disk(char *disk)
|
||||||
{
|
{
|
||||||
struct disk *d;
|
struct disk *d;
|
||||||
char *p;
|
char *p;
|
||||||
int row;
|
int key = 0;
|
||||||
|
Boolean chunking;
|
||||||
|
char *msg = NULL;
|
||||||
|
|
||||||
d = Open_Disk(disk);
|
d = Open_Disk(disk);
|
||||||
if (!d)
|
if (!d)
|
||||||
@ -100,23 +155,152 @@ device_slice_disk(char *disk)
|
|||||||
msgConfirm(p);
|
msgConfirm(p);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
while (1) {
|
chunking = TRUE;
|
||||||
|
keypad(stdscr, TRUE);
|
||||||
|
|
||||||
|
record_chunks(disk, d);
|
||||||
|
while (chunking) {
|
||||||
clear();
|
clear();
|
||||||
mvprintw(0, 0, "Disk name: %s, Flags: %lx", disk, d->flags);
|
print_chunks(disk, d);
|
||||||
mvprintw(1, 0,
|
print_command_summary();
|
||||||
"Real Geometry: %lu/%lu/%lu, BIOS Geometry: %lu/%lu/%lu [cyls/heads/sectors]",
|
if (msg) {
|
||||||
d->real_cyl, d->real_hd, d->real_sect,
|
standout(); mvprintw(23, 0, msg); standend();
|
||||||
d->bios_cyl, d->bios_hd, d->bios_sect);
|
beep();
|
||||||
mvprintw(4, 0, "%10s %10s %10s %-8s %4s %-8s %4s %4s",
|
msg = NULL;
|
||||||
"Offset", "Size", "End", "Name", "PType", "Desc",
|
}
|
||||||
"Subtype", "Flags");
|
refresh();
|
||||||
row = 5;
|
|
||||||
device_print_chunk(d->chunks, 0, &row);
|
key = getch();
|
||||||
move(23, 0);
|
switch (key) {
|
||||||
addstr("Done!");
|
case KEY_UP:
|
||||||
if (getch() == 'q')
|
case '-':
|
||||||
return 0;
|
if (current_chunk != 0)
|
||||||
|
--current_chunk;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_DOWN:
|
||||||
|
case '+':
|
||||||
|
case '\r':
|
||||||
|
case '\n':
|
||||||
|
if (chunk_info[current_chunk + 1])
|
||||||
|
++current_chunk;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_HOME:
|
||||||
|
current_chunk = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_END:
|
||||||
|
while (chunk_info[current_chunk + 1])
|
||||||
|
++current_chunk;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_F(1):
|
||||||
|
case '?':
|
||||||
|
systemDisplayFile("slice.hlp");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'B':
|
||||||
|
case 'b':
|
||||||
|
if (chunk_info[current_chunk]->type != freebsd)
|
||||||
|
msg = "Can only scan for bad blocks in FreeBSD partition.";
|
||||||
|
else
|
||||||
|
chunk_info[current_chunk]->flags |= CHUNK_BAD144;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'C':
|
||||||
|
case 'c':
|
||||||
|
if (chunk_info[current_chunk]->type != unused)
|
||||||
|
msg = "Partition in use, delete it first or move to an unused one.";
|
||||||
|
else {
|
||||||
|
char *val;
|
||||||
|
char tmp[20];
|
||||||
|
int size;
|
||||||
|
|
||||||
|
snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
|
||||||
|
val = msgGetInput(tmp, "Please specify size for new FreeBSD partition");
|
||||||
|
if (val && (size = atoi(val)) > 0) {
|
||||||
|
Create_Chunk(d, chunk_info[current_chunk]->offset,
|
||||||
|
size,
|
||||||
|
freebsd,
|
||||||
|
3,
|
||||||
|
chunk_info[current_chunk]->flags);
|
||||||
|
record_chunks(disk, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'D':
|
||||||
|
case 'd':
|
||||||
|
if (chunk_info[current_chunk]->type == unused)
|
||||||
|
msg = "Partition is already unused!";
|
||||||
|
else {
|
||||||
|
Delete_Chunk(d, chunk_info[current_chunk]);
|
||||||
|
record_chunks(disk, d);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'U':
|
||||||
|
case 'u':
|
||||||
|
Free_Disk(d);
|
||||||
|
d = Open_Disk(disk);
|
||||||
|
record_chunks(disk, d);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 27: /* ESC */
|
||||||
|
chunking = FALSE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
msg = "Invalid character typed.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clear();
|
||||||
|
refresh();
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a menu listing all the devices in the system. The pass-in menu
|
||||||
|
* is expected to be a "prototype" from which the new menu is cloned.
|
||||||
|
*/
|
||||||
|
DMenu *
|
||||||
|
device_create_disk_menu(DMenu *menu, Device **rdevs, int (*hook)())
|
||||||
|
{
|
||||||
|
Device *devices;
|
||||||
|
int numdevs;
|
||||||
|
|
||||||
|
devices = device_get_all(DEVICE_TYPE_DISK, &numdevs);
|
||||||
|
*rdevs = devices;
|
||||||
|
if (!devices) {
|
||||||
|
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.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Device *start;
|
||||||
|
DMenu *tmp;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
tmp = (DMenu *)safe_malloc(sizeof(DMenu) +
|
||||||
|
(sizeof(DMenuItem) * (numdevs + 1)));
|
||||||
|
bcopy(menu, tmp, sizeof(DMenu));
|
||||||
|
for (start = devices, i = 0; start->name[0]; start++, i++) {
|
||||||
|
tmp->items[i].title = start->name;
|
||||||
|
if (!strncmp(start->name, "sd", 2))
|
||||||
|
tmp->items[i].prompt = "SCSI disk";
|
||||||
|
else if (!strncmp(start->name, "wd", 2))
|
||||||
|
tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk";
|
||||||
|
else
|
||||||
|
msgFatal("Unknown disk type: %s!", start->name);
|
||||||
|
tmp->items[i].type = DMENU_CALL;
|
||||||
|
tmp->items[i].ptr = hook;
|
||||||
|
tmp->items[i].disabled = FALSE;
|
||||||
|
}
|
||||||
|
tmp->items[i].type = DMENU_NOP;
|
||||||
|
tmp->items[i].title = NULL;
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: install.c,v 1.3 1995/04/29 19:33:01 jkh Exp $
|
* $Id: install.c,v 1.4 1995/05/01 21:56:22 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -46,60 +46,47 @@
|
|||||||
static int
|
static int
|
||||||
installHook(char *str)
|
installHook(char *str)
|
||||||
{
|
{
|
||||||
int rcode = 0;
|
int i;
|
||||||
|
struct disk *disks[100]; /* some ridiculously large number */
|
||||||
|
|
||||||
|
i = 0;
|
||||||
/* Clip garbage off the ends */
|
/* Clip garbage off the ends */
|
||||||
string_prune(str);
|
string_prune(str);
|
||||||
str = string_skipwhite(str);
|
str = string_skipwhite(str);
|
||||||
while (str) {
|
while (str) {
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
cp = index(str, ' ');
|
cp = index(str, '\n');
|
||||||
if (cp)
|
if (cp)
|
||||||
*cp++ = 0;
|
*cp++ = 0;
|
||||||
rcode = !device_slice_disk(str);
|
if (!*str) {
|
||||||
|
beep();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
disks[i++] = device_slice_disk(str);
|
||||||
str = cp;
|
str = cp;
|
||||||
}
|
}
|
||||||
return rcode;
|
disks[i] = NULL;
|
||||||
}
|
if (!i)
|
||||||
|
return 0;
|
||||||
/* Create a menu listing all the devices in the system. */
|
|
||||||
static DMenu *
|
|
||||||
getAllDisks(DMenu *menu, Device **rdevs)
|
|
||||||
{
|
|
||||||
Device *devices;
|
|
||||||
int numdevs;
|
|
||||||
|
|
||||||
devices = device_get_all(DEVICE_TYPE_DISK, &numdevs);
|
|
||||||
*rdevs = devices;
|
|
||||||
if (!devices) {
|
|
||||||
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.");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
Device *start;
|
#ifdef notdoneyet
|
||||||
DMenu *tmp;
|
partition_disks(disks);
|
||||||
int i;
|
if (!confirm_write(disks)) {
|
||||||
|
for (i = 0; disks[i]; i++)
|
||||||
tmp = (DMenu *)safe_malloc(sizeof(DMenu) +
|
Free_Disk(disks[i]);
|
||||||
(sizeof(DMenuItem) * (numdevs + 1)));
|
return 0;
|
||||||
bcopy(menu, tmp, sizeof(DMenu));
|
|
||||||
for (start = devices, i = 0; start->name[0]; start++, i++) {
|
|
||||||
tmp->items[i].title = start->name;
|
|
||||||
if (!strncmp(start->name, "sd", 2))
|
|
||||||
tmp->items[i].prompt = "SCSI disk";
|
|
||||||
else if (!strncmp(start->name, "wd", 2))
|
|
||||||
tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk";
|
|
||||||
else
|
|
||||||
msgFatal("Unknown disk type: %s!", start->name);
|
|
||||||
tmp->items[i].type = DMENU_CALL;
|
|
||||||
tmp->items[i].ptr = installHook;
|
|
||||||
tmp->items[i].disabled = FALSE;
|
|
||||||
}
|
}
|
||||||
tmp->items[i].type = DMENU_NOP;
|
else {
|
||||||
tmp->items[i].title = NULL;
|
make_filesystems(disks);
|
||||||
return tmp;
|
cpio_extract(disks);
|
||||||
|
extract_dists(disks);
|
||||||
|
do_final_setup(disks);
|
||||||
|
systemShutdown();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -110,9 +97,8 @@ installCustom(char *str)
|
|||||||
DMenu *menu;
|
DMenu *menu;
|
||||||
Device *devs;
|
Device *devs;
|
||||||
|
|
||||||
msgInfo("Installating the system custom");
|
|
||||||
variable_set2("install_type", "custom");
|
variable_set2("install_type", "custom");
|
||||||
menu = getAllDisks(&MenuDiskDevices, &devs);
|
menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return 0;
|
return 0;
|
||||||
choice = scroll = curr = max = 0;
|
choice = scroll = curr = max = 0;
|
||||||
@ -130,9 +116,8 @@ installExpress(char *str)
|
|||||||
DMenu *menu;
|
DMenu *menu;
|
||||||
Device *devs;
|
Device *devs;
|
||||||
|
|
||||||
msgInfo("Installating the system express");
|
|
||||||
variable_set2("install_type", "express");
|
variable_set2("install_type", "express");
|
||||||
menu = getAllDisks(&MenuDiskDevices, &devs);
|
menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return 0;
|
return 0;
|
||||||
choice = scroll = curr = max = 0;
|
choice = scroll = curr = max = 0;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last attempt in the `sysinstall' line, the next
|
* This is probably the last attempt in the `sysinstall' line, the next
|
||||||
* generation being slated for what's essentially a complete rewrite.
|
* generation being slated for what's essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: main.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -48,6 +48,10 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int choice, scroll, curr, max;
|
int choice, scroll, curr, max;
|
||||||
|
|
||||||
|
if (geteuid() != 0) {
|
||||||
|
fprintf(stderr, "This utility can only be run as root.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/* Set up whatever things need setting up */
|
/* Set up whatever things need setting up */
|
||||||
systemInitialize(argc, argv);
|
systemInitialize(argc, argv);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: menus.c,v 1.3 1995/04/29 19:33:03 jkh Exp $
|
* $Id: menus.c,v 1.4 1995/05/01 21:56:25 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -73,12 +73,8 @@ option by pressing enter.", /* prompt */
|
|||||||
DMENU_SUBMENU, (void *)&MenuDocumentation, 0 },
|
DMENU_SUBMENU, (void *)&MenuDocumentation, 0 },
|
||||||
{ "Lang", "Select natural language options.", /* L */
|
{ "Lang", "Select natural language options.", /* L */
|
||||||
DMENU_SUBMENU, (void *)&MenuLanguage, 0 },
|
DMENU_SUBMENU, (void *)&MenuLanguage, 0 },
|
||||||
{ "Express", "Express installation (don't ask)", /* E */
|
{ "Install", "Begin installation", /* I */
|
||||||
DMENU_CALL, (void *)installExpress, 0 },
|
|
||||||
{ "Custom", "Custom installation (please ask)", /* C */
|
|
||||||
DMENU_CALL, (void *)installCustom, 0 },
|
DMENU_CALL, (void *)installCustom, 0 },
|
||||||
{ "Maint", "Go into maintainance mode (`fix it').", /* M */
|
|
||||||
DMENU_CALL, (void *)installMaint, 0 },
|
|
||||||
{ "Bootmsg", "Read the boot messages again.", /* B */
|
{ "Bootmsg", "Read the boot messages again.", /* B */
|
||||||
DMENU_SYSTEM_COMMAND_BOX, (void *)"dmesg", 0 },
|
DMENU_SYSTEM_COMMAND_BOX, (void *)"dmesg", 0 },
|
||||||
{ NULL } },
|
{ NULL } },
|
||||||
@ -142,6 +138,8 @@ of the english versions.", /* prompt */
|
|||||||
DMENU_SET_VARIABLE, (void *)"LANG=ru_SU.KOI8-R", 0 },
|
DMENU_SET_VARIABLE, (void *)"LANG=ru_SU.KOI8-R", 0 },
|
||||||
{ "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
|
{ "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
|
||||||
DMENU_SET_VARIABLE, (void *)"LANG=es_ES.ISO8859-1", 0 },
|
DMENU_SET_VARIABLE, (void *)"LANG=es_ES.ISO8859-1", 0 },
|
||||||
|
{ "Swedish", "Swedish language and character set (ISO-8859-1)", /* S */
|
||||||
|
DMENU_SET_VARIABLE, (void *)"LANG=sv_SV.ISO8859-1", 0 },
|
||||||
{ NULL } },
|
{ NULL } },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -247,10 +245,11 @@ DMenu MenuDiskDevices = {
|
|||||||
FreeBSD. You need to select at least one drive containing some free\n\
|
FreeBSD. You need to select at least one drive containing some free\n\
|
||||||
space, though FreeBSD can be installed across several drives if you do\n\
|
space, though FreeBSD can be installed across several drives if you do\n\
|
||||||
not have the required space on a single drive. If you wish to boot\n\
|
not have the required space on a single drive. If you wish to boot\n\
|
||||||
off a drive that's not a `zero drive', you will have the option to install\n\
|
off a drive that's not a `zero drive', or have multiple operating\n\
|
||||||
a boot manager later.",
|
systems on your machine, you will have the option to install a boot\n\
|
||||||
"drives.hlp",
|
manager later.",
|
||||||
"Press F1 for more information on what you see here.",
|
"Press F1 for more information on what you see here.",
|
||||||
|
"drives.hlp",
|
||||||
{ { NULL } },
|
{ { NULL } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: msg.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
|
* $Id: msg.c,v 1.2 1995/05/01 21:56:29 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -44,20 +44,45 @@
|
|||||||
#include "sysinstall.h"
|
#include "sysinstall.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
/* Whack up an informational message on the status line */
|
/* Whack up an informational message on the status line, in stand-out */
|
||||||
void
|
void
|
||||||
msgInfo(char *fmt, ...)
|
msgYap(char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
errstr[0] = '\0';
|
errstr[0] = '\0';
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
attrs = getattrs(stdscr);
|
||||||
addstr(errstr);
|
attrset(A_BOLD);
|
||||||
|
mvaddstr(23, 0, errstr);
|
||||||
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
|
free(errstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Whack up an informational message on the status line */
|
||||||
|
void
|
||||||
|
msgInfo(char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
|
errstr[0] = '\0';
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
attrs = getattrs(stdscr);
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
mvaddstr(23, 0, errstr);
|
||||||
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,17 +92,19 @@ msgWarn(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
strcpy(errstr, "Warning: ");
|
strcpy(errstr, "Warning: ");
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
attrs = getattrs(stdscr);
|
||||||
beep();
|
beep();
|
||||||
standout();
|
attrset(A_BOLD);
|
||||||
addstr(errstr);
|
mvaddstr(23, 0, errstr);
|
||||||
standend();
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,17 +114,19 @@ msgError(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
strcpy(errstr, "Error: ");
|
strcpy(errstr, "Error: ");
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
|
||||||
beep();
|
beep();
|
||||||
standout();
|
attrs = getattrs(stdscr);
|
||||||
addstr(errstr);
|
attrset(A_BOLD);
|
||||||
standend();
|
mvaddstr(23, 0, errstr);
|
||||||
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,23 +136,25 @@ msgFatal(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
strcpy(errstr, "Fatal Error: ");
|
strcpy(errstr, "Fatal Error: ");
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
|
||||||
beep();
|
beep();
|
||||||
standout();
|
attrs = getattrs(stdscr);
|
||||||
addstr(errstr);
|
attrset(A_BOLD);
|
||||||
|
mvaddstr(23, 0, errstr);
|
||||||
addstr(" - ");
|
addstr(" - ");
|
||||||
addstr("PRESS ANY KEY TO ");
|
addstr("PRESS ANY KEY TO ");
|
||||||
if (getpid() == 1)
|
if (getpid() == 1)
|
||||||
addstr("REBOOT");
|
addstr("REBOOT");
|
||||||
else
|
else
|
||||||
addstr("QUIT");
|
addstr("QUIT");
|
||||||
standend();
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
getch();
|
getch();
|
||||||
systemShutdown();
|
systemShutdown();
|
||||||
@ -164,3 +195,29 @@ msgYesNo(char *fmt, ...)
|
|||||||
free(errstr);
|
free(errstr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Put up a message in an input box and return the value */
|
||||||
|
char *
|
||||||
|
msgGetInput(char *buf, char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
char *errstr;
|
||||||
|
char *ret;
|
||||||
|
static input_buffer[256];
|
||||||
|
int rval;
|
||||||
|
|
||||||
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsnprintf(errstr, FILENAME_MAX, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
use_helpline(NULL);
|
||||||
|
use_helpfile(NULL);
|
||||||
|
strcpy(input_buffer, buf);
|
||||||
|
rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer);
|
||||||
|
free(errstr);
|
||||||
|
if (!rval)
|
||||||
|
return input_buffer;
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last attempt in the `sysinstall' line, the next
|
* This is probably the last attempt in the `sysinstall' line, the next
|
||||||
* generation being slated to essentially a complete rewrite.
|
* generation being slated to essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: sysinstall.h,v 1.3 1995/04/29 19:33:05 jkh Exp $
|
* $Id: sysinstall.h,v 1.4 1995/05/01 21:56:30 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -182,11 +182,13 @@ extern int set_termcap(void);
|
|||||||
|
|
||||||
/* msg.c */
|
/* msg.c */
|
||||||
extern void msgInfo(char *fmt, ...);
|
extern void msgInfo(char *fmt, ...);
|
||||||
|
extern void msgYap(char *fmt, ...);
|
||||||
extern void msgWarn(char *fmt, ...);
|
extern void msgWarn(char *fmt, ...);
|
||||||
extern void msgError(char *fmt, ...);
|
extern void msgError(char *fmt, ...);
|
||||||
extern void msgFatal(char *fmt, ...);
|
extern void msgFatal(char *fmt, ...);
|
||||||
extern void msgConfirm(char *fmt, ...);
|
extern void msgConfirm(char *fmt, ...);
|
||||||
extern int msgYesNo(char *fmt, ...);
|
extern int msgYesNo(char *fmt, ...);
|
||||||
|
extern char *msgGetInput(char *buf, char *fmt, ...);
|
||||||
|
|
||||||
/* media.c */
|
/* media.c */
|
||||||
extern int mediaSetCDROM(char *str);
|
extern int mediaSetCDROM(char *str);
|
||||||
@ -198,7 +200,9 @@ extern int mediaSetFS(char *str);
|
|||||||
|
|
||||||
/* devices.c */
|
/* devices.c */
|
||||||
extern Device *device_get_all(DeviceType type, int *ndevs);
|
extern Device *device_get_all(DeviceType type, int *ndevs);
|
||||||
extern int device_slice_disk(char *disk);
|
extern struct disk *device_slice_disk(char *disk);
|
||||||
|
extern DMenu *device_create_disk_menu(DMenu *menu, Device **rdevs,
|
||||||
|
int (*func)());
|
||||||
|
|
||||||
/* variables.c */
|
/* variables.c */
|
||||||
extern void variable_set(char *var);
|
extern void variable_set(char *var);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
|
* $Id: devices.c,v 1.1 1995/05/01 21:56:19 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -44,6 +44,9 @@
|
|||||||
#include "sysinstall.h"
|
#include "sysinstall.h"
|
||||||
#include "libdisk.h"
|
#include "libdisk.h"
|
||||||
|
|
||||||
|
/* Where we start displaying chunk information on the screen */
|
||||||
|
#define CHUNK_START_ROW 5
|
||||||
|
|
||||||
/* Get all device information for a given device class */
|
/* Get all device information for a given device class */
|
||||||
Device *
|
Device *
|
||||||
device_get_all(DeviceType which, int *ndevs)
|
device_get_all(DeviceType which, int *ndevs)
|
||||||
@ -71,26 +74,78 @@ device_get_all(DeviceType which, int *ndevs)
|
|||||||
return devs;
|
return devs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static struct chunk *chunk_info[10];
|
||||||
device_print_chunk(struct chunk *c1, int offset, int *row)
|
static int current_chunk;
|
||||||
{
|
|
||||||
CHAR_N
|
|
||||||
|
|
||||||
if (!c1)
|
static void
|
||||||
return;
|
record_chunks(char *disk, struct disk *d)
|
||||||
mvprintw(*row++, offset, "%10lu %10lu %10lu %-8s %d %-8s %4d %lx",
|
{
|
||||||
c1->offset, c1->size, c1->end, c1->name, c1->type,
|
struct chunk *c1;
|
||||||
chunk_n[c1->type], c1->subtype, c1->flags);
|
int i = 0;
|
||||||
device_print_chunk(c1->part, offset + 2, row);
|
int last_free = 0;
|
||||||
device_print_chunk(c1->next, offset, row);
|
if (!d->chunks)
|
||||||
|
msgFatal("No chunk list found for %s!", disk);
|
||||||
|
c1 = d->chunks->part;
|
||||||
|
while (c1) {
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static void
|
||||||
|
print_chunks(char *disk, struct disk *d)
|
||||||
|
{
|
||||||
|
int row;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
mvaddstr(0, 0, "Disk name:\t");
|
||||||
|
attrset(A_BOLD); addstr(disk); attrset(A_NORMAL);
|
||||||
|
mvprintw(1, 0,
|
||||||
|
"BIOS 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",
|
||||||
|
"Subtype", "Flags");
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
|
||||||
|
if (i == current_chunk)
|
||||||
|
attrset(A_BOLD);
|
||||||
|
mvprintw(row, 2, "%10lu %10lu %10lu %8s %8d %8s %8d %6lx",
|
||||||
|
chunk_info[i]->offset, chunk_info[i]->size,
|
||||||
|
chunk_info[i]->end, chunk_info[i]->name,
|
||||||
|
chunk_info[i]->type, chunk_n[chunk_info[i]->type],
|
||||||
|
chunk_info[i]->subtype, chunk_info[i]->flags);
|
||||||
|
if (i == current_chunk)
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_command_summary()
|
||||||
|
{
|
||||||
|
mvprintw(15, 0, "The following commands are supported (in upper or lower case):");
|
||||||
|
mvprintw(17, 0, "C = Create New Partition D = Delete Partition");
|
||||||
|
mvprintw(18, 0, "B = Scan For Bad Blocks U = Undo All Changes");
|
||||||
|
mvprintw(19, 0, "ESC = Proceed to next screen");
|
||||||
|
mvprintw(21, 0, "The currently selected partition is displayed in ");
|
||||||
|
attrset(A_BOLD); addstr("bold"); attrset(A_NORMAL);
|
||||||
|
move(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct disk *
|
||||||
device_slice_disk(char *disk)
|
device_slice_disk(char *disk)
|
||||||
{
|
{
|
||||||
struct disk *d;
|
struct disk *d;
|
||||||
char *p;
|
char *p;
|
||||||
int row;
|
int key = 0;
|
||||||
|
Boolean chunking;
|
||||||
|
char *msg = NULL;
|
||||||
|
|
||||||
d = Open_Disk(disk);
|
d = Open_Disk(disk);
|
||||||
if (!d)
|
if (!d)
|
||||||
@ -100,23 +155,152 @@ device_slice_disk(char *disk)
|
|||||||
msgConfirm(p);
|
msgConfirm(p);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
while (1) {
|
chunking = TRUE;
|
||||||
|
keypad(stdscr, TRUE);
|
||||||
|
|
||||||
|
record_chunks(disk, d);
|
||||||
|
while (chunking) {
|
||||||
clear();
|
clear();
|
||||||
mvprintw(0, 0, "Disk name: %s, Flags: %lx", disk, d->flags);
|
print_chunks(disk, d);
|
||||||
mvprintw(1, 0,
|
print_command_summary();
|
||||||
"Real Geometry: %lu/%lu/%lu, BIOS Geometry: %lu/%lu/%lu [cyls/heads/sectors]",
|
if (msg) {
|
||||||
d->real_cyl, d->real_hd, d->real_sect,
|
standout(); mvprintw(23, 0, msg); standend();
|
||||||
d->bios_cyl, d->bios_hd, d->bios_sect);
|
beep();
|
||||||
mvprintw(4, 0, "%10s %10s %10s %-8s %4s %-8s %4s %4s",
|
msg = NULL;
|
||||||
"Offset", "Size", "End", "Name", "PType", "Desc",
|
}
|
||||||
"Subtype", "Flags");
|
refresh();
|
||||||
row = 5;
|
|
||||||
device_print_chunk(d->chunks, 0, &row);
|
key = getch();
|
||||||
move(23, 0);
|
switch (key) {
|
||||||
addstr("Done!");
|
case KEY_UP:
|
||||||
if (getch() == 'q')
|
case '-':
|
||||||
return 0;
|
if (current_chunk != 0)
|
||||||
|
--current_chunk;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_DOWN:
|
||||||
|
case '+':
|
||||||
|
case '\r':
|
||||||
|
case '\n':
|
||||||
|
if (chunk_info[current_chunk + 1])
|
||||||
|
++current_chunk;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_HOME:
|
||||||
|
current_chunk = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_END:
|
||||||
|
while (chunk_info[current_chunk + 1])
|
||||||
|
++current_chunk;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_F(1):
|
||||||
|
case '?':
|
||||||
|
systemDisplayFile("slice.hlp");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'B':
|
||||||
|
case 'b':
|
||||||
|
if (chunk_info[current_chunk]->type != freebsd)
|
||||||
|
msg = "Can only scan for bad blocks in FreeBSD partition.";
|
||||||
|
else
|
||||||
|
chunk_info[current_chunk]->flags |= CHUNK_BAD144;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'C':
|
||||||
|
case 'c':
|
||||||
|
if (chunk_info[current_chunk]->type != unused)
|
||||||
|
msg = "Partition in use, delete it first or move to an unused one.";
|
||||||
|
else {
|
||||||
|
char *val;
|
||||||
|
char tmp[20];
|
||||||
|
int size;
|
||||||
|
|
||||||
|
snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
|
||||||
|
val = msgGetInput(tmp, "Please specify size for new FreeBSD partition");
|
||||||
|
if (val && (size = atoi(val)) > 0) {
|
||||||
|
Create_Chunk(d, chunk_info[current_chunk]->offset,
|
||||||
|
size,
|
||||||
|
freebsd,
|
||||||
|
3,
|
||||||
|
chunk_info[current_chunk]->flags);
|
||||||
|
record_chunks(disk, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'D':
|
||||||
|
case 'd':
|
||||||
|
if (chunk_info[current_chunk]->type == unused)
|
||||||
|
msg = "Partition is already unused!";
|
||||||
|
else {
|
||||||
|
Delete_Chunk(d, chunk_info[current_chunk]);
|
||||||
|
record_chunks(disk, d);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'U':
|
||||||
|
case 'u':
|
||||||
|
Free_Disk(d);
|
||||||
|
d = Open_Disk(disk);
|
||||||
|
record_chunks(disk, d);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 27: /* ESC */
|
||||||
|
chunking = FALSE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
msg = "Invalid character typed.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clear();
|
||||||
|
refresh();
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a menu listing all the devices in the system. The pass-in menu
|
||||||
|
* is expected to be a "prototype" from which the new menu is cloned.
|
||||||
|
*/
|
||||||
|
DMenu *
|
||||||
|
device_create_disk_menu(DMenu *menu, Device **rdevs, int (*hook)())
|
||||||
|
{
|
||||||
|
Device *devices;
|
||||||
|
int numdevs;
|
||||||
|
|
||||||
|
devices = device_get_all(DEVICE_TYPE_DISK, &numdevs);
|
||||||
|
*rdevs = devices;
|
||||||
|
if (!devices) {
|
||||||
|
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.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Device *start;
|
||||||
|
DMenu *tmp;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
tmp = (DMenu *)safe_malloc(sizeof(DMenu) +
|
||||||
|
(sizeof(DMenuItem) * (numdevs + 1)));
|
||||||
|
bcopy(menu, tmp, sizeof(DMenu));
|
||||||
|
for (start = devices, i = 0; start->name[0]; start++, i++) {
|
||||||
|
tmp->items[i].title = start->name;
|
||||||
|
if (!strncmp(start->name, "sd", 2))
|
||||||
|
tmp->items[i].prompt = "SCSI disk";
|
||||||
|
else if (!strncmp(start->name, "wd", 2))
|
||||||
|
tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk";
|
||||||
|
else
|
||||||
|
msgFatal("Unknown disk type: %s!", start->name);
|
||||||
|
tmp->items[i].type = DMENU_CALL;
|
||||||
|
tmp->items[i].ptr = hook;
|
||||||
|
tmp->items[i].disabled = FALSE;
|
||||||
|
}
|
||||||
|
tmp->items[i].type = DMENU_NOP;
|
||||||
|
tmp->items[i].title = NULL;
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: install.c,v 1.3 1995/04/29 19:33:01 jkh Exp $
|
* $Id: install.c,v 1.4 1995/05/01 21:56:22 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -46,60 +46,47 @@
|
|||||||
static int
|
static int
|
||||||
installHook(char *str)
|
installHook(char *str)
|
||||||
{
|
{
|
||||||
int rcode = 0;
|
int i;
|
||||||
|
struct disk *disks[100]; /* some ridiculously large number */
|
||||||
|
|
||||||
|
i = 0;
|
||||||
/* Clip garbage off the ends */
|
/* Clip garbage off the ends */
|
||||||
string_prune(str);
|
string_prune(str);
|
||||||
str = string_skipwhite(str);
|
str = string_skipwhite(str);
|
||||||
while (str) {
|
while (str) {
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
cp = index(str, ' ');
|
cp = index(str, '\n');
|
||||||
if (cp)
|
if (cp)
|
||||||
*cp++ = 0;
|
*cp++ = 0;
|
||||||
rcode = !device_slice_disk(str);
|
if (!*str) {
|
||||||
|
beep();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
disks[i++] = device_slice_disk(str);
|
||||||
str = cp;
|
str = cp;
|
||||||
}
|
}
|
||||||
return rcode;
|
disks[i] = NULL;
|
||||||
}
|
if (!i)
|
||||||
|
return 0;
|
||||||
/* Create a menu listing all the devices in the system. */
|
|
||||||
static DMenu *
|
|
||||||
getAllDisks(DMenu *menu, Device **rdevs)
|
|
||||||
{
|
|
||||||
Device *devices;
|
|
||||||
int numdevs;
|
|
||||||
|
|
||||||
devices = device_get_all(DEVICE_TYPE_DISK, &numdevs);
|
|
||||||
*rdevs = devices;
|
|
||||||
if (!devices) {
|
|
||||||
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.");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
Device *start;
|
#ifdef notdoneyet
|
||||||
DMenu *tmp;
|
partition_disks(disks);
|
||||||
int i;
|
if (!confirm_write(disks)) {
|
||||||
|
for (i = 0; disks[i]; i++)
|
||||||
tmp = (DMenu *)safe_malloc(sizeof(DMenu) +
|
Free_Disk(disks[i]);
|
||||||
(sizeof(DMenuItem) * (numdevs + 1)));
|
return 0;
|
||||||
bcopy(menu, tmp, sizeof(DMenu));
|
|
||||||
for (start = devices, i = 0; start->name[0]; start++, i++) {
|
|
||||||
tmp->items[i].title = start->name;
|
|
||||||
if (!strncmp(start->name, "sd", 2))
|
|
||||||
tmp->items[i].prompt = "SCSI disk";
|
|
||||||
else if (!strncmp(start->name, "wd", 2))
|
|
||||||
tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk";
|
|
||||||
else
|
|
||||||
msgFatal("Unknown disk type: %s!", start->name);
|
|
||||||
tmp->items[i].type = DMENU_CALL;
|
|
||||||
tmp->items[i].ptr = installHook;
|
|
||||||
tmp->items[i].disabled = FALSE;
|
|
||||||
}
|
}
|
||||||
tmp->items[i].type = DMENU_NOP;
|
else {
|
||||||
tmp->items[i].title = NULL;
|
make_filesystems(disks);
|
||||||
return tmp;
|
cpio_extract(disks);
|
||||||
|
extract_dists(disks);
|
||||||
|
do_final_setup(disks);
|
||||||
|
systemShutdown();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -110,9 +97,8 @@ installCustom(char *str)
|
|||||||
DMenu *menu;
|
DMenu *menu;
|
||||||
Device *devs;
|
Device *devs;
|
||||||
|
|
||||||
msgInfo("Installating the system custom");
|
|
||||||
variable_set2("install_type", "custom");
|
variable_set2("install_type", "custom");
|
||||||
menu = getAllDisks(&MenuDiskDevices, &devs);
|
menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return 0;
|
return 0;
|
||||||
choice = scroll = curr = max = 0;
|
choice = scroll = curr = max = 0;
|
||||||
@ -130,9 +116,8 @@ installExpress(char *str)
|
|||||||
DMenu *menu;
|
DMenu *menu;
|
||||||
Device *devs;
|
Device *devs;
|
||||||
|
|
||||||
msgInfo("Installating the system express");
|
|
||||||
variable_set2("install_type", "express");
|
variable_set2("install_type", "express");
|
||||||
menu = getAllDisks(&MenuDiskDevices, &devs);
|
menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return 0;
|
return 0;
|
||||||
choice = scroll = curr = max = 0;
|
choice = scroll = curr = max = 0;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last attempt in the `sysinstall' line, the next
|
* This is probably the last attempt in the `sysinstall' line, the next
|
||||||
* generation being slated for what's essentially a complete rewrite.
|
* generation being slated for what's essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: main.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -48,6 +48,10 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int choice, scroll, curr, max;
|
int choice, scroll, curr, max;
|
||||||
|
|
||||||
|
if (geteuid() != 0) {
|
||||||
|
fprintf(stderr, "This utility can only be run as root.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/* Set up whatever things need setting up */
|
/* Set up whatever things need setting up */
|
||||||
systemInitialize(argc, argv);
|
systemInitialize(argc, argv);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: menus.c,v 1.3 1995/04/29 19:33:03 jkh Exp $
|
* $Id: menus.c,v 1.4 1995/05/01 21:56:25 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -73,12 +73,8 @@ option by pressing enter.", /* prompt */
|
|||||||
DMENU_SUBMENU, (void *)&MenuDocumentation, 0 },
|
DMENU_SUBMENU, (void *)&MenuDocumentation, 0 },
|
||||||
{ "Lang", "Select natural language options.", /* L */
|
{ "Lang", "Select natural language options.", /* L */
|
||||||
DMENU_SUBMENU, (void *)&MenuLanguage, 0 },
|
DMENU_SUBMENU, (void *)&MenuLanguage, 0 },
|
||||||
{ "Express", "Express installation (don't ask)", /* E */
|
{ "Install", "Begin installation", /* I */
|
||||||
DMENU_CALL, (void *)installExpress, 0 },
|
|
||||||
{ "Custom", "Custom installation (please ask)", /* C */
|
|
||||||
DMENU_CALL, (void *)installCustom, 0 },
|
DMENU_CALL, (void *)installCustom, 0 },
|
||||||
{ "Maint", "Go into maintainance mode (`fix it').", /* M */
|
|
||||||
DMENU_CALL, (void *)installMaint, 0 },
|
|
||||||
{ "Bootmsg", "Read the boot messages again.", /* B */
|
{ "Bootmsg", "Read the boot messages again.", /* B */
|
||||||
DMENU_SYSTEM_COMMAND_BOX, (void *)"dmesg", 0 },
|
DMENU_SYSTEM_COMMAND_BOX, (void *)"dmesg", 0 },
|
||||||
{ NULL } },
|
{ NULL } },
|
||||||
@ -142,6 +138,8 @@ of the english versions.", /* prompt */
|
|||||||
DMENU_SET_VARIABLE, (void *)"LANG=ru_SU.KOI8-R", 0 },
|
DMENU_SET_VARIABLE, (void *)"LANG=ru_SU.KOI8-R", 0 },
|
||||||
{ "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
|
{ "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
|
||||||
DMENU_SET_VARIABLE, (void *)"LANG=es_ES.ISO8859-1", 0 },
|
DMENU_SET_VARIABLE, (void *)"LANG=es_ES.ISO8859-1", 0 },
|
||||||
|
{ "Swedish", "Swedish language and character set (ISO-8859-1)", /* S */
|
||||||
|
DMENU_SET_VARIABLE, (void *)"LANG=sv_SV.ISO8859-1", 0 },
|
||||||
{ NULL } },
|
{ NULL } },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -247,10 +245,11 @@ DMenu MenuDiskDevices = {
|
|||||||
FreeBSD. You need to select at least one drive containing some free\n\
|
FreeBSD. You need to select at least one drive containing some free\n\
|
||||||
space, though FreeBSD can be installed across several drives if you do\n\
|
space, though FreeBSD can be installed across several drives if you do\n\
|
||||||
not have the required space on a single drive. If you wish to boot\n\
|
not have the required space on a single drive. If you wish to boot\n\
|
||||||
off a drive that's not a `zero drive', you will have the option to install\n\
|
off a drive that's not a `zero drive', or have multiple operating\n\
|
||||||
a boot manager later.",
|
systems on your machine, you will have the option to install a boot\n\
|
||||||
"drives.hlp",
|
manager later.",
|
||||||
"Press F1 for more information on what you see here.",
|
"Press F1 for more information on what you see here.",
|
||||||
|
"drives.hlp",
|
||||||
{ { NULL } },
|
{ { NULL } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: msg.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
|
* $Id: msg.c,v 1.2 1995/05/01 21:56:29 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -44,20 +44,45 @@
|
|||||||
#include "sysinstall.h"
|
#include "sysinstall.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
/* Whack up an informational message on the status line */
|
/* Whack up an informational message on the status line, in stand-out */
|
||||||
void
|
void
|
||||||
msgInfo(char *fmt, ...)
|
msgYap(char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
errstr[0] = '\0';
|
errstr[0] = '\0';
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
attrs = getattrs(stdscr);
|
||||||
addstr(errstr);
|
attrset(A_BOLD);
|
||||||
|
mvaddstr(23, 0, errstr);
|
||||||
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
|
free(errstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Whack up an informational message on the status line */
|
||||||
|
void
|
||||||
|
msgInfo(char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
|
errstr[0] = '\0';
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
attrs = getattrs(stdscr);
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
mvaddstr(23, 0, errstr);
|
||||||
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,17 +92,19 @@ msgWarn(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
strcpy(errstr, "Warning: ");
|
strcpy(errstr, "Warning: ");
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
attrs = getattrs(stdscr);
|
||||||
beep();
|
beep();
|
||||||
standout();
|
attrset(A_BOLD);
|
||||||
addstr(errstr);
|
mvaddstr(23, 0, errstr);
|
||||||
standend();
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,17 +114,19 @@ msgError(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
strcpy(errstr, "Error: ");
|
strcpy(errstr, "Error: ");
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
|
||||||
beep();
|
beep();
|
||||||
standout();
|
attrs = getattrs(stdscr);
|
||||||
addstr(errstr);
|
attrset(A_BOLD);
|
||||||
standend();
|
mvaddstr(23, 0, errstr);
|
||||||
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,23 +136,25 @@ msgFatal(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
strcpy(errstr, "Fatal Error: ");
|
strcpy(errstr, "Fatal Error: ");
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
|
||||||
beep();
|
beep();
|
||||||
standout();
|
attrs = getattrs(stdscr);
|
||||||
addstr(errstr);
|
attrset(A_BOLD);
|
||||||
|
mvaddstr(23, 0, errstr);
|
||||||
addstr(" - ");
|
addstr(" - ");
|
||||||
addstr("PRESS ANY KEY TO ");
|
addstr("PRESS ANY KEY TO ");
|
||||||
if (getpid() == 1)
|
if (getpid() == 1)
|
||||||
addstr("REBOOT");
|
addstr("REBOOT");
|
||||||
else
|
else
|
||||||
addstr("QUIT");
|
addstr("QUIT");
|
||||||
standend();
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
getch();
|
getch();
|
||||||
systemShutdown();
|
systemShutdown();
|
||||||
@ -164,3 +195,29 @@ msgYesNo(char *fmt, ...)
|
|||||||
free(errstr);
|
free(errstr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Put up a message in an input box and return the value */
|
||||||
|
char *
|
||||||
|
msgGetInput(char *buf, char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
char *errstr;
|
||||||
|
char *ret;
|
||||||
|
static input_buffer[256];
|
||||||
|
int rval;
|
||||||
|
|
||||||
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsnprintf(errstr, FILENAME_MAX, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
use_helpline(NULL);
|
||||||
|
use_helpfile(NULL);
|
||||||
|
strcpy(input_buffer, buf);
|
||||||
|
rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer);
|
||||||
|
free(errstr);
|
||||||
|
if (!rval)
|
||||||
|
return input_buffer;
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last attempt in the `sysinstall' line, the next
|
* This is probably the last attempt in the `sysinstall' line, the next
|
||||||
* generation being slated to essentially a complete rewrite.
|
* generation being slated to essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: sysinstall.h,v 1.3 1995/04/29 19:33:05 jkh Exp $
|
* $Id: sysinstall.h,v 1.4 1995/05/01 21:56:30 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -182,11 +182,13 @@ extern int set_termcap(void);
|
|||||||
|
|
||||||
/* msg.c */
|
/* msg.c */
|
||||||
extern void msgInfo(char *fmt, ...);
|
extern void msgInfo(char *fmt, ...);
|
||||||
|
extern void msgYap(char *fmt, ...);
|
||||||
extern void msgWarn(char *fmt, ...);
|
extern void msgWarn(char *fmt, ...);
|
||||||
extern void msgError(char *fmt, ...);
|
extern void msgError(char *fmt, ...);
|
||||||
extern void msgFatal(char *fmt, ...);
|
extern void msgFatal(char *fmt, ...);
|
||||||
extern void msgConfirm(char *fmt, ...);
|
extern void msgConfirm(char *fmt, ...);
|
||||||
extern int msgYesNo(char *fmt, ...);
|
extern int msgYesNo(char *fmt, ...);
|
||||||
|
extern char *msgGetInput(char *buf, char *fmt, ...);
|
||||||
|
|
||||||
/* media.c */
|
/* media.c */
|
||||||
extern int mediaSetCDROM(char *str);
|
extern int mediaSetCDROM(char *str);
|
||||||
@ -198,7 +200,9 @@ extern int mediaSetFS(char *str);
|
|||||||
|
|
||||||
/* devices.c */
|
/* devices.c */
|
||||||
extern Device *device_get_all(DeviceType type, int *ndevs);
|
extern Device *device_get_all(DeviceType type, int *ndevs);
|
||||||
extern int device_slice_disk(char *disk);
|
extern struct disk *device_slice_disk(char *disk);
|
||||||
|
extern DMenu *device_create_disk_menu(DMenu *menu, Device **rdevs,
|
||||||
|
int (*func)());
|
||||||
|
|
||||||
/* variables.c */
|
/* variables.c */
|
||||||
extern void variable_set(char *var);
|
extern void variable_set(char *var);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: install.c,v 1.2 1995/04/27 18:03:53 jkh Exp $
|
* $Id: devices.c,v 1.1 1995/05/01 21:56:19 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -44,6 +44,9 @@
|
|||||||
#include "sysinstall.h"
|
#include "sysinstall.h"
|
||||||
#include "libdisk.h"
|
#include "libdisk.h"
|
||||||
|
|
||||||
|
/* Where we start displaying chunk information on the screen */
|
||||||
|
#define CHUNK_START_ROW 5
|
||||||
|
|
||||||
/* Get all device information for a given device class */
|
/* Get all device information for a given device class */
|
||||||
Device *
|
Device *
|
||||||
device_get_all(DeviceType which, int *ndevs)
|
device_get_all(DeviceType which, int *ndevs)
|
||||||
@ -71,26 +74,78 @@ device_get_all(DeviceType which, int *ndevs)
|
|||||||
return devs;
|
return devs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static struct chunk *chunk_info[10];
|
||||||
device_print_chunk(struct chunk *c1, int offset, int *row)
|
static int current_chunk;
|
||||||
{
|
|
||||||
CHAR_N
|
|
||||||
|
|
||||||
if (!c1)
|
static void
|
||||||
return;
|
record_chunks(char *disk, struct disk *d)
|
||||||
mvprintw(*row++, offset, "%10lu %10lu %10lu %-8s %d %-8s %4d %lx",
|
{
|
||||||
c1->offset, c1->size, c1->end, c1->name, c1->type,
|
struct chunk *c1;
|
||||||
chunk_n[c1->type], c1->subtype, c1->flags);
|
int i = 0;
|
||||||
device_print_chunk(c1->part, offset + 2, row);
|
int last_free = 0;
|
||||||
device_print_chunk(c1->next, offset, row);
|
if (!d->chunks)
|
||||||
|
msgFatal("No chunk list found for %s!", disk);
|
||||||
|
c1 = d->chunks->part;
|
||||||
|
while (c1) {
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static void
|
||||||
|
print_chunks(char *disk, struct disk *d)
|
||||||
|
{
|
||||||
|
int row;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
mvaddstr(0, 0, "Disk name:\t");
|
||||||
|
attrset(A_BOLD); addstr(disk); attrset(A_NORMAL);
|
||||||
|
mvprintw(1, 0,
|
||||||
|
"BIOS 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",
|
||||||
|
"Subtype", "Flags");
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
|
||||||
|
if (i == current_chunk)
|
||||||
|
attrset(A_BOLD);
|
||||||
|
mvprintw(row, 2, "%10lu %10lu %10lu %8s %8d %8s %8d %6lx",
|
||||||
|
chunk_info[i]->offset, chunk_info[i]->size,
|
||||||
|
chunk_info[i]->end, chunk_info[i]->name,
|
||||||
|
chunk_info[i]->type, chunk_n[chunk_info[i]->type],
|
||||||
|
chunk_info[i]->subtype, chunk_info[i]->flags);
|
||||||
|
if (i == current_chunk)
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_command_summary()
|
||||||
|
{
|
||||||
|
mvprintw(15, 0, "The following commands are supported (in upper or lower case):");
|
||||||
|
mvprintw(17, 0, "C = Create New Partition D = Delete Partition");
|
||||||
|
mvprintw(18, 0, "B = Scan For Bad Blocks U = Undo All Changes");
|
||||||
|
mvprintw(19, 0, "ESC = Proceed to next screen");
|
||||||
|
mvprintw(21, 0, "The currently selected partition is displayed in ");
|
||||||
|
attrset(A_BOLD); addstr("bold"); attrset(A_NORMAL);
|
||||||
|
move(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct disk *
|
||||||
device_slice_disk(char *disk)
|
device_slice_disk(char *disk)
|
||||||
{
|
{
|
||||||
struct disk *d;
|
struct disk *d;
|
||||||
char *p;
|
char *p;
|
||||||
int row;
|
int key = 0;
|
||||||
|
Boolean chunking;
|
||||||
|
char *msg = NULL;
|
||||||
|
|
||||||
d = Open_Disk(disk);
|
d = Open_Disk(disk);
|
||||||
if (!d)
|
if (!d)
|
||||||
@ -100,23 +155,152 @@ device_slice_disk(char *disk)
|
|||||||
msgConfirm(p);
|
msgConfirm(p);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
while (1) {
|
chunking = TRUE;
|
||||||
|
keypad(stdscr, TRUE);
|
||||||
|
|
||||||
|
record_chunks(disk, d);
|
||||||
|
while (chunking) {
|
||||||
clear();
|
clear();
|
||||||
mvprintw(0, 0, "Disk name: %s, Flags: %lx", disk, d->flags);
|
print_chunks(disk, d);
|
||||||
mvprintw(1, 0,
|
print_command_summary();
|
||||||
"Real Geometry: %lu/%lu/%lu, BIOS Geometry: %lu/%lu/%lu [cyls/heads/sectors]",
|
if (msg) {
|
||||||
d->real_cyl, d->real_hd, d->real_sect,
|
standout(); mvprintw(23, 0, msg); standend();
|
||||||
d->bios_cyl, d->bios_hd, d->bios_sect);
|
beep();
|
||||||
mvprintw(4, 0, "%10s %10s %10s %-8s %4s %-8s %4s %4s",
|
msg = NULL;
|
||||||
"Offset", "Size", "End", "Name", "PType", "Desc",
|
}
|
||||||
"Subtype", "Flags");
|
refresh();
|
||||||
row = 5;
|
|
||||||
device_print_chunk(d->chunks, 0, &row);
|
key = getch();
|
||||||
move(23, 0);
|
switch (key) {
|
||||||
addstr("Done!");
|
case KEY_UP:
|
||||||
if (getch() == 'q')
|
case '-':
|
||||||
return 0;
|
if (current_chunk != 0)
|
||||||
|
--current_chunk;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_DOWN:
|
||||||
|
case '+':
|
||||||
|
case '\r':
|
||||||
|
case '\n':
|
||||||
|
if (chunk_info[current_chunk + 1])
|
||||||
|
++current_chunk;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_HOME:
|
||||||
|
current_chunk = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_END:
|
||||||
|
while (chunk_info[current_chunk + 1])
|
||||||
|
++current_chunk;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_F(1):
|
||||||
|
case '?':
|
||||||
|
systemDisplayFile("slice.hlp");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'B':
|
||||||
|
case 'b':
|
||||||
|
if (chunk_info[current_chunk]->type != freebsd)
|
||||||
|
msg = "Can only scan for bad blocks in FreeBSD partition.";
|
||||||
|
else
|
||||||
|
chunk_info[current_chunk]->flags |= CHUNK_BAD144;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'C':
|
||||||
|
case 'c':
|
||||||
|
if (chunk_info[current_chunk]->type != unused)
|
||||||
|
msg = "Partition in use, delete it first or move to an unused one.";
|
||||||
|
else {
|
||||||
|
char *val;
|
||||||
|
char tmp[20];
|
||||||
|
int size;
|
||||||
|
|
||||||
|
snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
|
||||||
|
val = msgGetInput(tmp, "Please specify size for new FreeBSD partition");
|
||||||
|
if (val && (size = atoi(val)) > 0) {
|
||||||
|
Create_Chunk(d, chunk_info[current_chunk]->offset,
|
||||||
|
size,
|
||||||
|
freebsd,
|
||||||
|
3,
|
||||||
|
chunk_info[current_chunk]->flags);
|
||||||
|
record_chunks(disk, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'D':
|
||||||
|
case 'd':
|
||||||
|
if (chunk_info[current_chunk]->type == unused)
|
||||||
|
msg = "Partition is already unused!";
|
||||||
|
else {
|
||||||
|
Delete_Chunk(d, chunk_info[current_chunk]);
|
||||||
|
record_chunks(disk, d);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'U':
|
||||||
|
case 'u':
|
||||||
|
Free_Disk(d);
|
||||||
|
d = Open_Disk(disk);
|
||||||
|
record_chunks(disk, d);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 27: /* ESC */
|
||||||
|
chunking = FALSE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
msg = "Invalid character typed.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clear();
|
||||||
|
refresh();
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a menu listing all the devices in the system. The pass-in menu
|
||||||
|
* is expected to be a "prototype" from which the new menu is cloned.
|
||||||
|
*/
|
||||||
|
DMenu *
|
||||||
|
device_create_disk_menu(DMenu *menu, Device **rdevs, int (*hook)())
|
||||||
|
{
|
||||||
|
Device *devices;
|
||||||
|
int numdevs;
|
||||||
|
|
||||||
|
devices = device_get_all(DEVICE_TYPE_DISK, &numdevs);
|
||||||
|
*rdevs = devices;
|
||||||
|
if (!devices) {
|
||||||
|
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.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Device *start;
|
||||||
|
DMenu *tmp;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
tmp = (DMenu *)safe_malloc(sizeof(DMenu) +
|
||||||
|
(sizeof(DMenuItem) * (numdevs + 1)));
|
||||||
|
bcopy(menu, tmp, sizeof(DMenu));
|
||||||
|
for (start = devices, i = 0; start->name[0]; start++, i++) {
|
||||||
|
tmp->items[i].title = start->name;
|
||||||
|
if (!strncmp(start->name, "sd", 2))
|
||||||
|
tmp->items[i].prompt = "SCSI disk";
|
||||||
|
else if (!strncmp(start->name, "wd", 2))
|
||||||
|
tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk";
|
||||||
|
else
|
||||||
|
msgFatal("Unknown disk type: %s!", start->name);
|
||||||
|
tmp->items[i].type = DMENU_CALL;
|
||||||
|
tmp->items[i].ptr = hook;
|
||||||
|
tmp->items[i].disabled = FALSE;
|
||||||
|
}
|
||||||
|
tmp->items[i].type = DMENU_NOP;
|
||||||
|
tmp->items[i].title = NULL;
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: install.c,v 1.3 1995/04/29 19:33:01 jkh Exp $
|
* $Id: install.c,v 1.4 1995/05/01 21:56:22 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -46,60 +46,47 @@
|
|||||||
static int
|
static int
|
||||||
installHook(char *str)
|
installHook(char *str)
|
||||||
{
|
{
|
||||||
int rcode = 0;
|
int i;
|
||||||
|
struct disk *disks[100]; /* some ridiculously large number */
|
||||||
|
|
||||||
|
i = 0;
|
||||||
/* Clip garbage off the ends */
|
/* Clip garbage off the ends */
|
||||||
string_prune(str);
|
string_prune(str);
|
||||||
str = string_skipwhite(str);
|
str = string_skipwhite(str);
|
||||||
while (str) {
|
while (str) {
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
cp = index(str, ' ');
|
cp = index(str, '\n');
|
||||||
if (cp)
|
if (cp)
|
||||||
*cp++ = 0;
|
*cp++ = 0;
|
||||||
rcode = !device_slice_disk(str);
|
if (!*str) {
|
||||||
|
beep();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
disks[i++] = device_slice_disk(str);
|
||||||
str = cp;
|
str = cp;
|
||||||
}
|
}
|
||||||
return rcode;
|
disks[i] = NULL;
|
||||||
}
|
if (!i)
|
||||||
|
return 0;
|
||||||
/* Create a menu listing all the devices in the system. */
|
|
||||||
static DMenu *
|
|
||||||
getAllDisks(DMenu *menu, Device **rdevs)
|
|
||||||
{
|
|
||||||
Device *devices;
|
|
||||||
int numdevs;
|
|
||||||
|
|
||||||
devices = device_get_all(DEVICE_TYPE_DISK, &numdevs);
|
|
||||||
*rdevs = devices;
|
|
||||||
if (!devices) {
|
|
||||||
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.");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
Device *start;
|
#ifdef notdoneyet
|
||||||
DMenu *tmp;
|
partition_disks(disks);
|
||||||
int i;
|
if (!confirm_write(disks)) {
|
||||||
|
for (i = 0; disks[i]; i++)
|
||||||
tmp = (DMenu *)safe_malloc(sizeof(DMenu) +
|
Free_Disk(disks[i]);
|
||||||
(sizeof(DMenuItem) * (numdevs + 1)));
|
return 0;
|
||||||
bcopy(menu, tmp, sizeof(DMenu));
|
|
||||||
for (start = devices, i = 0; start->name[0]; start++, i++) {
|
|
||||||
tmp->items[i].title = start->name;
|
|
||||||
if (!strncmp(start->name, "sd", 2))
|
|
||||||
tmp->items[i].prompt = "SCSI disk";
|
|
||||||
else if (!strncmp(start->name, "wd", 2))
|
|
||||||
tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk";
|
|
||||||
else
|
|
||||||
msgFatal("Unknown disk type: %s!", start->name);
|
|
||||||
tmp->items[i].type = DMENU_CALL;
|
|
||||||
tmp->items[i].ptr = installHook;
|
|
||||||
tmp->items[i].disabled = FALSE;
|
|
||||||
}
|
}
|
||||||
tmp->items[i].type = DMENU_NOP;
|
else {
|
||||||
tmp->items[i].title = NULL;
|
make_filesystems(disks);
|
||||||
return tmp;
|
cpio_extract(disks);
|
||||||
|
extract_dists(disks);
|
||||||
|
do_final_setup(disks);
|
||||||
|
systemShutdown();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -110,9 +97,8 @@ installCustom(char *str)
|
|||||||
DMenu *menu;
|
DMenu *menu;
|
||||||
Device *devs;
|
Device *devs;
|
||||||
|
|
||||||
msgInfo("Installating the system custom");
|
|
||||||
variable_set2("install_type", "custom");
|
variable_set2("install_type", "custom");
|
||||||
menu = getAllDisks(&MenuDiskDevices, &devs);
|
menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return 0;
|
return 0;
|
||||||
choice = scroll = curr = max = 0;
|
choice = scroll = curr = max = 0;
|
||||||
@ -130,9 +116,8 @@ installExpress(char *str)
|
|||||||
DMenu *menu;
|
DMenu *menu;
|
||||||
Device *devs;
|
Device *devs;
|
||||||
|
|
||||||
msgInfo("Installating the system express");
|
|
||||||
variable_set2("install_type", "express");
|
variable_set2("install_type", "express");
|
||||||
menu = getAllDisks(&MenuDiskDevices, &devs);
|
menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return 0;
|
return 0;
|
||||||
choice = scroll = curr = max = 0;
|
choice = scroll = curr = max = 0;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last attempt in the `sysinstall' line, the next
|
* This is probably the last attempt in the `sysinstall' line, the next
|
||||||
* generation being slated for what's essentially a complete rewrite.
|
* generation being slated for what's essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: main.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -48,6 +48,10 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int choice, scroll, curr, max;
|
int choice, scroll, curr, max;
|
||||||
|
|
||||||
|
if (geteuid() != 0) {
|
||||||
|
fprintf(stderr, "This utility can only be run as root.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/* Set up whatever things need setting up */
|
/* Set up whatever things need setting up */
|
||||||
systemInitialize(argc, argv);
|
systemInitialize(argc, argv);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: menus.c,v 1.3 1995/04/29 19:33:03 jkh Exp $
|
* $Id: menus.c,v 1.4 1995/05/01 21:56:25 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -73,12 +73,8 @@ option by pressing enter.", /* prompt */
|
|||||||
DMENU_SUBMENU, (void *)&MenuDocumentation, 0 },
|
DMENU_SUBMENU, (void *)&MenuDocumentation, 0 },
|
||||||
{ "Lang", "Select natural language options.", /* L */
|
{ "Lang", "Select natural language options.", /* L */
|
||||||
DMENU_SUBMENU, (void *)&MenuLanguage, 0 },
|
DMENU_SUBMENU, (void *)&MenuLanguage, 0 },
|
||||||
{ "Express", "Express installation (don't ask)", /* E */
|
{ "Install", "Begin installation", /* I */
|
||||||
DMENU_CALL, (void *)installExpress, 0 },
|
|
||||||
{ "Custom", "Custom installation (please ask)", /* C */
|
|
||||||
DMENU_CALL, (void *)installCustom, 0 },
|
DMENU_CALL, (void *)installCustom, 0 },
|
||||||
{ "Maint", "Go into maintainance mode (`fix it').", /* M */
|
|
||||||
DMENU_CALL, (void *)installMaint, 0 },
|
|
||||||
{ "Bootmsg", "Read the boot messages again.", /* B */
|
{ "Bootmsg", "Read the boot messages again.", /* B */
|
||||||
DMENU_SYSTEM_COMMAND_BOX, (void *)"dmesg", 0 },
|
DMENU_SYSTEM_COMMAND_BOX, (void *)"dmesg", 0 },
|
||||||
{ NULL } },
|
{ NULL } },
|
||||||
@ -142,6 +138,8 @@ of the english versions.", /* prompt */
|
|||||||
DMENU_SET_VARIABLE, (void *)"LANG=ru_SU.KOI8-R", 0 },
|
DMENU_SET_VARIABLE, (void *)"LANG=ru_SU.KOI8-R", 0 },
|
||||||
{ "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
|
{ "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
|
||||||
DMENU_SET_VARIABLE, (void *)"LANG=es_ES.ISO8859-1", 0 },
|
DMENU_SET_VARIABLE, (void *)"LANG=es_ES.ISO8859-1", 0 },
|
||||||
|
{ "Swedish", "Swedish language and character set (ISO-8859-1)", /* S */
|
||||||
|
DMENU_SET_VARIABLE, (void *)"LANG=sv_SV.ISO8859-1", 0 },
|
||||||
{ NULL } },
|
{ NULL } },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -247,10 +245,11 @@ DMenu MenuDiskDevices = {
|
|||||||
FreeBSD. You need to select at least one drive containing some free\n\
|
FreeBSD. You need to select at least one drive containing some free\n\
|
||||||
space, though FreeBSD can be installed across several drives if you do\n\
|
space, though FreeBSD can be installed across several drives if you do\n\
|
||||||
not have the required space on a single drive. If you wish to boot\n\
|
not have the required space on a single drive. If you wish to boot\n\
|
||||||
off a drive that's not a `zero drive', you will have the option to install\n\
|
off a drive that's not a `zero drive', or have multiple operating\n\
|
||||||
a boot manager later.",
|
systems on your machine, you will have the option to install a boot\n\
|
||||||
"drives.hlp",
|
manager later.",
|
||||||
"Press F1 for more information on what you see here.",
|
"Press F1 for more information on what you see here.",
|
||||||
|
"drives.hlp",
|
||||||
{ { NULL } },
|
{ { NULL } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: msg.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
|
* $Id: msg.c,v 1.2 1995/05/01 21:56:29 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -44,20 +44,45 @@
|
|||||||
#include "sysinstall.h"
|
#include "sysinstall.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
/* Whack up an informational message on the status line */
|
/* Whack up an informational message on the status line, in stand-out */
|
||||||
void
|
void
|
||||||
msgInfo(char *fmt, ...)
|
msgYap(char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
errstr[0] = '\0';
|
errstr[0] = '\0';
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
attrs = getattrs(stdscr);
|
||||||
addstr(errstr);
|
attrset(A_BOLD);
|
||||||
|
mvaddstr(23, 0, errstr);
|
||||||
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
|
free(errstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Whack up an informational message on the status line */
|
||||||
|
void
|
||||||
|
msgInfo(char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
|
errstr[0] = '\0';
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
attrs = getattrs(stdscr);
|
||||||
|
attrset(A_NORMAL);
|
||||||
|
mvaddstr(23, 0, errstr);
|
||||||
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,17 +92,19 @@ msgWarn(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
strcpy(errstr, "Warning: ");
|
strcpy(errstr, "Warning: ");
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
attrs = getattrs(stdscr);
|
||||||
beep();
|
beep();
|
||||||
standout();
|
attrset(A_BOLD);
|
||||||
addstr(errstr);
|
mvaddstr(23, 0, errstr);
|
||||||
standend();
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,17 +114,19 @@ msgError(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
strcpy(errstr, "Error: ");
|
strcpy(errstr, "Error: ");
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
|
||||||
beep();
|
beep();
|
||||||
standout();
|
attrs = getattrs(stdscr);
|
||||||
addstr(errstr);
|
attrset(A_BOLD);
|
||||||
standend();
|
mvaddstr(23, 0, errstr);
|
||||||
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,23 +136,25 @@ msgFatal(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *errstr;
|
char *errstr;
|
||||||
|
int attrs;
|
||||||
|
|
||||||
errstr = (char *)malloc(FILENAME_MAX);
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
strcpy(errstr, "Fatal Error: ");
|
strcpy(errstr, "Fatal Error: ");
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
move(25, 0);
|
|
||||||
beep();
|
beep();
|
||||||
standout();
|
attrs = getattrs(stdscr);
|
||||||
addstr(errstr);
|
attrset(A_BOLD);
|
||||||
|
mvaddstr(23, 0, errstr);
|
||||||
addstr(" - ");
|
addstr(" - ");
|
||||||
addstr("PRESS ANY KEY TO ");
|
addstr("PRESS ANY KEY TO ");
|
||||||
if (getpid() == 1)
|
if (getpid() == 1)
|
||||||
addstr("REBOOT");
|
addstr("REBOOT");
|
||||||
else
|
else
|
||||||
addstr("QUIT");
|
addstr("QUIT");
|
||||||
standend();
|
attrset(attrs);
|
||||||
|
refresh();
|
||||||
free(errstr);
|
free(errstr);
|
||||||
getch();
|
getch();
|
||||||
systemShutdown();
|
systemShutdown();
|
||||||
@ -164,3 +195,29 @@ msgYesNo(char *fmt, ...)
|
|||||||
free(errstr);
|
free(errstr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Put up a message in an input box and return the value */
|
||||||
|
char *
|
||||||
|
msgGetInput(char *buf, char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
char *errstr;
|
||||||
|
char *ret;
|
||||||
|
static input_buffer[256];
|
||||||
|
int rval;
|
||||||
|
|
||||||
|
errstr = (char *)malloc(FILENAME_MAX);
|
||||||
|
va_start(args, fmt);
|
||||||
|
vsnprintf(errstr, FILENAME_MAX, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
use_helpline(NULL);
|
||||||
|
use_helpfile(NULL);
|
||||||
|
strcpy(input_buffer, buf);
|
||||||
|
rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer);
|
||||||
|
free(errstr);
|
||||||
|
if (!rval)
|
||||||
|
return input_buffer;
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last attempt in the `sysinstall' line, the next
|
* This is probably the last attempt in the `sysinstall' line, the next
|
||||||
* generation being slated to essentially a complete rewrite.
|
* generation being slated to essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: sysinstall.h,v 1.3 1995/04/29 19:33:05 jkh Exp $
|
* $Id: sysinstall.h,v 1.4 1995/05/01 21:56:30 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -182,11 +182,13 @@ extern int set_termcap(void);
|
|||||||
|
|
||||||
/* msg.c */
|
/* msg.c */
|
||||||
extern void msgInfo(char *fmt, ...);
|
extern void msgInfo(char *fmt, ...);
|
||||||
|
extern void msgYap(char *fmt, ...);
|
||||||
extern void msgWarn(char *fmt, ...);
|
extern void msgWarn(char *fmt, ...);
|
||||||
extern void msgError(char *fmt, ...);
|
extern void msgError(char *fmt, ...);
|
||||||
extern void msgFatal(char *fmt, ...);
|
extern void msgFatal(char *fmt, ...);
|
||||||
extern void msgConfirm(char *fmt, ...);
|
extern void msgConfirm(char *fmt, ...);
|
||||||
extern int msgYesNo(char *fmt, ...);
|
extern int msgYesNo(char *fmt, ...);
|
||||||
|
extern char *msgGetInput(char *buf, char *fmt, ...);
|
||||||
|
|
||||||
/* media.c */
|
/* media.c */
|
||||||
extern int mediaSetCDROM(char *str);
|
extern int mediaSetCDROM(char *str);
|
||||||
@ -198,7 +200,9 @@ extern int mediaSetFS(char *str);
|
|||||||
|
|
||||||
/* devices.c */
|
/* devices.c */
|
||||||
extern Device *device_get_all(DeviceType type, int *ndevs);
|
extern Device *device_get_all(DeviceType type, int *ndevs);
|
||||||
extern int device_slice_disk(char *disk);
|
extern struct disk *device_slice_disk(char *disk);
|
||||||
|
extern DMenu *device_create_disk_menu(DMenu *menu, Device **rdevs,
|
||||||
|
int (*func)());
|
||||||
|
|
||||||
/* variables.c */
|
/* variables.c */
|
||||||
extern void variable_set(char *var);
|
extern void variable_set(char *var);
|
||||||
|
Loading…
Reference in New Issue
Block a user