1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. 6 *
| 1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. 6 *
|
7 * $Id: install.c,v 1.3 1995/04/29 19:33:01 jkh Exp $
| 7 * $Id: install.c,v 1.4 1995/05/01 21:56:22 jkh Exp $
|
8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer, 17 * verbatim and that no modifications are made prior to this 18 * point in the file. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in the 21 * documentation and/or other materials provided with the distribution. 22 * 3. All advertising materials mentioning features or use of this software 23 * must display the following acknowledgement: 24 * This product includes software developed by Jordan Hubbard 25 * for the FreeBSD Project. 26 * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to 27 * endorse or promote products derived from this software without specific 28 * prior written permission. 29 * 30 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND 31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33 * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE 34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 36 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) 37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 40 * SUCH DAMAGE. 41 * 42 */ 43 44#include "sysinstall.h" 45 46static int 47installHook(char *str) 48{
| 8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer, 17 * verbatim and that no modifications are made prior to this 18 * point in the file. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in the 21 * documentation and/or other materials provided with the distribution. 22 * 3. All advertising materials mentioning features or use of this software 23 * must display the following acknowledgement: 24 * This product includes software developed by Jordan Hubbard 25 * for the FreeBSD Project. 26 * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to 27 * endorse or promote products derived from this software without specific 28 * prior written permission. 29 * 30 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND 31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33 * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE 34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 36 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) 37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 40 * SUCH DAMAGE. 41 * 42 */ 43 44#include "sysinstall.h" 45 46static int 47installHook(char *str) 48{
|
49 int rcode = 0;
| 49 int i; 50 struct disk *disks[100]; /* some ridiculously large number */
|
50
| 51
|
| 52 i = 0;
|
51 /* Clip garbage off the ends */ 52 string_prune(str); 53 str = string_skipwhite(str); 54 while (str) { 55 char *cp; 56
| 53 /* Clip garbage off the ends */ 54 string_prune(str); 55 str = string_skipwhite(str); 56 while (str) { 57 char *cp; 58
|
57 cp = index(str, ' ');
| 59 cp = index(str, '\n');
|
58 if (cp) 59 *cp++ = 0;
| 60 if (cp) 61 *cp++ = 0;
|
60 rcode = !device_slice_disk(str);
| 62 if (!*str) { 63 beep(); 64 return 0; 65 } 66 disks[i++] = device_slice_disk(str);
|
61 str = cp; 62 }
| 67 str = cp; 68 }
|
63 return rcode; 64} 65 66/* Create a menu listing all the devices in the system. */ 67static DMenu * 68getAllDisks(DMenu *menu, Device **rdevs) 69{ 70 Device *devices; 71 int numdevs; 72 73 devices = device_get_all(DEVICE_TYPE_DISK, &numdevs); 74 *rdevs = devices; 75 if (!devices) { 76 msgConfirm("No devices suitable for installation found!\n\nPlease verify that your disk controller (and attached drives) were detected properly. This can be done by selecting the ``Bootmsg'' option on the main menu and reviewing the boot messages carefully."); 77 return NULL; 78 }
| 69 disks[i] = NULL; 70 if (!i) 71 return 0;
|
79 else {
| 72 else {
|
80 Device *start; 81 DMenu *tmp; 82 int i; 83 84 tmp = (DMenu *)safe_malloc(sizeof(DMenu) + 85 (sizeof(DMenuItem) * (numdevs + 1))); 86 bcopy(menu, tmp, sizeof(DMenu)); 87 for (start = devices, i = 0; start->name[0]; start++, i++) { 88 tmp->items[i].title = start->name; 89 if (!strncmp(start->name, "sd", 2)) 90 tmp->items[i].prompt = "SCSI disk"; 91 else if (!strncmp(start->name, "wd", 2)) 92 tmp->items[i].prompt = "IDE/ESDI/MFM/ST506 disk"; 93 else 94 msgFatal("Unknown disk type: %s!", start->name); 95 tmp->items[i].type = DMENU_CALL; 96 tmp->items[i].ptr = installHook; 97 tmp->items[i].disabled = FALSE;
| 73#ifdef notdoneyet 74 partition_disks(disks); 75 if (!confirm_write(disks)) { 76 for (i = 0; disks[i]; i++) 77 Free_Disk(disks[i]); 78 return 0;
|
98 }
| 79 }
|
99 tmp->items[i].type = DMENU_NOP; 100 tmp->items[i].title = NULL; 101 return tmp;
| 80 else { 81 make_filesystems(disks); 82 cpio_extract(disks); 83 extract_dists(disks); 84 do_final_setup(disks); 85 systemShutdown(); 86 } 87#endif
|
102 }
| 88 }
|
| 89 return 1;
|
103} 104 105int 106installCustom(char *str) 107{ 108 int scroll, choice, curr, max; 109 extern DMenu MenuDiskDevices; 110 DMenu *menu; 111 Device *devs; 112
| 90} 91 92int 93installCustom(char *str) 94{ 95 int scroll, choice, curr, max; 96 extern DMenu MenuDiskDevices; 97 DMenu *menu; 98 Device *devs; 99
|
113 msgInfo("Installating the system custom");
| |
114 variable_set2("install_type", "custom");
| 100 variable_set2("install_type", "custom");
|
115 menu = getAllDisks(&MenuDiskDevices, &devs);
| 101 menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
|
116 if (!menu) 117 return 0; 118 choice = scroll = curr = max = 0; 119 dmenuOpen(menu, &choice, &scroll, &curr, &max); 120 free(menu); 121 free(devs); 122 return 1; 123} 124 125int 126installExpress(char *str) 127{ 128 int scroll, choice, curr, max; 129 extern DMenu MenuDiskDevices; 130 DMenu *menu; 131 Device *devs; 132
| 102 if (!menu) 103 return 0; 104 choice = scroll = curr = max = 0; 105 dmenuOpen(menu, &choice, &scroll, &curr, &max); 106 free(menu); 107 free(devs); 108 return 1; 109} 110 111int 112installExpress(char *str) 113{ 114 int scroll, choice, curr, max; 115 extern DMenu MenuDiskDevices; 116 DMenu *menu; 117 Device *devs; 118
|
133 msgInfo("Installating the system express");
| |
134 variable_set2("install_type", "express");
| 119 variable_set2("install_type", "express");
|
135 menu = getAllDisks(&MenuDiskDevices, &devs);
| 120 menu = device_create_disk_menu(&MenuDiskDevices, &devs, installHook);
|
136 if (!menu) 137 return 0; 138 choice = scroll = curr = max = 0; 139 dmenuOpen(menu, &choice, &scroll, &curr, &max); 140 free(menu); 141 free(devs); 142 return 1; 143} 144 145int 146installMaint(char *str) 147{ 148 msgConfirm("Sorry, maintainance mode is not implemented in this version."); 149 return 0; 150} 151 152int 153installSetDeveloper(char *str) 154{ 155 /* Dists = DIST_BIN | DIST_MAN | DIST_FOO; */ 156 return 0; 157} 158 159int 160installSetXDeveloper(char *str) 161{ 162 return 0; 163} 164 165int 166installSetUser(char *str) 167{ 168 return 0; 169} 170 171int 172installSetXUser(char *str) 173{ 174 return 0; 175} 176 177int 178installSetMinimum(char *str) 179{ 180 return 0; 181} 182 183int 184installSetEverything(char *str) 185{ 186 return 0; 187}
| 121 if (!menu) 122 return 0; 123 choice = scroll = curr = max = 0; 124 dmenuOpen(menu, &choice, &scroll, &curr, &max); 125 free(menu); 126 free(devs); 127 return 1; 128} 129 130int 131installMaint(char *str) 132{ 133 msgConfirm("Sorry, maintainance mode is not implemented in this version."); 134 return 0; 135} 136 137int 138installSetDeveloper(char *str) 139{ 140 /* Dists = DIST_BIN | DIST_MAN | DIST_FOO; */ 141 return 0; 142} 143 144int 145installSetXDeveloper(char *str) 146{ 147 return 0; 148} 149 150int 151installSetUser(char *str) 152{ 153 return 0; 154} 155 156int 157installSetXUser(char *str) 158{ 159 return 0; 160} 161 162int 163installSetMinimum(char *str) 164{ 165 return 0; 166} 167 168int 169installSetEverything(char *str) 170{ 171 return 0; 172}
|