diff --git a/release/doFS.sh b/release/doFS.sh index 984120072cf8..d7315c770672 100644 --- a/release/doFS.sh +++ b/release/doFS.sh @@ -34,27 +34,15 @@ do vnconfig -s labels -c /dev/r${VNDEVICE} fs-image - sed '/^minimum:/,$d' /etc/disktab > /etc/disktab.tmp - cat /etc/disktab.tmp > /etc/disktab - rm -f /etc/disktab.tmp - ( - a=`expr ${FSSIZE} \* 2` - echo - echo "minimum:ty=mfs:se#512:nt#1:rm#300:\\" - echo " :ns#$a:nc#1:\\" - echo " :pa#$a:oa#0:ba#4096:fa#512:\\" - echo " :pc#$a:oc#0:bc#4096:fc#512:" - echo - ) >> /etc/disktab - - disklabel -w -r -B \ + dd if=${RD}/trees/bin/usr/mdec/boot1 of=fs-image conv=notrunc + disklabel /dev/r${VNDEVICE} | disklabel -R -B \ -b ${RD}/trees/bin/usr/mdec/fdboot \ -s ${RD}/trees/bin/usr/mdec/bootfd \ - /dev/r${VNDEVICE} minimum + /dev/r${VNDEVICE} /dev/stdin - newfs -u 0 -t 0 -i ${FSINODE} -m 0 -T minimum -o space /dev/r${VNDEVICE}a + newfs -u 0 -t 0 -i ${FSINODE} -m 0 -T minimum -o space /dev/r${VNDEVICE}c - mount /dev/${VNDEVICE}a ${MNT} + mount /dev/${VNDEVICE}c ${MNT} ( set -e && cd ${FSPROTO} && find . -print | cpio -dump ${MNT} ) @@ -62,7 +50,7 @@ do umount ${MNT} - fsck -p /dev/r${VNDEVICE}a < /dev/null + fsck -p /dev/r${VNDEVICE}c < /dev/null vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true diff --git a/release/scripts/doFS.sh b/release/scripts/doFS.sh index 984120072cf8..d7315c770672 100644 --- a/release/scripts/doFS.sh +++ b/release/scripts/doFS.sh @@ -34,27 +34,15 @@ do vnconfig -s labels -c /dev/r${VNDEVICE} fs-image - sed '/^minimum:/,$d' /etc/disktab > /etc/disktab.tmp - cat /etc/disktab.tmp > /etc/disktab - rm -f /etc/disktab.tmp - ( - a=`expr ${FSSIZE} \* 2` - echo - echo "minimum:ty=mfs:se#512:nt#1:rm#300:\\" - echo " :ns#$a:nc#1:\\" - echo " :pa#$a:oa#0:ba#4096:fa#512:\\" - echo " :pc#$a:oc#0:bc#4096:fc#512:" - echo - ) >> /etc/disktab - - disklabel -w -r -B \ + dd if=${RD}/trees/bin/usr/mdec/boot1 of=fs-image conv=notrunc + disklabel /dev/r${VNDEVICE} | disklabel -R -B \ -b ${RD}/trees/bin/usr/mdec/fdboot \ -s ${RD}/trees/bin/usr/mdec/bootfd \ - /dev/r${VNDEVICE} minimum + /dev/r${VNDEVICE} /dev/stdin - newfs -u 0 -t 0 -i ${FSINODE} -m 0 -T minimum -o space /dev/r${VNDEVICE}a + newfs -u 0 -t 0 -i ${FSINODE} -m 0 -T minimum -o space /dev/r${VNDEVICE}c - mount /dev/${VNDEVICE}a ${MNT} + mount /dev/${VNDEVICE}c ${MNT} ( set -e && cd ${FSPROTO} && find . -print | cpio -dump ${MNT} ) @@ -62,7 +50,7 @@ do umount ${MNT} - fsck -p /dev/r${VNDEVICE}a < /dev/null + fsck -p /dev/r${VNDEVICE}c < /dev/null vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true diff --git a/release/sysinstall/cdrom.c b/release/sysinstall/cdrom.c index 1e68ba1ce32d..c8aaf4ec1af9 100644 --- a/release/sysinstall/cdrom.c +++ b/release/sysinstall/cdrom.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: cdrom.c,v 1.21 1996/07/16 17:11:38 jkh Exp $ + * $Id: cdrom.c,v 1.22 1996/08/23 07:55:57 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -83,10 +83,12 @@ mediaInitCDROM(Device *dev) if (!file_readable("/cdrom/cdrom.inf")) { Mkdir("/cdrom"); if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { - msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno); - return FALSE; + if (errno != EBUSY) { + msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno); + return FALSE; + } } - else if (!file_readable("/cdrom/cdrom.inf")) { + if (!file_readable("/cdrom/cdrom.inf")) { if (msgYesNo("Warning: The CD currently in the drive is either not a FreeBSD\n" "CD or it is an older (pre 2.1.5) FreeBSD CD which does not\n" "have a version number on it. Do you wish to use this CD anyway?")) { diff --git a/release/sysinstall/dispatch.c b/release/sysinstall/dispatch.c index 5534b18639fc..3175c013dc76 100644 --- a/release/sysinstall/dispatch.c +++ b/release/sysinstall/dispatch.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dispatch.c,v 1.3 1996/06/26 09:09:27 jkh Exp $ + * $Id: dispatch.c,v 1.4 1996/07/02 10:57:51 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -79,7 +79,7 @@ static struct _word { { "mediaSetFTPPassive", mediaSetFTPPassive }, { "mediaSetUFS", mediaSetUFS }, { "mediaSetNFS", mediaSetNFS }, - { "mediaSetFtpUserPass", mediaSetFtpUserPass }, + { "mediaSetFTPUserPass", mediaSetFTPUserPass }, { "mediaSetCPIOVerbosity", mediaSetCPIOVerbosity }, { "mediaGetType", mediaGetType }, { "optionsEditor", optionsEditor }, diff --git a/release/sysinstall/label.c b/release/sysinstall/label.c index ad30c723658c..15565fd74bcd 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.57 1996/08/03 05:25:56 jkh Exp $ + * $Id: label.c,v 1.58 1996/08/03 10:11:10 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -263,7 +263,12 @@ get_mountpoint(struct chunk *old) tmp = old->private_data; else tmp = NULL; + if (!old) { + DialogX = 13; + DialogY = 17; + } val = msgGetInput(tmp ? tmp->mountpoint : NULL, "Please specify a mount point for the partition"); + DialogX = DialogY = 0; if (!val || !*val) { if (!old) return NULL; @@ -313,7 +318,6 @@ get_partition_type(void) { char selection[20]; int i; - WINDOW *save = savescr(); static unsigned char *fs_types[] = { "FS", @@ -321,12 +325,13 @@ get_partition_type(void) "Swap", "A swap partition.", }; - dialog_clear_norefresh(); + DialogX = 7; + DialogY = 9; i = dialog_menu("Please choose a partition type", "If you want to use this partition for swap space, select Swap.\n" "If you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL); - restorescr(save); + DialogX = DialogY = 0; if (!i) { if (!strcmp(selection, "FS")) return PART_FILESYSTEM; @@ -448,7 +453,7 @@ print_label_chunks(void) } static void -print_command_summary() +print_command_summary(void) { mvprintw(17, 0, "The following commands are valid here (upper or lower case):"); mvprintw(18, 0, "C = Create D = Delete M = Mount"); @@ -460,10 +465,17 @@ print_command_summary() move(0, 0); } +static void +clear_wins(void) +{ + clear(); + wclear(ChunkWin); +} + static int diskLabel(char *str) { - int sz, key = 0, first_time = 1; + int sz, key = 0; Boolean labeling; char *msg = NULL; PartInfo *p, *oldp; @@ -480,13 +492,10 @@ diskLabel(char *str) keypad(stdscr, TRUE); record_label_chunks(devs); - dialog_clear_norefresh(); clear(); + clear(); while (labeling) { print_label_chunks(); - if (first_time) { - print_command_summary(); - first_time = 0; - } + print_command_summary(); if (msg) { attrset(title_attr); mvprintw(23, 0, msg); attrset(A_NORMAL); clrtoeol(); @@ -497,13 +506,15 @@ diskLabel(char *str) move(23, 0); clrtoeol(); } + refresh(); key = getch(); switch (toupper(key)) { int i; static char _msg[40]; case '\014': /* ^L */ - continue; + clear_wins(); + break; case KEY_UP: case '-': @@ -536,6 +547,7 @@ diskLabel(char *str) case KEY_F(1): case '?': systemDisplayHelp("partition"); + clear_wins(); break; case 'A': @@ -561,6 +573,7 @@ diskLabel(char *str) (cp ? atoi(cp) : 32) * ONE_MEG, part, FS_BSDFFS, CHUNK_IS_ROOT); if (!tmp) { msgConfirm("Unable to create the root partition. Too big?"); + clear_wins(); break; } tmp->private_data = new_part("/", TRUE, tmp->size); @@ -583,6 +596,7 @@ diskLabel(char *str) swsize, part, FS_SWAP, 0); if (!tmp) { msgConfirm("Unable to create the swap partition. Too big?"); + clear_wins(); break; } tmp->private_data = 0; @@ -598,6 +612,7 @@ diskLabel(char *str) msgConfirm("Less than %dMB free for /var - you will need to\n" "partition your disk manually with a custom install!", (cp ? atoi(cp) : VAR_MIN_SIZE)); + clear_wins(); break; } tmp->private_data = new_part("/var", TRUE, tmp->size); @@ -614,6 +629,7 @@ diskLabel(char *str) if (!sz || sz < (USR_MIN_SIZE * ONE_MEG)) { msgConfirm("Less than %dMB free for /usr - you will need to\n" "partition your disk manually with a custom install!", USR_MIN_SIZE); + clear_wins(); break; } @@ -623,6 +639,7 @@ diskLabel(char *str) if (!tmp) { msgConfirm("Unable to create the /usr partition. Not enough space?\n" "You will need to partition your disk manually with a custom install!"); + clear_wins(); break; } tmp->private_data = new_part("/usr", TRUE, tmp->size); @@ -652,11 +669,17 @@ diskLabel(char *str) u_long flags = 0; sprintf(osize, "%d", sz); - val = msgGetInput(osize, "Please specify the size for new FreeBSD partition in blocks, or\n" - "append a trailing `M' for megabytes (e.g. 20M) or `C' for cylinders.\n\n" - "Space free is %d blocks (%dMB)", sz, sz / ONE_MEG); - if (!val || (size = strtol(val, &cp, 0)) <= 0) + DialogX = 3; + DialogY = 1; + val = msgGetInput(osize, + "Please specify the partition size in blocks or append a trailing M for\n" + "megabytes or C for cylinders. %d blocks (%dMB) are free.", + sz, sz / ONE_MEG); + DialogX = DialogY = 0; + if (!val || (size = strtol(val, &cp, 0)) <= 0) { + clear_wins(); break; + } if (*cp) { if (toupper(*cp) == 'M') @@ -666,20 +689,28 @@ diskLabel(char *str) } if (size <= FS_MIN_SIZE) { msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG); + clear_wins(); break; } type = get_partition_type(); - if (type == PART_NONE) + if (type == PART_NONE) { + clear_wins(); + beep(); break; + } if (type == PART_FILESYSTEM) { - if ((p = get_mountpoint(NULL)) == NULL) + if ((p = get_mountpoint(NULL)) == NULL) { + clear_wins(); + beep(); break; + } else if (!strcmp(p->mountpoint, "/")) flags |= CHUNK_IS_ROOT; else flags &= ~CHUNK_IS_ROOT; - } else + } + else p = NULL; if ((flags & CHUNK_IS_ROOT)) { @@ -688,6 +719,7 @@ diskLabel(char *str) "FreeBSD boot code cannot deal with a root partition created\n" "in that location. Please choose another location or smaller\n" "size for your root partition and try again!"); + clear_wins(); break; } if (size < (ROOT_MIN_SIZE * ONE_MEG)) { @@ -703,6 +735,7 @@ diskLabel(char *str) flags); if (!tmp) { msgConfirm("Unable to create the partition. Too big?"); + clear_wins(); break; } if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) { @@ -711,6 +744,7 @@ diskLabel(char *str) "poor location to boot from. Please choose another\n" "location (or smaller size) for your root partition and try again!"); Delete_Chunk(label_chunk_info[here].c->disk, tmp); + clear_wins(); break; } if (type != PART_SWAP) { @@ -723,6 +757,7 @@ diskLabel(char *str) tmp->private_free = safe_free; variable_set2(DISK_LABELLED, "yes"); record_label_chunks(devs); + clear_wins(); } break; @@ -767,6 +802,7 @@ diskLabel(char *str) } variable_set2(DISK_LABELLED, "yes"); record_label_chunks(devs); + clear(); break; default: @@ -791,7 +827,7 @@ diskLabel(char *str) safe_free(pi); label_chunk_info[here].c->private_free = safe_free; variable_set2(DISK_LABELLED, "yes"); - } + } else msg = MSG_NOT_APPLICABLE; break; @@ -814,6 +850,7 @@ diskLabel(char *str) } } record_label_chunks(devs); + clear(); break; case 'W': @@ -821,12 +858,10 @@ diskLabel(char *str) "operation, and it should also be noted that this option is NOT for\n" "use during new installations but rather for modifying existing ones.\n\n" "Are you absolutely SURE you want to do this now?")) { - WINDOW *save = savescr(); - variable_set2(DISK_LABELLED, "yes"); diskLabelCommit(NULL); - restorescr(save); } + clear(); break; case '|': @@ -835,7 +870,6 @@ diskLabel(char *str) "expected to understand!")) { int i; Device **devs; - WINDOW *save = savescr(); dialog_clear(); end_dialog(); @@ -851,9 +885,8 @@ diskLabel(char *str) } variable_set2(DISK_LABELLED, "yes"); DialogActive = TRUE; - dialog_clear_norefresh(); - restorescr(save); record_label_chunks(devs); + clear(); } else msg = "A most prudent choice!"; diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c index d3013db2fc68..f73567836e09 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.52 1996/08/03 10:11:16 jkh Exp $ + * $Id: media.c,v 1.53 1996/09/26 22:07:32 pst Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -259,21 +259,23 @@ mediaSetFTP(dialogMenuItem *self) static Device ftpDevice; char *cp, *hostname, *dir; extern int FtpPort; - static int first_time = 1; + int what; - dialog_clear_norefresh(); cp = variable_get(VAR_FTP_PATH); - if (!(cp && first_time)) { + if (!cp) { + dialog_clear_norefresh(); if (!dmenuOpenSimple(&MenuMediaFTP, FALSE)) return DITEM_FAILURE | DITEM_RECREATE; else cp = variable_get(VAR_FTP_PATH); + what = DITEM_RECREATE; } - if (first_time) - first_time = 0; + else + what = DITEM_RESTORE; if (!cp) { + dialog_clear_norefresh(); msgConfirm("%s not set! Not setting an FTP installation path, OK?", VAR_FTP_PATH); - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } else if (!strcmp(cp, "other")) { variable_set2(VAR_FTP_PATH, "ftp://"); @@ -286,20 +288,20 @@ mediaSetFTP(dialogMenuItem *self) "Where is relative to the anonymous ftp directory or the\n" "home directory of the user being logged in as."); if (!cp || !*cp) - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } if (strncmp("ftp://", cp, 6)) { msgConfirm("Sorry, %s is an invalid URL!", cp); - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } strcpy(ftpDevice.name, cp); if (!tcpDeviceSelect()) - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; if (!mediaDevice || !mediaDevice->init(mediaDevice)) { if (isDebug()) msgDebug("mediaSetFTP: Net device init failed.\n"); - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } hostname = cp + 6; if ((cp = index(hostname, ':')) != NULL) { @@ -321,7 +323,7 @@ mediaSetFTP(dialogMenuItem *self) msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n" "name server, gateway and network interface are correctly configured?", hostname); mediaDevice->shutdown(mediaDevice); - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } } variable_set2(VAR_FTP_HOST, hostname); @@ -334,7 +336,7 @@ mediaSetFTP(dialogMenuItem *self) ftpDevice.shutdown = mediaShutdownFTP; ftpDevice.private = mediaDevice; /* Set to network device by tcpDeviceSelect() */ mediaDevice = &ftpDevice; - return DITEM_LEAVE_MENU | DITEM_RECREATE; + return DITEM_SUCCESS | DITEM_LEAVE_MENU | what; } int @@ -357,6 +359,7 @@ mediaSetUFS(dialogMenuItem *self) static Device ufsDevice; char *cp; + dialog_clear_norefresh(); cp = variable_get_value(VAR_UFS_PATH, "Enter a fully qualified pathname for the directory\n" "containing the FreeBSD distribution files:"); if (!cp) @@ -378,6 +381,7 @@ mediaSetNFS(dialogMenuItem *self) static Device nfsDevice; char *cp, *idx; + dialog_clear_norefresh(); cp = variable_get_value(VAR_NFS_PATH, "Please enter the full NFS file specification for the remote\n" "host and directory containing the FreeBSD distribution files.\n" "This should be in the format: hostname:/some/freebsd/dir"); @@ -593,15 +597,18 @@ mediaVerify(void) /* Set the FTP username and password fields */ int -mediaSetFtpUserPass(dialogMenuItem *self) +mediaSetFTPUserPass(dialogMenuItem *self) { char *pass; - if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:")) + dialog_clear_norefresh(); + if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:")) { + dialog_clear_norefresh(); pass = variable_get_value(VAR_FTP_PASS, "Please enter the password for this user:"); + } else pass = NULL; - return pass ? DITEM_SUCCESS : DITEM_FAILURE; + return (pass ? DITEM_SUCCESS : DITEM_FAILURE) | DITEM_RESTORE; } /* Set CPIO verbosity level */ diff --git a/release/sysinstall/options.c b/release/sysinstall/options.c index c522692cb323..bec4c6bea6fd 100644 --- a/release/sysinstall/options.c +++ b/release/sysinstall/options.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id: options.c,v 1.41 1996/07/09 14:28:18 jkh Exp $ + * $Id: options.c,v 1.42 1996/08/03 10:11:33 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -111,7 +111,7 @@ static Option Options[] = { { "Yes to All", "Assume \"Yes\" answers to all non-critical dialogs", OPT_IS_VAR, NULL, VAR_NO_CONFIRM, varCheck }, { "FTP username", "Username and password to use instead of anonymous", - OPT_IS_FUNC, mediaSetFtpUserPass, VAR_FTP_USER, varCheck }, + OPT_IS_FUNC, mediaSetFTPUserPass, VAR_FTP_USER, varCheck }, { "Editor", "Which text editor to use during installation", OPT_IS_VAR, EDITOR_PROMPT, VAR_EDITOR, varCheck }, { "Tape Blocksize", "Tape media block size in 512 byte blocks", @@ -164,17 +164,22 @@ value_of(Option opt) return ""; } -static void +static int fire(Option opt) { - if (opt.type == OPT_IS_FUNC) { - int (*cp)(char *) = opt.data; + int status = 0; - cp(NULL); + if (opt.type == OPT_IS_FUNC) { + int (*cp)(char *) = opt.data, rcode; + + rcode = cp(NULL); + if (rcode & (DITEM_RECREATE | DITEM_RESTORE)) + status = 1; } else if (opt.type == OPT_IS_VAR) { if (opt.data) { (void)variable_get_value(opt.aux, opt.data); + status = 1; } else if (variable_get(opt.aux)) variable_unset(opt.aux); @@ -183,8 +188,8 @@ fire(Option opt) } if (opt.check) opt.check(opt); - clear(); refresh(); + return status; } int @@ -239,6 +244,7 @@ optionsEditor(dialogMenuItem *self) case KEY_F(1): case '?': systemDisplayHelp("options"); + clear(); break; case KEY_UP: @@ -265,9 +271,8 @@ optionsEditor(dialogMenuItem *self) continue; case ' ': - clear(); - fire(Options[currOpt]); - clear(); + if (fire(Options[currOpt])) + clear(); continue; case 'Q': diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 517a14135512..a7154c9231ec 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.77 1996/07/31 09:29:35 jkh Exp $ + * $Id: sysinstall.h,v 1.78 1996/08/01 10:58:53 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -513,7 +513,7 @@ extern int mediaSetFTPActive(dialogMenuItem *self); extern int mediaSetFTPPassive(dialogMenuItem *self); extern int mediaSetUFS(dialogMenuItem *self); extern int mediaSetNFS(dialogMenuItem *self); -extern int mediaSetFtpUserPass(dialogMenuItem *self); +extern int mediaSetFTPUserPass(dialogMenuItem *self); extern int mediaSetCPIOVerbosity(dialogMenuItem *self); extern int mediaGetType(dialogMenuItem *self); extern Boolean mediaExtractDist(char *dir, int fd); diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c index 5aa7f0cf8daa..c6580abf9d53 100644 --- a/release/sysinstall/system.c +++ b/release/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.64 1996/09/26 21:07:08 pst Exp $ + * $Id: system.c,v 1.65 1996/10/01 04:56:34 jkh Exp $ * * Jordan Hubbard * @@ -37,8 +37,12 @@ static void handle_intr(int sig) { + WINDOW *save = savescr(); + if (!msgYesNo("Are you sure you want to abort the installation?")) systemShutdown(1); + else + restorescr(save); } /* Expand a file into a convenient location, nuking it each time */ diff --git a/usr.sbin/sade/dispatch.c b/usr.sbin/sade/dispatch.c index 5534b18639fc..3175c013dc76 100644 --- a/usr.sbin/sade/dispatch.c +++ b/usr.sbin/sade/dispatch.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dispatch.c,v 1.3 1996/06/26 09:09:27 jkh Exp $ + * $Id: dispatch.c,v 1.4 1996/07/02 10:57:51 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -79,7 +79,7 @@ static struct _word { { "mediaSetFTPPassive", mediaSetFTPPassive }, { "mediaSetUFS", mediaSetUFS }, { "mediaSetNFS", mediaSetNFS }, - { "mediaSetFtpUserPass", mediaSetFtpUserPass }, + { "mediaSetFTPUserPass", mediaSetFTPUserPass }, { "mediaSetCPIOVerbosity", mediaSetCPIOVerbosity }, { "mediaGetType", mediaGetType }, { "optionsEditor", optionsEditor }, diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index ad30c723658c..15565fd74bcd 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.57 1996/08/03 05:25:56 jkh Exp $ + * $Id: label.c,v 1.58 1996/08/03 10:11:10 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -263,7 +263,12 @@ get_mountpoint(struct chunk *old) tmp = old->private_data; else tmp = NULL; + if (!old) { + DialogX = 13; + DialogY = 17; + } val = msgGetInput(tmp ? tmp->mountpoint : NULL, "Please specify a mount point for the partition"); + DialogX = DialogY = 0; if (!val || !*val) { if (!old) return NULL; @@ -313,7 +318,6 @@ get_partition_type(void) { char selection[20]; int i; - WINDOW *save = savescr(); static unsigned char *fs_types[] = { "FS", @@ -321,12 +325,13 @@ get_partition_type(void) "Swap", "A swap partition.", }; - dialog_clear_norefresh(); + DialogX = 7; + DialogY = 9; i = dialog_menu("Please choose a partition type", "If you want to use this partition for swap space, select Swap.\n" "If you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL); - restorescr(save); + DialogX = DialogY = 0; if (!i) { if (!strcmp(selection, "FS")) return PART_FILESYSTEM; @@ -448,7 +453,7 @@ print_label_chunks(void) } static void -print_command_summary() +print_command_summary(void) { mvprintw(17, 0, "The following commands are valid here (upper or lower case):"); mvprintw(18, 0, "C = Create D = Delete M = Mount"); @@ -460,10 +465,17 @@ print_command_summary() move(0, 0); } +static void +clear_wins(void) +{ + clear(); + wclear(ChunkWin); +} + static int diskLabel(char *str) { - int sz, key = 0, first_time = 1; + int sz, key = 0; Boolean labeling; char *msg = NULL; PartInfo *p, *oldp; @@ -480,13 +492,10 @@ diskLabel(char *str) keypad(stdscr, TRUE); record_label_chunks(devs); - dialog_clear_norefresh(); clear(); + clear(); while (labeling) { print_label_chunks(); - if (first_time) { - print_command_summary(); - first_time = 0; - } + print_command_summary(); if (msg) { attrset(title_attr); mvprintw(23, 0, msg); attrset(A_NORMAL); clrtoeol(); @@ -497,13 +506,15 @@ diskLabel(char *str) move(23, 0); clrtoeol(); } + refresh(); key = getch(); switch (toupper(key)) { int i; static char _msg[40]; case '\014': /* ^L */ - continue; + clear_wins(); + break; case KEY_UP: case '-': @@ -536,6 +547,7 @@ diskLabel(char *str) case KEY_F(1): case '?': systemDisplayHelp("partition"); + clear_wins(); break; case 'A': @@ -561,6 +573,7 @@ diskLabel(char *str) (cp ? atoi(cp) : 32) * ONE_MEG, part, FS_BSDFFS, CHUNK_IS_ROOT); if (!tmp) { msgConfirm("Unable to create the root partition. Too big?"); + clear_wins(); break; } tmp->private_data = new_part("/", TRUE, tmp->size); @@ -583,6 +596,7 @@ diskLabel(char *str) swsize, part, FS_SWAP, 0); if (!tmp) { msgConfirm("Unable to create the swap partition. Too big?"); + clear_wins(); break; } tmp->private_data = 0; @@ -598,6 +612,7 @@ diskLabel(char *str) msgConfirm("Less than %dMB free for /var - you will need to\n" "partition your disk manually with a custom install!", (cp ? atoi(cp) : VAR_MIN_SIZE)); + clear_wins(); break; } tmp->private_data = new_part("/var", TRUE, tmp->size); @@ -614,6 +629,7 @@ diskLabel(char *str) if (!sz || sz < (USR_MIN_SIZE * ONE_MEG)) { msgConfirm("Less than %dMB free for /usr - you will need to\n" "partition your disk manually with a custom install!", USR_MIN_SIZE); + clear_wins(); break; } @@ -623,6 +639,7 @@ diskLabel(char *str) if (!tmp) { msgConfirm("Unable to create the /usr partition. Not enough space?\n" "You will need to partition your disk manually with a custom install!"); + clear_wins(); break; } tmp->private_data = new_part("/usr", TRUE, tmp->size); @@ -652,11 +669,17 @@ diskLabel(char *str) u_long flags = 0; sprintf(osize, "%d", sz); - val = msgGetInput(osize, "Please specify the size for new FreeBSD partition in blocks, or\n" - "append a trailing `M' for megabytes (e.g. 20M) or `C' for cylinders.\n\n" - "Space free is %d blocks (%dMB)", sz, sz / ONE_MEG); - if (!val || (size = strtol(val, &cp, 0)) <= 0) + DialogX = 3; + DialogY = 1; + val = msgGetInput(osize, + "Please specify the partition size in blocks or append a trailing M for\n" + "megabytes or C for cylinders. %d blocks (%dMB) are free.", + sz, sz / ONE_MEG); + DialogX = DialogY = 0; + if (!val || (size = strtol(val, &cp, 0)) <= 0) { + clear_wins(); break; + } if (*cp) { if (toupper(*cp) == 'M') @@ -666,20 +689,28 @@ diskLabel(char *str) } if (size <= FS_MIN_SIZE) { msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG); + clear_wins(); break; } type = get_partition_type(); - if (type == PART_NONE) + if (type == PART_NONE) { + clear_wins(); + beep(); break; + } if (type == PART_FILESYSTEM) { - if ((p = get_mountpoint(NULL)) == NULL) + if ((p = get_mountpoint(NULL)) == NULL) { + clear_wins(); + beep(); break; + } else if (!strcmp(p->mountpoint, "/")) flags |= CHUNK_IS_ROOT; else flags &= ~CHUNK_IS_ROOT; - } else + } + else p = NULL; if ((flags & CHUNK_IS_ROOT)) { @@ -688,6 +719,7 @@ diskLabel(char *str) "FreeBSD boot code cannot deal with a root partition created\n" "in that location. Please choose another location or smaller\n" "size for your root partition and try again!"); + clear_wins(); break; } if (size < (ROOT_MIN_SIZE * ONE_MEG)) { @@ -703,6 +735,7 @@ diskLabel(char *str) flags); if (!tmp) { msgConfirm("Unable to create the partition. Too big?"); + clear_wins(); break; } if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) { @@ -711,6 +744,7 @@ diskLabel(char *str) "poor location to boot from. Please choose another\n" "location (or smaller size) for your root partition and try again!"); Delete_Chunk(label_chunk_info[here].c->disk, tmp); + clear_wins(); break; } if (type != PART_SWAP) { @@ -723,6 +757,7 @@ diskLabel(char *str) tmp->private_free = safe_free; variable_set2(DISK_LABELLED, "yes"); record_label_chunks(devs); + clear_wins(); } break; @@ -767,6 +802,7 @@ diskLabel(char *str) } variable_set2(DISK_LABELLED, "yes"); record_label_chunks(devs); + clear(); break; default: @@ -791,7 +827,7 @@ diskLabel(char *str) safe_free(pi); label_chunk_info[here].c->private_free = safe_free; variable_set2(DISK_LABELLED, "yes"); - } + } else msg = MSG_NOT_APPLICABLE; break; @@ -814,6 +850,7 @@ diskLabel(char *str) } } record_label_chunks(devs); + clear(); break; case 'W': @@ -821,12 +858,10 @@ diskLabel(char *str) "operation, and it should also be noted that this option is NOT for\n" "use during new installations but rather for modifying existing ones.\n\n" "Are you absolutely SURE you want to do this now?")) { - WINDOW *save = savescr(); - variable_set2(DISK_LABELLED, "yes"); diskLabelCommit(NULL); - restorescr(save); } + clear(); break; case '|': @@ -835,7 +870,6 @@ diskLabel(char *str) "expected to understand!")) { int i; Device **devs; - WINDOW *save = savescr(); dialog_clear(); end_dialog(); @@ -851,9 +885,8 @@ diskLabel(char *str) } variable_set2(DISK_LABELLED, "yes"); DialogActive = TRUE; - dialog_clear_norefresh(); - restorescr(save); record_label_chunks(devs); + clear(); } else msg = "A most prudent choice!"; diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 517a14135512..a7154c9231ec 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.77 1996/07/31 09:29:35 jkh Exp $ + * $Id: sysinstall.h,v 1.78 1996/08/01 10:58:53 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -513,7 +513,7 @@ extern int mediaSetFTPActive(dialogMenuItem *self); extern int mediaSetFTPPassive(dialogMenuItem *self); extern int mediaSetUFS(dialogMenuItem *self); extern int mediaSetNFS(dialogMenuItem *self); -extern int mediaSetFtpUserPass(dialogMenuItem *self); +extern int mediaSetFTPUserPass(dialogMenuItem *self); extern int mediaSetCPIOVerbosity(dialogMenuItem *self); extern int mediaGetType(dialogMenuItem *self); extern Boolean mediaExtractDist(char *dir, int fd); diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index 5aa7f0cf8daa..c6580abf9d53 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.64 1996/09/26 21:07:08 pst Exp $ + * $Id: system.c,v 1.65 1996/10/01 04:56:34 jkh Exp $ * * Jordan Hubbard * @@ -37,8 +37,12 @@ static void handle_intr(int sig) { + WINDOW *save = savescr(); + if (!msgYesNo("Are you sure you want to abort the installation?")) systemShutdown(1); + else + restorescr(save); } /* Expand a file into a convenient location, nuking it each time */ diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c index 1e68ba1ce32d..c8aaf4ec1af9 100644 --- a/usr.sbin/sysinstall/cdrom.c +++ b/usr.sbin/sysinstall/cdrom.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: cdrom.c,v 1.21 1996/07/16 17:11:38 jkh Exp $ + * $Id: cdrom.c,v 1.22 1996/08/23 07:55:57 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -83,10 +83,12 @@ mediaInitCDROM(Device *dev) if (!file_readable("/cdrom/cdrom.inf")) { Mkdir("/cdrom"); if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) { - msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno); - return FALSE; + if (errno != EBUSY) { + msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno); + return FALSE; + } } - else if (!file_readable("/cdrom/cdrom.inf")) { + if (!file_readable("/cdrom/cdrom.inf")) { if (msgYesNo("Warning: The CD currently in the drive is either not a FreeBSD\n" "CD or it is an older (pre 2.1.5) FreeBSD CD which does not\n" "have a version number on it. Do you wish to use this CD anyway?")) { diff --git a/usr.sbin/sysinstall/dispatch.c b/usr.sbin/sysinstall/dispatch.c index 5534b18639fc..3175c013dc76 100644 --- a/usr.sbin/sysinstall/dispatch.c +++ b/usr.sbin/sysinstall/dispatch.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dispatch.c,v 1.3 1996/06/26 09:09:27 jkh Exp $ + * $Id: dispatch.c,v 1.4 1996/07/02 10:57:51 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -79,7 +79,7 @@ static struct _word { { "mediaSetFTPPassive", mediaSetFTPPassive }, { "mediaSetUFS", mediaSetUFS }, { "mediaSetNFS", mediaSetNFS }, - { "mediaSetFtpUserPass", mediaSetFtpUserPass }, + { "mediaSetFTPUserPass", mediaSetFTPUserPass }, { "mediaSetCPIOVerbosity", mediaSetCPIOVerbosity }, { "mediaGetType", mediaGetType }, { "optionsEditor", optionsEditor }, diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index ad30c723658c..15565fd74bcd 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.57 1996/08/03 05:25:56 jkh Exp $ + * $Id: label.c,v 1.58 1996/08/03 10:11:10 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -263,7 +263,12 @@ get_mountpoint(struct chunk *old) tmp = old->private_data; else tmp = NULL; + if (!old) { + DialogX = 13; + DialogY = 17; + } val = msgGetInput(tmp ? tmp->mountpoint : NULL, "Please specify a mount point for the partition"); + DialogX = DialogY = 0; if (!val || !*val) { if (!old) return NULL; @@ -313,7 +318,6 @@ get_partition_type(void) { char selection[20]; int i; - WINDOW *save = savescr(); static unsigned char *fs_types[] = { "FS", @@ -321,12 +325,13 @@ get_partition_type(void) "Swap", "A swap partition.", }; - dialog_clear_norefresh(); + DialogX = 7; + DialogY = 9; i = dialog_menu("Please choose a partition type", "If you want to use this partition for swap space, select Swap.\n" "If you want to put a filesystem on it, choose FS.", -1, -1, 2, 2, fs_types, selection, NULL, NULL); - restorescr(save); + DialogX = DialogY = 0; if (!i) { if (!strcmp(selection, "FS")) return PART_FILESYSTEM; @@ -448,7 +453,7 @@ print_label_chunks(void) } static void -print_command_summary() +print_command_summary(void) { mvprintw(17, 0, "The following commands are valid here (upper or lower case):"); mvprintw(18, 0, "C = Create D = Delete M = Mount"); @@ -460,10 +465,17 @@ print_command_summary() move(0, 0); } +static void +clear_wins(void) +{ + clear(); + wclear(ChunkWin); +} + static int diskLabel(char *str) { - int sz, key = 0, first_time = 1; + int sz, key = 0; Boolean labeling; char *msg = NULL; PartInfo *p, *oldp; @@ -480,13 +492,10 @@ diskLabel(char *str) keypad(stdscr, TRUE); record_label_chunks(devs); - dialog_clear_norefresh(); clear(); + clear(); while (labeling) { print_label_chunks(); - if (first_time) { - print_command_summary(); - first_time = 0; - } + print_command_summary(); if (msg) { attrset(title_attr); mvprintw(23, 0, msg); attrset(A_NORMAL); clrtoeol(); @@ -497,13 +506,15 @@ diskLabel(char *str) move(23, 0); clrtoeol(); } + refresh(); key = getch(); switch (toupper(key)) { int i; static char _msg[40]; case '\014': /* ^L */ - continue; + clear_wins(); + break; case KEY_UP: case '-': @@ -536,6 +547,7 @@ diskLabel(char *str) case KEY_F(1): case '?': systemDisplayHelp("partition"); + clear_wins(); break; case 'A': @@ -561,6 +573,7 @@ diskLabel(char *str) (cp ? atoi(cp) : 32) * ONE_MEG, part, FS_BSDFFS, CHUNK_IS_ROOT); if (!tmp) { msgConfirm("Unable to create the root partition. Too big?"); + clear_wins(); break; } tmp->private_data = new_part("/", TRUE, tmp->size); @@ -583,6 +596,7 @@ diskLabel(char *str) swsize, part, FS_SWAP, 0); if (!tmp) { msgConfirm("Unable to create the swap partition. Too big?"); + clear_wins(); break; } tmp->private_data = 0; @@ -598,6 +612,7 @@ diskLabel(char *str) msgConfirm("Less than %dMB free for /var - you will need to\n" "partition your disk manually with a custom install!", (cp ? atoi(cp) : VAR_MIN_SIZE)); + clear_wins(); break; } tmp->private_data = new_part("/var", TRUE, tmp->size); @@ -614,6 +629,7 @@ diskLabel(char *str) if (!sz || sz < (USR_MIN_SIZE * ONE_MEG)) { msgConfirm("Less than %dMB free for /usr - you will need to\n" "partition your disk manually with a custom install!", USR_MIN_SIZE); + clear_wins(); break; } @@ -623,6 +639,7 @@ diskLabel(char *str) if (!tmp) { msgConfirm("Unable to create the /usr partition. Not enough space?\n" "You will need to partition your disk manually with a custom install!"); + clear_wins(); break; } tmp->private_data = new_part("/usr", TRUE, tmp->size); @@ -652,11 +669,17 @@ diskLabel(char *str) u_long flags = 0; sprintf(osize, "%d", sz); - val = msgGetInput(osize, "Please specify the size for new FreeBSD partition in blocks, or\n" - "append a trailing `M' for megabytes (e.g. 20M) or `C' for cylinders.\n\n" - "Space free is %d blocks (%dMB)", sz, sz / ONE_MEG); - if (!val || (size = strtol(val, &cp, 0)) <= 0) + DialogX = 3; + DialogY = 1; + val = msgGetInput(osize, + "Please specify the partition size in blocks or append a trailing M for\n" + "megabytes or C for cylinders. %d blocks (%dMB) are free.", + sz, sz / ONE_MEG); + DialogX = DialogY = 0; + if (!val || (size = strtol(val, &cp, 0)) <= 0) { + clear_wins(); break; + } if (*cp) { if (toupper(*cp) == 'M') @@ -666,20 +689,28 @@ diskLabel(char *str) } if (size <= FS_MIN_SIZE) { msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG); + clear_wins(); break; } type = get_partition_type(); - if (type == PART_NONE) + if (type == PART_NONE) { + clear_wins(); + beep(); break; + } if (type == PART_FILESYSTEM) { - if ((p = get_mountpoint(NULL)) == NULL) + if ((p = get_mountpoint(NULL)) == NULL) { + clear_wins(); + beep(); break; + } else if (!strcmp(p->mountpoint, "/")) flags |= CHUNK_IS_ROOT; else flags &= ~CHUNK_IS_ROOT; - } else + } + else p = NULL; if ((flags & CHUNK_IS_ROOT)) { @@ -688,6 +719,7 @@ diskLabel(char *str) "FreeBSD boot code cannot deal with a root partition created\n" "in that location. Please choose another location or smaller\n" "size for your root partition and try again!"); + clear_wins(); break; } if (size < (ROOT_MIN_SIZE * ONE_MEG)) { @@ -703,6 +735,7 @@ diskLabel(char *str) flags); if (!tmp) { msgConfirm("Unable to create the partition. Too big?"); + clear_wins(); break; } if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) { @@ -711,6 +744,7 @@ diskLabel(char *str) "poor location to boot from. Please choose another\n" "location (or smaller size) for your root partition and try again!"); Delete_Chunk(label_chunk_info[here].c->disk, tmp); + clear_wins(); break; } if (type != PART_SWAP) { @@ -723,6 +757,7 @@ diskLabel(char *str) tmp->private_free = safe_free; variable_set2(DISK_LABELLED, "yes"); record_label_chunks(devs); + clear_wins(); } break; @@ -767,6 +802,7 @@ diskLabel(char *str) } variable_set2(DISK_LABELLED, "yes"); record_label_chunks(devs); + clear(); break; default: @@ -791,7 +827,7 @@ diskLabel(char *str) safe_free(pi); label_chunk_info[here].c->private_free = safe_free; variable_set2(DISK_LABELLED, "yes"); - } + } else msg = MSG_NOT_APPLICABLE; break; @@ -814,6 +850,7 @@ diskLabel(char *str) } } record_label_chunks(devs); + clear(); break; case 'W': @@ -821,12 +858,10 @@ diskLabel(char *str) "operation, and it should also be noted that this option is NOT for\n" "use during new installations but rather for modifying existing ones.\n\n" "Are you absolutely SURE you want to do this now?")) { - WINDOW *save = savescr(); - variable_set2(DISK_LABELLED, "yes"); diskLabelCommit(NULL); - restorescr(save); } + clear(); break; case '|': @@ -835,7 +870,6 @@ diskLabel(char *str) "expected to understand!")) { int i; Device **devs; - WINDOW *save = savescr(); dialog_clear(); end_dialog(); @@ -851,9 +885,8 @@ diskLabel(char *str) } variable_set2(DISK_LABELLED, "yes"); DialogActive = TRUE; - dialog_clear_norefresh(); - restorescr(save); record_label_chunks(devs); + clear(); } else msg = "A most prudent choice!"; diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index d3013db2fc68..f73567836e09 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.52 1996/08/03 10:11:16 jkh Exp $ + * $Id: media.c,v 1.53 1996/09/26 22:07:32 pst Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -259,21 +259,23 @@ mediaSetFTP(dialogMenuItem *self) static Device ftpDevice; char *cp, *hostname, *dir; extern int FtpPort; - static int first_time = 1; + int what; - dialog_clear_norefresh(); cp = variable_get(VAR_FTP_PATH); - if (!(cp && first_time)) { + if (!cp) { + dialog_clear_norefresh(); if (!dmenuOpenSimple(&MenuMediaFTP, FALSE)) return DITEM_FAILURE | DITEM_RECREATE; else cp = variable_get(VAR_FTP_PATH); + what = DITEM_RECREATE; } - if (first_time) - first_time = 0; + else + what = DITEM_RESTORE; if (!cp) { + dialog_clear_norefresh(); msgConfirm("%s not set! Not setting an FTP installation path, OK?", VAR_FTP_PATH); - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } else if (!strcmp(cp, "other")) { variable_set2(VAR_FTP_PATH, "ftp://"); @@ -286,20 +288,20 @@ mediaSetFTP(dialogMenuItem *self) "Where is relative to the anonymous ftp directory or the\n" "home directory of the user being logged in as."); if (!cp || !*cp) - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } if (strncmp("ftp://", cp, 6)) { msgConfirm("Sorry, %s is an invalid URL!", cp); - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } strcpy(ftpDevice.name, cp); if (!tcpDeviceSelect()) - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; if (!mediaDevice || !mediaDevice->init(mediaDevice)) { if (isDebug()) msgDebug("mediaSetFTP: Net device init failed.\n"); - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } hostname = cp + 6; if ((cp = index(hostname, ':')) != NULL) { @@ -321,7 +323,7 @@ mediaSetFTP(dialogMenuItem *self) msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n" "name server, gateway and network interface are correctly configured?", hostname); mediaDevice->shutdown(mediaDevice); - return DITEM_FAILURE | DITEM_RECREATE; + return DITEM_FAILURE | what; } } variable_set2(VAR_FTP_HOST, hostname); @@ -334,7 +336,7 @@ mediaSetFTP(dialogMenuItem *self) ftpDevice.shutdown = mediaShutdownFTP; ftpDevice.private = mediaDevice; /* Set to network device by tcpDeviceSelect() */ mediaDevice = &ftpDevice; - return DITEM_LEAVE_MENU | DITEM_RECREATE; + return DITEM_SUCCESS | DITEM_LEAVE_MENU | what; } int @@ -357,6 +359,7 @@ mediaSetUFS(dialogMenuItem *self) static Device ufsDevice; char *cp; + dialog_clear_norefresh(); cp = variable_get_value(VAR_UFS_PATH, "Enter a fully qualified pathname for the directory\n" "containing the FreeBSD distribution files:"); if (!cp) @@ -378,6 +381,7 @@ mediaSetNFS(dialogMenuItem *self) static Device nfsDevice; char *cp, *idx; + dialog_clear_norefresh(); cp = variable_get_value(VAR_NFS_PATH, "Please enter the full NFS file specification for the remote\n" "host and directory containing the FreeBSD distribution files.\n" "This should be in the format: hostname:/some/freebsd/dir"); @@ -593,15 +597,18 @@ mediaVerify(void) /* Set the FTP username and password fields */ int -mediaSetFtpUserPass(dialogMenuItem *self) +mediaSetFTPUserPass(dialogMenuItem *self) { char *pass; - if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:")) + dialog_clear_norefresh(); + if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:")) { + dialog_clear_norefresh(); pass = variable_get_value(VAR_FTP_PASS, "Please enter the password for this user:"); + } else pass = NULL; - return pass ? DITEM_SUCCESS : DITEM_FAILURE; + return (pass ? DITEM_SUCCESS : DITEM_FAILURE) | DITEM_RESTORE; } /* Set CPIO verbosity level */ diff --git a/usr.sbin/sysinstall/options.c b/usr.sbin/sysinstall/options.c index c522692cb323..bec4c6bea6fd 100644 --- a/usr.sbin/sysinstall/options.c +++ b/usr.sbin/sysinstall/options.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id: options.c,v 1.41 1996/07/09 14:28:18 jkh Exp $ + * $Id: options.c,v 1.42 1996/08/03 10:11:33 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -111,7 +111,7 @@ static Option Options[] = { { "Yes to All", "Assume \"Yes\" answers to all non-critical dialogs", OPT_IS_VAR, NULL, VAR_NO_CONFIRM, varCheck }, { "FTP username", "Username and password to use instead of anonymous", - OPT_IS_FUNC, mediaSetFtpUserPass, VAR_FTP_USER, varCheck }, + OPT_IS_FUNC, mediaSetFTPUserPass, VAR_FTP_USER, varCheck }, { "Editor", "Which text editor to use during installation", OPT_IS_VAR, EDITOR_PROMPT, VAR_EDITOR, varCheck }, { "Tape Blocksize", "Tape media block size in 512 byte blocks", @@ -164,17 +164,22 @@ value_of(Option opt) return ""; } -static void +static int fire(Option opt) { - if (opt.type == OPT_IS_FUNC) { - int (*cp)(char *) = opt.data; + int status = 0; - cp(NULL); + if (opt.type == OPT_IS_FUNC) { + int (*cp)(char *) = opt.data, rcode; + + rcode = cp(NULL); + if (rcode & (DITEM_RECREATE | DITEM_RESTORE)) + status = 1; } else if (opt.type == OPT_IS_VAR) { if (opt.data) { (void)variable_get_value(opt.aux, opt.data); + status = 1; } else if (variable_get(opt.aux)) variable_unset(opt.aux); @@ -183,8 +188,8 @@ fire(Option opt) } if (opt.check) opt.check(opt); - clear(); refresh(); + return status; } int @@ -239,6 +244,7 @@ optionsEditor(dialogMenuItem *self) case KEY_F(1): case '?': systemDisplayHelp("options"); + clear(); break; case KEY_UP: @@ -265,9 +271,8 @@ optionsEditor(dialogMenuItem *self) continue; case ' ': - clear(); - fire(Options[currOpt]); - clear(); + if (fire(Options[currOpt])) + clear(); continue; case 'Q': diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 517a14135512..a7154c9231ec 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.77 1996/07/31 09:29:35 jkh Exp $ + * $Id: sysinstall.h,v 1.78 1996/08/01 10:58:53 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -513,7 +513,7 @@ extern int mediaSetFTPActive(dialogMenuItem *self); extern int mediaSetFTPPassive(dialogMenuItem *self); extern int mediaSetUFS(dialogMenuItem *self); extern int mediaSetNFS(dialogMenuItem *self); -extern int mediaSetFtpUserPass(dialogMenuItem *self); +extern int mediaSetFTPUserPass(dialogMenuItem *self); extern int mediaSetCPIOVerbosity(dialogMenuItem *self); extern int mediaGetType(dialogMenuItem *self); extern Boolean mediaExtractDist(char *dir, int fd); diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index 5aa7f0cf8daa..c6580abf9d53 100644 --- a/usr.sbin/sysinstall/system.c +++ b/usr.sbin/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.64 1996/09/26 21:07:08 pst Exp $ + * $Id: system.c,v 1.65 1996/10/01 04:56:34 jkh Exp $ * * Jordan Hubbard * @@ -37,8 +37,12 @@ static void handle_intr(int sig) { + WINDOW *save = savescr(); + if (!msgYesNo("Are you sure you want to abort the installation?")) systemShutdown(1); + else + restorescr(save); } /* Expand a file into a convenient location, nuking it each time */