summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-05 23:47:47 +0000
committerjkh <jkh@FreeBSD.org>1995-05-05 23:47:47 +0000
commit5d77b2037bd2957e492a7f71d3c5c24aa1acd977 (patch)
tree72d06abaf97eae38b135d8d052df7300f82c0063
parent4577466eb8a6f81f81486ed5ae680e9b021dacfb (diff)
downloadFreeBSD-src-5d77b2037bd2957e492a7f71d3c5c24aa1acd977.zip
FreeBSD-src-5d77b2037bd2957e492a7f71d3c5c24aa1acd977.tar.gz
All the editors are finished. Now if I can just get a problem with libdisk
fixed, we should be able to fully set up the user's disk. Still to come with next commit: filesystem setup, distribution extraction, final configuration.
-rw-r--r--release/sysinstall/Makefile27
-rw-r--r--release/sysinstall/devices.c17
-rw-r--r--release/sysinstall/disks.c359
-rw-r--r--release/sysinstall/install.c7
-rw-r--r--release/sysinstall/lang.c63
-rw-r--r--release/sysinstall/menus.c8
-rw-r--r--release/sysinstall/msg.c24
-rw-r--r--release/sysinstall/sysinstall.h30
-rw-r--r--release/sysinstall/system.c46
-rw-r--r--release/sysinstall/termcap.c21
-rw-r--r--usr.sbin/sade/Makefile27
-rw-r--r--usr.sbin/sade/devices.c17
-rw-r--r--usr.sbin/sade/disks.c359
-rw-r--r--usr.sbin/sade/install.c7
-rw-r--r--usr.sbin/sade/menus.c8
-rw-r--r--usr.sbin/sade/msg.c24
-rw-r--r--usr.sbin/sade/sade.h30
-rw-r--r--usr.sbin/sade/system.c46
-rw-r--r--usr.sbin/sade/termcap.c21
-rw-r--r--usr.sbin/sysinstall/Makefile27
-rw-r--r--usr.sbin/sysinstall/devices.c17
-rw-r--r--usr.sbin/sysinstall/disks.c359
-rw-r--r--usr.sbin/sysinstall/install.c7
-rw-r--r--usr.sbin/sysinstall/menus.c8
-rw-r--r--usr.sbin/sysinstall/msg.c24
-rw-r--r--usr.sbin/sysinstall/sysinstall.h30
-rw-r--r--usr.sbin/sysinstall/system.c46
-rw-r--r--usr.sbin/sysinstall/termcap.c21
28 files changed, 1544 insertions, 136 deletions
diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile
index f2fa070..848f279 100644
--- a/release/sysinstall/Makefile
+++ b/release/sysinstall/Makefile
@@ -4,7 +4,7 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel
-SRCS = globals.c main.c dmenu.c menus.c \
+SRCS= globals.c main.c dmenu.c menus.c \
misc.c msg.c system.c install.c \
termcap.c makedevs.c media.c variable.c \
devices.c dist.c lang.c wizard.c \
@@ -12,9 +12,14 @@ SRCS = globals.c main.c dmenu.c menus.c \
CFLAGS += -Wall -g -I${.CURDIR}/../libdisk
-LDADD = -ldialog -lncurses -lmytinfo -L${.CURDIR}/../libdisk -ldisk
+LDADD= -ldialog -lncurses -lmytinfo
+.if exists(${.CURDIR}/../libdisk/obj)
+LDADD+= -L${.CURDIR}/../libdisk/obj -ldisk
+.else
+LDADD+= -L${.CURDIR}/../libdisk -ldisk
+.endif
-DPADD = ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
+DPADD= ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
.if exists(${.CURDIR}/../../sys/i386/boot/biosboot/obj)
BOOTS=${.CURDIR}/../../sys/i386/boot/biosboot/obj
@@ -29,6 +34,7 @@ makedevs.c: dev2c.sh Makefile rtermcap
# sh ${.CURDIR}/dev2c.sh dev > makedevs.tmp
# rm -rf dev
rm -f makedevs.tmp
+ echo '#include <sys/types.h>' > makedevs.tmp
uudecode < ${.CURDIR}/bteasy17.uu
file2c 'const unsigned char boot0[] = {' '};' \
< bteasy17 >> makedevs.tmp
@@ -49,12 +55,27 @@ makedevs.c: dev2c.sh Makefile rtermcap
./rtermcap cons25r-m | \
file2c 'const char termcap_cons25r_m[] = {' ',0};' \
>> makedevs.tmp
+ ./rtermcap cons25l1 | \
+ file2c 'const char termcap_cons25l1[] = {' ',0};' \
+ >> makedevs.tmp
./rtermcap cons25l1-m | \
file2c 'const char termcap_cons25l1_m[] = {' ',0};' \
>> makedevs.tmp
./rtermcap vt100 | \
file2c 'const char termcap_vt100[] = {' ',0};' \
>> makedevs.tmp
+ file2c 'const u_char font_iso_8x14[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/fonts/iso-8x14.fnt \
+ >> makedevs.tmp
+ file2c 'const u_char font_cp850_8x14[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/fonts/cp850-8x14.fnt \
+ >> makedevs.tmp
+ file2c 'const u_char font_koi8_r_8x14[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/fonts/koi8-r-8x14.fnt \
+ >> makedevs.tmp
+ file2c 'const u_char koi8_r2cp866[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/scrnmaps/koi8-r2cp866 \
+ >> makedevs.tmp
mv makedevs.tmp makedevs.c
rtermcap: ${.CURDIR}/rtermcap.c
diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c
index 582db23..69e1be2 100644
--- a/release/sysinstall/devices.c
+++ b/release/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.3 1995/05/04 19:48:09 jkh Exp $
+ * $Id: devices.c,v 1.2 1995/05/04 03:51:14 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -102,10 +102,11 @@ print_chunks(struct disk *d)
{
int row;
int i;
+ int b_attr = ColorDisplay ? A_BOLD : A_UNDERLINE;
attrset(A_NORMAL);
mvaddstr(0, 0, "Disk name:\t");
- attrset(A_BOLD); addstr(d->name); attrset(A_NORMAL);
+ attrset(b_attr); addstr(d->name); attrset(A_NORMAL);
attrset(A_REVERSE); mvaddstr(0, 55, "Master Partition Editor"); attrset(A_NORMAL);
mvprintw(1, 0,
"BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
@@ -115,7 +116,7 @@ print_chunks(struct disk *d)
"Subtype", "Flags");
for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
if (i == current_chunk)
- attrset(A_BOLD);
+ attrset(b_attr);
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,
@@ -129,13 +130,15 @@ print_chunks(struct disk *d)
static void
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 ");
- attrset(A_BOLD); addstr("bold"); attrset(A_NORMAL);
+ attrset(b_attr); addstr(ColorDisplay ? "bold" : "underline"); attrset(A_NORMAL);
move(0, 0);
}
@@ -212,8 +215,7 @@ device_slice_disk(struct disk *d)
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];
+ char *val, tmp[20];
int size;
snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
@@ -223,7 +225,8 @@ device_slice_disk(struct disk *d)
size,
freebsd,
3,
- chunk_info[current_chunk]->flags);
+ (chunk_info[current_chunk]->flags &
+ CHUNK_ALIGN));
record_chunks(d);
}
}
diff --git a/release/sysinstall/disks.c b/release/sysinstall/disks.c
index 0313372..be7d803 100644
--- a/release/sysinstall/disks.c
+++ b/release/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: install.c,v 1.5 1995/05/04 03:51:16 jkh Exp $
+ * $Id$
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -42,17 +42,370 @@
*/
#include "sysinstall.h"
+#include <ctype.h>
+
+/*
+ * I make some pretty gross assumptions about having a max of 50 chunks
+ * total - 8 slices and 42 partitions. I can't easily display many more
+ * than that on the screen at once!
+ *
+ * For 2.1 I'll revisit this and try to make it more dynamic, but since
+ * this will catch 99.99% of all possible cases, I'm not too worried.
+ */
+
+#define MAX_CHUNKS 50
+
+#define FS_SWAP 1
+
+/* Where to start printing the freebsd slices */
+#define CHUNK_SLICE_START_ROW 2
+#define CHUNK_PART_START_ROW 10
+
+/* 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;
+} fbsd_chunk_info[MAX_CHUNKS + 1];
+static int current_chunk;
+
/* If the given disk has a root partition on it, return TRUE */
static Boolean
contains_root_partition(struct disk *d)
{
+ struct chunk *c1;
+
+ if (!d->chunks)
+ msgFatal("Disk %s has no chunks!", d->name);
+ c1 = d->chunks->part;
+ while (c1) {
+ if (c1->type == freebsd) {
+ struct chunk *c2 = c1->part;
+
+ while (c2) {
+ if (c2->flags & CHUNK_IS_ROOT)
+ return TRUE;
+ c2 = c2->next;
+ }
+ }
+ c1 = c1->next;
+ }
+ return FALSE;
+}
+
+static Boolean
+check_conflict(char *name)
+{
+ int i;
+
+ for (i = 0; fbsd_chunk_info[i].d; i++)
+ if (fbsd_chunk_info[i].type == PART_FILESYSTEM &&
+ !strcmp(fbsd_chunk_info[i].c->name, name))
+ return TRUE;
return FALSE;
}
+static int
+space_free(struct chunk *c)
+{
+ struct chunk *c1 = c->part;
+ int sz = c->size;
+
+ while (c1) {
+ if (c1->type != unused)
+ sz -= c1->size;
+ c1 = c1->next;
+ }
+ if (sz < 0)
+ msgFatal("Partitions are larger than actual chunk??");
+ return sz;
+}
+
+static void
+record_fbsd_chunks(struct disk **disks)
+{
+ int i, j, p;
+
+ j = p = 0;
+ 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;
+
+ fbsd_chunk_info[j].type = PART_SLICE;
+ fbsd_chunk_info[j].d = disks[i];
+ fbsd_chunk_info[j].c = c1;
+ fbsd_chunk_info[j++].p = NULL;
+ while (c2) {
+ if (c2->type == part) {
+ if (c2->subtype == FS_SWAP)
+ fbsd_chunk_info[j].type = PART_SWAP;
+ else
+ fbsd_chunk_info[j].type = PART_FILESYSTEM;
+ fbsd_chunk_info[j].d = disks[i];
+ fbsd_chunk_info[j].c = c2;
+ fbsd_chunk_info[j++].p = c2->private;
+ }
+ c2 = c2->next;
+ }
+ }
+ c1 = c1->next;
+ }
+ }
+ fbsd_chunk_info[j].d = NULL;
+ fbsd_chunk_info[j].c = NULL;
+}
+
+int
+get_mountpoint(struct chunk *c)
+{
+ char *val;
+ struct part_info *part;
+
+ val = msgGetInput(c->private,
+ "Please specify mount point for new partition");
+ if (val) {
+ if (!strcmp(val, "/")) {
+ if (c->flags & CHUNK_PAST_1024) {
+msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
+ return 1;
+ }
+ c->flags |= CHUNK_IS_ROOT;
+ }
+ if (check_conflict(val)) {
+ msgConfirm("You already have a mountpoint for %s assigned!", val);
+ return 1;
+ }
+ safe_free(c->private);
+ part = (struct part_info *)malloc(sizeof(struct part_info));
+ strncpy(part->mountpoint, val, FILENAME_MAX);
+ part->newfs = TRUE;
+ c->private = (void *)part;
+ c->private_free = free;
+ return 0;
+ }
+ return 1;
+}
+
+static part_type
+get_partition_type(struct chunk *c)
+{
+ char selection[20];
+ static unsigned char *fs_types[] = {
+ "Swap",
+ "A swap partition.",
+ "FS",
+ "A file system",
+ };
+
+ if (!dialog_menu("Please choose a partition type",
+ "If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL)) {
+ if (!strcmp(selection, "FS"))
+ return PART_FILESYSTEM;
+ else if (!strcmp(selection, "Swap"))
+ return PART_SWAP;
+ }
+ return PART_NONE;
+}
+
+#define PART_PART_COL 0
+#define PART_MOUNT_COL 8
+#define PART_NEWFS_COL 32
+#define PART_OFF 40
+
+static void
+print_fbsd_chunks(void)
+{
+ int i, srow, prow, pcol;
+ int sz;
+
+ attrset(A_REVERSE);
+ mvaddstr(0, 25, "FreeBSD Partition Editor");
+ attrset(A_NORMAL);
+
+ for (i = 0; i < 2; i++) {
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF),
+ "Part");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF),
+ "Mount");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF),
+ "Newfs");
+ attrset(A_NORMAL);
+ }
+
+ srow = CHUNK_SLICE_START_ROW;
+ prow = CHUNK_PART_START_ROW;
+
+ for (i = 0; fbsd_chunk_info[i].d; i++) {
+ if (i == current_chunk)
+ attrset(A_BOLD);
+ if (fbsd_chunk_info[i].type == PART_SLICE) {
+ sz = space_free(fbsd_chunk_info[i].c);
+ mvprintw(srow++, 0,
+ "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)",
+ fbsd_chunk_info[i].d->name,
+ fbsd_chunk_info[i].c->name, sz, (sz / 2048));
+ }
+ else {
+ /* Go for two columns */
+ if (prow == (CHUNK_PART_START_ROW + 9))
+ pcol = PART_OFF;
+ else
+ pcol = 0;
+ mvaddstr(prow, pcol + PART_PART_COL, fbsd_chunk_info[i].c->name);
+ if (fbsd_chunk_info[i].type == PART_FILESYSTEM) {
+ 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";
+ }
+ else {
+ mountpoint = "?";
+ newfs = "";
+ }
+ mvaddstr(prow, pcol + PART_MOUNT_COL, mountpoint);
+ mvaddstr(prow, pcol + PART_NEWFS_COL, newfs);
+ }
+ else
+ mvaddstr(prow, pcol + PART_MOUNT_COL, "swap");
+ ++prow;
+ }
+ if (i == current_chunk)
+ attrset(A_NORMAL);
+ }
+}
+
+static void
+print_command_summary()
+{
+ int attrs = ColorDisplay ? A_BOLD : A_UNDERLINE;
+
+ mvprintw(19, 0,
+ "The following commands are valid here (upper or lower case):");
+ mvprintw(20, 0, "C = Create FreeBSD Partition D = Delete Partition");
+ mvprintw(21, 0, "M = Mount Partition (no newfs) ESC = Proceed to summary screen");
+ mvprintw(22, 0, "The default target will be displayed in ");
+
+ attrset(attrs);
+ addstr(ColorDisplay ? "bold" : "underline");
+ attrset(A_NORMAL);
+ move(0, 0);
+}
+
void
-partition_disk(struct disk *d)
+partition_disks(struct disk **disks)
{
+ int sz, key = 0;
+ Boolean partitioning;
+ char *msg = NULL;
+
+ dialog_clear();
+ partitioning = TRUE;
+ keypad(stdscr, TRUE);
+ record_fbsd_chunks(disks);
+
+ while (partitioning) {
+ clear();
+ print_fbsd_chunks();
+ print_command_summary();
+ if (msg) {
+ standout(); mvprintw(23, 0, msg); standend();
+ beep();
+ msg = NULL;
+ }
+ refresh();
+ key = toupper(getch());
+ switch (key) {
+ case KEY_UP:
+ case '-':
+ if (current_chunk != 0)
+ --current_chunk;
+ break;
+
+ case KEY_DOWN:
+ case '+':
+ case '\r':
+ case '\n':
+ if (fbsd_chunk_info[current_chunk + 1].d)
+ ++current_chunk;
+ break;
+
+ case KEY_HOME:
+ current_chunk = 0;
+ break;
+
+ case KEY_END:
+ while (fbsd_chunk_info[current_chunk + 1].d)
+ ++current_chunk;
+ break;
+
+ case KEY_F(1):
+ case '?':
+ systemDisplayFile("partitioning.hlp");
+ break;
+
+ case 'C':
+ if (fbsd_chunk_info[current_chunk].type != PART_SLICE) {
+ msg = "Can only create sub-partitions in a master partition (at top)";
+ break;
+ }
+ sz = space_free(fbsd_chunk_info[current_chunk].c);
+ if (sz <= FS_MIN_SIZE)
+ msg = "Not enough space to create additional FreeBSD partition";
+ else {
+ char *val, tmp[20];
+ int size;
+
+ 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;
+
+ if (get_mountpoint(fbsd_chunk_info[current_chunk].c))
+ break;
+ type = get_partition_type(fbsd_chunk_info[current_chunk].c);
+ if (type == PART_NONE)
+ break;
+ Create_Chunk(fbsd_chunk_info[current_chunk].d,
+ fbsd_chunk_info[current_chunk].c->offset,
+ size,
+ part,
+ type == PART_SWAP ? FS_SWAP : freebsd,
+ fbsd_chunk_info[current_chunk].c->flags);
+ record_fbsd_chunks(disks);
+ }
+ }
+ break;
+
+ case 27: /* ESC */
+ partitioning = FALSE;
+ break;
+ }
+ }
}
int
@@ -71,7 +424,9 @@ write_disks(struct disk **disks)
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);
+#if 0
Write_Disk(disks[i]);
+#endif
}
return 0;
}
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index f64562c..8bb677c 100644
--- a/release/sysinstall/install.c
+++ b/release/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.6 1995/05/04 19:48:11 jkh Exp $
+ * $Id: install.c,v 1.5 1995/05/04 03:51:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -81,8 +81,7 @@ installHook(char *str)
for (i = 0; disks[i]; i++)
disks[i] = device_slice_disk(disks[i]);
- for (i = 0; disks[i]; i++)
- partition_disk(disks[i]);
+ partition_disks(disks);
if (!write_disks(disks)) {
make_filesystems(disks);
@@ -94,7 +93,7 @@ installHook(char *str)
}
else {
dialog_clear();
- if (msgYesNo("Would you like to go back to the master partition menu?")) {
+ if (msgYesNo("Would you like to go back to the Master Partition Editor?")) {
for (i = 0; disks[i]; i++)
Free_Disk(disks[i]);
break;
diff --git a/release/sysinstall/lang.c b/release/sysinstall/lang.c
index bcf7e52..7f9d16d 100644
--- a/release/sysinstall/lang.c
+++ b/release/sysinstall/lang.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: menus.c,v 1.5 1995/05/04 03:51:19 jkh Exp $
+ * $Id: lang.c,v 1.1 1995/05/04 19:48:12 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -46,81 +46,100 @@
void
lang_set_Danish(char *str)
{
- systemChangeFont("iso-8x14");
+ systemChangeFont(font_iso_8x14);
systemChangeLang("da_DK.ISO8859-1");
- systemChangeTerminal("cons25l1", "cons25l1_m");
+ systemChangeTerminal("cons25l1", termcap_cons25l1,
+ "cons25l1-m", termcap_cons25l1_m);
}
void
lang_set_Dutch(char *str)
{
- systemChangeFont("iso-8x14");
+ systemChangeFont(font_iso_8x14);
systemChangeLang("nl_NL.ISO8859-1");
- systemChangeTerminal("cons25l1", "cons25l1_m");
+ systemChangeTerminal("cons25l1", termcap_cons25l1,
+ "cons25l1-m", termcap_cons25l1_m);
}
void
lang_set_English(char *str)
{
- systemChangeFont("cp850-8x14");
+ systemChangeFont("font_cp850_8x14");
systemChangeLang("en_US.ISO8859-1");
- systemChangeTerminal("cons25", "cons25_m");
+ systemChangeTerminal("cons25", termcap_cons25,
+ "cons25-m", termcap_cons25_m);
}
void
lang_set_French(char *str)
{
- systemChangeFont("iso-8x14");
+ systemChangeFont(font_iso_8x14);
systemChangeLang("fr_FR.ISO8859-1");
- systemChangeTerminal("cons25l1", "cons25l1_m");
+ systemChangeTerminal("cons25l1", termcap_cons25l1,
+ "cons25l1-m", termcap_cons25l1_m);
}
void
lang_set_German(char *str)
{
- systemChangeFont("iso-8x14");
+ systemChangeFont(font_iso_8x14);
systemChangeLang("de_DE.ISO8859-1");
- systemChangeTerminal("cons25l1", "cons25l1_m");
+ systemChangeTerminal("cons25l1", termcap_cons25l1,
+ "cons25l1-m", termcap_cons25l1_m);
}
void
lang_set_Italian(char *str)
{
- systemChangeFont("iso-8x14");
+ systemChangeFont(font_iso_8x14);
systemChangeLang("it_IT.ISO8859-1");
- systemChangeTerminal("cons25l1", "cons25l1_m");
+ systemChangeTerminal("cons25l1", termcap_cons25l1,
+ "cons25l1-m", termcap_cons25l1_m);
}
/* Someday we will have to do a lot better than this */
void
lang_set_Japanese(char *str)
{
- systemChangeFont("iso-8x14");
+ systemChangeFont(font_iso_8x14);
systemChangeLang("ja_JP.ROMAJI");
- systemChangeTerminal("cons25", "cons25_m");
+ systemChangeTerminal("cons25", termcap_cons25,
+ "cons25-m", termcap_cons25_m);
+}
+
+void
+lang_set_Norwegian(char *str)
+{
+ systemChangeFont(font_iso_8x14);
+ systemChangeLang("no_NO.ISO8859-1");
+ systemChangeTerminal("cons25l1", termcap_cons25l1,
+ "cons25l1-m", termcap_cons25l1_m);
}
void
lang_set_Russian(char *str)
{
- systemChangeFont("iso-8x14");
+ systemChangeFont(font_koi8_r_8x14);
systemChangeLang("ru_SU.KOI8-R");
- systemChangeTerminal("cons25r", "cons25r_m");
- systemChangeScreenmap("koi8-r2cp866");
+ systemChangeScreenmap(koi8_r2cp866);
+ systemChangeTerminal("cons25r", termcap_cons25r,
+ "cons25r-m", termcap_cons25r_m);
}
void
lang_set_Spanish(char *str)
{
- systemChangeFont("iso-8x14");
+ systemChangeFont(font_iso_8x14);
systemChangeLang("es_ES.ISO8859-1");
- systemChangeTerminal("cons25l1", "cons25l1_m");
+ systemChangeTerminal("cons25l1", termcap_cons25l1,
+ "cons25l1-m", termcap_cons25l1_m);
}
void
lang_set_Swedish(char *str)
{
- systemChangeFont("iso-8x14");
+ systemChangeFont(font_iso_8x14);
systemChangeLang("sv_SV.ISO8859-1");
- systemChangeTerminal("cons25l1", "cons25l1_m");
+ systemChangeTerminal("cons25l1", termcap_cons25l1,
+ "cons25l1-m", termcap_cons25l1_m);
}
diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c
index a823f5d..aa55d40 100644
--- a/release/sysinstall/menus.c
+++ b/release/sysinstall/menus.c
@@ -4,7 +4,13 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
+<<<<<<< menus.c
+ * $Id: menus.c,v 1.5 1995/05/04 03:51:19 jkh Exp $
+||||||| 1.7
* $Id: menus.c,v 1.6 1995/05/04 19:48:14 jkh Exp $
+=======
+ * $Id: menus.c,v 1.7 1995/05/04 23:36:20 jkh Exp $
+>>>>>>> /tmp/T4000279
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -133,6 +139,8 @@ of the english versions.", /* prompt */
DMENU_CALL, (void *)lang_set_Italian, 0 },
{ "Japanese", "Japanese language and default character set (romaji)",/* J */
DMENU_CALL, (void *)lang_set_Japanese, 0 },
+ { "Norwegian", "Norwegian language and character set (ISO-8859-1)", /* N */
+ DMENU_CALL, (void *)lang_set_Norwegian, 0 },
{ "Russian", "Russian language and character set (cp866-8x14)", /* R */
DMENU_CALL, (void *)lang_set_Russian, 0 },
{ "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
diff --git a/release/sysinstall/msg.c b/release/sysinstall/msg.c
index 442a3c9..9c60c1d 100644
--- a/release/sysinstall/msg.c
+++ b/release/sysinstall/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: msg.c,v 1.4 1995/05/04 19:48:16 jkh Exp $
+ * $Id: msg.c,v 1.3 1995/05/04 03:51:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -177,6 +177,23 @@ msgConfirm(char *fmt, ...)
free(errstr);
}
+/* Put up a message in a popup information box */
+void
+msgNotify(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+
+ errstr = (char *)malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ dialog_notify(errstr);
+ free(errstr);
+}
+
/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */
int
msgYesNo(char *fmt, ...)
@@ -211,7 +228,10 @@ msgGetInput(char *buf, char *fmt, ...)
va_end(args);
use_helpline(NULL);
use_helpfile(NULL);
- strcpy(input_buffer, buf);
+ if (buf)
+ strcpy(input_buffer, buf);
+ else
+ input_buffer[0] = '\0';
rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer);
free(errstr);
if (!rval)
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index d0da1c1..dc207f9 100644
--- a/release/sysinstall/sysinstall.h
+++ b/release/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.6 1995/05/04 19:48:17 jkh Exp $
+ * $Id: sysinstall.h,v 1.5 1995/05/04 03:51:22 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -109,6 +109,9 @@
/* device limits */
#define DEV_NAME_MAX 128
+/* handy */
+#define ONE_MEG 1048576
+
/*** Types ***/
typedef unsigned int Boolean;
@@ -174,6 +177,8 @@ extern Boolean OnCDROM; /* Are we running off of a CDROM? */
extern Boolean OnSerial; /* Are we on a serial console? */
extern Boolean SystemWasInstalled; /* Did we install it? */
extern Boolean DialogActive; /* Is the dialog() stuff up? */
+extern Boolean ColorDisplay; /* Are we on a color display? */
+extern Boolean OnVTY; /* On a syscons VTY? */
extern Variable *VarHead; /* The head of the variable chain */
extern unsigned int Dists; /* Which distributions we want */
extern unsigned int SrcDists; /* Which src distributions we want */
@@ -205,13 +210,14 @@ extern int systemExecute(char *cmd);
extern int systemShellEscape(void);
extern int systemDisplayFile(char *file);
extern char *systemHelpFile(char *file, char *buf);
-extern void systemChangeFont(char *font);
+extern void systemChangeFont(const u_char font[]);
extern void systemChangeLang(char *lang);
-extern void systemChangeTerminal(char *color, char *mono);
-extern void systemChangeScreenmap(char *newmap);
+extern void systemChangeTerminal(char *color, const u_char c_termcap[],
+ char *mono, const u_char m_termcap[]);
+extern void systemChangeScreenmap(const u_char newmap[]);
/* disks.c */
-extern void partition_disk(struct disk *disks);
+extern void partition_disks(struct disk **disks);
extern int write_disks(struct disk **disks);
extern void make_filesystems(struct disk **disks);
extern void cpio_extract(struct disk **disks);
@@ -274,10 +280,24 @@ extern void lang_set_French(char *str);
extern void lang_set_German(char *str);
extern void lang_set_Italian(char *str);
extern void lang_set_Japanese(char *str);
+extern void lang_set_Norwegian(char *str);
extern void lang_set_Russian(char *str);
extern void lang_set_Spanish(char *str);
extern void lang_set_Swedish(char *str);
+/* makedevs.c (auto-generated) */
+extern const char termcap_vt100[];
+extern const char termcap_cons25[];
+extern const char termcap_cons25_m[];
+extern const char termcap_cons25r[];
+extern const char termcap_cons25r_m[];
+extern const char termcap_cons25l1[];
+extern const char termcap_cons25l1_m[];
+extern const u_char font_iso_8x14[];
+extern const u_char font_cp850_8x14[];
+extern const u_char font_koi8_r_8x14[];
+extern const u_char koi8_r2cp866[];
+
/* wizard.c */
extern void slice_wizard(struct disk *d);
diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c
index 3c4b268..9fac4e8 100644
--- a/release/sysinstall/system.c
+++ b/release/sysinstall/system.c
@@ -18,20 +18,35 @@
#include "sysinstall.h"
#include <signal.h>
#include <sys/reboot.h>
+#include <machine/console.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
-/* Handle interrupt signals (duh!) */
+/*
+ * Handle interrupt signals - this probably won't work in all cases
+ * due to our having bogotified the internal state of dialog or curses,
+ * but we'll give it a try.
+ */
static void
handle_intr(int sig)
{
+ dialog_clear();
+ clear();
+ if (!msgYesNo("Are you sure you want to abort the installation?"))
+ systemShutdown();
+ else {
+ dialog_clear();
+ clear();
+ refresh();
+ }
}
/* Welcome the user to the system */
void
systemWelcome(void)
{
+ printf("Installation system initializing..\n");
}
/* Initialize system defaults */
@@ -201,8 +216,12 @@ systemHelpFile(char *file, char *buf)
}
void
-systemChangeFont(char *font)
+systemChangeFont(const u_char font[])
{
+ if (OnVTY) {
+ if (ioctl(0, PIO_FONT8x14, font) < 0)
+ msgConfirm("Sorry! Unable to load font for %s", getenv("LANG"));
+ }
}
void
@@ -212,12 +231,29 @@ systemChangeLang(char *lang)
}
void
-systemChangeTerminal(char *color, char *mono)
+systemChangeTerminal(char *color, const u_char c_term[],
+ char *mono, const u_char m_term[])
{
- /* Do something with setterm */
+ if (!OnSerial) {
+ if (ColorDisplay) {
+ setenv("TERM", color, 1);
+ setenv("TERMCAP", c_term, 1);
+ setterm(color);
+ }
+ else {
+ setenv("TERM", mono, 1);
+ setenv("TERMCAP", m_term, 1);
+ setterm(mono);
+ }
+ }
}
void
-systemChangeScreenmap(char *newmap)
+systemChangeScreenmap(const u_char newmap[])
{
+ if (OnVTY) {
+ if (ioctl(0, PIO_SCRNMAP, newmap) < 0)
+ msgConfirm("Sorry! Unable to load the screenmap for %s",
+ getenv("LANG"));
+ }
}
diff --git a/release/sysinstall/termcap.c b/release/sysinstall/termcap.c
index e05b82d..cb2eca2 100644
--- a/release/sysinstall/termcap.c
+++ b/release/sysinstall/termcap.c
@@ -22,41 +22,42 @@
#include "sysinstall.h"
+Boolean ColorDisplay;
+Boolean OnVTY;
+
int
set_termcap(void)
{
char *term;
- extern const char termcap_vt100[];
- extern const char termcap_cons25[];
- extern const char termcap_cons25_m[];
+ OnVTY = OnSerial = FALSE;
term = getenv("TERM");
if (term == NULL) {
- int color_display;
-
- if (ioctl(STDERR_FILENO, GIO_COLOR, &color_display) < 0) {
+ if (ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay) < 0) {
if (setenv("TERM", "vt100", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_vt100, 1) < 0)
return -1;
DebugFD = dup(1);
OnSerial = TRUE;
- } else if (color_display) {
+ } else if (ColorDisplay) {
if (setenv("TERM", "cons25", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25, 1) < 0)
return -1;
DebugFD = open("/dev/ttyv1",O_WRONLY);
+ OnVTY = TRUE;
} else {
if (setenv("TERM", "cons25-m", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25_m, 1) < 0)
return -1;
DebugFD = open("/dev/ttyv1",O_WRONLY);
+ OnVTY = TRUE;
}
- } else {
- DebugFD = open("sysinstall.debug",
- O_WRONLY|O_CREAT|O_TRUNC,0644);
+ }
+ else {
+ DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC,0644);
}
return 0;
}
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
index f2fa070..848f279 100644
--- a/usr.sbin/sade/Makefile
+++ b/usr.sbin/sade/Makefile
@@ -4,7 +4,7 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel
-SRCS = globals.c main.c dmenu.c menus.c \
+SRCS= globals.c main.c dmenu.c menus.c \
misc.c msg.c system.c install.c \
termcap.c makedevs.c media.c variable.c \
devices.c dist.c lang.c wizard.c \
@@ -12,9 +12,14 @@ SRCS = globals.c main.c dmenu.c menus.c \
CFLAGS += -Wall -g -I${.CURDIR}/../libdisk
-LDADD = -ldialog -lncurses -lmytinfo -L${.CURDIR}/../libdisk -ldisk
+LDADD= -ldialog -lncurses -lmytinfo
+.if exists(${.CURDIR}/../libdisk/obj)
+LDADD+= -L${.CURDIR}/../libdisk/obj -ldisk
+.else
+LDADD+= -L${.CURDIR}/../libdisk -ldisk
+.endif
-DPADD = ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
+DPADD= ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
.if exists(${.CURDIR}/../../sys/i386/boot/biosboot/obj)
BOOTS=${.CURDIR}/../../sys/i386/boot/biosboot/obj
@@ -29,6 +34,7 @@ makedevs.c: dev2c.sh Makefile rtermcap
# sh ${.CURDIR}/dev2c.sh dev > makedevs.tmp
# rm -rf dev
rm -f makedevs.tmp
+ echo '#include <sys/types.h>' > makedevs.tmp
uudecode < ${.CURDIR}/bteasy17.uu
file2c 'const unsigned char boot0[] = {' '};' \
< bteasy17 >> makedevs.tmp
@@ -49,12 +55,27 @@ makedevs.c: dev2c.sh Makefile rtermcap
./rtermcap cons25r-m | \
file2c 'const char termcap_cons25r_m[] = {' ',0};' \
>> makedevs.tmp
+ ./rtermcap cons25l1 | \
+ file2c 'const char termcap_cons25l1[] = {' ',0};' \
+ >> makedevs.tmp
./rtermcap cons25l1-m | \
file2c 'const char termcap_cons25l1_m[] = {' ',0};' \
>> makedevs.tmp
./rtermcap vt100 | \
file2c 'const char termcap_vt100[] = {' ',0};' \
>> makedevs.tmp
+ file2c 'const u_char font_iso_8x14[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/fonts/iso-8x14.fnt \
+ >> makedevs.tmp
+ file2c 'const u_char font_cp850_8x14[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/fonts/cp850-8x14.fnt \
+ >> makedevs.tmp
+ file2c 'const u_char font_koi8_r_8x14[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/fonts/koi8-r-8x14.fnt \
+ >> makedevs.tmp
+ file2c 'const u_char koi8_r2cp866[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/scrnmaps/koi8-r2cp866 \
+ >> makedevs.tmp
mv makedevs.tmp makedevs.c
rtermcap: ${.CURDIR}/rtermcap.c
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c
index 582db23..69e1be2 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.3 1995/05/04 19:48:09 jkh Exp $
+ * $Id: devices.c,v 1.2 1995/05/04 03:51:14 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -102,10 +102,11 @@ print_chunks(struct disk *d)
{
int row;
int i;
+ int b_attr = ColorDisplay ? A_BOLD : A_UNDERLINE;
attrset(A_NORMAL);
mvaddstr(0, 0, "Disk name:\t");
- attrset(A_BOLD); addstr(d->name); attrset(A_NORMAL);
+ attrset(b_attr); addstr(d->name); attrset(A_NORMAL);
attrset(A_REVERSE); mvaddstr(0, 55, "Master Partition Editor"); attrset(A_NORMAL);
mvprintw(1, 0,
"BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
@@ -115,7 +116,7 @@ print_chunks(struct disk *d)
"Subtype", "Flags");
for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
if (i == current_chunk)
- attrset(A_BOLD);
+ attrset(b_attr);
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,
@@ -129,13 +130,15 @@ print_chunks(struct disk *d)
static void
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 ");
- attrset(A_BOLD); addstr("bold"); attrset(A_NORMAL);
+ attrset(b_attr); addstr(ColorDisplay ? "bold" : "underline"); attrset(A_NORMAL);
move(0, 0);
}
@@ -212,8 +215,7 @@ device_slice_disk(struct disk *d)
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];
+ char *val, tmp[20];
int size;
snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
@@ -223,7 +225,8 @@ device_slice_disk(struct disk *d)
size,
freebsd,
3,
- chunk_info[current_chunk]->flags);
+ (chunk_info[current_chunk]->flags &
+ CHUNK_ALIGN));
record_chunks(d);
}
}
diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c
index 0313372..be7d803 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: install.c,v 1.5 1995/05/04 03:51:16 jkh Exp $
+ * $Id$
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -42,17 +42,370 @@
*/
#include "sysinstall.h"
+#include <ctype.h>
+
+/*
+ * I make some pretty gross assumptions about having a max of 50 chunks
+ * total - 8 slices and 42 partitions. I can't easily display many more
+ * than that on the screen at once!
+ *
+ * For 2.1 I'll revisit this and try to make it more dynamic, but since
+ * this will catch 99.99% of all possible cases, I'm not too worried.
+ */
+
+#define MAX_CHUNKS 50
+
+#define FS_SWAP 1
+
+/* Where to start printing the freebsd slices */
+#define CHUNK_SLICE_START_ROW 2
+#define CHUNK_PART_START_ROW 10
+
+/* 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;
+} fbsd_chunk_info[MAX_CHUNKS + 1];
+static int current_chunk;
+
/* If the given disk has a root partition on it, return TRUE */
static Boolean
contains_root_partition(struct disk *d)
{
+ struct chunk *c1;
+
+ if (!d->chunks)
+ msgFatal("Disk %s has no chunks!", d->name);
+ c1 = d->chunks->part;
+ while (c1) {
+ if (c1->type == freebsd) {
+ struct chunk *c2 = c1->part;
+
+ while (c2) {
+ if (c2->flags & CHUNK_IS_ROOT)
+ return TRUE;
+ c2 = c2->next;
+ }
+ }
+ c1 = c1->next;
+ }
+ return FALSE;
+}
+
+static Boolean
+check_conflict(char *name)
+{
+ int i;
+
+ for (i = 0; fbsd_chunk_info[i].d; i++)
+ if (fbsd_chunk_info[i].type == PART_FILESYSTEM &&
+ !strcmp(fbsd_chunk_info[i].c->name, name))
+ return TRUE;
return FALSE;
}
+static int
+space_free(struct chunk *c)
+{
+ struct chunk *c1 = c->part;
+ int sz = c->size;
+
+ while (c1) {
+ if (c1->type != unused)
+ sz -= c1->size;
+ c1 = c1->next;
+ }
+ if (sz < 0)
+ msgFatal("Partitions are larger than actual chunk??");
+ return sz;
+}
+
+static void
+record_fbsd_chunks(struct disk **disks)
+{
+ int i, j, p;
+
+ j = p = 0;
+ 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;
+
+ fbsd_chunk_info[j].type = PART_SLICE;
+ fbsd_chunk_info[j].d = disks[i];
+ fbsd_chunk_info[j].c = c1;
+ fbsd_chunk_info[j++].p = NULL;
+ while (c2) {
+ if (c2->type == part) {
+ if (c2->subtype == FS_SWAP)
+ fbsd_chunk_info[j].type = PART_SWAP;
+ else
+ fbsd_chunk_info[j].type = PART_FILESYSTEM;
+ fbsd_chunk_info[j].d = disks[i];
+ fbsd_chunk_info[j].c = c2;
+ fbsd_chunk_info[j++].p = c2->private;
+ }
+ c2 = c2->next;
+ }
+ }
+ c1 = c1->next;
+ }
+ }
+ fbsd_chunk_info[j].d = NULL;
+ fbsd_chunk_info[j].c = NULL;
+}
+
+int
+get_mountpoint(struct chunk *c)
+{
+ char *val;
+ struct part_info *part;
+
+ val = msgGetInput(c->private,
+ "Please specify mount point for new partition");
+ if (val) {
+ if (!strcmp(val, "/")) {
+ if (c->flags & CHUNK_PAST_1024) {
+msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
+ return 1;
+ }
+ c->flags |= CHUNK_IS_ROOT;
+ }
+ if (check_conflict(val)) {
+ msgConfirm("You already have a mountpoint for %s assigned!", val);
+ return 1;
+ }
+ safe_free(c->private);
+ part = (struct part_info *)malloc(sizeof(struct part_info));
+ strncpy(part->mountpoint, val, FILENAME_MAX);
+ part->newfs = TRUE;
+ c->private = (void *)part;
+ c->private_free = free;
+ return 0;
+ }
+ return 1;
+}
+
+static part_type
+get_partition_type(struct chunk *c)
+{
+ char selection[20];
+ static unsigned char *fs_types[] = {
+ "Swap",
+ "A swap partition.",
+ "FS",
+ "A file system",
+ };
+
+ if (!dialog_menu("Please choose a partition type",
+ "If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL)) {
+ if (!strcmp(selection, "FS"))
+ return PART_FILESYSTEM;
+ else if (!strcmp(selection, "Swap"))
+ return PART_SWAP;
+ }
+ return PART_NONE;
+}
+
+#define PART_PART_COL 0
+#define PART_MOUNT_COL 8
+#define PART_NEWFS_COL 32
+#define PART_OFF 40
+
+static void
+print_fbsd_chunks(void)
+{
+ int i, srow, prow, pcol;
+ int sz;
+
+ attrset(A_REVERSE);
+ mvaddstr(0, 25, "FreeBSD Partition Editor");
+ attrset(A_NORMAL);
+
+ for (i = 0; i < 2; i++) {
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF),
+ "Part");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF),
+ "Mount");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF),
+ "Newfs");
+ attrset(A_NORMAL);
+ }
+
+ srow = CHUNK_SLICE_START_ROW;
+ prow = CHUNK_PART_START_ROW;
+
+ for (i = 0; fbsd_chunk_info[i].d; i++) {
+ if (i == current_chunk)
+ attrset(A_BOLD);
+ if (fbsd_chunk_info[i].type == PART_SLICE) {
+ sz = space_free(fbsd_chunk_info[i].c);
+ mvprintw(srow++, 0,
+ "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)",
+ fbsd_chunk_info[i].d->name,
+ fbsd_chunk_info[i].c->name, sz, (sz / 2048));
+ }
+ else {
+ /* Go for two columns */
+ if (prow == (CHUNK_PART_START_ROW + 9))
+ pcol = PART_OFF;
+ else
+ pcol = 0;
+ mvaddstr(prow, pcol + PART_PART_COL, fbsd_chunk_info[i].c->name);
+ if (fbsd_chunk_info[i].type == PART_FILESYSTEM) {
+ 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";
+ }
+ else {
+ mountpoint = "?";
+ newfs = "";
+ }
+ mvaddstr(prow, pcol + PART_MOUNT_COL, mountpoint);
+ mvaddstr(prow, pcol + PART_NEWFS_COL, newfs);
+ }
+ else
+ mvaddstr(prow, pcol + PART_MOUNT_COL, "swap");
+ ++prow;
+ }
+ if (i == current_chunk)
+ attrset(A_NORMAL);
+ }
+}
+
+static void
+print_command_summary()
+{
+ int attrs = ColorDisplay ? A_BOLD : A_UNDERLINE;
+
+ mvprintw(19, 0,
+ "The following commands are valid here (upper or lower case):");
+ mvprintw(20, 0, "C = Create FreeBSD Partition D = Delete Partition");
+ mvprintw(21, 0, "M = Mount Partition (no newfs) ESC = Proceed to summary screen");
+ mvprintw(22, 0, "The default target will be displayed in ");
+
+ attrset(attrs);
+ addstr(ColorDisplay ? "bold" : "underline");
+ attrset(A_NORMAL);
+ move(0, 0);
+}
+
void
-partition_disk(struct disk *d)
+partition_disks(struct disk **disks)
{
+ int sz, key = 0;
+ Boolean partitioning;
+ char *msg = NULL;
+
+ dialog_clear();
+ partitioning = TRUE;
+ keypad(stdscr, TRUE);
+ record_fbsd_chunks(disks);
+
+ while (partitioning) {
+ clear();
+ print_fbsd_chunks();
+ print_command_summary();
+ if (msg) {
+ standout(); mvprintw(23, 0, msg); standend();
+ beep();
+ msg = NULL;
+ }
+ refresh();
+ key = toupper(getch());
+ switch (key) {
+ case KEY_UP:
+ case '-':
+ if (current_chunk != 0)
+ --current_chunk;
+ break;
+
+ case KEY_DOWN:
+ case '+':
+ case '\r':
+ case '\n':
+ if (fbsd_chunk_info[current_chunk + 1].d)
+ ++current_chunk;
+ break;
+
+ case KEY_HOME:
+ current_chunk = 0;
+ break;
+
+ case KEY_END:
+ while (fbsd_chunk_info[current_chunk + 1].d)
+ ++current_chunk;
+ break;
+
+ case KEY_F(1):
+ case '?':
+ systemDisplayFile("partitioning.hlp");
+ break;
+
+ case 'C':
+ if (fbsd_chunk_info[current_chunk].type != PART_SLICE) {
+ msg = "Can only create sub-partitions in a master partition (at top)";
+ break;
+ }
+ sz = space_free(fbsd_chunk_info[current_chunk].c);
+ if (sz <= FS_MIN_SIZE)
+ msg = "Not enough space to create additional FreeBSD partition";
+ else {
+ char *val, tmp[20];
+ int size;
+
+ 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;
+
+ if (get_mountpoint(fbsd_chunk_info[current_chunk].c))
+ break;
+ type = get_partition_type(fbsd_chunk_info[current_chunk].c);
+ if (type == PART_NONE)
+ break;
+ Create_Chunk(fbsd_chunk_info[current_chunk].d,
+ fbsd_chunk_info[current_chunk].c->offset,
+ size,
+ part,
+ type == PART_SWAP ? FS_SWAP : freebsd,
+ fbsd_chunk_info[current_chunk].c->flags);
+ record_fbsd_chunks(disks);
+ }
+ }
+ break;
+
+ case 27: /* ESC */
+ partitioning = FALSE;
+ break;
+ }
+ }
}
int
@@ -71,7 +424,9 @@ write_disks(struct disk **disks)
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);
+#if 0
Write_Disk(disks[i]);
+#endif
}
return 0;
}
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index f64562c..8bb677c 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.6 1995/05/04 19:48:11 jkh Exp $
+ * $Id: install.c,v 1.5 1995/05/04 03:51:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -81,8 +81,7 @@ installHook(char *str)
for (i = 0; disks[i]; i++)
disks[i] = device_slice_disk(disks[i]);
- for (i = 0; disks[i]; i++)
- partition_disk(disks[i]);
+ partition_disks(disks);
if (!write_disks(disks)) {
make_filesystems(disks);
@@ -94,7 +93,7 @@ installHook(char *str)
}
else {
dialog_clear();
- if (msgYesNo("Would you like to go back to the master partition menu?")) {
+ if (msgYesNo("Would you like to go back to the Master Partition Editor?")) {
for (i = 0; disks[i]; i++)
Free_Disk(disks[i]);
break;
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index a823f5d..aa55d40 100644
--- a/usr.sbin/sade/menus.c
+++ b/usr.sbin/sade/menus.c
@@ -4,7 +4,13 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
+<<<<<<< menus.c
+ * $Id: menus.c,v 1.5 1995/05/04 03:51:19 jkh Exp $
+||||||| 1.7
* $Id: menus.c,v 1.6 1995/05/04 19:48:14 jkh Exp $
+=======
+ * $Id: menus.c,v 1.7 1995/05/04 23:36:20 jkh Exp $
+>>>>>>> /tmp/T4000279
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -133,6 +139,8 @@ of the english versions.", /* prompt */
DMENU_CALL, (void *)lang_set_Italian, 0 },
{ "Japanese", "Japanese language and default character set (romaji)",/* J */
DMENU_CALL, (void *)lang_set_Japanese, 0 },
+ { "Norwegian", "Norwegian language and character set (ISO-8859-1)", /* N */
+ DMENU_CALL, (void *)lang_set_Norwegian, 0 },
{ "Russian", "Russian language and character set (cp866-8x14)", /* R */
DMENU_CALL, (void *)lang_set_Russian, 0 },
{ "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c
index 442a3c9..9c60c1d 100644
--- a/usr.sbin/sade/msg.c
+++ b/usr.sbin/sade/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: msg.c,v 1.4 1995/05/04 19:48:16 jkh Exp $
+ * $Id: msg.c,v 1.3 1995/05/04 03:51:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -177,6 +177,23 @@ msgConfirm(char *fmt, ...)
free(errstr);
}
+/* Put up a message in a popup information box */
+void
+msgNotify(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+
+ errstr = (char *)malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ dialog_notify(errstr);
+ free(errstr);
+}
+
/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */
int
msgYesNo(char *fmt, ...)
@@ -211,7 +228,10 @@ msgGetInput(char *buf, char *fmt, ...)
va_end(args);
use_helpline(NULL);
use_helpfile(NULL);
- strcpy(input_buffer, buf);
+ if (buf)
+ strcpy(input_buffer, buf);
+ else
+ input_buffer[0] = '\0';
rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer);
free(errstr);
if (!rval)
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index d0da1c1..dc207f9 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.6 1995/05/04 19:48:17 jkh Exp $
+ * $Id: sysinstall.h,v 1.5 1995/05/04 03:51:22 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -109,6 +109,9 @@
/* device limits */
#define DEV_NAME_MAX 128
+/* handy */
+#define ONE_MEG 1048576
+
/*** Types ***/
typedef unsigned int Boolean;
@@ -174,6 +177,8 @@ extern Boolean OnCDROM; /* Are we running off of a CDROM? */
extern Boolean OnSerial; /* Are we on a serial console? */
extern Boolean SystemWasInstalled; /* Did we install it? */
extern Boolean DialogActive; /* Is the dialog() stuff up? */
+extern Boolean ColorDisplay; /* Are we on a color display? */
+extern Boolean OnVTY; /* On a syscons VTY? */
extern Variable *VarHead; /* The head of the variable chain */
extern unsigned int Dists; /* Which distributions we want */
extern unsigned int SrcDists; /* Which src distributions we want */
@@ -205,13 +210,14 @@ extern int systemExecute(char *cmd);
extern int systemShellEscape(void);
extern int systemDisplayFile(char *file);
extern char *systemHelpFile(char *file, char *buf);
-extern void systemChangeFont(char *font);
+extern void systemChangeFont(const u_char font[]);
extern void systemChangeLang(char *lang);
-extern void systemChangeTerminal(char *color, char *mono);
-extern void systemChangeScreenmap(char *newmap);
+extern void systemChangeTerminal(char *color, const u_char c_termcap[],
+ char *mono, const u_char m_termcap[]);
+extern void systemChangeScreenmap(const u_char newmap[]);
/* disks.c */
-extern void partition_disk(struct disk *disks);
+extern void partition_disks(struct disk **disks);
extern int write_disks(struct disk **disks);
extern void make_filesystems(struct disk **disks);
extern void cpio_extract(struct disk **disks);
@@ -274,10 +280,24 @@ extern void lang_set_French(char *str);
extern void lang_set_German(char *str);
extern void lang_set_Italian(char *str);
extern void lang_set_Japanese(char *str);
+extern void lang_set_Norwegian(char *str);
extern void lang_set_Russian(char *str);
extern void lang_set_Spanish(char *str);
extern void lang_set_Swedish(char *str);
+/* makedevs.c (auto-generated) */
+extern const char termcap_vt100[];
+extern const char termcap_cons25[];
+extern const char termcap_cons25_m[];
+extern const char termcap_cons25r[];
+extern const char termcap_cons25r_m[];
+extern const char termcap_cons25l1[];
+extern const char termcap_cons25l1_m[];
+extern const u_char font_iso_8x14[];
+extern const u_char font_cp850_8x14[];
+extern const u_char font_koi8_r_8x14[];
+extern const u_char koi8_r2cp866[];
+
/* wizard.c */
extern void slice_wizard(struct disk *d);
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index 3c4b268..9fac4e8 100644
--- a/usr.sbin/sade/system.c
+++ b/usr.sbin/sade/system.c
@@ -18,20 +18,35 @@
#include "sysinstall.h"
#include <signal.h>
#include <sys/reboot.h>
+#include <machine/console.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
-/* Handle interrupt signals (duh!) */
+/*
+ * Handle interrupt signals - this probably won't work in all cases
+ * due to our having bogotified the internal state of dialog or curses,
+ * but we'll give it a try.
+ */
static void
handle_intr(int sig)
{
+ dialog_clear();
+ clear();
+ if (!msgYesNo("Are you sure you want to abort the installation?"))
+ systemShutdown();
+ else {
+ dialog_clear();
+ clear();
+ refresh();
+ }
}
/* Welcome the user to the system */
void
systemWelcome(void)
{
+ printf("Installation system initializing..\n");
}
/* Initialize system defaults */
@@ -201,8 +216,12 @@ systemHelpFile(char *file, char *buf)
}
void
-systemChangeFont(char *font)
+systemChangeFont(const u_char font[])
{
+ if (OnVTY) {
+ if (ioctl(0, PIO_FONT8x14, font) < 0)
+ msgConfirm("Sorry! Unable to load font for %s", getenv("LANG"));
+ }
}
void
@@ -212,12 +231,29 @@ systemChangeLang(char *lang)
}
void
-systemChangeTerminal(char *color, char *mono)
+systemChangeTerminal(char *color, const u_char c_term[],
+ char *mono, const u_char m_term[])
{
- /* Do something with setterm */
+ if (!OnSerial) {
+ if (ColorDisplay) {
+ setenv("TERM", color, 1);
+ setenv("TERMCAP", c_term, 1);
+ setterm(color);
+ }
+ else {
+ setenv("TERM", mono, 1);
+ setenv("TERMCAP", m_term, 1);
+ setterm(mono);
+ }
+ }
}
void
-systemChangeScreenmap(char *newmap)
+systemChangeScreenmap(const u_char newmap[])
{
+ if (OnVTY) {
+ if (ioctl(0, PIO_SCRNMAP, newmap) < 0)
+ msgConfirm("Sorry! Unable to load the screenmap for %s",
+ getenv("LANG"));
+ }
}
diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c
index e05b82d..cb2eca2 100644
--- a/usr.sbin/sade/termcap.c
+++ b/usr.sbin/sade/termcap.c
@@ -22,41 +22,42 @@
#include "sysinstall.h"
+Boolean ColorDisplay;
+Boolean OnVTY;
+
int
set_termcap(void)
{
char *term;
- extern const char termcap_vt100[];
- extern const char termcap_cons25[];
- extern const char termcap_cons25_m[];
+ OnVTY = OnSerial = FALSE;
term = getenv("TERM");
if (term == NULL) {
- int color_display;
-
- if (ioctl(STDERR_FILENO, GIO_COLOR, &color_display) < 0) {
+ if (ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay) < 0) {
if (setenv("TERM", "vt100", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_vt100, 1) < 0)
return -1;
DebugFD = dup(1);
OnSerial = TRUE;
- } else if (color_display) {
+ } else if (ColorDisplay) {
if (setenv("TERM", "cons25", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25, 1) < 0)
return -1;
DebugFD = open("/dev/ttyv1",O_WRONLY);
+ OnVTY = TRUE;
} else {
if (setenv("TERM", "cons25-m", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25_m, 1) < 0)
return -1;
DebugFD = open("/dev/ttyv1",O_WRONLY);
+ OnVTY = TRUE;
}
- } else {
- DebugFD = open("sysinstall.debug",
- O_WRONLY|O_CREAT|O_TRUNC,0644);
+ }
+ else {
+ DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC,0644);
}
return 0;
}
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile
index f2fa070..848f279 100644
--- a/usr.sbin/sysinstall/Makefile
+++ b/usr.sbin/sysinstall/Makefile
@@ -4,7 +4,7 @@ CLEANFILES= makedevs.c rtermcap
.PATH: ${.CURDIR}/../disklabel
-SRCS = globals.c main.c dmenu.c menus.c \
+SRCS= globals.c main.c dmenu.c menus.c \
misc.c msg.c system.c install.c \
termcap.c makedevs.c media.c variable.c \
devices.c dist.c lang.c wizard.c \
@@ -12,9 +12,14 @@ SRCS = globals.c main.c dmenu.c menus.c \
CFLAGS += -Wall -g -I${.CURDIR}/../libdisk
-LDADD = -ldialog -lncurses -lmytinfo -L${.CURDIR}/../libdisk -ldisk
+LDADD= -ldialog -lncurses -lmytinfo
+.if exists(${.CURDIR}/../libdisk/obj)
+LDADD+= -L${.CURDIR}/../libdisk/obj -ldisk
+.else
+LDADD+= -L${.CURDIR}/../libdisk -ldisk
+.endif
-DPADD = ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
+DPADD= ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
.if exists(${.CURDIR}/../../sys/i386/boot/biosboot/obj)
BOOTS=${.CURDIR}/../../sys/i386/boot/biosboot/obj
@@ -29,6 +34,7 @@ makedevs.c: dev2c.sh Makefile rtermcap
# sh ${.CURDIR}/dev2c.sh dev > makedevs.tmp
# rm -rf dev
rm -f makedevs.tmp
+ echo '#include <sys/types.h>' > makedevs.tmp
uudecode < ${.CURDIR}/bteasy17.uu
file2c 'const unsigned char boot0[] = {' '};' \
< bteasy17 >> makedevs.tmp
@@ -49,12 +55,27 @@ makedevs.c: dev2c.sh Makefile rtermcap
./rtermcap cons25r-m | \
file2c 'const char termcap_cons25r_m[] = {' ',0};' \
>> makedevs.tmp
+ ./rtermcap cons25l1 | \
+ file2c 'const char termcap_cons25l1[] = {' ',0};' \
+ >> makedevs.tmp
./rtermcap cons25l1-m | \
file2c 'const char termcap_cons25l1_m[] = {' ',0};' \
>> makedevs.tmp
./rtermcap vt100 | \
file2c 'const char termcap_vt100[] = {' ',0};' \
>> makedevs.tmp
+ file2c 'const u_char font_iso_8x14[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/fonts/iso-8x14.fnt \
+ >> makedevs.tmp
+ file2c 'const u_char font_cp850_8x14[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/fonts/cp850-8x14.fnt \
+ >> makedevs.tmp
+ file2c 'const u_char font_koi8_r_8x14[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/fonts/koi8-r-8x14.fnt \
+ >> makedevs.tmp
+ file2c 'const u_char koi8_r2cp866[] = {' '};' \
+ < ${.CURDIR}/../../share/syscons/scrnmaps/koi8-r2cp866 \
+ >> makedevs.tmp
mv makedevs.tmp makedevs.c
rtermcap: ${.CURDIR}/rtermcap.c
diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c
index 582db23..69e1be2 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.3 1995/05/04 19:48:09 jkh Exp $
+ * $Id: devices.c,v 1.2 1995/05/04 03:51:14 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -102,10 +102,11 @@ print_chunks(struct disk *d)
{
int row;
int i;
+ int b_attr = ColorDisplay ? A_BOLD : A_UNDERLINE;
attrset(A_NORMAL);
mvaddstr(0, 0, "Disk name:\t");
- attrset(A_BOLD); addstr(d->name); attrset(A_NORMAL);
+ attrset(b_attr); addstr(d->name); attrset(A_NORMAL);
attrset(A_REVERSE); mvaddstr(0, 55, "Master Partition Editor"); attrset(A_NORMAL);
mvprintw(1, 0,
"BIOS Geometry:\t%lu cyls/%lu heads/%lu sectors",
@@ -115,7 +116,7 @@ print_chunks(struct disk *d)
"Subtype", "Flags");
for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
if (i == current_chunk)
- attrset(A_BOLD);
+ attrset(b_attr);
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,
@@ -129,13 +130,15 @@ print_chunks(struct disk *d)
static void
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 ");
- attrset(A_BOLD); addstr("bold"); attrset(A_NORMAL);
+ attrset(b_attr); addstr(ColorDisplay ? "bold" : "underline"); attrset(A_NORMAL);
move(0, 0);
}
@@ -212,8 +215,7 @@ device_slice_disk(struct disk *d)
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];
+ char *val, tmp[20];
int size;
snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size);
@@ -223,7 +225,8 @@ device_slice_disk(struct disk *d)
size,
freebsd,
3,
- chunk_info[current_chunk]->flags);
+ (chunk_info[current_chunk]->flags &
+ CHUNK_ALIGN));
record_chunks(d);
}
}
diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c
index 0313372..be7d803 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: install.c,v 1.5 1995/05/04 03:51:16 jkh Exp $
+ * $Id$
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -42,17 +42,370 @@
*/
#include "sysinstall.h"
+#include <ctype.h>
+
+/*
+ * I make some pretty gross assumptions about having a max of 50 chunks
+ * total - 8 slices and 42 partitions. I can't easily display many more
+ * than that on the screen at once!
+ *
+ * For 2.1 I'll revisit this and try to make it more dynamic, but since
+ * this will catch 99.99% of all possible cases, I'm not too worried.
+ */
+
+#define MAX_CHUNKS 50
+
+#define FS_SWAP 1
+
+/* Where to start printing the freebsd slices */
+#define CHUNK_SLICE_START_ROW 2
+#define CHUNK_PART_START_ROW 10
+
+/* 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;
+} fbsd_chunk_info[MAX_CHUNKS + 1];
+static int current_chunk;
+
/* If the given disk has a root partition on it, return TRUE */
static Boolean
contains_root_partition(struct disk *d)
{
+ struct chunk *c1;
+
+ if (!d->chunks)
+ msgFatal("Disk %s has no chunks!", d->name);
+ c1 = d->chunks->part;
+ while (c1) {
+ if (c1->type == freebsd) {
+ struct chunk *c2 = c1->part;
+
+ while (c2) {
+ if (c2->flags & CHUNK_IS_ROOT)
+ return TRUE;
+ c2 = c2->next;
+ }
+ }
+ c1 = c1->next;
+ }
+ return FALSE;
+}
+
+static Boolean
+check_conflict(char *name)
+{
+ int i;
+
+ for (i = 0; fbsd_chunk_info[i].d; i++)
+ if (fbsd_chunk_info[i].type == PART_FILESYSTEM &&
+ !strcmp(fbsd_chunk_info[i].c->name, name))
+ return TRUE;
return FALSE;
}
+static int
+space_free(struct chunk *c)
+{
+ struct chunk *c1 = c->part;
+ int sz = c->size;
+
+ while (c1) {
+ if (c1->type != unused)
+ sz -= c1->size;
+ c1 = c1->next;
+ }
+ if (sz < 0)
+ msgFatal("Partitions are larger than actual chunk??");
+ return sz;
+}
+
+static void
+record_fbsd_chunks(struct disk **disks)
+{
+ int i, j, p;
+
+ j = p = 0;
+ 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;
+
+ fbsd_chunk_info[j].type = PART_SLICE;
+ fbsd_chunk_info[j].d = disks[i];
+ fbsd_chunk_info[j].c = c1;
+ fbsd_chunk_info[j++].p = NULL;
+ while (c2) {
+ if (c2->type == part) {
+ if (c2->subtype == FS_SWAP)
+ fbsd_chunk_info[j].type = PART_SWAP;
+ else
+ fbsd_chunk_info[j].type = PART_FILESYSTEM;
+ fbsd_chunk_info[j].d = disks[i];
+ fbsd_chunk_info[j].c = c2;
+ fbsd_chunk_info[j++].p = c2->private;
+ }
+ c2 = c2->next;
+ }
+ }
+ c1 = c1->next;
+ }
+ }
+ fbsd_chunk_info[j].d = NULL;
+ fbsd_chunk_info[j].c = NULL;
+}
+
+int
+get_mountpoint(struct chunk *c)
+{
+ char *val;
+ struct part_info *part;
+
+ val = msgGetInput(c->private,
+ "Please specify mount point for new partition");
+ if (val) {
+ if (!strcmp(val, "/")) {
+ if (c->flags & CHUNK_PAST_1024) {
+msgConfirm("This region cannot be used for your root partition as\nit is past the 1024'th cylinder mark and the system would not be\nable to boot from it. Please pick another location for your\nroot partition and try again!");
+ return 1;
+ }
+ c->flags |= CHUNK_IS_ROOT;
+ }
+ if (check_conflict(val)) {
+ msgConfirm("You already have a mountpoint for %s assigned!", val);
+ return 1;
+ }
+ safe_free(c->private);
+ part = (struct part_info *)malloc(sizeof(struct part_info));
+ strncpy(part->mountpoint, val, FILENAME_MAX);
+ part->newfs = TRUE;
+ c->private = (void *)part;
+ c->private_free = free;
+ return 0;
+ }
+ return 1;
+}
+
+static part_type
+get_partition_type(struct chunk *c)
+{
+ char selection[20];
+ static unsigned char *fs_types[] = {
+ "Swap",
+ "A swap partition.",
+ "FS",
+ "A file system",
+ };
+
+ if (!dialog_menu("Please choose a partition type",
+ "If you want to use this partition for swap space, select Swap.\nIf you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL)) {
+ if (!strcmp(selection, "FS"))
+ return PART_FILESYSTEM;
+ else if (!strcmp(selection, "Swap"))
+ return PART_SWAP;
+ }
+ return PART_NONE;
+}
+
+#define PART_PART_COL 0
+#define PART_MOUNT_COL 8
+#define PART_NEWFS_COL 32
+#define PART_OFF 40
+
+static void
+print_fbsd_chunks(void)
+{
+ int i, srow, prow, pcol;
+ int sz;
+
+ attrset(A_REVERSE);
+ mvaddstr(0, 25, "FreeBSD Partition Editor");
+ attrset(A_NORMAL);
+
+ for (i = 0; i < 2; i++) {
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF),
+ "Part");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF),
+ "Mount");
+ attrset(A_NORMAL);
+
+ attrset(A_UNDERLINE);
+ mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF),
+ "Newfs");
+ attrset(A_NORMAL);
+ }
+
+ srow = CHUNK_SLICE_START_ROW;
+ prow = CHUNK_PART_START_ROW;
+
+ for (i = 0; fbsd_chunk_info[i].d; i++) {
+ if (i == current_chunk)
+ attrset(A_BOLD);
+ if (fbsd_chunk_info[i].type == PART_SLICE) {
+ sz = space_free(fbsd_chunk_info[i].c);
+ mvprintw(srow++, 0,
+ "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)",
+ fbsd_chunk_info[i].d->name,
+ fbsd_chunk_info[i].c->name, sz, (sz / 2048));
+ }
+ else {
+ /* Go for two columns */
+ if (prow == (CHUNK_PART_START_ROW + 9))
+ pcol = PART_OFF;
+ else
+ pcol = 0;
+ mvaddstr(prow, pcol + PART_PART_COL, fbsd_chunk_info[i].c->name);
+ if (fbsd_chunk_info[i].type == PART_FILESYSTEM) {
+ 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";
+ }
+ else {
+ mountpoint = "?";
+ newfs = "";
+ }
+ mvaddstr(prow, pcol + PART_MOUNT_COL, mountpoint);
+ mvaddstr(prow, pcol + PART_NEWFS_COL, newfs);
+ }
+ else
+ mvaddstr(prow, pcol + PART_MOUNT_COL, "swap");
+ ++prow;
+ }
+ if (i == current_chunk)
+ attrset(A_NORMAL);
+ }
+}
+
+static void
+print_command_summary()
+{
+ int attrs = ColorDisplay ? A_BOLD : A_UNDERLINE;
+
+ mvprintw(19, 0,
+ "The following commands are valid here (upper or lower case):");
+ mvprintw(20, 0, "C = Create FreeBSD Partition D = Delete Partition");
+ mvprintw(21, 0, "M = Mount Partition (no newfs) ESC = Proceed to summary screen");
+ mvprintw(22, 0, "The default target will be displayed in ");
+
+ attrset(attrs);
+ addstr(ColorDisplay ? "bold" : "underline");
+ attrset(A_NORMAL);
+ move(0, 0);
+}
+
void
-partition_disk(struct disk *d)
+partition_disks(struct disk **disks)
{
+ int sz, key = 0;
+ Boolean partitioning;
+ char *msg = NULL;
+
+ dialog_clear();
+ partitioning = TRUE;
+ keypad(stdscr, TRUE);
+ record_fbsd_chunks(disks);
+
+ while (partitioning) {
+ clear();
+ print_fbsd_chunks();
+ print_command_summary();
+ if (msg) {
+ standout(); mvprintw(23, 0, msg); standend();
+ beep();
+ msg = NULL;
+ }
+ refresh();
+ key = toupper(getch());
+ switch (key) {
+ case KEY_UP:
+ case '-':
+ if (current_chunk != 0)
+ --current_chunk;
+ break;
+
+ case KEY_DOWN:
+ case '+':
+ case '\r':
+ case '\n':
+ if (fbsd_chunk_info[current_chunk + 1].d)
+ ++current_chunk;
+ break;
+
+ case KEY_HOME:
+ current_chunk = 0;
+ break;
+
+ case KEY_END:
+ while (fbsd_chunk_info[current_chunk + 1].d)
+ ++current_chunk;
+ break;
+
+ case KEY_F(1):
+ case '?':
+ systemDisplayFile("partitioning.hlp");
+ break;
+
+ case 'C':
+ if (fbsd_chunk_info[current_chunk].type != PART_SLICE) {
+ msg = "Can only create sub-partitions in a master partition (at top)";
+ break;
+ }
+ sz = space_free(fbsd_chunk_info[current_chunk].c);
+ if (sz <= FS_MIN_SIZE)
+ msg = "Not enough space to create additional FreeBSD partition";
+ else {
+ char *val, tmp[20];
+ int size;
+
+ 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;
+
+ if (get_mountpoint(fbsd_chunk_info[current_chunk].c))
+ break;
+ type = get_partition_type(fbsd_chunk_info[current_chunk].c);
+ if (type == PART_NONE)
+ break;
+ Create_Chunk(fbsd_chunk_info[current_chunk].d,
+ fbsd_chunk_info[current_chunk].c->offset,
+ size,
+ part,
+ type == PART_SWAP ? FS_SWAP : freebsd,
+ fbsd_chunk_info[current_chunk].c->flags);
+ record_fbsd_chunks(disks);
+ }
+ }
+ break;
+
+ case 27: /* ESC */
+ partitioning = FALSE;
+ break;
+ }
+ }
}
int
@@ -71,7 +424,9 @@ write_disks(struct disk **disks)
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);
+#if 0
Write_Disk(disks[i]);
+#endif
}
return 0;
}
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index f64562c..8bb677c 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.6 1995/05/04 19:48:11 jkh Exp $
+ * $Id: install.c,v 1.5 1995/05/04 03:51:16 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -81,8 +81,7 @@ installHook(char *str)
for (i = 0; disks[i]; i++)
disks[i] = device_slice_disk(disks[i]);
- for (i = 0; disks[i]; i++)
- partition_disk(disks[i]);
+ partition_disks(disks);
if (!write_disks(disks)) {
make_filesystems(disks);
@@ -94,7 +93,7 @@ installHook(char *str)
}
else {
dialog_clear();
- if (msgYesNo("Would you like to go back to the master partition menu?")) {
+ if (msgYesNo("Would you like to go back to the Master Partition Editor?")) {
for (i = 0; disks[i]; i++)
Free_Disk(disks[i]);
break;
diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c
index a823f5d..aa55d40 100644
--- a/usr.sbin/sysinstall/menus.c
+++ b/usr.sbin/sysinstall/menus.c
@@ -4,7 +4,13 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
+<<<<<<< menus.c
+ * $Id: menus.c,v 1.5 1995/05/04 03:51:19 jkh Exp $
+||||||| 1.7
* $Id: menus.c,v 1.6 1995/05/04 19:48:14 jkh Exp $
+=======
+ * $Id: menus.c,v 1.7 1995/05/04 23:36:20 jkh Exp $
+>>>>>>> /tmp/T4000279
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -133,6 +139,8 @@ of the english versions.", /* prompt */
DMENU_CALL, (void *)lang_set_Italian, 0 },
{ "Japanese", "Japanese language and default character set (romaji)",/* J */
DMENU_CALL, (void *)lang_set_Japanese, 0 },
+ { "Norwegian", "Norwegian language and character set (ISO-8859-1)", /* N */
+ DMENU_CALL, (void *)lang_set_Norwegian, 0 },
{ "Russian", "Russian language and character set (cp866-8x14)", /* R */
DMENU_CALL, (void *)lang_set_Russian, 0 },
{ "Spanish", "Spanish language and character set (ISO-8859-1)", /* S */
diff --git a/usr.sbin/sysinstall/msg.c b/usr.sbin/sysinstall/msg.c
index 442a3c9..9c60c1d 100644
--- a/usr.sbin/sysinstall/msg.c
+++ b/usr.sbin/sysinstall/msg.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: msg.c,v 1.4 1995/05/04 19:48:16 jkh Exp $
+ * $Id: msg.c,v 1.3 1995/05/04 03:51:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -177,6 +177,23 @@ msgConfirm(char *fmt, ...)
free(errstr);
}
+/* Put up a message in a popup information box */
+void
+msgNotify(char *fmt, ...)
+{
+ va_list args;
+ char *errstr;
+
+ errstr = (char *)malloc(FILENAME_MAX);
+ va_start(args, fmt);
+ vsnprintf(errstr, FILENAME_MAX, fmt, args);
+ va_end(args);
+ use_helpline(NULL);
+ use_helpfile(NULL);
+ dialog_notify(errstr);
+ free(errstr);
+}
+
/* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */
int
msgYesNo(char *fmt, ...)
@@ -211,7 +228,10 @@ msgGetInput(char *buf, char *fmt, ...)
va_end(args);
use_helpline(NULL);
use_helpfile(NULL);
- strcpy(input_buffer, buf);
+ if (buf)
+ strcpy(input_buffer, buf);
+ else
+ input_buffer[0] = '\0';
rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer);
free(errstr);
if (!rval)
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index d0da1c1..dc207f9 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.6 1995/05/04 19:48:17 jkh Exp $
+ * $Id: sysinstall.h,v 1.5 1995/05/04 03:51:22 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -109,6 +109,9 @@
/* device limits */
#define DEV_NAME_MAX 128
+/* handy */
+#define ONE_MEG 1048576
+
/*** Types ***/
typedef unsigned int Boolean;
@@ -174,6 +177,8 @@ extern Boolean OnCDROM; /* Are we running off of a CDROM? */
extern Boolean OnSerial; /* Are we on a serial console? */
extern Boolean SystemWasInstalled; /* Did we install it? */
extern Boolean DialogActive; /* Is the dialog() stuff up? */
+extern Boolean ColorDisplay; /* Are we on a color display? */
+extern Boolean OnVTY; /* On a syscons VTY? */
extern Variable *VarHead; /* The head of the variable chain */
extern unsigned int Dists; /* Which distributions we want */
extern unsigned int SrcDists; /* Which src distributions we want */
@@ -205,13 +210,14 @@ extern int systemExecute(char *cmd);
extern int systemShellEscape(void);
extern int systemDisplayFile(char *file);
extern char *systemHelpFile(char *file, char *buf);
-extern void systemChangeFont(char *font);
+extern void systemChangeFont(const u_char font[]);
extern void systemChangeLang(char *lang);
-extern void systemChangeTerminal(char *color, char *mono);
-extern void systemChangeScreenmap(char *newmap);
+extern void systemChangeTerminal(char *color, const u_char c_termcap[],
+ char *mono, const u_char m_termcap[]);
+extern void systemChangeScreenmap(const u_char newmap[]);
/* disks.c */
-extern void partition_disk(struct disk *disks);
+extern void partition_disks(struct disk **disks);
extern int write_disks(struct disk **disks);
extern void make_filesystems(struct disk **disks);
extern void cpio_extract(struct disk **disks);
@@ -274,10 +280,24 @@ extern void lang_set_French(char *str);
extern void lang_set_German(char *str);
extern void lang_set_Italian(char *str);
extern void lang_set_Japanese(char *str);
+extern void lang_set_Norwegian(char *str);
extern void lang_set_Russian(char *str);
extern void lang_set_Spanish(char *str);
extern void lang_set_Swedish(char *str);
+/* makedevs.c (auto-generated) */
+extern const char termcap_vt100[];
+extern const char termcap_cons25[];
+extern const char termcap_cons25_m[];
+extern const char termcap_cons25r[];
+extern const char termcap_cons25r_m[];
+extern const char termcap_cons25l1[];
+extern const char termcap_cons25l1_m[];
+extern const u_char font_iso_8x14[];
+extern const u_char font_cp850_8x14[];
+extern const u_char font_koi8_r_8x14[];
+extern const u_char koi8_r2cp866[];
+
/* wizard.c */
extern void slice_wizard(struct disk *d);
diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c
index 3c4b268..9fac4e8 100644
--- a/usr.sbin/sysinstall/system.c
+++ b/usr.sbin/sysinstall/system.c
@@ -18,20 +18,35 @@
#include "sysinstall.h"
#include <signal.h>
#include <sys/reboot.h>
+#include <machine/console.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
-/* Handle interrupt signals (duh!) */
+/*
+ * Handle interrupt signals - this probably won't work in all cases
+ * due to our having bogotified the internal state of dialog or curses,
+ * but we'll give it a try.
+ */
static void
handle_intr(int sig)
{
+ dialog_clear();
+ clear();
+ if (!msgYesNo("Are you sure you want to abort the installation?"))
+ systemShutdown();
+ else {
+ dialog_clear();
+ clear();
+ refresh();
+ }
}
/* Welcome the user to the system */
void
systemWelcome(void)
{
+ printf("Installation system initializing..\n");
}
/* Initialize system defaults */
@@ -201,8 +216,12 @@ systemHelpFile(char *file, char *buf)
}
void
-systemChangeFont(char *font)
+systemChangeFont(const u_char font[])
{
+ if (OnVTY) {
+ if (ioctl(0, PIO_FONT8x14, font) < 0)
+ msgConfirm("Sorry! Unable to load font for %s", getenv("LANG"));
+ }
}
void
@@ -212,12 +231,29 @@ systemChangeLang(char *lang)
}
void
-systemChangeTerminal(char *color, char *mono)
+systemChangeTerminal(char *color, const u_char c_term[],
+ char *mono, const u_char m_term[])
{
- /* Do something with setterm */
+ if (!OnSerial) {
+ if (ColorDisplay) {
+ setenv("TERM", color, 1);
+ setenv("TERMCAP", c_term, 1);
+ setterm(color);
+ }
+ else {
+ setenv("TERM", mono, 1);
+ setenv("TERMCAP", m_term, 1);
+ setterm(mono);
+ }
+ }
}
void
-systemChangeScreenmap(char *newmap)
+systemChangeScreenmap(const u_char newmap[])
{
+ if (OnVTY) {
+ if (ioctl(0, PIO_SCRNMAP, newmap) < 0)
+ msgConfirm("Sorry! Unable to load the screenmap for %s",
+ getenv("LANG"));
+ }
}
diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c
index e05b82d..cb2eca2 100644
--- a/usr.sbin/sysinstall/termcap.c
+++ b/usr.sbin/sysinstall/termcap.c
@@ -22,41 +22,42 @@
#include "sysinstall.h"
+Boolean ColorDisplay;
+Boolean OnVTY;
+
int
set_termcap(void)
{
char *term;
- extern const char termcap_vt100[];
- extern const char termcap_cons25[];
- extern const char termcap_cons25_m[];
+ OnVTY = OnSerial = FALSE;
term = getenv("TERM");
if (term == NULL) {
- int color_display;
-
- if (ioctl(STDERR_FILENO, GIO_COLOR, &color_display) < 0) {
+ if (ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay) < 0) {
if (setenv("TERM", "vt100", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_vt100, 1) < 0)
return -1;
DebugFD = dup(1);
OnSerial = TRUE;
- } else if (color_display) {
+ } else if (ColorDisplay) {
if (setenv("TERM", "cons25", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25, 1) < 0)
return -1;
DebugFD = open("/dev/ttyv1",O_WRONLY);
+ OnVTY = TRUE;
} else {
if (setenv("TERM", "cons25-m", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25_m, 1) < 0)
return -1;
DebugFD = open("/dev/ttyv1",O_WRONLY);
+ OnVTY = TRUE;
}
- } else {
- DebugFD = open("sysinstall.debug",
- O_WRONLY|O_CREAT|O_TRUNC,0644);
+ }
+ else {
+ DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC,0644);
}
return 0;
}
OpenPOWER on IntegriCloud