xref: /netbsd-src/usr.sbin/sysinst/arch/mac68k/menus.md.en (revision 7991f5a7b8fc83a3d55dc2a1767cca3b84103969)
1/*	$NetBSD: menus.md.en,v 1.7 2021/07/24 21:31:39 andvar Exp $	*/
2
3/*
4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved.
6 *
7 * Written by Philip A. Nelson for Piermont Information Systems Inc.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 *    notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in the
16 *    documentation and/or other materials provided with the distribution.
17 * 3. The name of Piermont Information Systems Inc. may not be used to endorse
18 *    or promote products derived from this software without specific prior
19 *    written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
34
35/* Menu definitions for sysinst. mac68k version, machine dependent. */
36
37menu fullpart, title  "Select your choice";
38	option "Use only part of the disk", exit, action  {usefull = 0;};
39	option "Use the entire disk", 	    exit, action  {usefull = 1;};
40
41menu nodiskmap, title "Choose an option", y=16;
42	display action { msg_fmt_display (MSG_nodiskmap, "%s", pm->diskdev); };
43	option "Abort install", exit, action {
44		endwin();  exit(1);
45	};
46	option "Initialize Disk partition Map", exit, action {
47		int i, rv;
48
49		msg_clear();
50		msg_display (MSG_okwritediskmap);
51		process_menu (MENU_okabort, &rv);
52		if (!rv) {
53		    endwin();
54		    return 0;
55		}
56		map.size = NEW_MAP_SIZE;
57		map.in_use_cnt = new_map[0].pmMapBlkCnt;
58		map.blk = (struct apple_part_map_entry *)calloc(map.size,
59			sizeof(struct apple_part_map_entry));
60		for (i=0;i<map.size;i++)
61		    memcpy (&map.blk[i], &new_map[i],
62			 sizeof(struct apple_part_map_entry));
63	};
64
65menu editparttable, title  "Choose your partition", exit, y=14;
66	display action  { msg_display (MSG_mac68k_editparttable);
67			  sortmerge();
68			  if (map.selected >= map.usable_cnt)
69				map.selected = 0;
70			  disp_selected_part (map.selected);
71			};
72	option "Select next partition",  action {
73		map.selected += 1;
74		if (map.selected >= map.usable_cnt)
75			map.selected = 0;
76		};
77	option "Change selected partition", sub menu chooseid;
78	option "Set mount point for partition", sub menu mount_point;
79	option "Split selected partition", action {
80		int i, j, k, size, free_size, rv;
81		char buf[40];
82		EBZB *bzb;
83
84		j = map.mblk[map.selected];
85		msg_fmt_display(MSG_split_part, "%d", map.blk[j].pmPartBlkCnt);
86		msg_prompt_add (MSG_scratch_size, NULL, buf, sizeof(buf));
87		size = atoi(buf);
88		if (size > 0 && size < (int)map.blk[j].pmPartBlkCnt) {
89		    k = map.in_use_cnt+1;
90		    if (k <= map.size) {
91			memcpy (&map.blk[k], &map.blk[j],
92			    sizeof(struct apple_part_map_entry));
93			free_size = map.blk[j].pmPartBlkCnt - size;
94			strcpy ((char *)map.blk[j].pmPartType, "Apple_Scratch");
95			map.blk[j].pmPartBlkCnt = size;
96			map.blk[j].pmDataCnt = size;
97			bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
98			bzb->magic = 0;
99			bzb->mount_point[0] = '\0';
100			strcpy ((char *)map.blk[k].pmPartType, "Apple_Free");
101			map.blk[k].pmPyPartStart += size;
102			if ((map.blk[k].pmPyPartStart + free_size) > pm->dlsize)
103			    map.blk[k].pmPartBlkCnt =
104				pm->dlsize - map.blk[k].pmPyPartStart;
105			else
106			    map.blk[k].pmPartBlkCnt = free_size;
107			map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt;
108			bzb = (EBZB *)&map.blk[k].pmBootArgs[0];
109			bzb->magic = 0;
110			bzb->mount_point[0] = '\0';
111			map.in_use_cnt += 1;	/* Count new part as usable */
112			sortmerge();
113		    } else {
114			msg_display (MSG_diskfull);
115			process_menu (MENU_okabort, &rv);
116			if (!rv) {
117			    free (map.blk);
118			    map.size = NEW_MAP_SIZE;
119			    map.in_use_cnt = new_map[0].pmMapBlkCnt;
120			    map.blk = (struct apple_part_map_entry *)calloc(map.size,
121				sizeof(struct apple_part_map_entry));
122			    for (i=0;i<map.size;i++)
123				memcpy (&map.blk[i], &new_map[i],
124				    sizeof(struct apple_part_map_entry));
125			    map.blk[0].pmSigPad = 0; /* Don't rewrite Block0 */
126			}
127		    }
128		} };
129	option "Fix selected partition", action {
130		int i = map.mblk[map.selected];
131		EBZB *bzb = (EBZB *)&map.blk[i].pmBootArgs[0];
132		msg_fmt_display(MSG_partdebug, "%s%c%d%d",
133		    pm->diskdev, bzb->flags.part, map.blk[i].pmPyPartStart,
134		    map.blk[i].pmPartBlkCnt);
135		if ((map.blk[i].pmPyPartStart +
136		    map.blk[i].pmPartBlkCnt) > pm->dlsize) {
137			msg_fmt_display_add(MSG_parttable_fix_fixing,
138			    "%s%c%d%d",
139			    pm->diskdev, bzb->flags.part);
140			map.blk[i].pmPartBlkCnt =
141			    pm->dlsize - map.blk[i].pmPyPartStart;
142			map.blk[i].pmDataCnt =
143			    map.blk[i].pmPartBlkCnt;
144		} else {
145		    msg_fmt_display_add(MSG_parttable_fix_fine, "%s%c",
146			pm->diskdev, bzb->flags.part);
147		}
148		process_menu(MENU_ok, NULL);
149		};
150
151
152menu ok2, title "Abort?", y=17;
153       option "OK", exit, action { };
154
155menu okabort, title "What do you want to do?", y=17;
156	option "Continue", exit, action { *((int*)arg) = 1; };
157	option "Abort install", exit, action { *((int*)arg) = 0; };
158
159menu chooseid, title  "Partition Type?";
160	option "NetBSD Root", exit, action {
161		int i, j;
162		EBZB *bzb;
163
164		j = map.mblk[map.selected];
165		reset_part_flags(&map.blk[j]);
166		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
167		bzb->magic = APPLE_BZB_MAGIC;
168		strcpy ((char *)map.blk[j].pmPartName, "NetBSD Root");
169		strcpy ((char *)map.blk[j].pmPartType, "Apple_Unix_SVR2");
170		bzb->type = APPLE_BZB_TYPEFS;
171		bzb->flags.root = 1;
172		/*
173		 * Automatically determine root mount points.  The first
174		 *  root-type filesystem is mounted on "/", all others
175		 *  will mount on "/altroot".  If there are multiple
176		 *  occurrences of "/altroot" they will be picked up on
177		 *  the sanity_scan in the next step of the installation.
178		 */
179		for (i=0,map.root_cnt=0;i<map.usable_cnt;i++) {
180		    j = map.mblk[i];
181		    if (whichType(&map.blk[j]) == ROOT_PART) {
182			bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
183			if (bzb->type == APPLE_BZB_TYPEFS && bzb->flags.root) {
184			   if (map.root_cnt++ == 0)
185				strcpy ((char *)bzb->mount_point, "/");
186			   else
187				strcpy ((char *)bzb->mount_point, "/altroot");
188			}
189		    }
190		} };
191	option "NetBSD SWAP", exit, action {
192		int j;
193		EBZB *bzb;
194
195		j = map.mblk[map.selected];
196		reset_part_flags(&map.blk[j]);
197		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
198		bzb->magic = APPLE_BZB_MAGIC;
199		strcpy ((char *)map.blk[j].pmPartName, "NetBSD SWAP");
200		strcpy ((char *)map.blk[j].pmPartType, "Apple_Unix_SVR2");
201		bzb->type = APPLE_BZB_TYPESWAP; };
202	option "NetBSD Usr", exit, action {
203		int j;
204		EBZB *bzb;
205
206		j = map.mblk[map.selected];
207		reset_part_flags(&map.blk[j]);
208		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
209		bzb->magic = APPLE_BZB_MAGIC;
210		strcpy ((char *)map.blk[j].pmPartName, "NetBSD Usr");
211		strcpy ((char *)map.blk[j].pmPartType, "Apple_Unix_SVR2");
212		bzb->type = APPLE_BZB_TYPEFS;
213		bzb->flags.usr = 1;
214		if (map.usr_cnt++ == 0)
215		    strcpy ((char *)bzb->mount_point, "/usr");
216		};
217	option "NetBSD Root&Usr", exit, action {
218		int j;
219		EBZB *bzb;
220
221		j = map.mblk[map.selected];
222		reset_part_flags(&map.blk[j]);
223		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
224		bzb->magic = APPLE_BZB_MAGIC;
225		strcpy ((char *)map.blk[j].pmPartName, "NetBSD Root & Usr");
226		strcpy ((char *)map.blk[j].pmPartType, "Apple_Unix_SVR2");
227		bzb->type = APPLE_BZB_TYPEFS;
228		bzb->flags.root = 1;
229		bzb->flags.usr = 1;
230		if (map.root_cnt++ == 0)
231		    strcpy ((char *)bzb->mount_point, "/");
232		else {
233		    if (map.usr_cnt++ == 0)
234			strcpy ((char *)bzb->mount_point, "/usr");
235		} };
236	option "MacOS HFS", exit, action {
237		int j;
238		EBZB *bzb;
239
240		j = map.mblk[map.selected];
241		reset_part_flags(&map.blk[j]);
242		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
243		bzb->magic = 0;
244		bzb->mount_point[0] = '\0';
245		strcpy ((char *)map.blk[j].pmPartName, "untitled (HFS)");
246		strcpy ((char *)map.blk[j].pmPartType, "Apple_HFS"); };
247	option "Scratch", exit, action {
248		int j;
249		EBZB *bzb;
250
251		j = map.mblk[map.selected];
252		reset_part_flags(&map.blk[j]);
253		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
254		bzb->magic = 0;
255		bzb->mount_point[0] = '\0';
256		strcpy ((char *)map.blk[j].pmPartName, "untitled (Scratch)");
257		strcpy ((char *)map.blk[j].pmPartType, "Apple_Scratch"); };
258	option "Free", exit, action {
259		int j;
260		EBZB *bzb;
261
262		j = map.mblk[map.selected];
263		reset_part_flags(&map.blk[j]);
264		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
265		bzb->magic = 0;
266		bzb->mount_point[0] = '\0';
267		strcpy ((char *)map.blk[j].pmPartName, "untitled (Free)");
268		strcpy ((char *)map.blk[j].pmPartType, "Apple_Free"); };
269
270menu mount_point, title  "Mount Point?";
271	option "/usr", exit, action {
272		int j;
273		EBZB *bzb;
274
275		j = map.mblk[map.selected];
276		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
277		strcpy ((char *)bzb->mount_point, "/usr"); };
278	option "/home", exit, action {
279		int j;
280		EBZB *bzb;
281
282		j = map.mblk[map.selected];
283		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
284		strcpy ((char *)bzb->mount_point, "/home"); };
285	option "/var", exit, action {
286		int j;
287		EBZB *bzb;
288
289		j = map.mblk[map.selected];
290		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
291		strcpy ((char *)bzb->mount_point, "/var"); };
292	option "/tmp", exit, action {
293		int j;
294		EBZB *bzb;
295
296		j = map.mblk[map.selected];
297		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
298		strcpy ((char *)bzb->mount_point, "/tmp"); };
299	option "None", exit, action {
300		int j;
301		EBZB *bzb;
302
303		j = map.mblk[map.selected];
304		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
305		bzb->mount_point[0] = '\0'; };
306	option "other", exit, action {
307		int j;
308		char buf[60];
309		EBZB *bzb;
310
311		msg_display (MSG_custom_mount_point);
312		msg_prompt_add (MSG_mountpoint, NULL, buf, sizeof(buf));
313		j = map.mblk[map.selected];
314		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
315		if (buf[0] != '\0') {
316		    bzb->mount_point[0] = '\0';
317		    if (buf[0] != '/')
318			strcpy ((char *)bzb->mount_point, "/");
319		    strcat((char *)bzb->mount_point, buf);
320		} };
321
322menu sanity, title "Choose an option";
323	display action {msg_display (MSG_sanity_check);
324		report_errors(); };
325	option "Abort installation", exit, action { *((int*)arg) = -1; };
326	option "Ignore warnings and continue", exit, action { *((int*)arg) = 1;};
327	option "Re-edit Disk Partition Map", exit, action { *((int*)arg) = 0; };
328
329/*
330 * This menu shouldn't be used in the mac68k port, but it needs to be
331 *  defined because it's referenced from the toplevel code.
332 */
333