Home | History | Annotate | Line # | Download | only in mac68k
menus.md.de revision 1.7
      1 /*	$NetBSD: menus.md.de,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 
     37 menu fullpart, title  "Bitte whlen Sie";
     38 	option "Nur einen Teil der Festplatte nutzen",      exit, action  {usefull = 0;};
     39 	option "Die ganze Festplatte fr NetBSD verwenden", exit, action  {usefull = 1;};
     40 
     41 menu nodiskmap, title "Bitte whlen Sie", y=16;
     42 	display action { msg_fmt_display (MSG_nodiskmap, "%s", pm->diskdev); };
     43 	option "Installation abbrechen", exit, action {
     44 		endwin();  exit(1);
     45 	};
     46 	option "Initialisiere Festplatten Partition bersicht", 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 
     65 menu editparttable, title  "Whlen Sie eine 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 "Nchste Partition auswhlen",  action {
     73 		map.selected += 1;
     74 		if (map.selected >= map.usable_cnt)
     75 			map.selected = 0;
     76 		};
     77 	option "Ausgewhlte Partition bearbeiten", sub menu chooseid;
     78 	option "Mount Point festlegen", sub menu mount_point;
     79 	option "Gewhlte Partition unterteilen", 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, "%s", map.blk[j].pmPartBlkCnt);
     86 		msg_prompt_add (MSG_scratch_size, NULL, buf, sizeof(buf));
     87 		size = atoi(buf);
     88 		if (size > 0 && size < 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 (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 (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 "Partition korrigieren", 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", pm->diskdev, bzb->flags.part);
    139 			map.blk[i].pmPartBlkCnt =
    140 			    pm->dlsize - map.blk[i].pmPyPartStart;
    141 			map.blk[i].pmDataCnt =
    142 			    map.blk[i].pmPartBlkCnt;
    143 		} else {
    144 		    msg_fmt_display_add(MSG_parttable_fix_fine, "%s%c",
    145 			pm->diskdev, bzb->flags.part);
    146 		}
    147 		process_menu(MENU_ok, NULL);
    148 		};
    149 
    150 
    151 menu ok2, title "Abbrechen?", y=17;
    152        option "OK", exit, action { };
    153 
    154 menu okabort, title "Was mchten Sie?", y=17;
    155 	option "Fortfahren", exit, action { *((int*)arg) = 1; };
    156 	option "Installation abbrechen", exit, action { *((int*)arg) = 0; };
    157 
    158 menu chooseid, title  "Partitionstyp?";
    159 	option "NetBSD Root", exit, action {
    160 		int i, j;
    161 		EBZB *bzb;
    162 
    163 		j = map.mblk[map.selected];
    164 		reset_part_flags(&map.blk[j]);
    165 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    166 		bzb->magic = APPLE_BZB_MAGIC;
    167 		strcpy (map.blk[j].pmPartName, "NetBSD Root");
    168 		strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
    169 		bzb->type = APPLE_BZB_TYPEFS;
    170 		bzb->flags.root = 1;
    171 		/*
    172 		 * Automatically determine root mount points.  The first
    173 		 *  root-type filesystem is mounted on "/", all others
    174 		 *  will mount on "/altroot".  If there are multiple
    175 		 *  occurrences of "/altroot" they will be picked up on
    176 		 *  the sanity_scan in the next step of the installation.
    177 		 */
    178 		for (i=0,map.root_cnt=0;i<map.usable_cnt;i++) {
    179 		    j = map.mblk[i];
    180 		    if (whichType(&map.blk[j]) == ROOT_PART) {
    181 			bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    182 			if (bzb->type == APPLE_BZB_TYPEFS && bzb->flags.root) {
    183 			   if (map.root_cnt++ == 0)
    184 				strcpy (bzb->mount_point, "/");
    185 			   else
    186 				strcpy (bzb->mount_point, "/altroot");
    187 			}
    188 		    }
    189 		} };
    190 	option "NetBSD SWAP", exit, action {
    191 		int j;
    192 		EBZB *bzb;
    193 
    194 		j = map.mblk[map.selected];
    195 		reset_part_flags(&map.blk[j]);
    196 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    197 		bzb->magic = APPLE_BZB_MAGIC;
    198 		strcpy (map.blk[j].pmPartName, "NetBSD SWAP");
    199 		strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
    200 		bzb->type = APPLE_BZB_TYPESWAP; };
    201 	option "NetBSD Usr", exit, action {
    202 		int j;
    203 		EBZB *bzb;
    204 
    205 		j = map.mblk[map.selected];
    206 		reset_part_flags(&map.blk[j]);
    207 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    208 		bzb->magic = APPLE_BZB_MAGIC;
    209 		strcpy (map.blk[j].pmPartName, "NetBSD Usr");
    210 		strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
    211 		bzb->type = APPLE_BZB_TYPEFS;
    212 		bzb->flags.usr = 1;
    213 		if (map.usr_cnt++ == 0)
    214 		    strcpy (bzb->mount_point, "/usr");
    215 		};
    216 	option "NetBSD Root&Usr", exit, action {
    217 		int j;
    218 		EBZB *bzb;
    219 
    220 		j = map.mblk[map.selected];
    221 		reset_part_flags(&map.blk[j]);
    222 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    223 		bzb->magic = APPLE_BZB_MAGIC;
    224 		strcpy (map.blk[j].pmPartName, "NetBSD Root & Usr");
    225 		strcpy (map.blk[j].pmPartType, "Apple_Unix_SVR2");
    226 		bzb->type = APPLE_BZB_TYPEFS;
    227 		bzb->flags.root = 1;
    228 		bzb->flags.usr = 1;
    229 		if (map.root_cnt++ == 0)
    230 		    strcpy (bzb->mount_point, "/");
    231 		else {
    232 		    if (map.usr_cnt++ == 0)
    233 			strcpy (bzb->mount_point, "/usr");
    234 		} };
    235 	option "MacOS HFS", exit, action {
    236 		int j;
    237 		EBZB *bzb;
    238 
    239 		j = map.mblk[map.selected];
    240 		reset_part_flags(&map.blk[j]);
    241 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    242 		bzb->magic = 0;
    243 		bzb->mount_point[0] = '\0';
    244 		strcpy (map.blk[j].pmPartName, "unbetitelt (HFS)");
    245 		strcpy (map.blk[j].pmPartType, "Apple_HFS"); };
    246 	option "Scratch", exit, action {
    247 		int j;
    248 		EBZB *bzb;
    249 
    250 		j = map.mblk[map.selected];
    251 		reset_part_flags(&map.blk[j]);
    252 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    253 		bzb->magic = 0;
    254 		bzb->mount_point[0] = '\0';
    255 		strcpy (map.blk[j].pmPartName, "unbetitelt (Scratch)");
    256 		strcpy (map.blk[j].pmPartType, "Apple_Scratch"); };
    257 	option "Frei", exit, action {
    258 		int j;
    259 		EBZB *bzb;
    260 
    261 		j = map.mblk[map.selected];
    262 		reset_part_flags(&map.blk[j]);
    263 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    264 		bzb->magic = 0;
    265 		bzb->mount_point[0] = '\0';
    266 		strcpy (map.blk[j].pmPartName, "unbetitelt (frei)");
    267 		strcpy (map.blk[j].pmPartType, "Apple_Free"); };
    268 
    269 menu mount_point, title  "Mount Point?";
    270 	option "/usr", exit, action {
    271 		int j;
    272 		EBZB *bzb;
    273 
    274 		j = map.mblk[map.selected];
    275 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    276 		strcpy (bzb->mount_point, "/usr"); };
    277 	option "/home", exit, action {
    278 		int j;
    279 		EBZB *bzb;
    280 
    281 		j = map.mblk[map.selected];
    282 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    283 		strcpy (bzb->mount_point, "/home"); };
    284 	option "/var", exit, action {
    285 		int j;
    286 		EBZB *bzb;
    287 
    288 		j = map.mblk[map.selected];
    289 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    290 		strcpy (bzb->mount_point, "/var"); };
    291 	option "/tmp", exit, action {
    292 		int j;
    293 		EBZB *bzb;
    294 
    295 		j = map.mblk[map.selected];
    296 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    297 		strcpy (bzb->mount_point, "/tmp"); };
    298 	option "Keiner", exit, action {
    299 		int j;
    300 		EBZB *bzb;
    301 
    302 		j = map.mblk[map.selected];
    303 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    304 		bzb->mount_point[0] = '\0'; };
    305 	option "Sonstige", exit, action {
    306 		int j;
    307 		char buf[60];
    308 		EBZB *bzb;
    309 
    310 		msg_display (MSG_custom_mount_point);
    311 		msg_prompt_add (MSG_mountpoint, NULL, buf, sizeof(buf));
    312 		j = map.mblk[map.selected];
    313 		bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
    314 		if (buf[0] != '\0') {
    315 		    bzb->mount_point[0] = '\0';
    316 		    if (buf[0] != '/')
    317 			strcpy (bzb->mount_point, "/");
    318 		    strcat(bzb->mount_point, buf);
    319 		} };
    320 
    321 menu sanity, title "Bitte whlen Sie";
    322 	display action {msg_display (MSG_sanity_check);
    323 		report_errors(); };
    324 	option "Installation abbrechen", exit, action { *((int*)arg) = -1; };
    325 	option "Warnungen ignorieren und fortfahren", exit, action { *((int*)arg) = 1;};
    326 	option "Festplatten Partitions bersicht erneut ndern", exit, action { *((int*)arg) = 0; };
    327 
    328 /*
    329  * This menu shouldn't be used in the mac68k port, but it needs to be
    330  *  defined because it's referenced from the toplevel code.
    331  */
    332