From c49678020c6765f5c43e4b8f428c9761a2b4505d Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Mon, 22 May 1995 14:10:25 +0000 Subject: [PATCH] Implement most of the CD extract code. Clean up a few last display bugs. Add sanity checking that makes sure user creates root and swap partitions. Add swap partitions with swapon(). --- release/sysinstall/disks.c | 3 +- release/sysinstall/dist.c | 113 ++++++++--------- release/sysinstall/install.c | 180 +++++++++++++++++++--------- release/sysinstall/label.c | 116 +++++++++--------- release/sysinstall/media.c | 102 ++++++++-------- release/sysinstall/media_strategy.c | 68 +++++++---- release/sysinstall/msg.c | 17 +-- usr.sbin/sade/disks.c | 3 +- usr.sbin/sade/install.c | 180 +++++++++++++++++++--------- usr.sbin/sade/label.c | 116 +++++++++--------- usr.sbin/sade/msg.c | 17 +-- usr.sbin/sysinstall/disks.c | 3 +- usr.sbin/sysinstall/dist.c | 113 ++++++++--------- usr.sbin/sysinstall/install.c | 180 +++++++++++++++++++--------- usr.sbin/sysinstall/label.c | 116 +++++++++--------- usr.sbin/sysinstall/media.c | 102 ++++++++-------- usr.sbin/sysinstall/msg.c | 17 +-- 17 files changed, 851 insertions(+), 595 deletions(-) diff --git a/release/sysinstall/disks.c b/release/sysinstall/disks.c index 399c81296399..ba0b1904547a 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: disks.c,v 1.24 1995/05/20 19:22:18 jkh Exp $ + * $Id: disks.c,v 1.26 1995/05/21 06:12:42 phk Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -276,7 +276,6 @@ diskPartition(Disk *d) free(p); } dialog_clear(); - refresh(); variable_set2(DISK_PARTITIONED, "yes"); return d; } diff --git a/release/sysinstall/dist.c b/release/sysinstall/dist.c index f191fe70608d..8a15b1befe35 100644 --- a/release/sysinstall/dist.c +++ b/release/sysinstall/dist.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dist.c,v 1.14 1995/05/21 10:05:17 jkh Exp $ + * $Id: dist.c,v 1.15 1995/05/21 15:40:47 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -131,79 +131,79 @@ extern Distribution XF86ServerDistTable[]; /* The top-level distribution categories */ static Distribution DistTable[] = { -{ "bin", "/", &Dists, DIST_BIN, NULL }, -{ "games", "/", &Dists, DIST_GAMES, NULL }, -{ "manpages", "/", &Dists, DIST_MANPAGES, NULL }, -{ "proflibs", "/", &Dists, DIST_PROFLIBS, NULL }, -{ "dict", "/", &Dists, DIST_DICT, NULL }, -{ "src/", "/", &Dists, DIST_SRC, SrcDistTable }, -{ "des", "/", &Dists, DIST_DES, NULL }, -{ "compat1x", "/", &Dists, DIST_COMPAT1X, NULL }, -{ "compat20", "/", &Dists, DIST_COMPAT20, NULL }, -{ "xf86311/", "/usr", &Dists, DIST_XF86, XF86DistTable }, +{ "bin", "/", &Dists, DIST_BIN, NULL }, +{ "games", "/", &Dists, DIST_GAMES, NULL }, +{ "manpages", "/", &Dists, DIST_MANPAGES, NULL }, +{ "proflibs", "/", &Dists, DIST_PROFLIBS, NULL }, +{ "dict", "/", &Dists, DIST_DICT, NULL }, +{ "src/", "/", &Dists, DIST_SRC, SrcDistTable }, +{ "des", "/", &Dists, DIST_DES, NULL }, +{ "compat1x", "/", &Dists, DIST_COMPAT1X, NULL }, +{ "compat20", "/", &Dists, DIST_COMPAT20, NULL }, +{ "xf86311/", "/usr", &Dists, DIST_XF86, XF86DistTable }, { NULL }, }; /* The /usr/src distribution */ static Distribution SrcDistTable[] = { -{ "base", "/", &SrcDists, DIST_SRC_BASE, NULL }, -{ "gnu", "/", &SrcDists, DIST_SRC_GNU, NULL }, -{ "etc", "/", &SrcDists, DIST_SRC_ETC, NULL }, -{ "games", "/", &SrcDists, DIST_SRC_GAMES, NULL }, -{ "include", "/", &SrcDists, DIST_SRC_INCLUDE, NULL }, -{ "lib", "/", &SrcDists, DIST_SRC_LIB, NULL }, -{ "libexec", "/", &SrcDists, DIST_SRC_LIBEXEC, NULL }, -{ "lkm", "/", &SrcDists, DIST_SRC_LKM, NULL }, -{ "release", "/", &SrcDists, DIST_SRC_RELEASE, NULL }, -{ "sbin", "/", &SrcDists, DIST_SRC_SBIN, NULL }, -{ "share", "/", &SrcDists, DIST_SRC_SHARE, NULL }, -{ "sys", "/", &SrcDists, DIST_SRC_SYS, NULL }, -{ "ubin", "/", &SrcDists, DIST_SRC_UBIN, NULL }, -{ "usbin", "/", &SrcDists, DIST_SRC_USBIN, NULL }, -{ "xf86", "/usr", &SrcDists, DIST_SRC_XF86, NULL }, +{ "sbase", "/usr/src", &SrcDists, DIST_SRC_BASE, NULL }, +{ "sgnu", "/usr/src", &SrcDists, DIST_SRC_GNU, NULL }, +{ "setc", "/usr/src", &SrcDists, DIST_SRC_ETC, NULL }, +{ "sgames", "/usr/src", &SrcDists, DIST_SRC_GAMES, NULL }, +{ "sinclude", "/usr/src", &SrcDists, DIST_SRC_INCLUDE, NULL }, +{ "slib", "/usr/src", &SrcDists, DIST_SRC_LIB, NULL }, +{ "slibexec", "/usr/src", &SrcDists, DIST_SRC_LIBEXEC, NULL }, +{ "slkm", "/usr/src", &SrcDists, DIST_SRC_LKM, NULL }, +{ "srelease", "/usr/src", &SrcDists, DIST_SRC_RELEASE, NULL }, +{ "ssbin", "/usr/src", &SrcDists, DIST_SRC_SBIN, NULL }, +{ "sshare", "/usr/src", &SrcDists, DIST_SRC_SHARE, NULL }, +{ "ssys", "/usr/src", &SrcDists, DIST_SRC_SYS, NULL }, +{ "subin", "/usr/src", &SrcDists, DIST_SRC_UBIN, NULL }, +{ "susbin", "/usr/src", &SrcDists, DIST_SRC_USBIN, NULL }, +{ "xf86", "/usr/X11R6/src", &SrcDists, DIST_SRC_XF86, NULL }, { NULL }, }; /* The XFree86 distribution */ static Distribution XF86DistTable[] = { -{ "bin", "/usr", &XF86Dists, DIST_XF86_BIN, NULL }, -{ "lib", "/usr", &XF86Dists, DIST_XF86_LIB, NULL }, -{ "doc", "/usr", &XF86Dists, DIST_XF86_DOC, NULL }, -{ "xf86311/", "/usr", &XF86Dists, DIST_XF86_FONTS, XF86FontDistTable }, -{ "man", "/usr", &XF86Dists, DIST_XF86_MAN, NULL }, -{ "prog", "/usr", &XF86Dists, DIST_XF86_PROG, NULL }, -{ "link", "/usr", &XF86Dists, DIST_XF86_LINK, NULL }, -{ "pex", "/usr", &XF86Dists, DIST_XF86_PEX, NULL }, -{ "lbx", "/usr", &XF86Dists, DIST_XF86_LBX, NULL }, -{ "xicf", "/usr", &XF86Dists, DIST_XF86_XINIT, NULL }, -{ "xdmcf", "/usr", &XF86Dists, DIST_XF86_XDMCF, NULL }, -{ "xf86311/", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable }, +{ "bin", "/usr", &XF86Dists, DIST_XF86_BIN, NULL }, +{ "lib", "/usr", &XF86Dists, DIST_XF86_LIB, NULL }, +{ "doc", "/usr", &XF86Dists, DIST_XF86_DOC, NULL }, +{ "xf86311/", "/usr", &XF86Dists, DIST_XF86_FONTS, XF86FontDistTable }, +{ "man", "/usr", &XF86Dists, DIST_XF86_MAN, NULL }, +{ "prog", "/usr", &XF86Dists, DIST_XF86_PROG, NULL }, +{ "link", "/usr", &XF86Dists, DIST_XF86_LINK, NULL }, +{ "pex", "/usr", &XF86Dists, DIST_XF86_PEX, NULL }, +{ "lbx", "/usr", &XF86Dists, DIST_XF86_LBX, NULL }, +{ "xicf", "/usr", &XF86Dists, DIST_XF86_XINIT, NULL }, +{ "xdmcf", "/usr", &XF86Dists, DIST_XF86_XDMCF, NULL }, +{ "xf86311/", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable }, { NULL }, }; /* The XFree86 server distribution */ static Distribution XF86ServerDistTable[] = { -{ "X3118514", "/usr", &XF86ServerDists, DIST_XF86_SERVER_8514, NULL }, -{ "X311AGX", "/usr", &XF86ServerDists, DIST_XF86_SERVER_AGX, NULL }, -{ "X311Mch3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH32,NULL }, -{ "X311Mch8", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH8, NULL }, -{ "X311Mono", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MONO, NULL }, -{ "X311P9K", "/usr", &XF86ServerDists, DIST_XF86_SERVER_P9000, NULL }, -{ "X311S3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_S3, NULL }, -{ "X311SVGA", "/usr", &XF86ServerDists, DIST_XF86_SERVER_SVGA, NULL }, -{ "X311VG16", "/usr", &XF86ServerDists, DIST_XF86_SERVER_VGA16, NULL }, -{ "X311W32", "/usr", &XF86ServerDists, DIST_XF86_SERVER_W32, NULL }, -{ "X311nest", "/usr", &XF86ServerDists, DIST_XF86_SERVER_NEST, NULL }, +{ "X3118514", "/usr", &XF86ServerDists, DIST_XF86_SERVER_8514, NULL }, +{ "X311AGX", "/usr", &XF86ServerDists, DIST_XF86_SERVER_AGX, NULL }, +{ "X311Mch3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH32,NULL }, +{ "X311Mch8", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH8, NULL }, +{ "X311Mono", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MONO, NULL }, +{ "X311P9K", "/usr", &XF86ServerDists, DIST_XF86_SERVER_P9000, NULL }, +{ "X311S3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_S3, NULL }, +{ "X311SVGA", "/usr", &XF86ServerDists, DIST_XF86_SERVER_SVGA, NULL }, +{ "X311VG16", "/usr", &XF86ServerDists, DIST_XF86_SERVER_VGA16, NULL }, +{ "X311W32", "/usr", &XF86ServerDists, DIST_XF86_SERVER_W32, NULL }, +{ "X311nest", "/usr", &XF86ServerDists, DIST_XF86_SERVER_NEST, NULL }, { NULL }, }; /* The XFree86 font distribution */ static Distribution XF86FontDistTable[] = { -{ "X311fnts", "/usr", &XF86FontDists, DIST_XF86_FONTS_MISC, NULL }, -{ "X311f100", "/usr", &XF86FontDists, DIST_XF86_FONTS_100, NULL }, -{ "X311fscl", "/usr", &XF86FontDists, DIST_XF86_FONTS_SCALE, NULL }, -{ "X311fnon", "/usr", &XF86FontDists, DIST_XF86_FONTS_NON, NULL }, -{ "X311fsrv", "/usr", &XF86FontDists, DIST_XF86_FONTS_SERVER, NULL }, +{ "X311fnts", "/usr", &XF86FontDists, DIST_XF86_FONTS_MISC, NULL }, +{ "X311f100", "/usr", &XF86FontDists, DIST_XF86_FONTS_100, NULL }, +{ "X311fscl", "/usr", &XF86FontDists, DIST_XF86_FONTS_SCALE, NULL }, +{ "X311fnon", "/usr", &XF86FontDists, DIST_XF86_FONTS_NON, NULL }, +{ "X311fsrv", "/usr", &XF86FontDists, DIST_XF86_FONTS_SERVER, NULL }, { NULL }, }; @@ -214,15 +214,16 @@ distExtract(char *parent, Distribution *me) int fd; status = 0; + if (mediaDevice->init) + if ((*mediaDevice->init)(mediaDevice) == FALSE) + return 0; for (i = 0; me[i].my_name; i++) { if (me[i].my_bit & *(me[i].my_mask)) { if (me[i].my_dist) status = distExtract(me[i].my_name, me[i].my_dist); else { - msgNotify("Attempting to open %s%s distribution", parent ? parent : "", me[i].my_name); fd = mediaOpen(parent, me[i].my_name); if (fd != -1) { - msgNotify("Extracting %s%s distribution", parent ? parent : "", me[i].my_name); status = mediaExtractDist(me[i].my_dir, fd); close(fd); } diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c index db8ecf1dad74..a00431a855d2 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.45 1995/05/21 01:56:01 phk Exp $ + * $Id: install.c,v 1.46 1995/05/21 15:40:48 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -56,6 +56,69 @@ static void cpio_extract(void); static void install_configuration_files(void); static void do_final_setup(void); +static Disk *rootdisk; +static Chunk *rootdev; + +static Boolean +checkLabels(void) +{ + Device **devs; + Disk *disk; + Chunk *c1, *c2, *swapdev = NULL; + int i; + + devs = deviceFind(NULL, DEVICE_TYPE_DISK); + /* First verify that we have a root device */ + for (i = 0; devs[i]; i++) { + if (!devs[i]->enabled) + continue; + disk = (Disk *)devs[i]->private; + msgDebug("Scanning disk %s for root filesystem\n", disk->name); + if (!disk->chunks) + msgFatal("No chunk list found for %s!", disk->name); + for (c1 = disk->chunks->part; c1; c1 = c1->next) { + if (c1->type == freebsd) { + for (c2 = c1->part; c2; c2 = c2->next) { + if (c2->type == part && c2->subtype != FS_SWAP && + c2->private && c2->flags & CHUNK_IS_ROOT) { + rootdisk = disk; + rootdev = c2; + break; + } + } + } + } + } + + /* Now register the swap devices */ + for (i = 0; devs[i]; i++) { + disk = (Disk *)devs[i]->private; + msgDebug("Scanning disk %s for swap partitions\n", disk->name); + if (!disk->chunks) + msgFatal("No chunk list found for %s!", disk->name); + for (c1 = disk->chunks->part; c1; c1 = c1->next) { + if (c1->type == freebsd) { + for (c2 = c1->part; c2; c2 = c2->next) { + if (c2->type == part && c2->subtype == FS_SWAP) { + swapdev = c2; + break; + } + } + } + } + } + + if (!rootdev) { + msgConfirm("No root device found - you must label a partition as /\n in the label editor."); + return FALSE; + } + if (!swapdev) { + msgConfirm("No swap devices found - you must create at least one\nswap partition."); + return FALSE; + } + return TRUE; +} + static void installInitial(void) { @@ -78,6 +141,8 @@ installInitial(void) msgConfirm("You need to assign disk labels before you can proceed with\nthe installation."); return; } + if (!checkLabels()) + return; /* Figure out what kind of MBR the user wants */ dmenuOpenSimple(&MenuMBRType); @@ -96,8 +161,8 @@ installInitial(void) devs = deviceFind(NULL, DEVICE_TYPE_DISK); for (i = 0; devs[i]; i++) { - Disk *d = (Disk *)devs[i]->private; Chunk *c1; + Disk *d = (Disk *)devs[i]->private; if (!devs[i]->enabled) continue; @@ -178,64 +243,46 @@ make_filesystems(void) Disk *disk; Chunk *c1, *c2; Device **devs; + char dname[40]; + PartInfo *p = (PartInfo *)rootdev->private; command_clear(); devs = deviceFind(NULL, DEVICE_TYPE_DISK); - /* First look for the root device and mount it */ - for (i = 0; devs[i]; i++) { - disk = (Disk *)devs[i]->private; - msgDebug("Scanning disk %s for root filesystem\n", disk->name); - if (!disk->chunks) - msgFatal("No chunk list found for %s!", disk->name); - for (c1 = disk->chunks->part; c1; c1 = c1->next) { - if (c1->type == freebsd) { - for (c2 = c1->part; c2; c2 = c2->next) { - if (c2->type == part && c2->subtype != FS_SWAP && - c2->private && c2->flags & CHUNK_IS_ROOT) { - char dname[40]; - PartInfo *p = (PartInfo *)c2->private; + /* First, create and mount the root device */ + if (strcmp(p->mountpoint, "/")) + msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", rootdev->name, p->mountpoint); - if (strcmp(p->mountpoint, "/")) { - msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", c2->name, p->mountpoint); - continue; - } - if (p->newfs) { - int i; + if (p->newfs) { + int i; - sprintf(dname, "/dev/r%sa", disk->name); - msgNotify("Making a new root filesystem on %s", dname); - i = vsystem("%s %s", p->newfs_cmd,dname); - if (i) { - msgConfirm("Unable to make new root filesystem! Command returned status %d", i); - return; - } - } - else - msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD."); - sprintf(dname, "/dev/%sa", disk->name); - if (Mount("/mnt", dname)) { - msgConfirm("Unable to mount the root file system! Giving up."); - return; - } - else { - extern int makedevs(void); - - msgNotify("Making device files"); - if (Mkdir("/mnt/dev", NULL) - || chdir("/mnt/dev") - || makedevs()) - msgConfirm("Failed to make some of the devices in /mnt!"); - if (Mkdir("/mnt/stand", NULL)) - msgConfirm("Unable to make /mnt/stand directory!"); - chdir("/"); - break; - } - } - } - } + sprintf(dname, "/dev/r%sa", rootdisk->name); + msgNotify("Making a new root filesystem on %s", dname); + i = vsystem("%s %s", p->newfs_cmd, dname); + if (i) { + msgConfirm("Unable to make new root filesystem! Command returned status %d", i); + return; } } + else + msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD."); + sprintf(dname, "/dev/%sa", rootdisk->name); + if (Mount("/mnt", dname)) { + msgConfirm("Unable to mount the root file system! Giving up."); + return; + } + else { + extern int makedevs(void); + + msgNotify("Making device files"); + if (Mkdir("/mnt/dev", NULL) || chdir("/mnt/dev") || makedevs()) + msgConfirm("Failed to make some of the devices in /mnt!"); + if (Mkdir("/mnt/stand", NULL)) { + msgConfirm("Unable to make /mnt/stand directory!"); + return; + } + chdir("/"); + } /* Now buzz through the rest of the partitions and mount them too */ for (i = 0; devs[i]; i++) { @@ -256,10 +303,20 @@ make_filesystems(void) continue; if (tmp->newfs) - command_shell_add(tmp->mountpoint, - "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); + command_shell_add(tmp->mountpoint, "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); command_func_add(tmp->mountpoint, Mount, c2->name); } + else if (c2->type == part && c2->subtype == FS_SWAP) { + char fname[80]; + int i; + + sprintf(fname, "/mnt/dev/%s", c2->name); + i = swapon(fname); + if (!i) + msgNotify("Added %s as a swap device", fname); + else + msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno)); + } } } } @@ -285,10 +342,21 @@ cpio_extract(void) { int i, j, zpid, cpid, pfd[2]; +#if 0 + if (mediaDevice && mediaDevice->type == DEVICE_TYPE_CDROM) { + if (mediaDevice->init) { + if ((*mediaDevice->init)(mediaDevice)) { + CpioFD = open("/cdrom/floppies/cpio.flp", O_RDONLY); + if (CpioFD != -1) + msgNotify("Loading CPIO floppy from CDROM"); + } + } + } +#endif tryagain: while (CpioFD == -1) { msgConfirm("Please Insert CPIO floppy in floppy drive 0"); - CpioFD = open("/dev/rfd0", O_RDWR); + CpioFD = open("/dev/rfd0", O_RDONLY); if (CpioFD >= 0) break; msgDebug("Error on open of cpio floppy: %s (%d)\n", strerror(errno), errno); @@ -302,6 +370,8 @@ cpio_extract(void) if (!zpid) { dup2(CpioFD, 0); close(CpioFD); dup2(pfd[1], 1); close(pfd[1]); + if (DebugFD != -1) + dup2(DebugFD, 2); close(pfd[0]); i = execl("/stand/gunzip", "/stand/gunzip", 0); msgDebug("/stand/gunzip command returns %d status\n", i); diff --git a/release/sysinstall/label.c b/release/sysinstall/label.c index 5395e1cbc4fb..a5d811a7b179 100644 --- a/release/sysinstall/label.c +++ b/release/sysinstall/label.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: label.c,v 1.19 1995/05/21 17:53:27 jkh Exp $ + * $Id: label.c,v 1.20 1995/05/21 18:24:33 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -66,11 +66,14 @@ #define CHUNK_SLICE_START_ROW 2 #define CHUNK_PART_START_ROW 11 +/* One MB worth of blocks */ +#define ONE_MEG 2048 + /* The smallest filesystem we're willing to create */ -#define FS_MIN_SIZE 2048 +#define FS_MIN_SIZE ONE_MEG /* The smallest root filesystem we're willing to create */ -#define ROOT_MIN_SIZE 40960 /* 20MB */ +#define ROOT_MIN_SIZE (20 * ONE_MEG) /* All the chunks currently displayed on the screen */ static struct { @@ -169,6 +172,7 @@ record_label_chunks() label_chunk_info[j].type = PART_FAT; label_chunk_info[j].d = d; label_chunk_info[j].c = c1; + ++j; } } } @@ -210,7 +214,6 @@ get_mountpoint(struct chunk *old) char *val; PartInfo *tmp; - dialog_clear(); clear(); val = msgGetInput(old && old->private ? ((PartInfo *)old->private)->mountpoint : NULL, "Please specify a mount point for the partition"); if (!val) @@ -255,7 +258,6 @@ get_partition_type(void) "Swap", "A swap partition.", }; - dialog_clear(); clear(); i = 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 (!i) { @@ -329,7 +331,7 @@ print_label_chunks(void) mvprintw(srow++, 0, "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)", label_chunk_info[i].d->name, - label_chunk_info[i].c->name, sz, (sz / 2048)); + label_chunk_info[i].c->name, sz, (sz / ONE_MEG)); } /* Otherwise it's a DOS, swap or filesystem entry, at the bottom */ else { @@ -381,7 +383,7 @@ print_label_chunks(void) for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++) onestr[PART_MOUNT_COL + j] = mountpoint[j]; snprintf(num, 10, "%4ldMB", label_chunk_info[i].c->size ? - label_chunk_info[i].c->size / 2048 : 0); + label_chunk_info[i].c->size / ONE_MEG : 0); memcpy(onestr + PART_SIZE_COL, num, strlen(num)); memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs)); onestr[PART_NEWFS_COL + strlen(newfs)] = '\0'; @@ -426,8 +428,9 @@ diskLabelEditor(char *str) msgConfirm("You need to partition your disk(s) before you can assign disk labels."); return 0; } - clear(); + dialog_clear(); clear(); while (labeling) { + clear(); print_label_chunks(); print_command_summary(); if (msg) { @@ -478,66 +481,70 @@ diskLabelEditor(char *str) break; } { - char *val, *cp, tmpb[20]; - int size; - struct chunk *tmp; - u_long flags = 0; + char *val, *cp, tmpb[20]; + int size; + struct chunk *tmp; + u_long flags = 0; - snprintf(tmpb, 20, "%d", sz); - val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M)."); - if (!val || (size = strtol(val, &cp, 0)) <= 0) - break; + snprintf(tmpb, 20, "%d", sz); + val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M)."); + if (!val || (size = strtol(val, &cp, 0)) <= 0) + break; - if (*cp && toupper(*cp) == 'M') - size *= 2048; + if (sz <= FS_MIN_SIZE) { + msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG); + break; + } + if (*cp && toupper(*cp) == 'M') + size *= ONE_MEG; - type = get_partition_type(); - if (type == PART_NONE) - break; - - if (type == PART_FILESYSTEM) { - if ((p = get_mountpoint(NULL)) == NULL) + type = get_partition_type(); + if (type == PART_NONE) break; - else if (!strcmp(p->mountpoint, "/")) - flags |= CHUNK_IS_ROOT; - else - flags &= ~CHUNK_IS_ROOT; - } else - p = NULL; - if ((flags & CHUNK_IS_ROOT)) { - if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) { - msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!"); + if (type == PART_FILESYSTEM) { + if ((p = get_mountpoint(NULL)) == NULL) + break; + else if (!strcmp(p->mountpoint, "/")) + flags |= CHUNK_IS_ROOT; + else + flags &= ~CHUNK_IS_ROOT; + } else + p = NULL; + + if ((flags & CHUNK_IS_ROOT)) { + if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) { + msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!"); + break; + } + if (size < ROOT_MIN_SIZE) { + msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG); + break; + } + } + tmp = Create_Chunk_DWIM(label_chunk_info[here].d, + label_chunk_info[here].c, + size, part, + (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, + flags); + if (!tmp) { + msgConfirm("Unable to create the partition. Too big?"); break; } - if (size < ROOT_MIN_SIZE) { - msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / 2048); - break; - } - } - tmp = Create_Chunk_DWIM(label_chunk_info[here].d, - label_chunk_info[here].c, - size, part, - (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, - flags); - if (!tmp) { - msgConfirm("Unable to create the partition. Too big?"); - break; - } - if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) { + if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) { msgConfirm("This region cannot be used for your root partition as it starts\nor extends past the 1024'th cylinder mark and is thus a\npoor location to boot from. Please choose another\nlocation for your root partition and try again!"); Delete_Chunk(label_chunk_info[here].d, tmp); break; - } - if (type != PART_SWAP) { + } + if (type != PART_SWAP) { /* This is needed to tell the newfs -u about the size */ tmp->private = new_part(p->mountpoint,p->newfs,tmp->size); safe_free(p); - } else { + } else { tmp->private = p; - } - tmp->private_free = safe_free; - record_label_chunks(); + } + tmp->private_free = safe_free; + record_label_chunks(); } break; @@ -639,7 +646,6 @@ diskLabelEditor(char *str) } variable_set2(DISK_LABELLED, "yes"); dialog_clear(); - refresh(); return 0; } diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c index a68e3785fd72..16bbc3312e1b 100644 --- a/release/sysinstall/media.c +++ b/release/sysinstall/media.c @@ -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: media.c,v 1.12 1995/05/21 15:40:50 jkh Exp $ + * $Id: media.c,v 1.13 1995/05/21 19:28:05 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -293,9 +293,7 @@ mediaOpen(char *parent, char *me) snprintf(distname, FILENAME_MAX, "%s%s", parent, me); else snprintf(distname, FILENAME_MAX, "%s/%s", me, me); - if (mediaDevice->init) - if ((*mediaDevice->init)(mediaDevice) == FALSE) - return -1; + msgNotify("Attempting to open %s distribution", distname); fd = (*mediaDevice->get)(distname); return fd; } @@ -315,58 +313,58 @@ mediaExtractDist(char *dir, int fd) if (!dir) dir = "/"; - j = fork(); - if (!j) { - chdir(dir); - pipe(pfd); - zpid = fork(); - if (!zpid) { - dup2(fd, 0); close(fd); - dup2(pfd[1], 1); close(pfd[1]); - close(pfd[0]); - i = execl("/stand/gunzip", "/stand/gunzip", 0); - msgDebug("/stand/gunzip command returns %d status\n", i); - exit(i); - } - cpid = fork(); - if (!cpid) { - dup2(pfd[0], 0); close(pfd[0]); - close(fd); - close(pfd[1]); - if (DebugFD != -1) { - dup2(DebugFD, 1); - dup2(DebugFD, 2); - } - else { - close(1); open("/dev/null", O_WRONLY); - dup2(1, 2); - } - i = execl("/stand/cpio", "/stand/cpio", "-iduvm", "-H", "tar", 0); - msgDebug("/stand/cpio command returns %d status\n", i); - exit(i); + msgNotify("Extracting into %s directory..", dir); + Mkdir(dir, NULL); + chdir(dir); + pipe(pfd); + zpid = fork(); + if (!zpid) { + dup2(fd, 0); close(fd); + dup2(pfd[1], 1); close(pfd[1]); + if (DebugFD != -1) + dup2(DebugFD, 2); + else { + close(2); + open("/dev/null", O_WRONLY); } close(pfd[0]); - close(pfd[1]); - close(fd); - - i = waitpid(zpid, &j, 0); - if (i < 0 || _WSTATUS(j)) { - dialog_clear(); - msgConfirm("gunzip returned error status of %d!", _WSTATUS(j)); - exit(1); - } - i = waitpid(cpid, &j, 0); - if (i < 0 || _WSTATUS(j)) { - dialog_clear(); - msgConfirm("cpio returned error status of %d!", _WSTATUS(j)); - exit(2); - } - exit(0); + i = execl("/stand/gunzip", "/stand/gunzip", 0); + msgDebug("/stand/gunzip command returns %d status\n", i); + exit(i); } - else - i = wait(&j); - if (i < 0 || _WSTATUS(j)) + cpid = fork(); + if (!cpid) { + dup2(pfd[0], 0); close(pfd[0]); + close(fd); + close(pfd[1]); + if (DebugFD != -1) { + dup2(DebugFD, 1); + dup2(DebugFD, 2); + } + else { + close(1); open("/dev/null", O_WRONLY); + dup2(1, 2); + } + i = execl("/stand/cpio", "/stand/cpio", "-iduvm", "-H", "tar", 0); + msgDebug("/stand/cpio command returns %d status\n", i); + exit(i); + } + close(pfd[0]); + close(pfd[1]); + close(fd); + + i = waitpid(zpid, &j, 0); + if (i < 0 || _WSTATUS(j)) { + dialog_clear(); + msgConfirm("gunzip returned error status of %d!", _WSTATUS(j)); return FALSE; + } + i = waitpid(cpid, &j, 0); + if (i < 0 || _WSTATUS(j)) { + dialog_clear(); + msgConfirm("cpio returned error status of %d!", _WSTATUS(j)); + return FALSE; + } return TRUE; } diff --git a/release/sysinstall/media_strategy.c b/release/sysinstall/media_strategy.c index b9bd7f2eb5af..954a2454d1ae 100644 --- a/release/sysinstall/media_strategy.c +++ b/release/sysinstall/media_strategy.c @@ -8,6 +8,8 @@ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. + * Copyright (c) 1995 + * Gary J Palmer. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -163,8 +165,8 @@ attr_parse(struct attribs **attr, char *file) break; case COMMIT: - attr[num_attribs]->name = strdup(hold_n); - attr[num_attribs++]->value = strdup(hold_v); + (*attr)[num_attribs].name = strdup(hold_n); + (*attr)[num_attribs++].value = strdup(hold_v); state = LOOK; v = n = 0; break; @@ -181,11 +183,12 @@ attr_match(struct attribs *attr, char *name) { int n = 0; - while((strcmp(attr[n].name, name)!=0) && (n < num_attribs)) + while((strcmp(attr[n].name, name)!=0) && (n < num_attribs) && (n < 20)) n++; - if (strcmp(attr[n].name, name)) + if (strcmp(attr[n].name, name)==0) return((const char *) attr[n].value); + return NULL; } @@ -196,6 +199,7 @@ genericGetDist(char *path, struct attribs *dist_attrib) char buf[512]; struct stat sb; int pfd[2], pid, numchunks; + const char *tmp; snprintf(buf, 512, "%s.tgz", path); @@ -209,10 +213,11 @@ genericGetDist(char *path, struct attribs *dist_attrib) if (stat(buf, &sb) != 0) { msgConfirm("Cannot find file(s) for distribution in ``%s''!\n", path); - return 0; + return -1; } - numchunks = atoi(attr_match(dist_attrib, "pieces")); + tmp = attr_match(dist_attrib, "pieces"); + numchunks = atoi(tmp); msgDebug("Attempting to extract distribution from %u files\n", numchunks); pipe(pfd); pid = fork(); @@ -220,6 +225,7 @@ genericGetDist(char *path, struct attribs *dist_attrib) { caddr_t memory; int chunk = 0; + int retval; dup2(pfd[1], 1); close(pfd[1]); close(pfd[0]); @@ -228,9 +234,8 @@ genericGetDist(char *path, struct attribs *dist_attrib) { int fd; - snprintf(buf, 512, "%s.%c%c", path, (chunk / 26), (chunk % 26)); - msgDebug("Opening %s\n", buf); - if ((fd = open(buf, O_RDONLY)) == NULL) + snprintf(buf, 512, "%s.%c%c", path, (chunk / 26) + 'a', (chunk % 26) + 'a'); + if ((fd = open(buf, O_RDONLY)) == -1) msgFatal("Cannot find file `%s'!\n", buf); fstat(fd, &sb); @@ -239,14 +244,26 @@ genericGetDist(char *path, struct attribs *dist_attrib) if (memory == (caddr_t) -1) msgFatal("mmap error: %s\n", strerror(errno)); - msgDebug("writing out mmap() space\n"); - write(1, memory, sb.st_size); - msgDebug("munmapping %s\n", buf); - munmap(memory, sb.st_size); - msgDebug("closing %s\n", buf); + retval = write(1, memory, sb.st_size); + if (retval != sb.st_size) + { + msgConfirm("write didn't write out the complete file!\n +(wrote %d bytes of %d bytes)\n", retval, sb.st_size); + exit(1); + } + + retval = munmap(memory, sb.st_size); + if (retval != 0) + { + msgConfirm("munmap() returned %d\n", retval); + exit(1); + } close(fd); ++chunk; } + close(1); + msgDebug("Extract of %s finished!!!\n", path); + exit(0); } close(pfd[1]); return(pfd[0]); @@ -254,21 +271,26 @@ genericGetDist(char *path, struct attribs *dist_attrib) /* Various media "strategy" routines */ +static Boolean cdromMounted; + Boolean mediaInitCDROM(Device *dev) { struct iso_args args; struct stat sb; - if (Mkdir("/mnt", NULL)) + if (cdromMounted) + return TRUE; + + if (Mkdir("/cdrom", NULL)) return FALSE; args.fspec = dev->devname; args.flags = 0; - if (mount(MOUNT_CD9660, "/mnt", MNT_RDONLY, (caddr_t) &args) == -1) + if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { - msgConfirm("Error mounting %s on /mnt: %s (%u)\n", + msgConfirm("Error mounting %s on /cdrom: %s (%u)\n", dev, strerror(errno), errno); return FALSE; } @@ -276,7 +298,7 @@ mediaInitCDROM(Device *dev) /* Do a very simple check to see if this looks roughly like a 2.0.5 CDROM Unfortunately FreeBSD won't let us read the ``label'' AFAIK, which is one sure way of telling the disc version :-( */ - if (stat("/mnt/dists", &sb)) + if (stat("/cdrom/dists", &sb)) { if (errno == ENOENT) { @@ -284,10 +306,11 @@ mediaInitCDROM(Device *dev) Is this a 2.0.5 CDROM?\n"); return FALSE; } else { - msgConfirm("Couldn't stat directory %s: %s", "/mnt/dists", strerror(errno)); + msgConfirm("Couldn't stat directory %s: %s", "/cdrom/dists", strerror(errno)); return FALSE; } } + cdromMounted = TRUE; return TRUE; } @@ -301,13 +324,14 @@ mediaGetCDROM(char *dist) dist_attr = safe_malloc(sizeof(struct attribs) * MAX_ATTRIBS); snprintf(buf, PATH_MAX, "/stand/info/%s.inf", dist); + if (attr_parse(&dist_attr, buf) == 0) { msgConfirm("Cannot load information file for distribution\n"); return FALSE; } - snprintf(buf, PATH_MAX, "/mnt/dists/%s", dist); + snprintf(buf, PATH_MAX, "/cdrom/dists/%s", dist); retval = genericGetDist(buf, dist_attr); free(dist_attr); @@ -317,9 +341,9 @@ mediaGetCDROM(char *dist) void mediaCloseCDROM(Device *dev) { - if (unmount("/mnt", 0) != 0) + if (unmount("/cdrom", 0) != 0) msgConfirm("Could not unmount the CDROM: %s\n", strerror(errno)); - + cdromMounted = FALSE; return; } diff --git a/release/sysinstall/msg.c b/release/sysinstall/msg.c index c9b3e2045e9f..c78621db4098 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.20 1995/05/20 14:05:31 jkh Exp $ + * $Id: msg.c,v 1.21 1995/05/20 19:12:12 phk Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -44,6 +44,9 @@ #include "sysinstall.h" #include +#define VTY_STATLINE 24 +#define TTY_STATLINE 23 + /* Whack up an informational message on the status line, in stand-out */ void msgYap(char *fmt, ...) @@ -58,7 +61,7 @@ msgYap(char *fmt, ...) va_end(args); attrs = getattrs(stdscr); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); free(errstr); @@ -74,7 +77,7 @@ msgInfo(char *fmt, ...) /* NULL is a special convention meaning "erase the old stuff" */ if (!fmt) { - move(23, 0); + move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0); clrtoeol(); return; } @@ -84,7 +87,7 @@ msgInfo(char *fmt, ...) va_end(args); attrs = getattrs(stdscr); attrset(A_NORMAL); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); if (OnVTY) { @@ -110,7 +113,7 @@ msgWarn(char *fmt, ...) attrs = getattrs(stdscr); beep(); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); if (OnVTY) @@ -134,7 +137,7 @@ msgError(char *fmt, ...) beep(); attrs = getattrs(stdscr); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); if (OnVTY) @@ -158,7 +161,7 @@ msgFatal(char *fmt, ...) beep(); attrs = getattrs(stdscr); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); addstr(" - "); addstr("PRESS ANY KEY TO "); if (getpid() == 1) diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c index 399c81296399..ba0b1904547a 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: disks.c,v 1.24 1995/05/20 19:22:18 jkh Exp $ + * $Id: disks.c,v 1.26 1995/05/21 06:12:42 phk Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -276,7 +276,6 @@ diskPartition(Disk *d) free(p); } dialog_clear(); - refresh(); variable_set2(DISK_PARTITIONED, "yes"); return d; } diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index db8ecf1dad74..a00431a855d2 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.45 1995/05/21 01:56:01 phk Exp $ + * $Id: install.c,v 1.46 1995/05/21 15:40:48 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -56,6 +56,69 @@ static void cpio_extract(void); static void install_configuration_files(void); static void do_final_setup(void); +static Disk *rootdisk; +static Chunk *rootdev; + +static Boolean +checkLabels(void) +{ + Device **devs; + Disk *disk; + Chunk *c1, *c2, *swapdev = NULL; + int i; + + devs = deviceFind(NULL, DEVICE_TYPE_DISK); + /* First verify that we have a root device */ + for (i = 0; devs[i]; i++) { + if (!devs[i]->enabled) + continue; + disk = (Disk *)devs[i]->private; + msgDebug("Scanning disk %s for root filesystem\n", disk->name); + if (!disk->chunks) + msgFatal("No chunk list found for %s!", disk->name); + for (c1 = disk->chunks->part; c1; c1 = c1->next) { + if (c1->type == freebsd) { + for (c2 = c1->part; c2; c2 = c2->next) { + if (c2->type == part && c2->subtype != FS_SWAP && + c2->private && c2->flags & CHUNK_IS_ROOT) { + rootdisk = disk; + rootdev = c2; + break; + } + } + } + } + } + + /* Now register the swap devices */ + for (i = 0; devs[i]; i++) { + disk = (Disk *)devs[i]->private; + msgDebug("Scanning disk %s for swap partitions\n", disk->name); + if (!disk->chunks) + msgFatal("No chunk list found for %s!", disk->name); + for (c1 = disk->chunks->part; c1; c1 = c1->next) { + if (c1->type == freebsd) { + for (c2 = c1->part; c2; c2 = c2->next) { + if (c2->type == part && c2->subtype == FS_SWAP) { + swapdev = c2; + break; + } + } + } + } + } + + if (!rootdev) { + msgConfirm("No root device found - you must label a partition as /\n in the label editor."); + return FALSE; + } + if (!swapdev) { + msgConfirm("No swap devices found - you must create at least one\nswap partition."); + return FALSE; + } + return TRUE; +} + static void installInitial(void) { @@ -78,6 +141,8 @@ installInitial(void) msgConfirm("You need to assign disk labels before you can proceed with\nthe installation."); return; } + if (!checkLabels()) + return; /* Figure out what kind of MBR the user wants */ dmenuOpenSimple(&MenuMBRType); @@ -96,8 +161,8 @@ installInitial(void) devs = deviceFind(NULL, DEVICE_TYPE_DISK); for (i = 0; devs[i]; i++) { - Disk *d = (Disk *)devs[i]->private; Chunk *c1; + Disk *d = (Disk *)devs[i]->private; if (!devs[i]->enabled) continue; @@ -178,64 +243,46 @@ make_filesystems(void) Disk *disk; Chunk *c1, *c2; Device **devs; + char dname[40]; + PartInfo *p = (PartInfo *)rootdev->private; command_clear(); devs = deviceFind(NULL, DEVICE_TYPE_DISK); - /* First look for the root device and mount it */ - for (i = 0; devs[i]; i++) { - disk = (Disk *)devs[i]->private; - msgDebug("Scanning disk %s for root filesystem\n", disk->name); - if (!disk->chunks) - msgFatal("No chunk list found for %s!", disk->name); - for (c1 = disk->chunks->part; c1; c1 = c1->next) { - if (c1->type == freebsd) { - for (c2 = c1->part; c2; c2 = c2->next) { - if (c2->type == part && c2->subtype != FS_SWAP && - c2->private && c2->flags & CHUNK_IS_ROOT) { - char dname[40]; - PartInfo *p = (PartInfo *)c2->private; + /* First, create and mount the root device */ + if (strcmp(p->mountpoint, "/")) + msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", rootdev->name, p->mountpoint); - if (strcmp(p->mountpoint, "/")) { - msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", c2->name, p->mountpoint); - continue; - } - if (p->newfs) { - int i; + if (p->newfs) { + int i; - sprintf(dname, "/dev/r%sa", disk->name); - msgNotify("Making a new root filesystem on %s", dname); - i = vsystem("%s %s", p->newfs_cmd,dname); - if (i) { - msgConfirm("Unable to make new root filesystem! Command returned status %d", i); - return; - } - } - else - msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD."); - sprintf(dname, "/dev/%sa", disk->name); - if (Mount("/mnt", dname)) { - msgConfirm("Unable to mount the root file system! Giving up."); - return; - } - else { - extern int makedevs(void); - - msgNotify("Making device files"); - if (Mkdir("/mnt/dev", NULL) - || chdir("/mnt/dev") - || makedevs()) - msgConfirm("Failed to make some of the devices in /mnt!"); - if (Mkdir("/mnt/stand", NULL)) - msgConfirm("Unable to make /mnt/stand directory!"); - chdir("/"); - break; - } - } - } - } + sprintf(dname, "/dev/r%sa", rootdisk->name); + msgNotify("Making a new root filesystem on %s", dname); + i = vsystem("%s %s", p->newfs_cmd, dname); + if (i) { + msgConfirm("Unable to make new root filesystem! Command returned status %d", i); + return; } } + else + msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD."); + sprintf(dname, "/dev/%sa", rootdisk->name); + if (Mount("/mnt", dname)) { + msgConfirm("Unable to mount the root file system! Giving up."); + return; + } + else { + extern int makedevs(void); + + msgNotify("Making device files"); + if (Mkdir("/mnt/dev", NULL) || chdir("/mnt/dev") || makedevs()) + msgConfirm("Failed to make some of the devices in /mnt!"); + if (Mkdir("/mnt/stand", NULL)) { + msgConfirm("Unable to make /mnt/stand directory!"); + return; + } + chdir("/"); + } /* Now buzz through the rest of the partitions and mount them too */ for (i = 0; devs[i]; i++) { @@ -256,10 +303,20 @@ make_filesystems(void) continue; if (tmp->newfs) - command_shell_add(tmp->mountpoint, - "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); + command_shell_add(tmp->mountpoint, "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); command_func_add(tmp->mountpoint, Mount, c2->name); } + else if (c2->type == part && c2->subtype == FS_SWAP) { + char fname[80]; + int i; + + sprintf(fname, "/mnt/dev/%s", c2->name); + i = swapon(fname); + if (!i) + msgNotify("Added %s as a swap device", fname); + else + msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno)); + } } } } @@ -285,10 +342,21 @@ cpio_extract(void) { int i, j, zpid, cpid, pfd[2]; +#if 0 + if (mediaDevice && mediaDevice->type == DEVICE_TYPE_CDROM) { + if (mediaDevice->init) { + if ((*mediaDevice->init)(mediaDevice)) { + CpioFD = open("/cdrom/floppies/cpio.flp", O_RDONLY); + if (CpioFD != -1) + msgNotify("Loading CPIO floppy from CDROM"); + } + } + } +#endif tryagain: while (CpioFD == -1) { msgConfirm("Please Insert CPIO floppy in floppy drive 0"); - CpioFD = open("/dev/rfd0", O_RDWR); + CpioFD = open("/dev/rfd0", O_RDONLY); if (CpioFD >= 0) break; msgDebug("Error on open of cpio floppy: %s (%d)\n", strerror(errno), errno); @@ -302,6 +370,8 @@ cpio_extract(void) if (!zpid) { dup2(CpioFD, 0); close(CpioFD); dup2(pfd[1], 1); close(pfd[1]); + if (DebugFD != -1) + dup2(DebugFD, 2); close(pfd[0]); i = execl("/stand/gunzip", "/stand/gunzip", 0); msgDebug("/stand/gunzip command returns %d status\n", i); diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index 5395e1cbc4fb..a5d811a7b179 100644 --- a/usr.sbin/sade/label.c +++ b/usr.sbin/sade/label.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: label.c,v 1.19 1995/05/21 17:53:27 jkh Exp $ + * $Id: label.c,v 1.20 1995/05/21 18:24:33 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -66,11 +66,14 @@ #define CHUNK_SLICE_START_ROW 2 #define CHUNK_PART_START_ROW 11 +/* One MB worth of blocks */ +#define ONE_MEG 2048 + /* The smallest filesystem we're willing to create */ -#define FS_MIN_SIZE 2048 +#define FS_MIN_SIZE ONE_MEG /* The smallest root filesystem we're willing to create */ -#define ROOT_MIN_SIZE 40960 /* 20MB */ +#define ROOT_MIN_SIZE (20 * ONE_MEG) /* All the chunks currently displayed on the screen */ static struct { @@ -169,6 +172,7 @@ record_label_chunks() label_chunk_info[j].type = PART_FAT; label_chunk_info[j].d = d; label_chunk_info[j].c = c1; + ++j; } } } @@ -210,7 +214,6 @@ get_mountpoint(struct chunk *old) char *val; PartInfo *tmp; - dialog_clear(); clear(); val = msgGetInput(old && old->private ? ((PartInfo *)old->private)->mountpoint : NULL, "Please specify a mount point for the partition"); if (!val) @@ -255,7 +258,6 @@ get_partition_type(void) "Swap", "A swap partition.", }; - dialog_clear(); clear(); i = 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 (!i) { @@ -329,7 +331,7 @@ print_label_chunks(void) mvprintw(srow++, 0, "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)", label_chunk_info[i].d->name, - label_chunk_info[i].c->name, sz, (sz / 2048)); + label_chunk_info[i].c->name, sz, (sz / ONE_MEG)); } /* Otherwise it's a DOS, swap or filesystem entry, at the bottom */ else { @@ -381,7 +383,7 @@ print_label_chunks(void) for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++) onestr[PART_MOUNT_COL + j] = mountpoint[j]; snprintf(num, 10, "%4ldMB", label_chunk_info[i].c->size ? - label_chunk_info[i].c->size / 2048 : 0); + label_chunk_info[i].c->size / ONE_MEG : 0); memcpy(onestr + PART_SIZE_COL, num, strlen(num)); memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs)); onestr[PART_NEWFS_COL + strlen(newfs)] = '\0'; @@ -426,8 +428,9 @@ diskLabelEditor(char *str) msgConfirm("You need to partition your disk(s) before you can assign disk labels."); return 0; } - clear(); + dialog_clear(); clear(); while (labeling) { + clear(); print_label_chunks(); print_command_summary(); if (msg) { @@ -478,66 +481,70 @@ diskLabelEditor(char *str) break; } { - char *val, *cp, tmpb[20]; - int size; - struct chunk *tmp; - u_long flags = 0; + char *val, *cp, tmpb[20]; + int size; + struct chunk *tmp; + u_long flags = 0; - snprintf(tmpb, 20, "%d", sz); - val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M)."); - if (!val || (size = strtol(val, &cp, 0)) <= 0) - break; + snprintf(tmpb, 20, "%d", sz); + val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M)."); + if (!val || (size = strtol(val, &cp, 0)) <= 0) + break; - if (*cp && toupper(*cp) == 'M') - size *= 2048; + if (sz <= FS_MIN_SIZE) { + msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG); + break; + } + if (*cp && toupper(*cp) == 'M') + size *= ONE_MEG; - type = get_partition_type(); - if (type == PART_NONE) - break; - - if (type == PART_FILESYSTEM) { - if ((p = get_mountpoint(NULL)) == NULL) + type = get_partition_type(); + if (type == PART_NONE) break; - else if (!strcmp(p->mountpoint, "/")) - flags |= CHUNK_IS_ROOT; - else - flags &= ~CHUNK_IS_ROOT; - } else - p = NULL; - if ((flags & CHUNK_IS_ROOT)) { - if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) { - msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!"); + if (type == PART_FILESYSTEM) { + if ((p = get_mountpoint(NULL)) == NULL) + break; + else if (!strcmp(p->mountpoint, "/")) + flags |= CHUNK_IS_ROOT; + else + flags &= ~CHUNK_IS_ROOT; + } else + p = NULL; + + if ((flags & CHUNK_IS_ROOT)) { + if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) { + msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!"); + break; + } + if (size < ROOT_MIN_SIZE) { + msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG); + break; + } + } + tmp = Create_Chunk_DWIM(label_chunk_info[here].d, + label_chunk_info[here].c, + size, part, + (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, + flags); + if (!tmp) { + msgConfirm("Unable to create the partition. Too big?"); break; } - if (size < ROOT_MIN_SIZE) { - msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / 2048); - break; - } - } - tmp = Create_Chunk_DWIM(label_chunk_info[here].d, - label_chunk_info[here].c, - size, part, - (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, - flags); - if (!tmp) { - msgConfirm("Unable to create the partition. Too big?"); - break; - } - if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) { + if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) { msgConfirm("This region cannot be used for your root partition as it starts\nor extends past the 1024'th cylinder mark and is thus a\npoor location to boot from. Please choose another\nlocation for your root partition and try again!"); Delete_Chunk(label_chunk_info[here].d, tmp); break; - } - if (type != PART_SWAP) { + } + if (type != PART_SWAP) { /* This is needed to tell the newfs -u about the size */ tmp->private = new_part(p->mountpoint,p->newfs,tmp->size); safe_free(p); - } else { + } else { tmp->private = p; - } - tmp->private_free = safe_free; - record_label_chunks(); + } + tmp->private_free = safe_free; + record_label_chunks(); } break; @@ -639,7 +646,6 @@ diskLabelEditor(char *str) } variable_set2(DISK_LABELLED, "yes"); dialog_clear(); - refresh(); return 0; } diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c index c9b3e2045e9f..c78621db4098 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.20 1995/05/20 14:05:31 jkh Exp $ + * $Id: msg.c,v 1.21 1995/05/20 19:12:12 phk Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -44,6 +44,9 @@ #include "sysinstall.h" #include +#define VTY_STATLINE 24 +#define TTY_STATLINE 23 + /* Whack up an informational message on the status line, in stand-out */ void msgYap(char *fmt, ...) @@ -58,7 +61,7 @@ msgYap(char *fmt, ...) va_end(args); attrs = getattrs(stdscr); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); free(errstr); @@ -74,7 +77,7 @@ msgInfo(char *fmt, ...) /* NULL is a special convention meaning "erase the old stuff" */ if (!fmt) { - move(23, 0); + move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0); clrtoeol(); return; } @@ -84,7 +87,7 @@ msgInfo(char *fmt, ...) va_end(args); attrs = getattrs(stdscr); attrset(A_NORMAL); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); if (OnVTY) { @@ -110,7 +113,7 @@ msgWarn(char *fmt, ...) attrs = getattrs(stdscr); beep(); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); if (OnVTY) @@ -134,7 +137,7 @@ msgError(char *fmt, ...) beep(); attrs = getattrs(stdscr); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); if (OnVTY) @@ -158,7 +161,7 @@ msgFatal(char *fmt, ...) beep(); attrs = getattrs(stdscr); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); addstr(" - "); addstr("PRESS ANY KEY TO "); if (getpid() == 1) diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index 399c81296399..ba0b1904547a 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: disks.c,v 1.24 1995/05/20 19:22:18 jkh Exp $ + * $Id: disks.c,v 1.26 1995/05/21 06:12:42 phk Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -276,7 +276,6 @@ diskPartition(Disk *d) free(p); } dialog_clear(); - refresh(); variable_set2(DISK_PARTITIONED, "yes"); return d; } diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index f191fe70608d..8a15b1befe35 100644 --- a/usr.sbin/sysinstall/dist.c +++ b/usr.sbin/sysinstall/dist.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dist.c,v 1.14 1995/05/21 10:05:17 jkh Exp $ + * $Id: dist.c,v 1.15 1995/05/21 15:40:47 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -131,79 +131,79 @@ extern Distribution XF86ServerDistTable[]; /* The top-level distribution categories */ static Distribution DistTable[] = { -{ "bin", "/", &Dists, DIST_BIN, NULL }, -{ "games", "/", &Dists, DIST_GAMES, NULL }, -{ "manpages", "/", &Dists, DIST_MANPAGES, NULL }, -{ "proflibs", "/", &Dists, DIST_PROFLIBS, NULL }, -{ "dict", "/", &Dists, DIST_DICT, NULL }, -{ "src/", "/", &Dists, DIST_SRC, SrcDistTable }, -{ "des", "/", &Dists, DIST_DES, NULL }, -{ "compat1x", "/", &Dists, DIST_COMPAT1X, NULL }, -{ "compat20", "/", &Dists, DIST_COMPAT20, NULL }, -{ "xf86311/", "/usr", &Dists, DIST_XF86, XF86DistTable }, +{ "bin", "/", &Dists, DIST_BIN, NULL }, +{ "games", "/", &Dists, DIST_GAMES, NULL }, +{ "manpages", "/", &Dists, DIST_MANPAGES, NULL }, +{ "proflibs", "/", &Dists, DIST_PROFLIBS, NULL }, +{ "dict", "/", &Dists, DIST_DICT, NULL }, +{ "src/", "/", &Dists, DIST_SRC, SrcDistTable }, +{ "des", "/", &Dists, DIST_DES, NULL }, +{ "compat1x", "/", &Dists, DIST_COMPAT1X, NULL }, +{ "compat20", "/", &Dists, DIST_COMPAT20, NULL }, +{ "xf86311/", "/usr", &Dists, DIST_XF86, XF86DistTable }, { NULL }, }; /* The /usr/src distribution */ static Distribution SrcDistTable[] = { -{ "base", "/", &SrcDists, DIST_SRC_BASE, NULL }, -{ "gnu", "/", &SrcDists, DIST_SRC_GNU, NULL }, -{ "etc", "/", &SrcDists, DIST_SRC_ETC, NULL }, -{ "games", "/", &SrcDists, DIST_SRC_GAMES, NULL }, -{ "include", "/", &SrcDists, DIST_SRC_INCLUDE, NULL }, -{ "lib", "/", &SrcDists, DIST_SRC_LIB, NULL }, -{ "libexec", "/", &SrcDists, DIST_SRC_LIBEXEC, NULL }, -{ "lkm", "/", &SrcDists, DIST_SRC_LKM, NULL }, -{ "release", "/", &SrcDists, DIST_SRC_RELEASE, NULL }, -{ "sbin", "/", &SrcDists, DIST_SRC_SBIN, NULL }, -{ "share", "/", &SrcDists, DIST_SRC_SHARE, NULL }, -{ "sys", "/", &SrcDists, DIST_SRC_SYS, NULL }, -{ "ubin", "/", &SrcDists, DIST_SRC_UBIN, NULL }, -{ "usbin", "/", &SrcDists, DIST_SRC_USBIN, NULL }, -{ "xf86", "/usr", &SrcDists, DIST_SRC_XF86, NULL }, +{ "sbase", "/usr/src", &SrcDists, DIST_SRC_BASE, NULL }, +{ "sgnu", "/usr/src", &SrcDists, DIST_SRC_GNU, NULL }, +{ "setc", "/usr/src", &SrcDists, DIST_SRC_ETC, NULL }, +{ "sgames", "/usr/src", &SrcDists, DIST_SRC_GAMES, NULL }, +{ "sinclude", "/usr/src", &SrcDists, DIST_SRC_INCLUDE, NULL }, +{ "slib", "/usr/src", &SrcDists, DIST_SRC_LIB, NULL }, +{ "slibexec", "/usr/src", &SrcDists, DIST_SRC_LIBEXEC, NULL }, +{ "slkm", "/usr/src", &SrcDists, DIST_SRC_LKM, NULL }, +{ "srelease", "/usr/src", &SrcDists, DIST_SRC_RELEASE, NULL }, +{ "ssbin", "/usr/src", &SrcDists, DIST_SRC_SBIN, NULL }, +{ "sshare", "/usr/src", &SrcDists, DIST_SRC_SHARE, NULL }, +{ "ssys", "/usr/src", &SrcDists, DIST_SRC_SYS, NULL }, +{ "subin", "/usr/src", &SrcDists, DIST_SRC_UBIN, NULL }, +{ "susbin", "/usr/src", &SrcDists, DIST_SRC_USBIN, NULL }, +{ "xf86", "/usr/X11R6/src", &SrcDists, DIST_SRC_XF86, NULL }, { NULL }, }; /* The XFree86 distribution */ static Distribution XF86DistTable[] = { -{ "bin", "/usr", &XF86Dists, DIST_XF86_BIN, NULL }, -{ "lib", "/usr", &XF86Dists, DIST_XF86_LIB, NULL }, -{ "doc", "/usr", &XF86Dists, DIST_XF86_DOC, NULL }, -{ "xf86311/", "/usr", &XF86Dists, DIST_XF86_FONTS, XF86FontDistTable }, -{ "man", "/usr", &XF86Dists, DIST_XF86_MAN, NULL }, -{ "prog", "/usr", &XF86Dists, DIST_XF86_PROG, NULL }, -{ "link", "/usr", &XF86Dists, DIST_XF86_LINK, NULL }, -{ "pex", "/usr", &XF86Dists, DIST_XF86_PEX, NULL }, -{ "lbx", "/usr", &XF86Dists, DIST_XF86_LBX, NULL }, -{ "xicf", "/usr", &XF86Dists, DIST_XF86_XINIT, NULL }, -{ "xdmcf", "/usr", &XF86Dists, DIST_XF86_XDMCF, NULL }, -{ "xf86311/", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable }, +{ "bin", "/usr", &XF86Dists, DIST_XF86_BIN, NULL }, +{ "lib", "/usr", &XF86Dists, DIST_XF86_LIB, NULL }, +{ "doc", "/usr", &XF86Dists, DIST_XF86_DOC, NULL }, +{ "xf86311/", "/usr", &XF86Dists, DIST_XF86_FONTS, XF86FontDistTable }, +{ "man", "/usr", &XF86Dists, DIST_XF86_MAN, NULL }, +{ "prog", "/usr", &XF86Dists, DIST_XF86_PROG, NULL }, +{ "link", "/usr", &XF86Dists, DIST_XF86_LINK, NULL }, +{ "pex", "/usr", &XF86Dists, DIST_XF86_PEX, NULL }, +{ "lbx", "/usr", &XF86Dists, DIST_XF86_LBX, NULL }, +{ "xicf", "/usr", &XF86Dists, DIST_XF86_XINIT, NULL }, +{ "xdmcf", "/usr", &XF86Dists, DIST_XF86_XDMCF, NULL }, +{ "xf86311/", "/usr", &XF86Dists, DIST_XF86_SERVER, XF86ServerDistTable }, { NULL }, }; /* The XFree86 server distribution */ static Distribution XF86ServerDistTable[] = { -{ "X3118514", "/usr", &XF86ServerDists, DIST_XF86_SERVER_8514, NULL }, -{ "X311AGX", "/usr", &XF86ServerDists, DIST_XF86_SERVER_AGX, NULL }, -{ "X311Mch3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH32,NULL }, -{ "X311Mch8", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH8, NULL }, -{ "X311Mono", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MONO, NULL }, -{ "X311P9K", "/usr", &XF86ServerDists, DIST_XF86_SERVER_P9000, NULL }, -{ "X311S3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_S3, NULL }, -{ "X311SVGA", "/usr", &XF86ServerDists, DIST_XF86_SERVER_SVGA, NULL }, -{ "X311VG16", "/usr", &XF86ServerDists, DIST_XF86_SERVER_VGA16, NULL }, -{ "X311W32", "/usr", &XF86ServerDists, DIST_XF86_SERVER_W32, NULL }, -{ "X311nest", "/usr", &XF86ServerDists, DIST_XF86_SERVER_NEST, NULL }, +{ "X3118514", "/usr", &XF86ServerDists, DIST_XF86_SERVER_8514, NULL }, +{ "X311AGX", "/usr", &XF86ServerDists, DIST_XF86_SERVER_AGX, NULL }, +{ "X311Mch3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH32,NULL }, +{ "X311Mch8", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MACH8, NULL }, +{ "X311Mono", "/usr", &XF86ServerDists, DIST_XF86_SERVER_MONO, NULL }, +{ "X311P9K", "/usr", &XF86ServerDists, DIST_XF86_SERVER_P9000, NULL }, +{ "X311S3", "/usr", &XF86ServerDists, DIST_XF86_SERVER_S3, NULL }, +{ "X311SVGA", "/usr", &XF86ServerDists, DIST_XF86_SERVER_SVGA, NULL }, +{ "X311VG16", "/usr", &XF86ServerDists, DIST_XF86_SERVER_VGA16, NULL }, +{ "X311W32", "/usr", &XF86ServerDists, DIST_XF86_SERVER_W32, NULL }, +{ "X311nest", "/usr", &XF86ServerDists, DIST_XF86_SERVER_NEST, NULL }, { NULL }, }; /* The XFree86 font distribution */ static Distribution XF86FontDistTable[] = { -{ "X311fnts", "/usr", &XF86FontDists, DIST_XF86_FONTS_MISC, NULL }, -{ "X311f100", "/usr", &XF86FontDists, DIST_XF86_FONTS_100, NULL }, -{ "X311fscl", "/usr", &XF86FontDists, DIST_XF86_FONTS_SCALE, NULL }, -{ "X311fnon", "/usr", &XF86FontDists, DIST_XF86_FONTS_NON, NULL }, -{ "X311fsrv", "/usr", &XF86FontDists, DIST_XF86_FONTS_SERVER, NULL }, +{ "X311fnts", "/usr", &XF86FontDists, DIST_XF86_FONTS_MISC, NULL }, +{ "X311f100", "/usr", &XF86FontDists, DIST_XF86_FONTS_100, NULL }, +{ "X311fscl", "/usr", &XF86FontDists, DIST_XF86_FONTS_SCALE, NULL }, +{ "X311fnon", "/usr", &XF86FontDists, DIST_XF86_FONTS_NON, NULL }, +{ "X311fsrv", "/usr", &XF86FontDists, DIST_XF86_FONTS_SERVER, NULL }, { NULL }, }; @@ -214,15 +214,16 @@ distExtract(char *parent, Distribution *me) int fd; status = 0; + if (mediaDevice->init) + if ((*mediaDevice->init)(mediaDevice) == FALSE) + return 0; for (i = 0; me[i].my_name; i++) { if (me[i].my_bit & *(me[i].my_mask)) { if (me[i].my_dist) status = distExtract(me[i].my_name, me[i].my_dist); else { - msgNotify("Attempting to open %s%s distribution", parent ? parent : "", me[i].my_name); fd = mediaOpen(parent, me[i].my_name); if (fd != -1) { - msgNotify("Extracting %s%s distribution", parent ? parent : "", me[i].my_name); status = mediaExtractDist(me[i].my_dir, fd); close(fd); } diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index db8ecf1dad74..a00431a855d2 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.45 1995/05/21 01:56:01 phk Exp $ + * $Id: install.c,v 1.46 1995/05/21 15:40:48 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -56,6 +56,69 @@ static void cpio_extract(void); static void install_configuration_files(void); static void do_final_setup(void); +static Disk *rootdisk; +static Chunk *rootdev; + +static Boolean +checkLabels(void) +{ + Device **devs; + Disk *disk; + Chunk *c1, *c2, *swapdev = NULL; + int i; + + devs = deviceFind(NULL, DEVICE_TYPE_DISK); + /* First verify that we have a root device */ + for (i = 0; devs[i]; i++) { + if (!devs[i]->enabled) + continue; + disk = (Disk *)devs[i]->private; + msgDebug("Scanning disk %s for root filesystem\n", disk->name); + if (!disk->chunks) + msgFatal("No chunk list found for %s!", disk->name); + for (c1 = disk->chunks->part; c1; c1 = c1->next) { + if (c1->type == freebsd) { + for (c2 = c1->part; c2; c2 = c2->next) { + if (c2->type == part && c2->subtype != FS_SWAP && + c2->private && c2->flags & CHUNK_IS_ROOT) { + rootdisk = disk; + rootdev = c2; + break; + } + } + } + } + } + + /* Now register the swap devices */ + for (i = 0; devs[i]; i++) { + disk = (Disk *)devs[i]->private; + msgDebug("Scanning disk %s for swap partitions\n", disk->name); + if (!disk->chunks) + msgFatal("No chunk list found for %s!", disk->name); + for (c1 = disk->chunks->part; c1; c1 = c1->next) { + if (c1->type == freebsd) { + for (c2 = c1->part; c2; c2 = c2->next) { + if (c2->type == part && c2->subtype == FS_SWAP) { + swapdev = c2; + break; + } + } + } + } + } + + if (!rootdev) { + msgConfirm("No root device found - you must label a partition as /\n in the label editor."); + return FALSE; + } + if (!swapdev) { + msgConfirm("No swap devices found - you must create at least one\nswap partition."); + return FALSE; + } + return TRUE; +} + static void installInitial(void) { @@ -78,6 +141,8 @@ installInitial(void) msgConfirm("You need to assign disk labels before you can proceed with\nthe installation."); return; } + if (!checkLabels()) + return; /* Figure out what kind of MBR the user wants */ dmenuOpenSimple(&MenuMBRType); @@ -96,8 +161,8 @@ installInitial(void) devs = deviceFind(NULL, DEVICE_TYPE_DISK); for (i = 0; devs[i]; i++) { - Disk *d = (Disk *)devs[i]->private; Chunk *c1; + Disk *d = (Disk *)devs[i]->private; if (!devs[i]->enabled) continue; @@ -178,64 +243,46 @@ make_filesystems(void) Disk *disk; Chunk *c1, *c2; Device **devs; + char dname[40]; + PartInfo *p = (PartInfo *)rootdev->private; command_clear(); devs = deviceFind(NULL, DEVICE_TYPE_DISK); - /* First look for the root device and mount it */ - for (i = 0; devs[i]; i++) { - disk = (Disk *)devs[i]->private; - msgDebug("Scanning disk %s for root filesystem\n", disk->name); - if (!disk->chunks) - msgFatal("No chunk list found for %s!", disk->name); - for (c1 = disk->chunks->part; c1; c1 = c1->next) { - if (c1->type == freebsd) { - for (c2 = c1->part; c2; c2 = c2->next) { - if (c2->type == part && c2->subtype != FS_SWAP && - c2->private && c2->flags & CHUNK_IS_ROOT) { - char dname[40]; - PartInfo *p = (PartInfo *)c2->private; + /* First, create and mount the root device */ + if (strcmp(p->mountpoint, "/")) + msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", rootdev->name, p->mountpoint); - if (strcmp(p->mountpoint, "/")) { - msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", c2->name, p->mountpoint); - continue; - } - if (p->newfs) { - int i; + if (p->newfs) { + int i; - sprintf(dname, "/dev/r%sa", disk->name); - msgNotify("Making a new root filesystem on %s", dname); - i = vsystem("%s %s", p->newfs_cmd,dname); - if (i) { - msgConfirm("Unable to make new root filesystem! Command returned status %d", i); - return; - } - } - else - msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD."); - sprintf(dname, "/dev/%sa", disk->name); - if (Mount("/mnt", dname)) { - msgConfirm("Unable to mount the root file system! Giving up."); - return; - } - else { - extern int makedevs(void); - - msgNotify("Making device files"); - if (Mkdir("/mnt/dev", NULL) - || chdir("/mnt/dev") - || makedevs()) - msgConfirm("Failed to make some of the devices in /mnt!"); - if (Mkdir("/mnt/stand", NULL)) - msgConfirm("Unable to make /mnt/stand directory!"); - chdir("/"); - break; - } - } - } - } + sprintf(dname, "/dev/r%sa", rootdisk->name); + msgNotify("Making a new root filesystem on %s", dname); + i = vsystem("%s %s", p->newfs_cmd, dname); + if (i) { + msgConfirm("Unable to make new root filesystem! Command returned status %d", i); + return; } } + else + msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD."); + sprintf(dname, "/dev/%sa", rootdisk->name); + if (Mount("/mnt", dname)) { + msgConfirm("Unable to mount the root file system! Giving up."); + return; + } + else { + extern int makedevs(void); + + msgNotify("Making device files"); + if (Mkdir("/mnt/dev", NULL) || chdir("/mnt/dev") || makedevs()) + msgConfirm("Failed to make some of the devices in /mnt!"); + if (Mkdir("/mnt/stand", NULL)) { + msgConfirm("Unable to make /mnt/stand directory!"); + return; + } + chdir("/"); + } /* Now buzz through the rest of the partitions and mount them too */ for (i = 0; devs[i]; i++) { @@ -256,10 +303,20 @@ make_filesystems(void) continue; if (tmp->newfs) - command_shell_add(tmp->mountpoint, - "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); + command_shell_add(tmp->mountpoint, "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); command_func_add(tmp->mountpoint, Mount, c2->name); } + else if (c2->type == part && c2->subtype == FS_SWAP) { + char fname[80]; + int i; + + sprintf(fname, "/mnt/dev/%s", c2->name); + i = swapon(fname); + if (!i) + msgNotify("Added %s as a swap device", fname); + else + msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno)); + } } } } @@ -285,10 +342,21 @@ cpio_extract(void) { int i, j, zpid, cpid, pfd[2]; +#if 0 + if (mediaDevice && mediaDevice->type == DEVICE_TYPE_CDROM) { + if (mediaDevice->init) { + if ((*mediaDevice->init)(mediaDevice)) { + CpioFD = open("/cdrom/floppies/cpio.flp", O_RDONLY); + if (CpioFD != -1) + msgNotify("Loading CPIO floppy from CDROM"); + } + } + } +#endif tryagain: while (CpioFD == -1) { msgConfirm("Please Insert CPIO floppy in floppy drive 0"); - CpioFD = open("/dev/rfd0", O_RDWR); + CpioFD = open("/dev/rfd0", O_RDONLY); if (CpioFD >= 0) break; msgDebug("Error on open of cpio floppy: %s (%d)\n", strerror(errno), errno); @@ -302,6 +370,8 @@ cpio_extract(void) if (!zpid) { dup2(CpioFD, 0); close(CpioFD); dup2(pfd[1], 1); close(pfd[1]); + if (DebugFD != -1) + dup2(DebugFD, 2); close(pfd[0]); i = execl("/stand/gunzip", "/stand/gunzip", 0); msgDebug("/stand/gunzip command returns %d status\n", i); diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index 5395e1cbc4fb..a5d811a7b179 100644 --- a/usr.sbin/sysinstall/label.c +++ b/usr.sbin/sysinstall/label.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: label.c,v 1.19 1995/05/21 17:53:27 jkh Exp $ + * $Id: label.c,v 1.20 1995/05/21 18:24:33 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -66,11 +66,14 @@ #define CHUNK_SLICE_START_ROW 2 #define CHUNK_PART_START_ROW 11 +/* One MB worth of blocks */ +#define ONE_MEG 2048 + /* The smallest filesystem we're willing to create */ -#define FS_MIN_SIZE 2048 +#define FS_MIN_SIZE ONE_MEG /* The smallest root filesystem we're willing to create */ -#define ROOT_MIN_SIZE 40960 /* 20MB */ +#define ROOT_MIN_SIZE (20 * ONE_MEG) /* All the chunks currently displayed on the screen */ static struct { @@ -169,6 +172,7 @@ record_label_chunks() label_chunk_info[j].type = PART_FAT; label_chunk_info[j].d = d; label_chunk_info[j].c = c1; + ++j; } } } @@ -210,7 +214,6 @@ get_mountpoint(struct chunk *old) char *val; PartInfo *tmp; - dialog_clear(); clear(); val = msgGetInput(old && old->private ? ((PartInfo *)old->private)->mountpoint : NULL, "Please specify a mount point for the partition"); if (!val) @@ -255,7 +258,6 @@ get_partition_type(void) "Swap", "A swap partition.", }; - dialog_clear(); clear(); i = 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 (!i) { @@ -329,7 +331,7 @@ print_label_chunks(void) mvprintw(srow++, 0, "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)", label_chunk_info[i].d->name, - label_chunk_info[i].c->name, sz, (sz / 2048)); + label_chunk_info[i].c->name, sz, (sz / ONE_MEG)); } /* Otherwise it's a DOS, swap or filesystem entry, at the bottom */ else { @@ -381,7 +383,7 @@ print_label_chunks(void) for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++) onestr[PART_MOUNT_COL + j] = mountpoint[j]; snprintf(num, 10, "%4ldMB", label_chunk_info[i].c->size ? - label_chunk_info[i].c->size / 2048 : 0); + label_chunk_info[i].c->size / ONE_MEG : 0); memcpy(onestr + PART_SIZE_COL, num, strlen(num)); memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs)); onestr[PART_NEWFS_COL + strlen(newfs)] = '\0'; @@ -426,8 +428,9 @@ diskLabelEditor(char *str) msgConfirm("You need to partition your disk(s) before you can assign disk labels."); return 0; } - clear(); + dialog_clear(); clear(); while (labeling) { + clear(); print_label_chunks(); print_command_summary(); if (msg) { @@ -478,66 +481,70 @@ diskLabelEditor(char *str) break; } { - char *val, *cp, tmpb[20]; - int size; - struct chunk *tmp; - u_long flags = 0; + char *val, *cp, tmpb[20]; + int size; + struct chunk *tmp; + u_long flags = 0; - snprintf(tmpb, 20, "%d", sz); - val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M)."); - if (!val || (size = strtol(val, &cp, 0)) <= 0) - break; + snprintf(tmpb, 20, "%d", sz); + val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M)."); + if (!val || (size = strtol(val, &cp, 0)) <= 0) + break; - if (*cp && toupper(*cp) == 'M') - size *= 2048; + if (sz <= FS_MIN_SIZE) { + msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG); + break; + } + if (*cp && toupper(*cp) == 'M') + size *= ONE_MEG; - type = get_partition_type(); - if (type == PART_NONE) - break; - - if (type == PART_FILESYSTEM) { - if ((p = get_mountpoint(NULL)) == NULL) + type = get_partition_type(); + if (type == PART_NONE) break; - else if (!strcmp(p->mountpoint, "/")) - flags |= CHUNK_IS_ROOT; - else - flags &= ~CHUNK_IS_ROOT; - } else - p = NULL; - if ((flags & CHUNK_IS_ROOT)) { - if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) { - msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!"); + if (type == PART_FILESYSTEM) { + if ((p = get_mountpoint(NULL)) == NULL) + break; + else if (!strcmp(p->mountpoint, "/")) + flags |= CHUNK_IS_ROOT; + else + flags &= ~CHUNK_IS_ROOT; + } else + p = NULL; + + if ((flags & CHUNK_IS_ROOT)) { + if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) { + msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!"); + break; + } + if (size < ROOT_MIN_SIZE) { + msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG); + break; + } + } + tmp = Create_Chunk_DWIM(label_chunk_info[here].d, + label_chunk_info[here].c, + size, part, + (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, + flags); + if (!tmp) { + msgConfirm("Unable to create the partition. Too big?"); break; } - if (size < ROOT_MIN_SIZE) { - msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / 2048); - break; - } - } - tmp = Create_Chunk_DWIM(label_chunk_info[here].d, - label_chunk_info[here].c, - size, part, - (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, - flags); - if (!tmp) { - msgConfirm("Unable to create the partition. Too big?"); - break; - } - if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) { + if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) { msgConfirm("This region cannot be used for your root partition as it starts\nor extends past the 1024'th cylinder mark and is thus a\npoor location to boot from. Please choose another\nlocation for your root partition and try again!"); Delete_Chunk(label_chunk_info[here].d, tmp); break; - } - if (type != PART_SWAP) { + } + if (type != PART_SWAP) { /* This is needed to tell the newfs -u about the size */ tmp->private = new_part(p->mountpoint,p->newfs,tmp->size); safe_free(p); - } else { + } else { tmp->private = p; - } - tmp->private_free = safe_free; - record_label_chunks(); + } + tmp->private_free = safe_free; + record_label_chunks(); } break; @@ -639,7 +646,6 @@ diskLabelEditor(char *str) } variable_set2(DISK_LABELLED, "yes"); dialog_clear(); - refresh(); return 0; } diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index a68e3785fd72..16bbc3312e1b 100644 --- a/usr.sbin/sysinstall/media.c +++ b/usr.sbin/sysinstall/media.c @@ -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: media.c,v 1.12 1995/05/21 15:40:50 jkh Exp $ + * $Id: media.c,v 1.13 1995/05/21 19:28:05 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -293,9 +293,7 @@ mediaOpen(char *parent, char *me) snprintf(distname, FILENAME_MAX, "%s%s", parent, me); else snprintf(distname, FILENAME_MAX, "%s/%s", me, me); - if (mediaDevice->init) - if ((*mediaDevice->init)(mediaDevice) == FALSE) - return -1; + msgNotify("Attempting to open %s distribution", distname); fd = (*mediaDevice->get)(distname); return fd; } @@ -315,58 +313,58 @@ mediaExtractDist(char *dir, int fd) if (!dir) dir = "/"; - j = fork(); - if (!j) { - chdir(dir); - pipe(pfd); - zpid = fork(); - if (!zpid) { - dup2(fd, 0); close(fd); - dup2(pfd[1], 1); close(pfd[1]); - close(pfd[0]); - i = execl("/stand/gunzip", "/stand/gunzip", 0); - msgDebug("/stand/gunzip command returns %d status\n", i); - exit(i); - } - cpid = fork(); - if (!cpid) { - dup2(pfd[0], 0); close(pfd[0]); - close(fd); - close(pfd[1]); - if (DebugFD != -1) { - dup2(DebugFD, 1); - dup2(DebugFD, 2); - } - else { - close(1); open("/dev/null", O_WRONLY); - dup2(1, 2); - } - i = execl("/stand/cpio", "/stand/cpio", "-iduvm", "-H", "tar", 0); - msgDebug("/stand/cpio command returns %d status\n", i); - exit(i); + msgNotify("Extracting into %s directory..", dir); + Mkdir(dir, NULL); + chdir(dir); + pipe(pfd); + zpid = fork(); + if (!zpid) { + dup2(fd, 0); close(fd); + dup2(pfd[1], 1); close(pfd[1]); + if (DebugFD != -1) + dup2(DebugFD, 2); + else { + close(2); + open("/dev/null", O_WRONLY); } close(pfd[0]); - close(pfd[1]); - close(fd); - - i = waitpid(zpid, &j, 0); - if (i < 0 || _WSTATUS(j)) { - dialog_clear(); - msgConfirm("gunzip returned error status of %d!", _WSTATUS(j)); - exit(1); - } - i = waitpid(cpid, &j, 0); - if (i < 0 || _WSTATUS(j)) { - dialog_clear(); - msgConfirm("cpio returned error status of %d!", _WSTATUS(j)); - exit(2); - } - exit(0); + i = execl("/stand/gunzip", "/stand/gunzip", 0); + msgDebug("/stand/gunzip command returns %d status\n", i); + exit(i); } - else - i = wait(&j); - if (i < 0 || _WSTATUS(j)) + cpid = fork(); + if (!cpid) { + dup2(pfd[0], 0); close(pfd[0]); + close(fd); + close(pfd[1]); + if (DebugFD != -1) { + dup2(DebugFD, 1); + dup2(DebugFD, 2); + } + else { + close(1); open("/dev/null", O_WRONLY); + dup2(1, 2); + } + i = execl("/stand/cpio", "/stand/cpio", "-iduvm", "-H", "tar", 0); + msgDebug("/stand/cpio command returns %d status\n", i); + exit(i); + } + close(pfd[0]); + close(pfd[1]); + close(fd); + + i = waitpid(zpid, &j, 0); + if (i < 0 || _WSTATUS(j)) { + dialog_clear(); + msgConfirm("gunzip returned error status of %d!", _WSTATUS(j)); return FALSE; + } + i = waitpid(cpid, &j, 0); + if (i < 0 || _WSTATUS(j)) { + dialog_clear(); + msgConfirm("cpio returned error status of %d!", _WSTATUS(j)); + return FALSE; + } return TRUE; } diff --git a/usr.sbin/sysinstall/msg.c b/usr.sbin/sysinstall/msg.c index c9b3e2045e9f..c78621db4098 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.20 1995/05/20 14:05:31 jkh Exp $ + * $Id: msg.c,v 1.21 1995/05/20 19:12:12 phk Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -44,6 +44,9 @@ #include "sysinstall.h" #include +#define VTY_STATLINE 24 +#define TTY_STATLINE 23 + /* Whack up an informational message on the status line, in stand-out */ void msgYap(char *fmt, ...) @@ -58,7 +61,7 @@ msgYap(char *fmt, ...) va_end(args); attrs = getattrs(stdscr); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); free(errstr); @@ -74,7 +77,7 @@ msgInfo(char *fmt, ...) /* NULL is a special convention meaning "erase the old stuff" */ if (!fmt) { - move(23, 0); + move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0); clrtoeol(); return; } @@ -84,7 +87,7 @@ msgInfo(char *fmt, ...) va_end(args); attrs = getattrs(stdscr); attrset(A_NORMAL); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); if (OnVTY) { @@ -110,7 +113,7 @@ msgWarn(char *fmt, ...) attrs = getattrs(stdscr); beep(); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); if (OnVTY) @@ -134,7 +137,7 @@ msgError(char *fmt, ...) beep(); attrs = getattrs(stdscr); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); attrset(attrs); refresh(); if (OnVTY) @@ -158,7 +161,7 @@ msgFatal(char *fmt, ...) beep(); attrs = getattrs(stdscr); attrset(A_REVERSE); - mvaddstr(23, 0, errstr); + mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr); addstr(" - "); addstr("PRESS ANY KEY TO "); if (getpid() == 1)