diff options
author | jkh <jkh@FreeBSD.org> | 1996-04-13 13:32:15 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-04-13 13:32:15 +0000 |
commit | 2d5b4f754ed0dd5ca6a7824a23a9c79d36da264a (patch) | |
tree | 75fa9d1786ffde4deed82bc4bb5c8264228a2aca /usr.sbin/sysinstall | |
parent | 52978a6ce95dd0f923ee8fa236b96c972f6622d4 (diff) | |
download | FreeBSD-src-2d5b4f754ed0dd5ca6a7824a23a9c79d36da264a.zip FreeBSD-src-2d5b4f754ed0dd5ca6a7824a23a9c79d36da264a.tar.gz |
1. Update all the copyrights to delete useless clauses 3 and 4.
2. Change more of the menu code over to new system.
3. Streamline label editor.
Diffstat (limited to 'usr.sbin/sysinstall')
32 files changed, 653 insertions, 796 deletions
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile index afeb135..c8bbe39 100644 --- a/usr.sbin/sysinstall/Makefile +++ b/usr.sbin/sysinstall/Makefile @@ -1,6 +1,7 @@ PROG= sysinstall NOMAN= yes CLEANFILES= makedevs.c rtermcap +DEBUG_FLAGS+= -g3 .PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum @@ -14,7 +15,7 @@ SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c \ CFLAGS+= -Wall -I${.CURDIR}/../../gnu/lib/libdialog DPADD= ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO} ${LIBUTIL} ${LIBDISK} -LDADD= -ldialog -lncurses -lmytinfo -lutil -ldisk +LDADD= /usr/src/gnu/lib/libdialog/obj/libdialog.a -lncurses -lmytinfo -lutil -ldisk makedevs.c: Makefile rtermcap rm -f makedevs.tmp diff --git a/usr.sbin/sysinstall/anonFTP.c b/usr.sbin/sysinstall/anonFTP.c index 3e02157..427e3f4 100644 --- a/usr.sbin/sysinstall/anonFTP.c +++ b/usr.sbin/sysinstall/anonFTP.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: anonFTP.c,v 1.9 1996/03/23 07:21:28 jkh Exp $ + * $Id: anonFTP.c,v 1.10 1996/04/07 03:52:16 jkh Exp $ * * Copyright (c) 1995 * Coranth Gryphon. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Coranth Gryphon - * for the FreeBSD Project. - * 4. The name of Coranth Gryphon or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY CORANTH GRYPHON ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -199,7 +192,7 @@ createFtpUser(void) if (tpw->pw_uid != FTP_UID) msgConfirm("FTP user already exists with a different uid."); - return (RET_SUCCESS); /* succeeds if already exists */ + return (DITEM_SUCCESS); /* succeeds if already exists */ } sprintf(pwline, "%s::%s:%d::0:0:%s:%s:/bin/date\n", FTP_NAME, tconf.uid, gid, tconf.comment, tconf.homedir); @@ -207,14 +200,14 @@ createFtpUser(void) fptr = fopen(_PATH_MASTERPASSWD,"a"); if (! fptr) { msgConfirm("Could not open master password file."); - return (RET_FAIL); + return (DITEM_FAILURE); } fprintf(fptr, pwline); fclose(fptr); msgNotify("Remaking password file: %s", _PATH_MASTERPASSWD); vsystem("pwd_mkdb -p %s", _PATH_MASTERPASSWD); - return (RET_SUCCESS); + return (DITEM_SUCCESS); } /* This is it - how to get the setup values */ @@ -234,7 +227,7 @@ anonftpOpenDialog(void) if (ds_win == 0) { beep(); msgConfirm("Cannot open anonymous ftp dialog window!!"); - return(RET_FAIL); + return(DITEM_FAILURE); } /* Say where our help comes from */ @@ -397,8 +390,8 @@ anonftpOpenDialog(void) use_helpfile(NULL); if (cancel) - return RET_FAIL; - return RET_SUCCESS; + return DITEM_FAILURE; + return DITEM_SUCCESS; } int @@ -407,14 +400,14 @@ configAnonFTP(dialogMenuItem *self) int i; /* Be optimistic */ - i = RET_SUCCESS; + i = DITEM_SUCCESS; dialog_clear(); i = anonftpOpenDialog(); - if (i != RET_SUCCESS) { + if (i != DITEM_SUCCESS) { dialog_clear(); msgConfirm("Configuration of Anonymous FTP cancelled per user request."); - return i; + return DITEM_SUCCESS; } /*** Use defaults for any invalid values ***/ @@ -452,7 +445,7 @@ configAnonFTP(dialogMenuItem *self) vsystem("mkdir -p %s/%s", tconf.homedir, tconf.upload); vsystem("chmod 1777 %s/%s", tconf.homedir, tconf.upload); - if (createFtpUser() == RET_SUCCESS) { + if (createFtpUser() == DITEM_SUCCESS) { msgNotify("Copying password information for anon FTP."); vsystem("cp /etc/pwd.db %s/etc && chmod 444 %s/etc/pwd.db", tconf.homedir, tconf.homedir); vsystem("cp /etc/passwd %s/etc && chmod 444 %s/etc/passwd",tconf.homedir, tconf.homedir); @@ -462,25 +455,31 @@ configAnonFTP(dialogMenuItem *self) else { dialog_clear(); msgConfirm("Unable to create FTP user! Anonymous FTP setup failed."); - i = RET_FAIL; + i = DITEM_FAILURE; } dialog_clear(); if (!msgYesNo("Create a welcome message file for anonymous FTP users?")) { char cmd[256]; - + WINDOW *w; + + w = savescr(); dialog_clear(); msgNotify("Uncompressing the editor - please wait.."); vsystem("echo Your welcome message here. > %s/etc/%s", tconf.homedir, MOTD_FILE); sprintf(cmd, "%s %s/etc/%s", variable_get(VAR_EDITOR), tconf.homedir, MOTD_FILE); - systemExecute(cmd); + if (!systemExecute(cmd)) + i = DITEM_SUCCESS; + else + i = DITEM_FAILURE; + restorescr(w); } } else { dialog_clear(); msgConfirm("Invalid Directory: %s\n" "Anonymous FTP will not be set up.", tconf.homedir); - i = RET_FAIL; + i = DITEM_FAILURE; } return i; } diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c index 7752df0..83c38da 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.10 1996/03/02 07:31:50 jkh Exp $ + * $Id: cdrom.c,v 1.11 1996/03/18 15:27:43 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -21,13 +21,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/usr.sbin/sysinstall/command.c b/usr.sbin/sysinstall/command.c index 225d4ec..fece9b0 100644 --- a/usr.sbin/sysinstall/command.c +++ b/usr.sbin/sysinstall/command.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: command.c,v 1.12 1995/09/18 16:52:21 peter Exp $ + * $Id: command.c,v 1.13 1995/12/07 10:33:33 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index 5609ad0..de74386 100644 --- a/usr.sbin/sysinstall/config.c +++ b/usr.sbin/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.22 1996/03/24 18:57:34 joerg Exp $ + * $Id: config.c,v 1.23 1996/04/07 03:52:18 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -156,7 +149,7 @@ configFstab(void) if (!RunningAsInit) { if (file_readable("/etc/fstab")) - return RET_SUCCESS; + return DITEM_SUCCESS; else { dialog_clear(); msgConfirm("Attempting to rebuild your /etc/fstab file. Warning: If you had\n" @@ -169,7 +162,7 @@ configFstab(void) if (!devs) { dialog_clear(); msgConfirm("No disks found!"); - return RET_FAIL; + return DITEM_FAILURE; } /* Record all the chunks */ @@ -199,7 +192,7 @@ configFstab(void) dialog_clear(); msgConfirm("Unable to create a new /etc/fstab file! Manual intervention\n" "will be required."); - return RET_FAIL; + return DITEM_FAILURE; } /* Go for the burn */ @@ -239,7 +232,7 @@ configFstab(void) fclose(fstab); if (isDebug()) msgDebug("Wrote out /etc/fstab file\n"); - return RET_SUCCESS; + return DITEM_SUCCESS; } /* @@ -329,13 +322,13 @@ int configSaverTimeout(dialogMenuItem *self) { return variable_get_value(VAR_BLANKTIME, "Enter time-out period in seconds for screen saver") ? - RET_SUCCESS : RET_FAIL; + DITEM_SUCCESS : DITEM_FAILURE; } int configNTP(dialogMenuItem *self) { - return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") ? RET_SUCCESS : RET_FAIL; + return variable_get_value(VAR_NTPDATE, "Enter the name of an NTP server") ? DITEM_SUCCESS : DITEM_FAILURE; } int @@ -343,12 +336,12 @@ configXFree86(dialogMenuItem *self) { if (file_executable("/usr/X11R6/bin/xf86config")) { systemExecute("/usr/X11R6/bin/xf86config"); - return RET_SUCCESS; + return DITEM_SUCCESS; } else { msgConfirm("XFree86 does not appear to be installed! Please install\n" "The XFree86 distribution before attempting to configure it."); - return RET_FAIL; + return DITEM_FAILURE; } } @@ -416,7 +409,7 @@ configRoutedFlags(dialogMenuItem *self) { return variable_get_value(VAR_ROUTEDFLAGS, "Specify the flags for routed; -q is the default, -s is\n" - "a good choice for gateway machines.") ? RET_SUCCESS : RET_FAIL; + "a good choice for gateway machines.") ? DITEM_SUCCESS : DITEM_FAILURE; } int @@ -428,10 +421,10 @@ configPackages(dialogMenuItem *self) int fd; if (!mediaVerify()) - return RET_FAIL; + return DITEM_FAILURE; if (!mediaDevice->init(mediaDevice)) - return RET_FAIL; + return DITEM_FAILURE; if (!index_initted) { msgNotify("Attempting to fetch packages/INDEX file from selected media."); @@ -445,7 +438,7 @@ configPackages(dialogMenuItem *self) "(or path to media) and try again. If your local site does not\n" "carry the packages collection, then we recommend either a CD\n" "distribution or the master distribution on ftp.freebsd.org."); - return RET_FAIL; + return DITEM_FAILURE; } msgNotify("Got INDEX successfully, now building packages menu.."); index_init(&top, &plist); @@ -454,7 +447,7 @@ configPackages(dialogMenuItem *self) msgConfirm("I/O or format error on packages/INDEX file.\n" "Please verify media (or path to media) and try again."); mediaDevice->close(mediaDevice, fd); - return RET_FAIL; + return DITEM_FAILURE; } mediaDevice->close(mediaDevice, fd); index_sort(&top); @@ -471,9 +464,9 @@ configPackages(dialogMenuItem *self) /* Now show the packing list menu */ pos = scroll = 0; ret = index_menu(&plist, NULL, &pos, &scroll); - if (ret == RET_DONE) + if (ret == DITEM_LEAVE_MENU) break; - else if (ret != RET_FAIL) { + else if (ret != DITEM_FAILURE) { index_extract(mediaDevice, &top, &plist); break; } @@ -493,7 +486,7 @@ configPackages(dialogMenuItem *self) } index_init(NULL, &plist); mediaDevice->shutdown(mediaDevice); - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -518,11 +511,11 @@ configPorts(dialogMenuItem *self) "reside in a directory with as much free space as possible,\n" "as you'll need space to compile any ports."); if (!cp || !*cp) - return RET_FAIL; + return DITEM_FAILURE; if (Mkdir(cp, NULL)) { dialog_clear(); msgConfirm("Unable to make the %s directory!", cp); - return RET_FAIL; + return DITEM_FAILURE; } else { if (strcmp(cp, "/usr/ports")) { @@ -530,7 +523,7 @@ configPorts(dialogMenuItem *self) if (symlink(cp, "/usr/ports") == -1) { msgConfirm("Unable to create a symlink from /usr/ports to %s!\n" "I can't continue, sorry!", cp); - return RET_FAIL; + return DITEM_FAILURE; } else { msgConfirm("NOTE: This directory is also now symlinked to /usr/ports\n" @@ -541,7 +534,7 @@ configPorts(dialogMenuItem *self) } } msgNotify("Making a link tree from %s to %s.", dist, cp); - if (lndir(dist, cp) != RET_SUCCESS) { + if (lndir(dist, cp) != DITEM_SUCCESS) { dialog_clear(); msgConfirm("The lndir function returned an error status and may not have.\n" "successfully generated the link tree. You may wish to inspect\n" @@ -557,6 +550,6 @@ configPorts(dialogMenuItem *self) } } else - return RET_FAIL; - return RET_SUCCESS; + return DITEM_FAILURE; + return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index 49b4c08..f3f615f 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.42 1996/03/24 09:36:41 jkh Exp $ + * $Id: devices.c,v 1.43 1996/04/07 03:52:19 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -356,7 +349,7 @@ deviceCount(Device **devs) * menu is cloned. */ DMenu * -deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)()) +deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), int (*check)(dialogMenuItem *d)) { Device **devs; int numdevs; @@ -381,7 +374,7 @@ deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)()) if (!device_names[j].name) tmp->items[i].title = "<unknown device type>"; tmp->items[i].fire = hook; - tmp->items[i].checked = NULL; + tmp->items[i].checked = check; } tmp->items[i].title = NULL; return tmp; diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index 6f8f3de..d151dac 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.38 1996/03/24 18:57:35 joerg Exp $ + * $Id: disks.c,v 1.39 1996/04/07 03:52:20 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -148,7 +141,6 @@ getBootMgr(char *dname) /* Figure out what kind of MBR the user wants */ sprintf(str, "Install Boot Manager for drive %s?", dname); MenuMBRType.title = str; - dialog_clear(); i = dmenuOpenSimple(&MenuMBRType); } else { @@ -260,7 +252,7 @@ diskPartition(Device *dev, Disk *d) variable_set2(DISK_PARTITIONED, "yes"); record_chunks(d); } - break; + break; case 'B': if (chunk_info[current_chunk]->type != freebsd) @@ -361,7 +353,7 @@ diskPartition(Device *dev, Disk *d) && (mbrContents = getBootMgr(d->name)) != NULL) Set_Boot_Mgr(d, mbrContents); - if (diskPartitionWrite(NULL) != RET_SUCCESS) { + if (diskPartitionWrite(NULL) != DITEM_SUCCESS) { dialog_clear(); msgConfirm("Disk partition write returned an error status!"); } @@ -415,35 +407,33 @@ diskPartition(Device *dev, Disk *d) } static int -partitionHook(char *str) +partitionHook(dialogMenuItem *selected) { Device **devs = NULL; + WINDOW *w; - /* Clip garbage off the ends */ - string_prune(str); - str = string_skipwhite(str); - /* Try and open all the disks */ - while (str) { - char *cp; - - cp = index(str, '\n'); - if (cp) - *cp++ = 0; - if (!*str) { - beep(); - return 0; - } - devs = deviceFind(str, DEVICE_TYPE_DISK); - if (!devs) { - dialog_clear(); - msgConfirm("Unable to find disk %s!", str); - return 0; - } - devs[0]->enabled = TRUE; - diskPartition(devs[0], (Disk *)devs[0]->private); - str = cp; + devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK); + if (!devs) { + dialog_clear(); + msgConfirm("Unable to find disk %s!", selected->prompt); + return DITEM_FAILURE; } - return devs ? 1 : 0; + devs[0]->enabled = TRUE; + w = savescr(); + diskPartition(devs[0], (Disk *)devs[0]->private); + restorescr(w); + return DITEM_SUCCESS; +} + +static int +partitionCheck(dialogMenuItem *selected) +{ + Device **devs = NULL; + + devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK); + if (!devs || devs[0]->enabled == FALSE) + return FALSE; + return TRUE; } int @@ -452,10 +442,9 @@ diskPartitionEditor(dialogMenuItem *self) DMenu *menu; Device **devs; int i, cnt; - char *cp, *str; + char *cp; cp = variable_get(VAR_DISK); - str= variable_get(SYSTEM_STATE); devs = deviceFind(cp, DEVICE_TYPE_DISK); cnt = deviceCount(devs); if (!cnt) { @@ -463,16 +452,15 @@ diskPartitionEditor(dialogMenuItem *self) msgConfirm("No disks found! Please verify that your disk controller is being\n" "properly probed at boot time. See the Hardware Guide on the\n" "Documentation menu for clues on diagnosing this type of problem."); - i = RET_FAIL; + i = DITEM_FAILURE; } else if (cnt == 1) { devs[0]->enabled = TRUE; diskPartition(devs[0], (Disk *)devs[0]->private); - i = RET_SUCCESS; - variable_set2(DISK_SELECTED, "yes"); + i = DITEM_SUCCESS; } else { - menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook); + menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook, partitionCheck); if (!menu) { dialog_clear(); msgConfirm("No devices suitable for installation found!\n\n" @@ -480,15 +468,17 @@ diskPartitionEditor(dialogMenuItem *self) "were detected properly. This can be done by pressing the\n" "[Scroll Lock] key and using the Arrow keys to move back to\n" "the boot messages. Press [Scroll Lock] again to return."); - i = RET_FAIL; + i = DITEM_FAILURE; } else { - if (!dmenuOpenSimple(menu)) - i = RET_FAIL; - else { - i = RET_SUCCESS; - variable_set2(DISK_SELECTED, "yes"); - } + WINDOW *w; + + w = savescr(); + if (dmenuOpenSimple(menu)) + i = DITEM_SUCCESS; + else + i = DITEM_FAILURE; + restorescr(w); free(menu); } } @@ -503,18 +493,18 @@ diskPartitionWrite(dialogMenuItem *self) int i; if ((cp = variable_get(DISK_PARTITIONED)) && strcmp(cp, "yes")) - return RET_SUCCESS; + return DITEM_SUCCESS; else if (!cp) { dialog_clear(); msgConfirm("You must partition the disk(s) before this option can be used."); - return RET_FAIL; + return DITEM_FAILURE; } devs = deviceFind(NULL, DEVICE_TYPE_DISK); if (!devs) { dialog_clear(); msgConfirm("Unable to find any disks to write to??"); - return RET_FAIL; + return DITEM_FAILURE; } for (i = 0; devs[i]; i++) { @@ -529,7 +519,7 @@ diskPartitionWrite(dialogMenuItem *self) if (Write_Disk(d)) { dialog_clear(); msgConfirm("ERROR: Unable to write data to disk %s!", d->name); - return RET_FAIL; + return DITEM_FAILURE; } /* Now scan for bad blocks, if necessary */ for (c1 = d->chunks->part; c1; c1 = c1->next) { @@ -552,5 +542,5 @@ diskPartitionWrite(dialogMenuItem *self) } /* Now it's not "yes", but "written" */ variable_set2(DISK_PARTITIONED, "written"); - return RET_SUCCESS; + return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index 117b53e..2a4b5a9 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.39 1996/02/02 06:43:59 jkh Exp $ + * $Id: dist.c,v 1.40 1996/04/07 03:52:22 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -172,7 +165,7 @@ distReset(dialogMenuItem *self) XF86Dists = 0; XF86ServerDists = 0; XF86FontDists = 0; - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -181,7 +174,7 @@ distSetDeveloper(dialogMenuItem *self) distReset(NULL); Dists = _DIST_DEVELOPER; SrcDists = DIST_SRC_ALL; - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -194,7 +187,7 @@ distSetXDeveloper(dialogMenuItem *self) XF86ServerDists = DIST_XF86_SERVER_SVGA; XF86FontDists = DIST_XF86_FONTS_MISC; distSetXF86(NULL); - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -203,7 +196,7 @@ distSetKernDeveloper(dialogMenuItem *self) distReset(NULL); Dists = _DIST_DEVELOPER; SrcDists = DIST_SRC_SYS; - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -211,7 +204,7 @@ distSetUser(dialogMenuItem *self) { distReset(NULL); Dists = _DIST_USER; - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -223,7 +216,7 @@ distSetXUser(dialogMenuItem *self) XF86ServerDists = DIST_XF86_SERVER_SVGA; XF86FontDists = DIST_XF86_FONTS_MISC; distSetXF86(NULL); - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -231,7 +224,7 @@ distSetMinimum(dialogMenuItem *self) { distReset(NULL); Dists = DIST_BIN; - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -242,51 +235,56 @@ distSetEverything(dialogMenuItem *self) XF86Dists = DIST_XF86_ALL; XF86ServerDists = DIST_XF86_SERVER_ALL; XF86FontDists = DIST_XF86_FONTS_ALL; - return RET_SUCCESS; + return DITEM_SUCCESS; } int distSetDES(dialogMenuItem *self) { - if (dmenuOpenSimple(&MenuDESDistributions)) { - if (DESDists) { - if (DESDists & DIST_DES_KERBEROS) - DESDists |= DIST_DES_DES; - Dists |= DIST_DES; - } - return RET_SUCCESS; + WINDOW *w; + + w = savescr(); + dmenuOpenSimple(&MenuDESDistributions); + if (DESDists) { + if (DESDists & DIST_DES_KERBEROS) + DESDists |= DIST_DES_DES; + Dists |= DIST_DES; } - else - return RET_FAIL; + restorescr(w); + return DITEM_SUCCESS; } int distSetSrc(dialogMenuItem *self) { - if (dmenuOpenSimple(&MenuSrcDistributions)) { - if (SrcDists) - Dists |= DIST_SRC; - return RET_SUCCESS; - } - return RET_FAIL; + WINDOW *w; + + w = savescr(); + dmenuOpenSimple(&MenuSrcDistributions); + if (SrcDists) + Dists |= DIST_SRC; + restorescr(w); + return DITEM_SUCCESS; } int distSetXF86(dialogMenuItem *self) { - if (dmenuOpenSimple(&MenuXF86Select)) { - if (XF86ServerDists) - XF86Dists |= DIST_XF86_SERVER; - if (XF86FontDists) - XF86Dists |= DIST_XF86_FONTS; - if (XF86Dists) - Dists |= DIST_XF86; - if (isDebug()) - msgDebug("SetXF86 Masks: Server: %0x, Fonts: %0x, XDists: %0x, Dists: %0x\n", - XF86ServerDists, XF86FontDists, XF86Dists, Dists); - return RET_SUCCESS; - } - return RET_FAIL; + WINDOW *w; + + w = savescr(); + dmenuOpenSimple(&MenuXF86Select); + if (XF86ServerDists) + XF86Dists |= DIST_XF86_SERVER; + if (XF86FontDists) + XF86Dists |= DIST_XF86_FONTS; + if (XF86Dists) + Dists |= DIST_XF86; + if (isDebug()) + msgDebug("SetXF86 Masks: Server: %0x, Fonts: %0x, XDists: %0x, Dists: %0x\n", + XF86ServerDists, XF86FontDists, XF86Dists, Dists); + restorescr(w); + return DITEM_SUCCESS; } static Boolean @@ -352,7 +350,7 @@ distExtract(char *parent, Distribution *me) if (isDebug()) msgDebug("Parsing attributes file for distribution %s\n", dist); dist_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS); - if (attr_parse_file(dist_attr, buf) == RET_FAIL) { + if (attr_parse_file(dist_attr, buf) == DITEM_FAILURE) { dialog_clear(); msgConfirm("Cannot load information file for %s distribution!\n" "Please verify that your media is valid and try again.", dist); @@ -477,10 +475,10 @@ distExtractAll(dialogMenuItem *self) /* First try to initialize the state of things */ if (!mediaDevice->init(mediaDevice)) - return RET_FAIL; + return DITEM_FAILURE; if (!Dists) { msgConfirm("You haven't selected any distributions to extract."); - return RET_FAIL; + return DITEM_FAILURE; } /* Try for 3 times around the loop, then give up. */ while (Dists && ++retries < 3) @@ -493,5 +491,5 @@ distExtractAll(dialogMenuItem *self) "be because the following distributions are not available on the\n" "installation media you've chosen:\n\n\t%s", buf); } - return RET_SUCCESS; + return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/dmenu.c b/usr.sbin/sysinstall/dmenu.c index 0633e3a..1a366b0 100644 --- a/usr.sbin/sysinstall/dmenu.c +++ b/usr.sbin/sysinstall/dmenu.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: dmenu.c,v 1.14 1996/03/02 07:31:51 jkh Exp $ + * $Id: dmenu.c,v 1.15 1996/04/07 03:52:23 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -52,41 +45,52 @@ int dmenuDisplayFile(dialogMenuItem *tmp) { systemDisplayHelp((char *)tmp->data); - return RET_SUCCESS; + return DITEM_SUCCESS; } int dmenuSubmenu(dialogMenuItem *tmp) { + WINDOW *w; + + w = savescr(); dialog_clear(); - return dmenuOpenSimple((DMenu *)tmp->data); + (void)dmenuOpenSimple((DMenu *)tmp->data); + restorescr(w); + return DITEM_SUCCESS; } int dmenuSystemCommand(dialogMenuItem *tmp) { - int i; + WINDOW *w; - i = systemExecute((char *)tmp->data) ? RET_FAIL : RET_SUCCESS; + w = savescr(); + systemExecute((char *)tmp->data); dialog_clear(); - return i; + restorescr(w); + return DITEM_SUCCESS; } int dmenuSystemCommandBox(dialogMenuItem *tmp) { + WINDOW *w; + + w = savescr(); use_helpfile(NULL); use_helpline("Select OK to dismiss this dialog"); dialog_prgbox(tmp->title, (char *)tmp->data, 22, 76, 1, 1); dialog_clear(); - return RET_SUCCESS; + restorescr(w); + return DITEM_SUCCESS; } int dmenuCancel(dialogMenuItem *tmp) { cancelled = TRUE; - return RET_SUCCESS; + return DITEM_LEAVE_MENU; } int @@ -94,21 +98,24 @@ dmenuSetVariable(dialogMenuItem *tmp) { variable_set((char *)tmp->data); msgInfo("Set %s", tmp->data); - return RET_SUCCESS; + return DITEM_SUCCESS; } int dmenuSetFlag(dialogMenuItem *tmp) { - *((unsigned int *)tmp->data) |= tmp->aux; - return RET_SUCCESS; + if (*((unsigned int *)tmp->data) & tmp->aux) + *((unsigned int *)tmp->data) &= ~tmp->aux; + else + *((unsigned int *)tmp->data) |= tmp->aux; + return DITEM_SUCCESS; } int dmenuSetValue(dialogMenuItem *tmp) { *((unsigned int *)tmp->data) = tmp->aux; - return RET_SUCCESS; + return DITEM_SUCCESS; } /* Traverse menu but give user no control over positioning */ @@ -188,21 +195,23 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max) use_helpfile(systemHelpFile(menu->helpfile, buf)); /* Pop up that dialog! */ - if (menu->type == DMENU_NORMAL_TYPE) + if (menu->type & DMENU_NORMAL_TYPE) rval = dialog_menu((u_char *)menu->title, (u_char *)menu->prompt, -1, -1, menu_height(menu, n), -n, menu->items, NULL, choice, scroll); - else if (menu->type == DMENU_RADIO_TYPE) + else if (menu->type & DMENU_RADIO_TYPE) rval = dialog_radiolist((u_char *)menu->title, (u_char *)menu->prompt, -1, -1, menu_height(menu, n), -n, menu->items, NULL); - else if (menu->type == DMENU_CHECKLIST_TYPE) + else if (menu->type & DMENU_CHECKLIST_TYPE) rval = dialog_checklist((u_char *)menu->title, (u_char *)menu->prompt, -1, -1, menu_height(menu, n), -n, menu->items, NULL); + else + msgFatal("Menu: `%s' is of an unknown type\n", menu->title); /* This seems to be the only technique that works for getting the display to look right */ dialog_clear(); - if (rval) + if (rval || menu->type & (DMENU_SELECTION_RETURNS | DMENU_RADIO_TYPE | DMENU_CHECKLIST_TYPE)) return FALSE; else if (cancelled) { cancelled = FALSE; diff --git a/usr.sbin/sysinstall/doc.c b/usr.sbin/sysinstall/doc.c index 013dd93..8a7e897 100644 --- a/usr.sbin/sysinstall/doc.c +++ b/usr.sbin/sysinstall/doc.c @@ -1,14 +1,37 @@ /* * The new sysinstall program. * - * This is probably the last program in the `sysinstall' line - the next - * generation being essentially a complete rewrite. + * This is probably the last attempt in the `sysinstall' line, the next + * generation being slated for what's essentially a complete rewrite. * - * $Id: doc.c,v 1.10 1995/11/06 12:49:23 jkh Exp $ + * $Id: dmenu.c,v 1.15 1996/04/07 03:52:23 jkh Exp $ * - * Jordan Hubbard + * Copyright (c) 1995 + * Jordan Hubbard. All rights reserved. * - * My contributions are in the public domain. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this + * point in the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * */ @@ -25,20 +48,20 @@ docBrowser(dialogMenuItem *self) if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) { msgConfirm("This option may only be used after the system is installed, sorry!"); - return RET_FAIL; + return DITEM_FAILURE; } /* Make sure we have media available */ if (!mediaVerify()) - return RET_FAIL; + return DITEM_FAILURE; /* First, make sure we have whatever browser we've chosen is here */ - if (package_add(browser) != RET_SUCCESS) { + if (package_add(browser) != DITEM_SUCCESS) { dialog_clear(); msgConfirm("Unable to install the %s HTML browser package. You may\n" "wish to verify that your media is configured correctly and\n" "try again.", browser); - return RET_FAIL; + return DITEM_FAILURE; } if (!file_executable(variable_get(VAR_BROWSER_BINARY))) { dialog_clear(); @@ -49,14 +72,14 @@ docBrowser(dialogMenuItem *self) "I suggest that we remove the version that was extracted since it does\n" "not appear to be correct. Would you like me to do that now?")) vsystem("pkg_delete %s %s", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v" : "", browser); - return RET_FAIL; + return DITEM_FAILURE; } /* Run browser on the appropriate doc */ if (dmenuOpenSimple(&MenuHTMLDoc)) - return RET_SUCCESS; + return DITEM_SUCCESS; else - return RET_FAIL; + return DITEM_FAILURE; } /* Try to show one of the documents requested from the HTML doc menu */ @@ -72,7 +95,7 @@ docShowDocument(dialogMenuItem *self) dialog_clear(); msgConfirm("Can't find the browser in %s! Please ensure that it's\n" "properly set in the Options editor.", browser); - return RET_FAIL; + return DITEM_FAILURE; } if (!strcmp(str, "Home")) where = "http://www.freebsd.org"; @@ -93,11 +116,12 @@ docShowDocument(dialogMenuItem *self) if (where) { sprintf(tmp, "%s %s", browser, where); systemExecute(tmp); - return RET_SUCCESS; + return DITEM_SUCCESS; } else { msgConfirm("Hmmmmm! I can't seem to access the documentation you selected!\n" "Have you loaded the bin distribution? Is your network connected?"); - return RET_FAIL; + return DITEM_FAILURE; } } + diff --git a/usr.sbin/sysinstall/dos.c b/usr.sbin/sysinstall/dos.c index 7c4b9b1..0df2d1a 100644 --- a/usr.sbin/sysinstall/dos.c +++ b/usr.sbin/sysinstall/dos.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: dos.c,v 1.8 1995/12/07 10:33:45 peter Exp $ + * $Id: dos.c,v 1.9 1996/03/02 07:31:52 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -21,13 +21,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -66,7 +59,7 @@ mediaInitDOS(Device *dev) if (!RunningAsInit || DOSMounted) return TRUE; - if (Mkdir("/dos", NULL) != RET_SUCCESS) + if (Mkdir("/dos", NULL) != DITEM_SUCCESS) return FALSE; memset(&args, 0, sizeof(args)); diff --git a/usr.sbin/sysinstall/floppy.c b/usr.sbin/sysinstall/floppy.c index 6f0c9d9..2479bb2 100644 --- a/usr.sbin/sysinstall/floppy.c +++ b/usr.sbin/sysinstall/floppy.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: floppy.c,v 1.8 1995/12/07 10:33:46 peter Exp $ + * $Id: floppy.c,v 1.9 1996/03/02 07:31:52 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -21,13 +21,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -65,19 +58,14 @@ static char *distWanted; /* For finding floppies */ static int -floppyChoiceHook(char *str) +floppyChoiceHook(dialogMenuItem *self) { Device **devs; - /* Clip garbage off the ends */ - string_prune(str); - str = string_skipwhite(str); - if (!*str) - return RET_FAIL; - devs = deviceFind(str, DEVICE_TYPE_FLOPPY); + devs = deviceFind(self->prompt, DEVICE_TYPE_FLOPPY); if (devs) floppyDev = devs[0]; - return devs ? RET_DONE : RET_FAIL; + return devs ? DITEM_LEAVE_MENU : DITEM_FAILURE; } /* Our last-ditch routine for getting ROOT from a floppy */ @@ -105,7 +93,7 @@ getRootFloppy(void) else { DMenu *menu; - menu = deviceCreateMenu(&MenuMediaFloppy, DEVICE_TYPE_FLOPPY, floppyChoiceHook); + menu = deviceCreateMenu(&MenuMediaFloppy, DEVICE_TYPE_FLOPPY, floppyChoiceHook, NULL); menu->title = "Please insert the ROOT floppy"; if (!dmenuOpenSimple(menu)) return -1; diff --git a/usr.sbin/sysinstall/globals.c b/usr.sbin/sysinstall/globals.c index bc303e5..c528b63 100644 --- a/usr.sbin/sysinstall/globals.c +++ b/usr.sbin/sysinstall/globals.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: globals.c,v 1.10.2.1 1995/10/21 14:06:41 jkh Exp $ + * $Id: globals.c,v 1.11 1995/12/07 10:33:50 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c index ec86888..9b45a41 100644 --- a/usr.sbin/sysinstall/index.c +++ b/usr.sbin/sysinstall/index.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: index.c,v 1.21 1996/03/18 15:27:51 jkh Exp $ + * $Id: index.c,v 1.22 1996/03/21 09:30:11 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -64,10 +57,9 @@ _strdup(char *ptr) static char *descrs[] = { "Package Selection", "To mark a package or select a category, move to it and press SPACE.\n" - "To unmark a package, press SPACE again. When you want to commit your\n" - "marks, press [ENTER]. To go to a previous menu, select UP item or Cancel.\n" - "To search for a package by name, press ESC. To extract packages, you\n" - "should Cancel all the way out of any submenus and finally this menu.", + "To unmark a package, press SPACE again. To go to a previous menu, select the Cancel\n" + "button. To search for a package by name, press ESC. To finally extract packages, you\n" + "should Cancel all the way out of any submenus and this top menu.", "Package Targets", "These are the packages you've selected for extraction.\n\n" "If you're sure of these choices, select OK.\n" "If not, select Cancel to go back to the package selection menu.\n", @@ -338,10 +330,7 @@ index_sort(PkgNodePtr top) } } -/* - * No, we don't free n because someone else is still pointing at it. - * It's just clone linked from another location, which we're adjusting. - */ +/* Delete an entry out of the index */ void index_delete(PkgNodePtr n) { @@ -351,6 +340,10 @@ index_delete(PkgNodePtr n) n->name = NULL; } +/* + * Search for a given node by name, returning the category in if + * tp is non-NULL. + */ PkgNodePtr index_search(PkgNodePtr top, char *str, PkgNodePtr *tp) { @@ -381,28 +374,52 @@ index_search(PkgNodePtr top, char *str, PkgNodePtr *tp) return p; } -/* Work function for seeing if name x is in result string y */ -static Boolean -is_selected_in(char *name, char *result) +int +pkg_checked(dialogMenuItem *self) { - Boolean ret = FALSE; + PkgNodePtr kp = self->data, plist = (PkgNodePtr)self->aux; - while (*result) { - char *cp; + if (kp->type == PACKAGE && plist) + return index_search(plist, kp->name, NULL) ? TRUE : FALSE; + else + return FALSE; +} - cp = index(result, '\n'); - if (!cp) { - ret = !strcmp(name, result); - break; +int +pkg_fire(dialogMenuItem *self) +{ + PkgNodePtr sp, kp = self->data, plist = (PkgNodePtr)self->aux; + + if (!plist) + return DITEM_FAILURE; + if (kp->type == PACKAGE) { + sp = index_search(plist, kp->name, NULL); + /* Not already selected? */ + if (!sp) { + PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode)); + + *np = *kp; + np->next = plist->kids; + plist->kids = np; + msgInfo("%s added to selection list", kp->name); } - else { - ret = !strncmp(name, result, cp - result - 1); - if (ret) - break; + else if (sp) { + msgInfo("Removing %s from selection list", kp->name); + index_delete(sp); } - result = cp + 1; } - return ret; + else { /* Not a package, must be a directory */ + int p, s; + + p = s = 0; + index_menu(kp, plist, &p, &s); + } + return DITEM_SUCCESS; +} + +void +pkg_selected(dialogMenuItem *self, int is_selected) +{ } int @@ -410,9 +427,8 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll) { int n, rval, maxname; int curr, max; - PkgNodePtr sp, kp; - char **nitems; - char result[4096]; + PkgNodePtr kp; + dialogMenuItem *nitems; Boolean hasPackages; hasPackages = FALSE; @@ -433,7 +449,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll) if (!n && plist) { dialog_clear(); msgConfirm("The %s menu is empty.", top->name); - return RET_DONE; + return DITEM_LEAVE_MENU; } dialog_clear(); @@ -441,66 +457,26 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll) n = 0; curr = max = 0; kp = top->kids; - if (!hasPackages && kp && kp->name && plist) { - nitems = item_add_pair(nitems, "UP", "<RETURN TO PREVIOUS MENU>", &curr, &max); - ++n; - } while (kp && kp->name) { + char buf[256]; + /* Brutally adjust description to fit in menu */ - if (strlen(kp->desc) > (_MAX_DESC - maxname)) - kp->desc[_MAX_DESC - maxname] = '\0'; - nitems = item_add_pair(nitems, kp->name, kp->desc, &curr, &max); - if (hasPackages) { - if (kp->type == PACKAGE && plist) - nitems = item_add(nitems, index_search(plist, kp->name, NULL) ? "ON" : "OFF", &curr, &max); - else - nitems = item_add(nitems, "OFF", &curr, &max); - } + strcpy(buf, kp->desc); + if (strlen(buf) > (_MAX_DESC - maxname)) + buf[_MAX_DESC - maxname] = '\0'; + nitems = item_add(nitems, kp->name, buf, pkg_checked, pkg_fire, pkg_selected, kp, (int)plist, &curr, &max); ++n; kp = kp->next; } - nitems = item_add(nitems, NULL, &curr, &max); + /* NULL delimiter so item_free() knows when to stop later */ + nitems = item_add(nitems, NULL, NULL, NULL, NULL, NULL, NULL, 0, &curr, &max); if (hasPackages) - rval = dialog_checklist(top->name, top->desc, -1, -1, n > MAX_MENU ? MAX_MENU : n, n, - (unsigned char **)nitems, result); + rval = dialog_checklist(top->name, top->desc, -1, -1, n > MAX_MENU ? MAX_MENU : n, -n, nitems, NULL); else /* It's a categories menu */ - rval = dialog_menu(top->name, top->desc, -1, -1, n > MAX_MENU ? MAX_MENU : n, n, - (unsigned char **)nitems, result, pos, scroll); - if (!rval && plist && strcmp(result, "UP")) { - for (kp = top->kids; kp; kp = kp->next) { - if (kp->type == PACKAGE) { - sp = index_search(plist, kp->name, NULL); - if (is_selected_in(kp->name, result)) { - if (!sp) { - PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode)); - - *np = *kp; - np->next = plist->kids; - plist->kids = np; - standout(); - mvprintw(24, 0, "Selected packages were added to selection list\n", kp->name); - standend(); - refresh(); - } - } - else if (sp) { - standout(); - mvprintw(24, 0, "Deleting unselected packages from selection list\n", kp->name); - standend(); - refresh(); - index_delete(sp); - } - } - else if (!strcmp(kp->name, result)) { /* Not a package, must be a directory */ - int p, s; - - p = s = 0; - index_menu(kp, plist, &p, &s); - } - } - } - else if (rval == -1 && plist) { + rval = dialog_menu(top->name, top->desc, -1, -1, n > MAX_MENU ? MAX_MENU : n, -n, + nitems, NULL, pos, scroll); + if (rval == -1 && plist) { static char *cp; PkgNodePtr menu; @@ -519,12 +495,11 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll) msgConfirm("Search string: %s yielded no hits.", cp); } } + continue; } - else { - dialog_clear(); - items_free(nitems, &curr, &max); - return rval ? RET_FAIL : RET_SUCCESS; - } + dialog_clear(); + items_free(nitems, &curr, &max); + return rval ? DITEM_FAILURE : DITEM_SUCCESS; } } @@ -532,7 +507,7 @@ int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist) { PkgNodePtr tmp; - int status = RET_SUCCESS; + int status = DITEM_SUCCESS; for (tmp = plist->kids; tmp; tmp = tmp->next) status = index_extract_one(dev, top, tmp, FALSE); @@ -542,7 +517,7 @@ index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist) static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) { - int status = RET_SUCCESS; + int status = DITEM_SUCCESS; PkgNodePtr tmp2; IndexEntryPtr id = who->data; @@ -551,12 +526,12 @@ index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) strcpy(t, id->deps); cp = t; - while (cp && status == RET_SUCCESS) { + while (cp && status == DITEM_SUCCESS) { if ((cp2 = index(cp, ' ')) != NULL) *cp2 = '\0'; if ((tmp2 = index_search(top, cp, NULL)) != NULL) { status = index_extract_one(dev, top, tmp2, TRUE); - if (status != RET_SUCCESS) { + if (status != DITEM_SUCCESS) { if (variable_get(VAR_NO_CONFIRM)) msgNotify("Loading of dependant package %s failed", cp); else @@ -570,7 +545,7 @@ index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) } } /* Done with the deps? Load the real m'coy */ - if (status == RET_SUCCESS) + if (status == DITEM_SUCCESS) status = package_extract(dev, who->name, depended); return status; } diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index f789fd7..8a55b08 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.81 1996/03/24 18:57:36 joerg Exp $ + * $Id: install.c,v 1.82 1996/04/07 03:52:25 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -168,12 +161,12 @@ installInitial(void) static Boolean alreadyDone = FALSE; if (alreadyDone) - return RET_SUCCESS; + return DITEM_SUCCESS; if (!variable_get(DISK_LABELLED)) { dialog_clear(); msgConfirm("You need to assign disk labels before you can proceed with\nthe installation."); - return RET_FAIL; + return DITEM_FAILURE; } /* If it's labelled, assume it's also partitioned */ if (!variable_get(DISK_PARTITIONED)) @@ -186,25 +179,25 @@ installInitial(void) "then WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before\n" "proceeding!\n\n" "We can take no responsibility for lost disk contents!")) - return RET_FAIL; + return DITEM_FAILURE; - if (diskLabelCommit(NULL) != RET_SUCCESS) { + if (diskLabelCommit(NULL) != DITEM_SUCCESS) { dialog_clear(); msgConfirm("Couldn't make filesystems properly. Aborting."); - return RET_FAIL; + return DITEM_FAILURE; } if (!copySelf()) { dialog_clear(); msgConfirm("Couldn't clone the boot floppy onto the root file system.\n" "Aborting."); - return RET_FAIL; + return DITEM_FAILURE; } if (chroot("/mnt") == -1) { dialog_clear(); msgConfirm("Unable to chroot to /mnt - this is bad!"); - return RET_FAIL; + return DITEM_FAILURE; } chdir("/"); @@ -215,11 +208,17 @@ installInitial(void) systemCreateHoloshell(); alreadyDone = TRUE; - return RET_SUCCESS; + return DITEM_SUCCESS; } int -installFixit(dialogMenuItem *self) +installFixitCDROM(dialogMenuItem *self) +{ + return DITEM_SUCCESS; +} + +int +installFixitFloppy(dialogMenuItem *self) { struct ufs_args args; pid_t child; @@ -237,7 +236,7 @@ installFixit(dialogMenuItem *self) break; dialog_clear(); if (msgYesNo("Unable to mount the fixit floppy - do you want to try again?")) - return RET_FAIL; + return DITEM_FAILURE; } dialog_clear(); dialog_update(); @@ -246,7 +245,7 @@ installFixit(dialogMenuItem *self) if (!directory_exists("/tmp")) (void)symlink("/mnt2/tmp", "/tmp"); if (!directory_exists("/var/tmp/vi.recover")) { - if (Mkdir("/var/tmp/vi.recover", NULL) != RET_SUCCESS) { + if (Mkdir("/var/tmp/vi.recover", NULL) != DITEM_SUCCESS) { dialog_clear(); msgConfirm("Warning: Was unable to create a /var/tmp/vi.recover directory.\n" "vi will kvetch and moan about it as a result but should still\n" @@ -254,7 +253,7 @@ installFixit(dialogMenuItem *self) } } /* Link the spwd.db file */ - if (Mkdir("/etc", NULL) != RET_SUCCESS) { + if (Mkdir("/etc", NULL) != DITEM_SUCCESS) { dialog_clear(); msgConfirm("Unable to create an /etc directory! Things are weird on this floppy.."); } @@ -294,33 +293,33 @@ installFixit(dialogMenuItem *self) unmount("/mnt2", MNT_FORCE); dialog_clear(); msgConfirm("Please remove the fixit floppy now."); - return RET_SUCCESS; + return DITEM_SUCCESS; } int installExpress(dialogMenuItem *self) { variable_set2(SYSTEM_STATE, "express"); - if (diskPartitionEditor(self) == RET_FAIL) - return RET_FAIL; + if (diskPartitionEditor(self) == DITEM_FAILURE) + return DITEM_FAILURE; - if (diskLabelEditor(self) == RET_FAIL) - return RET_FAIL; + if (diskLabelEditor(self) == DITEM_FAILURE) + return DITEM_FAILURE; if (!Dists) { if (!dmenuOpenSimple(&MenuDistributions)) - return RET_FAIL; + return DITEM_FAILURE; } if (!mediaDevice) { if (!dmenuOpenSimple(&MenuMedia) || !mediaDevice) - return RET_FAIL; + return DITEM_FAILURE; } - if (installCommit(self) == RET_FAIL) - return RET_FAIL; + if (installCommit(self) == DITEM_FAILURE) + return DITEM_FAILURE; - return RET_DONE; + return DITEM_LEAVE_MENU; } /* Novice mode installation */ @@ -336,8 +335,8 @@ installNovice(dialogMenuItem *self) "by a (Q)uit. If you wish to allocate only free space to FreeBSD, move to a\n" "partition marked \"unused\" and use the (C)reate command."); - if (diskPartitionEditor(self) == RET_FAIL) - return RET_FAIL; + if (diskPartitionEditor(self) == DITEM_FAILURE) + return DITEM_FAILURE; dialog_clear(); msgConfirm("Next, you need to create BSD partitions inside of the fdisk partition(s)\n" @@ -347,8 +346,8 @@ installNovice(dialogMenuItem *self) "care for the layout chosen by (A)uto, press F1 for more information on\n" "manual layout."); - if (diskLabelEditor(self) == RET_FAIL) - return RET_FAIL; + if (diskLabelEditor(self) == DITEM_FAILURE) + return DITEM_FAILURE; dialog_clear(); msgConfirm("Now it is time to select an installation subset. There are a number of\n" @@ -357,7 +356,7 @@ installNovice(dialogMenuItem *self) "of distributions if none of the provided ones are suitable."); while (1) { if (!dmenuOpenSimple(&MenuDistributions)) - return RET_FAIL; + return DITEM_FAILURE; if (Dists || !msgYesNo("No distributions selected. Are you sure you wish to continue?")) break; @@ -367,13 +366,13 @@ installNovice(dialogMenuItem *self) dialog_clear(); msgConfirm("Finally, you must specify an installation medium."); if (!dmenuOpenSimple(&MenuMedia) || !mediaDevice) - return RET_FAIL; + return DITEM_FAILURE; } - if (installCommit(self) == RET_FAIL) - return RET_FAIL; + if (installCommit(self) == DITEM_FAILURE) + return DITEM_FAILURE; - return RET_DONE; + return DITEM_LEAVE_MENU; } /* @@ -392,30 +391,30 @@ installCommit(dialogMenuItem *self) char *str; if (!mediaVerify()) - return RET_FAIL; + return DITEM_FAILURE; str = variable_get(SYSTEM_STATE); - i = RET_DONE; + i = DITEM_LEAVE_MENU; if (RunningAsInit) { - if (installInitial() == RET_FAIL) - return RET_FAIL; - if (configFstab() == RET_FAIL) - return RET_FAIL; + if (installInitial() == DITEM_FAILURE) + return DITEM_FAILURE; + if (configFstab() == DITEM_FAILURE) + return DITEM_FAILURE; if (!rootExtract()) { dialog_clear(); msgConfirm("Failed to load the ROOT distribution. Please correct\n" "this problem and try again."); - return RET_FAIL; + return DITEM_FAILURE; } } - if (distExtractAll(self) == RET_FAIL) - i = RET_FAIL; + if (distExtractAll(self) == DITEM_FAILURE) + i = DITEM_FAILURE; - if (installFixup(self) == RET_FAIL) - i = RET_FAIL; + if (installFixup(self) == DITEM_FAILURE) + i = DITEM_FAILURE; - if (i != RET_FAIL && !strcmp(str, "novice")) { + if (i != DITEM_FAILURE && !strcmp(str, "novice")) { dialog_clear(); msgConfirm("Since you're running the novice installation, a few post-configuration\n" "questions will be asked at this point. For any option you do not wish\n" @@ -509,7 +508,7 @@ installCommit(dialogMenuItem *self) /* Don't print this if we're express or novice installing */ if (strcmp(str, "express") && strcmp(str, "novice")) { - if (Dists || i == RET_FAIL) { + if (Dists || i == DITEM_FAILURE) { dialog_clear(); msgConfirm("Installation completed with some errors. You may wish to\n" "scroll through the debugging messages on VTY1 with the\n" @@ -523,7 +522,7 @@ installCommit(dialogMenuItem *self) } } else if (!strcmp(str, "novice")) { - if (Dists || i == RET_FAIL) { + if (Dists || i == DITEM_FAILURE) { dialog_clear(); msgConfirm("Installation completed with some errors. You may wish to\n" "scroll through the debugging messages on VTY1 with the\n" @@ -541,7 +540,7 @@ installCommit(dialogMenuItem *self) "may do so by typing: /stand/sysinstall."); } } - variable_set2(SYSTEM_STATE, i == RET_FAIL ? "error-install" : "full-install"); + variable_set2(SYSTEM_STATE, i == DITEM_FAILURE ? "error-install" : "full-install"); return i; } @@ -557,7 +556,7 @@ installFixup(dialogMenuItem *self) if (vsystem("cp -p /kernel.GENERIC /kernel")) { dialog_clear(); msgConfirm("Unable to link /kernel into place!"); - return RET_FAIL; + return DITEM_FAILURE; } } else { @@ -565,7 +564,7 @@ installFixup(dialogMenuItem *self) msgConfirm("Can't find a kernel image to link to on the root file system!\n" "You're going to have a hard time getting this system to\n" "boot from the hard disk, I'm afraid!"); - return RET_FAIL; + return DITEM_FAILURE; } } /* Resurrect /dev after bin distribution screws it up */ @@ -574,7 +573,7 @@ installFixup(dialogMenuItem *self) if (vsystem("cd /dev; sh MAKEDEV all")) { dialog_clear(); msgConfirm("MAKEDEV returned non-zero status"); - return RET_FAIL; + return DITEM_FAILURE; } msgNotify("Resurrecting /dev entries for slices.."); @@ -597,7 +596,7 @@ installFixup(dialogMenuItem *self) if (vsystem("cd /dev; sh MAKEDEV %sh", c1->name)) { dialog_clear(); msgConfirm("Unable to make slice entries for %s!", c1->name); - return RET_FAIL; + return DITEM_FAILURE; } } } @@ -622,7 +621,7 @@ installFixup(dialogMenuItem *self) vsystem("mtree -deU -f /etc/mtree/BSD.var.dist -p /var"); vsystem("mtree -deU -f /etc/mtree/BSD.usr.dist -p /usr"); } - return RET_SUCCESS; + return DITEM_SUCCESS; } /* Go newfs and/or mount all the filesystems we've been asked to */ @@ -641,7 +640,7 @@ installFilesystems(dialogMenuItem *self) str = variable_get(SYSTEM_STATE); if (!checkLabels(&rootdev, &swapdev, &usrdev)) - return RET_FAIL; + return DITEM_FAILURE; root = (PartInfo *)rootdev->private_data; command_clear(); @@ -653,7 +652,7 @@ installFilesystems(dialogMenuItem *self) dialog_clear(); msgConfirm("Unable to make device node for %s in /dev!\n" "The creation of filesystems will be aborted.", dname); - return RET_FAIL; + return DITEM_FAILURE; } if (!swapon(dname)) msgNotify("Added %s as initial swap device", dname); @@ -668,7 +667,7 @@ installFilesystems(dialogMenuItem *self) dialog_clear(); msgConfirm("Unable to make device node for %s in /dev!\n" "The creation of filesystems will be aborted.", dname); - return RET_FAIL; + return DITEM_FAILURE; } if (strcmp(root->mountpoint, "/")) { @@ -685,7 +684,7 @@ installFilesystems(dialogMenuItem *self) dialog_clear(); msgConfirm("Unable to make new root filesystem on %s!\n" "Command returned status %d", dname, i); - return RET_FAIL; + return DITEM_FAILURE; } } else { @@ -707,7 +706,7 @@ installFilesystems(dialogMenuItem *self) if (Mount("/mnt", dname)) { dialog_clear(); msgConfirm("Unable to mount the root file system on %s! Giving up.", dname); - return RET_FAIL; + return DITEM_FAILURE; } /* Now buzz through the rest of the partitions and mount them too */ @@ -720,7 +719,7 @@ installFilesystems(dialogMenuItem *self) if (!disk->chunks) { dialog_clear(); msgConfirm("No chunk list found for %s!", disk->name); - return RET_FAIL; + return DITEM_FAILURE; } if (root->newfs || upgrade) { Mkdir("/mnt/dev", NULL); @@ -774,12 +773,12 @@ installFilesystems(dialogMenuItem *self) if ((root->newfs || upgrade) && vsystem("find -x /dev | cpio -pdumv /mnt")) { dialog_clear(); msgConfirm("Couldn't clone the /dev files!"); - return RET_FAIL; + return DITEM_FAILURE; } command_sort(); command_execute(); - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -802,7 +801,7 @@ installVarDefaults(dialogMenuItem *self) variable_set2(SYSTEM_STATE, "update"); else variable_set2(SYSTEM_STATE, "init"); - return RET_SUCCESS; + return DITEM_SUCCESS; } /* Copy the boot floppy contents into /stand */ diff --git a/usr.sbin/sysinstall/installUpgrade.c b/usr.sbin/sysinstall/installUpgrade.c index 23acb9a..2d0c3cc 100644 --- a/usr.sbin/sysinstall/installUpgrade.c +++ b/usr.sbin/sysinstall/installUpgrade.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: installUpgrade.c,v 1.18 1995/11/17 14:17:12 jkh Exp $ + * $Id: installUpgrade.c,v 1.19 1996/04/07 03:52:29 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -195,7 +188,7 @@ installUpgrade(dialogMenuItem *self) dialog_clear(); msgConfirm("You can only perform this procedure when booted off the installation\n" "floppy."); - return RET_FAIL; + return DITEM_FAILURE; } variable_set2(SYSTEM_STATE, "upgrade"); @@ -203,7 +196,7 @@ installUpgrade(dialogMenuItem *self) if (msgYesNo("Given all that scary stuff you just read, are you sure you want to\n" "risk it all and proceed with this upgrade?")) - return RET_FAIL; + return DITEM_FAILURE; if (!Dists) { dialog_clear(); @@ -213,7 +206,7 @@ installUpgrade(dialogMenuItem *self) "to select those portions of 2.1 you wish to install on top of your 2.0.5\n" "system."); if (!dmenuOpenSimple(&MenuDistributions)) - return RET_FAIL; + return DITEM_FAILURE; } /* No bin selected? Not much of an upgrade.. */ @@ -235,7 +228,7 @@ installUpgrade(dialogMenuItem *self) dialog_clear(); msgConfirm("Now you must specify an installation medium for the upgrade."); if (!dmenuOpenSimple(&MenuMedia) || !mediaDevice) - return RET_FAIL; + return DITEM_FAILURE; } dialog_clear(); @@ -248,36 +241,36 @@ installUpgrade(dialogMenuItem *self) "Once you're done in the label editor, press Q to return here for the next\n" "step."); - if (diskLabelEditor(self) == RET_FAIL) { + if (diskLabelEditor(self) == DITEM_FAILURE) { dialog_clear(); msgConfirm("The disk label editor failed to work properly! Upgrade operation\n" "aborted."); - return RET_FAIL; + return DITEM_FAILURE; } /* Don't write out MBR info */ variable_set2(DISK_PARTITIONED, "written"); - if (diskLabelCommit(self) == RET_FAIL) { + if (diskLabelCommit(self) == DITEM_FAILURE) { dialog_clear(); msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" "aborted."); variable_unset(DISK_PARTITIONED); - return RET_FAIL; + return DITEM_FAILURE; } if (!copySelf()) { dialog_clear(); msgConfirm("Couldn't clone the boot floppy onto the root file system.\n" "Aborting."); - return RET_FAIL; + return DITEM_FAILURE; } - if (chroot("/mnt") == RET_FAIL) { + if (chroot("/mnt") == DITEM_FAILURE) { dialog_clear(); msgConfirm("Unable to chroot to /mnt - something is wrong with the\n" "root partition or the way it's mounted if this doesn't work."); variable_unset(DISK_PARTITIONED); - return RET_FAIL; + return DITEM_FAILURE; } chdir("/"); @@ -322,7 +315,7 @@ installUpgrade(dialogMenuItem *self) } msgNotify("Beginning extraction of distributions.."); - if (distExtractAll(self) == RET_FAIL) { + if (distExtractAll(self) == DITEM_FAILURE) { if (extractingBin && (Dists & DIST_BIN)) { dialog_clear(); msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n" @@ -341,7 +334,7 @@ installUpgrade(dialogMenuItem *self) "/dev entries and such that a 2.1 system expects to see. I'll also perform a\n" "few \"fixup\" operations to repair the effects of splatting a bin distribution\n" "on top of an existing system.."); - if (installFixup(self) == RET_FAIL) { + if (installFixup(self) == DITEM_FAILURE) { dialog_clear(); msgConfirm("Hmmmmm. The fixups don't seem to have been very happy.\n" "You may wish to examine the system a little more closely when\n" diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index 774a329..7b930c7 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.40 1996/03/24 18:57:37 joerg Exp $ + * $Id: label.c,v 1.41 1996/04/07 03:52:30 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -82,47 +75,14 @@ static int here; static int diskLabel(char *str); -static int -labelHook(char *str) -{ - Device **devs = NULL; - - /* Clip garbage off the ends */ - string_prune(str); - str = string_skipwhite(str); - /* Try and open all the disks */ - while (str) { - char *cp; - - cp = index(str, '\n'); - if (cp) - *cp++ = 0; - if (!*str) { - beep(); - return 0; - } - devs = deviceFind(str, DEVICE_TYPE_DISK); - if (!devs) { - dialog_clear(); - msgConfirm("Unable to find disk %s!", str); - return 0; - } - devs[0]->enabled = TRUE; - str = cp; - } - return devs ? 1 : 0; -} - int diskLabelEditor(dialogMenuItem *self) { Device **devs; - DMenu *menu; - int i, cnt; - char *cp, *str; + int i, cnt, enabled; + char *cp; cp = variable_get(VAR_DISK); - str = variable_get(SYSTEM_STATE); devs = deviceFind(cp, DEVICE_TYPE_DISK); cnt = deviceCount(devs); if (!cnt) { @@ -130,32 +90,20 @@ diskLabelEditor(dialogMenuItem *self) msgConfirm("No disks found! Please verify that your disk controller is being\n" "properly probed at boot time. See the Hardware Guide on the\n" "Documentation menu for clues on diagnosing this type of problem."); - return RET_FAIL; + return DITEM_FAILURE; } - else if (cnt == 1 || variable_get(DISK_SELECTED)) { - if (cnt == 1) - devs[0]->enabled = TRUE; - i = diskLabel(str); + for (i = 0, enabled = 0; i < cnt; i++) { + if (devs[i]->enabled) + ++enabled; } - else { - menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, labelHook); - if (!menu) { - dialog_clear(); - msgConfirm("No devices suitable for installation found!\n\n" - "Please verify that your disk controller (and attached drives)\n" - "were detected properly. This can be done by pressing the\n" - "[Scroll Lock] key and using the Arrow keys to move back to\n" - "the boot messages. Press [Scroll Lock] again to return."); - i = RET_FAIL; - } - else { - if (!dmenuOpenSimple(menu)) - i = RET_FAIL; - else - i = diskLabel(str); - free(menu); - } + if (!enabled) { + devs[0]->enabled = TRUE; + if (diskPartitionEditor(self) == DITEM_FAILURE) + return DITEM_FAILURE; } + i = diskLabel(devs[0]->name); + if (i != DITEM_FAILURE) + variable_set2(DISK_LABELLED, "yes"); return i; } @@ -168,22 +116,22 @@ diskLabelCommit(dialogMenuItem *self) /* Already done? */ if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes")) { variable_set2(DISK_PARTITIONED, "yes"); - i = RET_SUCCESS; + i = DITEM_SUCCESS; } else if (!cp) { dialog_clear(); msgConfirm("You must assign disk labels before this option can be used."); - i = RET_FAIL; + i = DITEM_FAILURE; } /* The routine will guard against redundant writes, just as this one does */ - else if (diskPartitionWrite(self) != RET_SUCCESS) - i = RET_FAIL; - else if (installFilesystems(self) != RET_SUCCESS) - i = RET_FAIL; + else if (diskPartitionWrite(self) != DITEM_SUCCESS) + i = DITEM_FAILURE; + else if (installFilesystems(self) != DITEM_SUCCESS) + i = DITEM_FAILURE; else { msgInfo("All filesystem information written successfully."); variable_set2(DISK_LABELLED, "written"); - i = RET_SUCCESS; + i = DITEM_SUCCESS; } return i; } @@ -522,7 +470,7 @@ diskLabel(char *str) if (!devs) { dialog_clear(); msgConfirm("No disks found!"); - return RET_FAIL; + return DITEM_FAILURE; } labeling = TRUE; @@ -878,7 +826,6 @@ diskLabel(char *str) break; variable_unset(DISK_PARTITIONED); for (i = 0; devs[i]; i++) { - extern void diskPartition(Device *dev, Disk *d); Disk *d; if (!devs[i]->enabled) @@ -945,5 +892,5 @@ diskLabel(char *str) } } dialog_clear(); - return RET_SUCCESS; + return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c index 9810b48..f956d13 100644 --- a/usr.sbin/sysinstall/main.c +++ b/usr.sbin/sysinstall/main.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: main.c,v 1.15 1995/12/07 10:33:55 peter Exp $ + * $Id: main.c,v 1.16 1996/04/07 03:52:31 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index 89bea6e..ad96f05 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.30 1996/03/21 17:20:31 jkh Exp $ + * $Id: media.c,v 1.31 1996/04/07 03:52:32 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -51,25 +44,20 @@ #include "sysinstall.h" static int -genericHook(char *str, DeviceType type) +genericHook(dialogMenuItem *self, DeviceType type) { Device **devs; - /* Clip garbage off the ends */ - string_prune(str); - str = string_skipwhite(str); - if (!*str) - return 0; - devs = deviceFind(str, type); + devs = deviceFind(self->prompt, type); if (devs) mediaDevice = devs[0]; - return devs ? 1 : 0; + return devs ? DITEM_SUCCESS : DITEM_FAILURE; } static int -cdromHook(char *str) +cdromHook(dialogMenuItem *self) { - return genericHook(str, DEVICE_TYPE_CDROM); + return genericHook(self, DEVICE_TYPE_CDROM); } char * @@ -100,29 +88,29 @@ mediaSetCDROM(dialogMenuItem *self) "configuration is correct and that the CDROM drive is of a supported\n" "type. For more information, consult the hardware guide\n" "in the Doc menu."); - return RET_FAIL; + return DITEM_FAILURE; } else if (cnt > 1) { DMenu *menu; int status; - menu = deviceCreateMenu(&MenuMediaCDROM, DEVICE_TYPE_CDROM, cdromHook); + menu = deviceCreateMenu(&MenuMediaCDROM, DEVICE_TYPE_CDROM, cdromHook, NULL); if (!menu) msgFatal("Unable to create CDROM menu! Something is seriously wrong."); status = dmenuOpenSimple(menu); free(menu); if (!status) - return RET_FAIL; + return DITEM_FAILURE; } else mediaDevice = devs[0]; - return mediaDevice ? RET_DONE : RET_FAIL; + return mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE; } static int -floppyHook(char *str) +floppyHook(dialogMenuItem *self) { - return genericHook(str, DEVICE_TYPE_FLOPPY); + return genericHook(self, DEVICE_TYPE_FLOPPY); } /* @@ -142,29 +130,29 @@ mediaSetFloppy(dialogMenuItem *self) msgConfirm("No floppy devices found! Please check that your system's configuration\n" "is correct. For more information, consult the hardware guide in the Doc\n" "menu."); - return RET_FAIL; + return DITEM_FAILURE; } else if (cnt > 1) { DMenu *menu; int status; - menu = deviceCreateMenu(&MenuMediaFloppy, DEVICE_TYPE_FLOPPY, floppyHook); + menu = deviceCreateMenu(&MenuMediaFloppy, DEVICE_TYPE_FLOPPY, floppyHook, NULL); if (!menu) msgFatal("Unable to create Floppy menu! Something is seriously wrong."); status = dmenuOpenSimple(menu); free(menu); if (!status) - return RET_FAIL; + return DITEM_FAILURE; } else mediaDevice = devs[0]; - return mediaDevice ? RET_DONE : RET_FAIL; + return mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE; } static int -DOSHook(char *str) +DOSHook(dialogMenuItem *self) { - return genericHook(str, DEVICE_TYPE_DOS); + return genericHook(self, DEVICE_TYPE_DOS); } /* @@ -182,29 +170,29 @@ mediaSetDOS(dialogMenuItem *self) if (!cnt) { dialog_clear(); msgConfirm("No DOS primary partitions found! This installation method is unavailable"); - return RET_FAIL; + return DITEM_FAILURE; } else if (cnt > 1) { DMenu *menu; int status; - menu = deviceCreateMenu(&MenuMediaDOS, DEVICE_TYPE_DOS, DOSHook); + menu = deviceCreateMenu(&MenuMediaDOS, DEVICE_TYPE_DOS, DOSHook, NULL); if (!menu) msgFatal("Unable to create DOS menu! Something is seriously wrong."); status = dmenuOpenSimple(menu); free(menu); if (!status) - return RET_FAIL; + return DITEM_FAILURE; } else mediaDevice = devs[0]; - return mediaDevice ? RET_DONE : RET_FAIL; + return mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE; } static int -tapeHook(char *str) +tapeHook(dialogMenuItem *self) { - return genericHook(str, DEVICE_TYPE_TAPE); + return genericHook(self, DEVICE_TYPE_TAPE); } /* @@ -224,19 +212,19 @@ mediaSetTape(dialogMenuItem *self) msgConfirm("No tape drive devices found! Please check that your system's configuration\n" "is correct. For more information, consult the hardware guide in the Doc\n" "menu."); - return RET_FAIL; + return DITEM_FAILURE; } else if (cnt > 1) { DMenu *menu; int status; - menu = deviceCreateMenu(&MenuMediaTape, DEVICE_TYPE_TAPE, tapeHook); + menu = deviceCreateMenu(&MenuMediaTape, DEVICE_TYPE_TAPE, tapeHook, NULL); if (!menu) msgFatal("Unable to create tape drive menu! Something is seriously wrong."); status = dmenuOpenSimple(menu); free(menu); if (!status) - return RET_FAIL; + return DITEM_FAILURE; } else mediaDevice = devs[0]; @@ -253,7 +241,7 @@ mediaSetTape(dialogMenuItem *self) else mediaDevice->private = strdup(val); } - return mediaDevice ? RET_DONE : RET_FAIL; + return mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE; } /* @@ -268,14 +256,14 @@ mediaSetFTP(dialogMenuItem *self) if (!(cp = variable_get(VAR_FTP_PATH))) { if (!dmenuOpenSimple(&MenuMediaFTP)) - return RET_FAIL; + return DITEM_FAILURE; else cp = variable_get(VAR_FTP_PATH); } if (!cp) { dialog_clear(); msgConfirm("%s not set! Not setting an FTP installation path, OK?", VAR_FTP_PATH); - return RET_FAIL; + return DITEM_FAILURE; } else if (!strcmp(cp, "other")) { variable_set2(VAR_FTP_PATH, "ftp://"); @@ -287,17 +275,17 @@ mediaSetFTP(dialogMenuItem *self) "Where <path> is relative to the anonymous ftp directory or the\n" "home directory of the user being logged in as."); if (!cp || !*cp) - return RET_FAIL; + return DITEM_FAILURE; } if (strncmp("ftp://", cp, 6)) { dialog_clear(); msgConfirm("Sorry, %s is an invalid URL!", cp); - return RET_FAIL; + return DITEM_FAILURE; } strcpy(ftpDevice.name, cp); if (!tcpDeviceSelect()) - return RET_FAIL; + return DITEM_FAILURE; ftpDevice.type = DEVICE_TYPE_FTP; ftpDevice.init = mediaInitFTP; @@ -306,7 +294,7 @@ mediaSetFTP(dialogMenuItem *self) ftpDevice.shutdown = mediaShutdownFTP; ftpDevice.private = mediaDevice; /* Set to network device by tcpDeviceSelect() */ mediaDevice = &ftpDevice; - return RET_DONE; + return DITEM_LEAVE_MENU; } int @@ -333,7 +321,7 @@ mediaSetUFS(dialogMenuItem *self) val = variable_get_value(VAR_UFS_PATH, "Enter a fully qualified pathname for the directory\n" "containing the FreeBSD distribution files:"); if (!val) - return RET_FAIL; + return DITEM_FAILURE; } strcpy(ufsDevice.name, "ufs"); ufsDevice.type = DEVICE_TYPE_UFS; @@ -343,7 +331,7 @@ mediaSetUFS(dialogMenuItem *self) ufsDevice.shutdown = dummyShutdown; ufsDevice.private = strdup(val); mediaDevice = &ufsDevice; - return RET_DONE; + return DITEM_LEAVE_MENU; } int @@ -356,11 +344,11 @@ mediaSetNFS(dialogMenuItem *self) "host and directory containing the FreeBSD distribution files.\n" "This should be in the format: hostname:/some/freebsd/dir"); if (!cp) - return RET_FAIL; + return DITEM_FAILURE; strncpy(nfsDevice.name, cp, DEV_NAME_MAX); /* str == NULL means we were just called to change NFS paths, not network interfaces */ if (!tcpDeviceSelect()) - return RET_FAIL; + return DITEM_FAILURE; nfsDevice.type = DEVICE_TYPE_NFS; nfsDevice.init = mediaInitNFS; nfsDevice.get = mediaGetNFS; @@ -368,7 +356,7 @@ mediaSetNFS(dialogMenuItem *self) nfsDevice.shutdown = mediaShutdownNFS; nfsDevice.private = mediaDevice; mediaDevice = &nfsDevice; - return RET_DONE; + return DITEM_LEAVE_MENU; } Boolean @@ -519,8 +507,8 @@ int mediaGetType(dialogMenuItem *self) { if (!dmenuOpenSimple(&MenuMedia)) - return RET_FAIL; - return RET_SUCCESS; + return DITEM_FAILURE; + return DITEM_SUCCESS; } /* Return TRUE if all the media variables are set up correctly */ @@ -531,7 +519,7 @@ mediaVerify(void) dialog_clear(); msgConfirm("Media type not set! Please select a media type\n" "from the Installation menu before proceeding."); - return mediaGetType(NULL) == RET_SUCCESS; + return mediaGetType(NULL) == DITEM_SUCCESS; } return TRUE; } @@ -545,7 +533,7 @@ mediaSetFtpOnError(dialogMenuItem *self) if (!cp) { dialog_clear(); msgConfirm("FTP error handling is not set to anything!"); - return RET_FAIL; + return DITEM_FAILURE; } else { if (!strcmp(cp, "abort")) @@ -555,7 +543,7 @@ mediaSetFtpOnError(dialogMenuItem *self) else /* must be "reselect" - wrap around */ variable_set2(VAR_FTP_ONERROR, "abort"); } - return RET_SUCCESS; + return DITEM_SUCCESS; } /* Set the FTP username and password fields */ @@ -570,7 +558,7 @@ mediaSetFtpUserPass(dialogMenuItem *self) else pass = NULL; dialog_clear(); - return pass ? RET_SUCCESS : RET_FAIL; + return pass ? DITEM_SUCCESS : DITEM_FAILURE; } /* Set CPIO verbosity level */ @@ -582,7 +570,7 @@ mediaSetCPIOVerbosity(dialogMenuItem *self) if (!cp) { dialog_clear(); msgConfirm("CPIO Verbosity is not set to anything!"); - return RET_FAIL; + return DITEM_FAILURE; } else { if (!strcmp(cp, "low")) @@ -592,5 +580,5 @@ mediaSetCPIOVerbosity(dialogMenuItem *self) else /* must be "high" - wrap around */ variable_set2(VAR_CPIO_VERBOSITY, "low"); } - return RET_SUCCESS; + return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index 14edc86..b50d77b 100644 --- a/usr.sbin/sysinstall/menus.c +++ b/usr.sbin/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.48 1996/04/03 06:55:09 jkh Exp $ + * $Id: menus.c,v 1.49 1996/04/07 03:52:33 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -66,13 +59,31 @@ option by pressing [ENTER].", /* prompt */ { "Novice", "Begin a novice installation (for beginners)", NULL, installNovice }, { "Express", "Begin a quick installation (for the impatient)", NULL, installExpress }, { "Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom }, - { "Fixit", "Mount fixit floppy and go into repair mode", NULL, installFixit }, + { "Fixit", "Go into repair mode with CDROM or floppy", NULL, dmenuSubmenu, NULL, &MenuFixit }, { "Upgrade", "Upgrade an existing 2.0.5 system", NULL, installUpgrade }, { "Configure","Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure }, { "Quit", "Exit this menu (and the installation)", NULL }, { NULL } }, }; +DMenu MenuFixit = { + DMENU_NORMAL_TYPE, + "Please choose a fixit option", +"There are two ways of going into \"fixit\" mode - you may either elect\n\ +to use the 2nd FreeBSD CDROM, in which case there will be full access\n\ +access to the complete set of FreeBSD commands and utilities, or you\n\ +can use the more limited fixit floppy if you don't have a CDROM or are\n\ +somehow faced with a situation where a CDROM is impractical. The fixit\n\ +floppy has only a minimal subset of commands which we deemed most useful\n\ +for fixing a system in trouble.", + "Press F1 for more detailed repair instructions", + "fixit", +{ { "CDROM", "Use the 2nd \"live\" CDROM from the distribution", NULL, installFixitCDROM }, + { "Floppy", "Use a floppy generated from the fixit image", NULL, installFixitFloppy }, + { NULL } }, +}; + + /* The main documentation menu */ DMenu MenuDocumentation = { DMENU_NORMAL_TYPE, @@ -95,7 +106,7 @@ consult the README file.", }; DMenu MenuMouse = { - DMENU_NORMAL_TYPE, + DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Please select your mouse type from the following menu", "There are many different types of mice currently on the market,\n\ but this configuration menu should at least narrow down the choices\n\ @@ -116,7 +127,7 @@ on building a kernel.", }; DMenu MenuMediaCDROM = { - DMENU_NORMAL_TYPE, + DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a CDROM type", "FreeBSD can be installed directly from a CDROM containing a valid\n\ FreeBSD distribution. If you are seeing this menu it is because\n\ @@ -128,7 +139,7 @@ of the following CDROM drives as your installation drive.", }; DMenu MenuMediaFloppy = { - DMENU_NORMAL_TYPE, + DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a Floppy drive", "You have more than one floppy drive. Please chose the drive\n\ you would like to use for this operation", @@ -138,7 +149,7 @@ you would like to use for this operation", }; DMenu MenuMediaDOS = { - DMENU_NORMAL_TYPE, + DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a DOS partition", "FreeBSD can be installed directly from a DOS partition\n\ assuming, of course, that you have copied the relevant\n\ @@ -154,7 +165,7 @@ distribution files.", }; DMenu MenuMediaFTP = { - DMENU_NORMAL_TYPE, + DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Please select a FreeBSD FTP distribution site", "Please select the site closest to you or \"other\" if you'd like to\n\ specify a different choice. Also note that not every site listed here\n\ @@ -276,7 +287,7 @@ guaranteed to carry the full range of possible distributions.", }; DMenu MenuMediaTape = { - DMENU_NORMAL_TYPE, + DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a tape drive type", "FreeBSD can be installed from tape drive, though this installation\n\ method requires a certain amount of temporary storage in addition\n\ @@ -290,7 +301,7 @@ select one of the following tape devices detected on your system.", }; DMenu MenuNetworkDevice = { - DMENU_NORMAL_TYPE, + DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Network interface information required", "If you are using PPP over a serial device (cuaa0 or cuaa1) as opposed\n\ to a direct ethernet connection, then you may first need to dial your\n\ @@ -308,7 +319,7 @@ for an ethernet installation.", /* The media selection menu */ DMenu MenuMedia = { - DMENU_NORMAL_TYPE, + DMENU_RADIO_TYPE, "Choose Installation Media", "FreeBSD can be installed from a variety of different installation\n\ media, ranging from floppies to an Internet FTP server. If you're\n\ @@ -317,14 +328,14 @@ the best media to use if you have no overriding reason for using other\n\ media.", "Press F1 for more information on the various media types", "media", -{ { "CDROM", "Install from a FreeBSD CDROM", NULL, mediaSetCDROM }, - { "DOS", "Install from a DOS partition", NULL, mediaSetDOS }, +{ { "CDROM", "Install from a FreeBSD CDROM", NULL, mediaSetCDROM }, + { "DOS", "Install from a DOS partition", NULL, mediaSetDOS }, { "File System", "Install from an existing filesystem", NULL, mediaSetUFS }, - { "Floppy", "Install from a floppy disk set", NULL, mediaSetFloppy }, - { "FTP", "Install from an FTP server", NULL, mediaSetFTPActive }, + { "Floppy", "Install from a floppy disk set", NULL, mediaSetFloppy }, + { "FTP", "Install from an FTP server", NULL, mediaSetFTPActive }, { "FTP Passive", "Install from an FTP server through a firewall", NULL, mediaSetFTPPassive }, - { "NFS", "Install over NFS", NULL, mediaSetNFS }, - { "Tape", "Install from SCSI or QIC tape", NULL, mediaSetTape }, + { "NFS", "Install over NFS", NULL, mediaSetNFS }, + { "Tape", "Install from SCSI or QIC tape", NULL, mediaSetTape }, { NULL } }, }; @@ -334,19 +345,30 @@ DMenu MenuDistributions = { "Choose Distributions", "As a convenience, we provide several \"canned\" distribution sets.\n\ These select what we consider to be the most reasonable defaults for the\n\ -type of system in question. If you would prefer to pick and choose\n\ -the list of distributions yourself, simply select \"Custom\".", +type of system in question. If you would prefer to pick and choose the\n\ +list of distributions yourself, simply select \"Custom\". You can also\n\ +add distribution sets together by picking more than one, fine-tuning the\n\ +final results with the Custom item. When you are finished, select Cancel", "Press F1 for more information on these options.", "distributions", -{ { "Developer", "Full sources, binaries and doc but no games [180MB]", NULL, distSetDeveloper }, - { "X-Developer", "Same as above, but includes XFree86 [201MB]", NULL, distSetXDeveloper }, - { "Kern-Developer", "Full binaries and doc, kernel sources only [70MB]", NULL, distSetKernDeveloper }, - { "User", "Average user - binaries and doc but no sources [52MB]", NULL, distSetUser }, - { "X-User", "Same as above, but includes XFree86 [52MB]", NULL, distSetXUser }, - { "Minimal", "The smallest configuration possible [44MB]", NULL, distSetMinimum }, - { "Everything", "All sources, binaries and XFree86 binaries [700MB]", NULL, distSetEverything }, - { "Custom", "Specify your own distribution set [?]", NULL, dmenuSubmenu, NULL, &MenuSubDistributions }, - { "Clear", "Reset selected distribution list to None", NULL, distReset }, +{ { "Developer", "Full sources, binaries and doc but no games [180MB]", + NULL, distSetDeveloper }, + { "X-Developer", "Same as above, but includes XFree86 [201MB]", + NULL, distSetXDeveloper }, + { "Kern-Developer", "Full binaries and doc, kernel sources only [70MB]", + NULL, distSetKernDeveloper }, + { "User", "Average user - binaries and doc but no sources [52MB]", + NULL, distSetUser }, + { "X-User", "Same as above, but includes XFree86 [52MB]", + NULL, distSetXUser }, + { "Minimal", "The smallest configuration possible [44MB]", + NULL, distSetMinimum }, + { "Everything", "All sources, binaries and XFree86 binaries [700MB]", + NULL, distSetEverything }, + { "Custom", "Specify your own distribution set [?]", + NULL, dmenuSubmenu, NULL, &MenuSubDistributions }, + { "Clear", "Reset selected distribution list to None", + NULL, distReset }, { NULL } }, }; @@ -378,7 +400,7 @@ DES distribution out of the U.S.! It is for U.S. customers only.", NULL, { { "bin", "Binary base distribution (required) [36MB]", dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_BIN }, - { "commercial", "Commercial and shareware demos [10MB]", + { "commerce", "Commercial and shareware demos [10MB]", dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_COMMERCIAL }, { "compat1x", "FreeBSD 1.x binary compatibility [2MB]", dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_COMPAT1X }, @@ -404,7 +426,7 @@ DES distribution out of the U.S.! It is for U.S. customers only.", srcFlagCheck, distSetSrc }, { "XFree86", "The XFree86 3.1.2-S distribution", x11FlagCheck, distSetXF86 }, - { "Experimental", "Work in progress!", + { "xperimnt", "Experimental work in progress!", dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_EXPERIMENTAL }, { NULL } }, }; @@ -479,22 +501,44 @@ clearx11(dialogMenuItem *self) XF86ServerDists = 0; XF86FontDists = 0; Dists &= ~DIST_XF86; - return 0; + return DITEM_REDRAW; } +static int +checkx11Basic(dialogMenuItem *self) +{ + return XF86Dists; +} + +static int +checkx11Servers(dialogMenuItem *self) +{ + return XF86ServerDists; +} + +static int +checkx11Fonts(dialogMenuItem *self) +{ + return XF86FontDists; +} + + DMenu MenuXF86Select = { - DMENU_NORMAL_TYPE, + DMENU_CHECKLIST_TYPE, "XFree86 3.1.2-S Distribution", "Please select the components you need from the XFree86 3.1.2-S\n\ distribution. We recommend that you select what you need from the basic\n\ component set and at least one entry from the Server and Font set menus.", "Press F1 to read the XFree86 release notes for FreeBSD", "XF86", -{ { "Basic", "Basic component menu (required)", NULL, dmenuSubmenu, NULL, &MenuXF86SelectCore }, - { "Server", "X server menu", NULL, dmenuSubmenu, NULL, &MenuXF86SelectServer }, - { "Fonts", "Font set menu", NULL, dmenuSubmenu, NULL, &MenuXF86SelectFonts }, - { "Exit", "Exit this menu (returning to previous)", NULL, dmenuCancel }, - { "Clear", "Reset XFree86 distribution list", NULL, clearx11 }, +{ { "Basic", "Basic component menu (required)", + checkx11Basic, dmenuSubmenu, NULL, &MenuXF86SelectCore }, + { "Server", "X server menu", + checkx11Servers, dmenuSubmenu, NULL, &MenuXF86SelectServer }, + { "Fonts", "Font set menu", + checkx11Fonts, dmenuSubmenu, NULL, &MenuXF86SelectFonts }, + { "Clear", "Reset XFree86 distribution list", + NULL, clearx11 }, { NULL } }, }; @@ -602,7 +646,8 @@ this operation. If you are attempting to install a boot partition\n\ on a drive other than the first one or have multiple operating\n\ systems on your machine, you will have the option to install a boot\n\ manager later. To select a drive, use the arrow keys to move to it\n\ -and press [SPACE].", +and press [SPACE]. When you're finished, select Cancel to go on to\n\ +the next step.", "Press F1 for important information regarding disk geometry!", "drives", { { NULL } }, @@ -661,9 +706,9 @@ DMenu MenuMBRType = { { { "BootMgr", "Install the FreeBSD Boot Manager (\"Booteasy\")", dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr }, { "Standard", "Install a standard MBR (no boot manager)", - dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '[', '*', ']', 1 }, + dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 1 }, { "None", "Leave the Master Boot Record untouched", - dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '[', '*', ']', 2 }, + dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 2 }, { NULL } }, }; diff --git a/usr.sbin/sysinstall/misc.c b/usr.sbin/sysinstall/misc.c index 296daf7..64b46eb 100644 --- a/usr.sbin/sysinstall/misc.c +++ b/usr.sbin/sysinstall/misc.c @@ -1,7 +1,7 @@ /* * Miscellaneous support routines.. * - * $Id: misc.c,v 1.14 1996/01/14 21:48:57 phk Exp $ + * $Id: misc.c,v 1.15 1996/03/18 15:28:03 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -16,13 +16,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -205,32 +198,41 @@ safe_realloc(void *orig, size_t size) * for dialog_menu(). */ -/* Add a string to an item list */ -char ** -item_add(char **list, char *item, int *curr, int *max) +/* Add an item to an item list */ +dialogMenuItem * +item_add(dialogMenuItem *list, char *prompt, char *title, + int (*checked)(dialogMenuItem *self), + int (*fire)(dialogMenuItem *self), + void (*selected)(dialogMenuItem *self, int is_selected), + void *data, int aux, int *curr, int *max) { + dialogMenuItem *d; if (*curr == *max) { *max += 20; - list = (char **)realloc(list, sizeof(char *) * *max); + list = (dialogMenuItem *)realloc(list, sizeof(dialogMenuItem) * *max); } - list[(*curr)++] = item; - return list; -} - -/* Add a pair of items to an item list (more the usual case) */ -char ** -item_add_pair(char **list, char *item1, char *item2, int *curr, int *max) -{ - list = item_add(list, item1, curr, max); - list = item_add(list, item2, curr, max); + d = &list[(*curr)++]; + d->prompt = prompt ? strdup(prompt) : NULL; + d->title = title ? strdup(title) : NULL; + d->checked = checked; + d->fire = fire; + d->selected = selected; + d->data = data; + d->aux = aux; return list; } /* Toss the items out */ void -items_free(char **list, int *curr, int *max) +items_free(dialogMenuItem *list, int *curr, int *max) { + int i; + + for (i = 0; list[i].prompt; i++) { + safe_free(list[i].prompt); + safe_free(list[i].title); + } safe_free(list); *curr = *max = 0; } @@ -243,7 +245,7 @@ Mkdir(char *ipath, void *data) char *p, *path; if (file_readable(ipath)) - return RET_SUCCESS; + return DITEM_SUCCESS; path = strdup(ipath); if (isDebug()) @@ -261,20 +263,20 @@ Mkdir(char *ipath, void *data) if (errno != ENOENT) { dialog_clear(); msgConfirm("Couldn't stat directory %s: %s", path, strerror(errno)); - return RET_FAIL; + return DITEM_FAILURE; } if (isDebug()) msgDebug("mkdir(%s..)\n", path); if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) { dialog_clear(); msgConfirm("Couldn't create directory %s: %s", path,strerror(errno)); - return RET_FAIL; + return DITEM_FAILURE; } } *p = '/'; } free(path); - return RET_SUCCESS; + return DITEM_SUCCESS; } int @@ -297,7 +299,7 @@ Mount(char *mountp, void *dev) if (Mkdir(mountpoint, NULL)) { dialog_clear(); msgConfirm("Unable to make directory mountpoint for %s!", mountpoint); - return RET_FAIL; + return DITEM_FAILURE; } if (isDebug()) msgDebug("mount %s %s\n", device, mountpoint); @@ -306,7 +308,24 @@ Mount(char *mountp, void *dev) if (mount(MOUNT_UFS, mountpoint, MNT_ASYNC, (caddr_t)&ufsargs) == -1) { dialog_clear(); msgConfirm("Error mounting %s on %s : %s", device, mountpoint, strerror(errno)); - return RET_FAIL; + return DITEM_FAILURE; } - return RET_SUCCESS; + return DITEM_SUCCESS; +} + +WINDOW * +savescr(void) +{ + WINDOW *w; + + w = dupwin(newscr); + return w; +} + +void +restorescr(WINDOW *w) +{ + touchwin(w); + wrefresh(w); + delwin(w); } diff --git a/usr.sbin/sysinstall/msg.c b/usr.sbin/sysinstall/msg.c index ae5e3f3..a569169 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.29.2.8 1995/10/22 21:38:17 jkh Exp $ + * $Id: msg.c,v 1.30 1995/12/07 10:34:09 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -214,16 +207,14 @@ msgConfirm(char *fmt, ...) va_end(args); use_helpline(NULL); use_helpfile(NULL); - w = dupwin(newscr); + w = savescr(); if (OnVTY) { msgDebug("Switching back to VTY1\n"); ioctl(0, VT_ACTIVATE, 1); msgInfo(NULL); } dialog_notify(errstr); - touchwin(w); - wrefresh(w); - delwin(w); + restorescr(w); free(errstr); } @@ -262,16 +253,14 @@ msgYesNo(char *fmt, ...) va_end(args); use_helpline(NULL); use_helpfile(NULL); - w = dupwin(newscr); + w = savescr(); if (OnVTY) { msgDebug("Switching back to VTY1\n"); ioctl(0, VT_ACTIVATE, 1); /* Switch back */ msgInfo(NULL); } ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1); - touchwin(w); - wrefresh(w); - delwin(w); + restorescr(w); free(errstr); return ret; } @@ -296,16 +285,14 @@ msgGetInput(char *buf, char *fmt, ...) strcpy(input_buffer, buf); else input_buffer[0] = '\0'; - w = dupwin(newscr); + w = savescr(); if (OnVTY) { msgDebug("Switching back to VTY1\n"); ioctl(0, VT_ACTIVATE, 1); /* Switch back */ msgInfo(NULL); } rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer); - touchwin(w); - wrefresh(w); - delwin(w); + restorescr(w); free(errstr); if (!rval) return input_buffer; @@ -357,12 +344,12 @@ int msgSimpleConfirm(char *str) { msgConfirm(str); - return RET_SUCCESS; + return DITEM_SUCCESS; } int msgSimpleNotify(char *str) { msgNotify(str); - return RET_SUCCESS; + return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/network.c b/usr.sbin/sysinstall/network.c index 3340d1c..f7ca433 100644 --- a/usr.sbin/sysinstall/network.c +++ b/usr.sbin/sysinstall/network.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: network.c,v 1.8 1995/09/18 16:52:33 peter Exp $ + * $Id: network.c,v 1.9 1995/12/07 10:34:10 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/usr.sbin/sysinstall/nfs.c b/usr.sbin/sysinstall/nfs.c index 36f5ea9..71332dd 100644 --- a/usr.sbin/sysinstall/nfs.c +++ b/usr.sbin/sysinstall/nfs.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: nfs.c,v 1.6 1995/12/07 10:34:12 peter Exp $ + * $Id: nfs.c,v 1.7 1996/03/02 07:31:55 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/usr.sbin/sysinstall/options.c b/usr.sbin/sysinstall/options.c index 9bc4daa..60c8269 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.31 1996/03/24 12:06:13 jkh Exp $ + * $Id: options.c,v 1.32 1996/04/07 03:52:34 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -279,12 +272,12 @@ optionsEditor(dialogMenuItem *self) case 'Q': clear(); dialog_clear(); - return RET_SUCCESS; + return DITEM_SUCCESS; default: beep(); } } /* NOTREACHED */ - return RET_SUCCESS; + return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c index 8e43f7a..0a32fc3 100644 --- a/usr.sbin/sysinstall/package.c +++ b/usr.sbin/sysinstall/package.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: package.c,v 1.29 1996/03/18 15:28:05 jkh Exp $ + * $Id: package.c,v 1.30 1996/03/21 09:30:14 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -55,7 +48,7 @@ int package_add(char *name) { if (!mediaVerify()) - return RET_FAIL; + return DITEM_FAILURE; return package_extract(mediaDevice, name, FALSE); } @@ -74,17 +67,17 @@ package_extract(Device *dev, char *name, Boolean depended) /* Check to make sure it's not already there */ if (!vsystem("pkg_info -e %s", name)) { msgDebug("package %s marked as already installed - return SUCCESS.\n", name); - return RET_SUCCESS; + return DITEM_SUCCESS; } if (!dev->init(dev)) { dialog_clear(); msgConfirm("Unable to initialize media type for package extract."); - return RET_FAIL; + return DITEM_FAILURE; } /* Be initially optimistic */ - ret = RET_SUCCESS; + ret = DITEM_SUCCESS; /* Make a couple of paranoid locations for temp files to live if user specified none */ if (!variable_get("PKG_TMPDIR")) { Mkdir("/usr/tmp", NULL); @@ -117,9 +110,17 @@ package_extract(Device *dev, char *name, Boolean depended) tot = 0; while ((i = read(fd, buf, BUFSIZ)) > 0) { + char line[80]; + int x, len; + write(pfd[1], buf, i); tot += i; - mvprintw(0, 0, "%d bytes read from package %s", tot, name); + sprintf(line, "%d bytes read from package %s", tot, name); + len = strlen(line); + for (x = len; x < 79; x++) + line[x] = ' '; + line[79] = '\0'; + mvprintw(0, 0, line); clrtoeol(); refresh(); } @@ -146,7 +147,7 @@ package_extract(Device *dev, char *name, Boolean depended) msgConfirm("Unable to fetch package %s from selected media.\n" "No package add will be done.", name); } - ret = RET_FAIL; + ret = DITEM_FAILURE; } return ret; } diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index c420f40..353da90 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.48 1996/03/23 07:21:31 jkh Exp $ + * $Id: sysinstall.h,v 1.49 1996/04/07 03:52:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -67,10 +60,6 @@ #define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */ #define MAX_FTP_RETRIES "4" /* How many times to beat our heads against the wall */ -#define RET_FAIL -1 -#define RET_SUCCESS 0 -#define RET_DONE 1 - /* * I make some pretty gross assumptions about having a max of 50 chunks * total - 8 slices and 42 partitions. I can't easily display many more @@ -145,10 +134,14 @@ typedef unsigned int Boolean; typedef struct disk Disk; typedef struct chunk Chunk; -typedef enum { DMENU_NORMAL_TYPE, DMENU_RADIO_TYPE, DMENU_CHECKLIST_TYPE } dmenuType; +/* Bitfields for menu options */ +#define DMENU_NORMAL_TYPE 0x1 /* Normal dialog menu */ +#define DMENU_RADIO_TYPE 0x2 /* Radio dialog menu */ +#define DMENU_CHECKLIST_TYPE 0x4 /* Multiple choice menu */ +#define DMENU_SELECTION_RETURNS 0x8 /* Immediate return on item selection */ typedef struct _dmenu { - dmenuType type; /* What sort of menu we are */ + int type; /* What sort of menu we are */ char *title; /* Our title */ char *prompt; /* Our prompt */ char *helpline; /* Line of help at bottom */ @@ -292,6 +285,7 @@ extern int BootMgr; /* Which boot manager to use */ extern DMenu MenuInitial; /* Initial installation menu */ +extern DMenu MenuFixit; /* Fixit repair menu */ extern DMenu MenuMBRType; /* Type of MBR to write on the disk */ extern DMenu MenuConfigure; /* Final configuration menu */ extern DMenu MenuDocumentation; /* Documentation menu */ @@ -366,7 +360,8 @@ extern int configRoutedFlags(dialogMenuItem *self); extern int crc(int, unsigned long *, unsigned long *); /* devices.c */ -extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)()); +extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), + int (*check)(dialogMenuItem *d)); extern void deviceGetAll(void); extern Device **deviceFind(char *name, DeviceType type); extern int deviceCount(Device **devs); @@ -383,6 +378,7 @@ extern void dummyShutdown(Device *dev); /* disks.c */ extern int diskPartitionEditor(dialogMenuItem *self); extern int diskPartitionWrite(dialogMenuItem *self); +extern void diskPartition(Device *dev, Disk *d); /* dist.c */ extern int distSetCustom(char *str); @@ -452,7 +448,8 @@ int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist); extern int installCommit(dialogMenuItem *self); extern int installExpress(dialogMenuItem *self); extern int installNovice(dialogMenuItem *self); -extern int installFixit(dialogMenuItem *self); +extern int installFixitCDROM(dialogMenuItem *self); +extern int installFixitFloppy(dialogMenuItem *self); extern int installFixup(dialogMenuItem *self); extern int installUpgrade(dialogMenuItem *self); extern int installFilesystems(dialogMenuItem *self); @@ -520,12 +517,16 @@ extern char *pathBaseName(const char *path); extern void safe_free(void *ptr); extern void *safe_malloc(size_t size); extern void *safe_realloc(void *orig, size_t size); -extern char **item_add(char **list, char *item, int *curr, int *max); -extern char **item_add_pair(char **list, char *item1, char *item2, - int *curr, int *max); -extern void items_free(char **list, int *curr, int *max); +extern dialogMenuItem *item_add(dialogMenuItem *list, char *prompt, char *title, + int (*checked)(dialogMenuItem *self), + int (*fire)(dialogMenuItem *self), + void (*selected)(dialogMenuItem *self, int is_selected), + void *data, int aux, int *curr, int *max); +extern void items_free(dialogMenuItem *list, int *curr, int *max); extern int Mkdir(char *, void *data); extern int Mount(char *, void *data); +extern WINDOW *savescr(void); +extern void restorescr(WINDOW *w); /* msg.c */ extern Boolean isDebug(void); diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index 3622f90..14f125a 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.48 1996/03/18 15:28:08 jkh Exp $ + * $Id: system.c,v 1.49 1996/03/21 09:30:17 jkh Exp $ * * Jordan Hubbard * @@ -129,21 +129,17 @@ systemDisplayHelp(char *file) snprintf(buf, FILENAME_MAX, "The %s file is not provided on this particular floppy image.", file); use_helpfile(NULL); use_helpline(NULL); - w = dupwin(newscr); + w = savescr(); dialog_mesgbox("Sorry!", buf, -1, -1); - touchwin(w); - wrefresh(w); - delwin(w); + restorescr(w); return 1; } else { use_helpfile(NULL); use_helpline(NULL); - w = dupwin(newscr); + w = savescr(); dialog_textbox(file, fname, LINES, COLS); - touchwin(w); - wrefresh(w); - delwin(w); + restorescr(w); } return 0; } diff --git a/usr.sbin/sysinstall/tape.c b/usr.sbin/sysinstall/tape.c index 3da533d..abafe81 100644 --- a/usr.sbin/sysinstall/tape.c +++ b/usr.sbin/sysinstall/tape.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: tape.c,v 1.8 1995/12/07 10:34:17 peter Exp $ + * $Id: tape.c,v 1.9 1996/03/02 07:31:57 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/usr.sbin/sysinstall/tcpip.c b/usr.sbin/sysinstall/tcpip.c index 00ed675..685ed56 100644 --- a/usr.sbin/sysinstall/tcpip.c +++ b/usr.sbin/sysinstall/tcpip.c @@ -1,5 +1,5 @@ /* - * $Id: tcpip.c,v 1.33 1996/03/02 07:31:58 jkh Exp $ + * $Id: tcpip.c,v 1.34 1996/04/07 03:52:36 jkh Exp $ * * Copyright (c) 1995 * Gary J Palmer. All rights reserved. @@ -14,13 +14,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Gary J Palmer - * for the FreeBSD Project. - * 4. The name of Gary J Palmer or the FreeBSD Project may - * not be used to endorse or promote products derived from this software - * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY GARY J PALMER ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -183,7 +176,7 @@ tcpInstallDevice(char *str) string_prune(str); str = string_skipwhite(str); if (!*str) - return RET_FAIL; + return DITEM_FAILURE; devs = deviceFind(str, DEVICE_TYPE_NETWORK); if (devs && (dp = devs[0])) { char temp[512], ifn[255]; @@ -225,7 +218,7 @@ tcpInstallDevice(char *str) } mediaDevice = dp; } - return dp ? RET_SUCCESS : RET_FAIL; + return dp ? DITEM_SUCCESS : DITEM_FAILURE; } /* This is it - how to get TCP setup values */ @@ -512,27 +505,22 @@ tcpOpenDialog(Device *devp) } if (ipaddr[0]) variable_set2(VAR_IPADDR, ipaddr); - return RET_SUCCESS; + return DITEM_SUCCESS; } - return RET_FAIL; + return DITEM_FAILURE; } static int -netHook(char *str) +netHook(dialogMenuItem *self) { Device **devs; - /* Clip garbage off the ends */ - string_prune(str); - str = string_skipwhite(str); - if (!*str) - return RET_FAIL; - devs = deviceFind(str, DEVICE_TYPE_NETWORK); + devs = deviceFind(self->prompt, DEVICE_TYPE_NETWORK); if (devs) { tcpOpenDialog(devs[0]); mediaDevice = devs[0]; } - return devs ? RET_DONE : RET_FAIL; + return devs ? DITEM_LEAVE_MENU : DITEM_FAILURE; } /* Get a network device */ @@ -558,7 +546,7 @@ tcpDeviceSelect(void) status = TRUE; } else { - menu = deviceCreateMenu(&MenuNetworkDevice, DEVICE_TYPE_NETWORK, netHook); + menu = deviceCreateMenu(&MenuNetworkDevice, DEVICE_TYPE_NETWORK, netHook, NULL); if (!menu) msgFatal("Unable to create network device menu! Argh!"); status = dmenuOpenSimple(menu); @@ -573,5 +561,5 @@ tcpMenuSelect(dialogMenuItem *self) { (void)tcpDeviceSelect(); configResolv(); - return RET_SUCCESS; + return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/ufs.c b/usr.sbin/sysinstall/ufs.c index fefbce0..95ea97f 100644 --- a/usr.sbin/sysinstall/ufs.c +++ b/usr.sbin/sysinstall/ufs.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: ufs.c,v 1.6 1995/12/07 10:34:21 peter Exp $ + * $Id: ufs.c,v 1.7 1996/03/02 07:31:58 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -21,13 +21,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/usr.sbin/sysinstall/variable.c b/usr.sbin/sysinstall/variable.c index 5cbaa84..6fbd643 100644 --- a/usr.sbin/sysinstall/variable.c +++ b/usr.sbin/sysinstall/variable.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: variable.c,v 1.6.2.7 1995/10/26 08:56:18 jkh Exp $ + * $Id: variable.c,v 1.7 1995/12/07 10:34:23 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -19,13 +19,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jordan Hubbard - * for the FreeBSD Project. - * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to - * endorse or promote products derived from this software without specific - * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |