Annotation of src/distrib/utils/sysinst/menus.mi, Revision 1.16.2.1.2.2
1.16.2.1.2.2! riz 1: /* $NetBSD: menus.mi,v 1.16.2.1.2.1 2005/07/24 02:25:24 snj Exp $ */
1.1 dsl 2:
3: /*-
4: * Copyright (c) 2003 The NetBSD Foundation, Inc.
5: * All rights reserved.
6: *
7: * This code is derived from software contributed to The NetBSD Foundation
8: * by David Laight.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. All advertising materials mentioning features or use of this software
19: * must display the following acknowledgement:
20: * This product includes software developed by the NetBSD
21: * Foundation, Inc. and its contributors.
22: * 4. Neither the name of The NetBSD Foundation nor the names of its
23: * contributors may be used to endorse or promote products derived
24: * from this software without specific prior written permission.
25: *
26: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36: * POSSIBILITY OF SUCH DAMAGE.
37: */
38:
39: /*
40: * Menu system definitions -- machine and language independent
41: *
1.6 dsl 42: * Some menus may be called directly in the code rather than via the
43: * menu system.
44: *
1.1 dsl 45: * This file must be first in the sed command line.
46: *
47: */
48:
49: {
50: #include <stdio.h>
51: #include <time.h>
52: #include <curses.h>
53: #include "defs.h"
54: #include "md.h"
55: #include "msg_defs.h"
56: #include "menu_defs.h"
57:
58: }
59:
60: default y=12, no exit, scrollable;
61:
62: allow dynamic menus;
1.4 dsl 63: allow dynamic messages;
1.5 dsl 64:
65:
1.15 dsl 66: menu selfskind, title MSG_Select_the_type, exitstring MSG_unchanged, y=6, x=30;
1.10 dsl 67: display action {
1.15 dsl 68: partinfo *p = arg;
69: switch (p->pi_fstype) {
1.10 dsl 70: case FS_UNUSED: menu->cursel = 0; break;
1.15 dsl 71: case FS_BSDFFS:
72: menu->cursel = p->pi_flags & PIF_FFSv2 ? 2 : 1;
73: break;
74: case FS_SWAP: menu->cursel = 3; break;
75: case FS_MSDOS: menu->cursel = 4; break;
76: case FS_BSDLFS: menu->cursel = 5; break;
77: default : menu->cursel = 6; break;
1.10 dsl 78: };
79: };
80: option "unused", exit, action
1.11 dsl 81: { memset(arg, 0, sizeof (partinfo)); };
1.16.2.1.2.1 snj 82: option "FFSv1", exit, action { set_ptype(arg, FS_BSDFFS, 0); };
83: option "FFSv2", exit, action { set_ptype(arg, FS_BSDFFS, PIF_FFSv2); };
84: option "swap", exit, action { set_ptype(arg, FS_SWAP, 0); };
85: option "msdos", exit, action { set_ptype(arg, FS_MSDOS, 0); };
86: option "LFS", exit, action { set_ptype(arg, FS_BSDLFS, 0); };
1.10 dsl 87: option MSG_other_types, action
88: { extern int all_fstype_menu;
89: m->opts[m->cursel].opt_menu = all_fstype_menu; };
1.5 dsl 90:
1.11 dsl 91: menu selbsize, title MSG_Select_file_system_block_size, y=10, x=40;
92: display action {
93: partinfo *pi = arg;
94: int b;
95: b = ffs(pi->pi_fsize * pi->pi_frag / 4096) - 1;
96: if (b < 0 || b >= menu->numopts)
97: b = 1;
98: menu->cursel = b;
99: };
100: option "4096", exit, action { set_bsize(arg, 4096); };
1.5 dsl 101: option "8192", exit, action { set_bsize(arg, 8192); };
102: option "16384", exit, action { set_bsize(arg, 16384); };
103: option "32768", exit, action { set_bsize(arg, 32768); };
104:
1.11 dsl 105: menu selfsize, title MSG_Select_file_system_fragment_size, y=11, x=40;
106: display action {
107: partinfo *pi = arg;
108: int b;
109: b = ffs(pi->pi_fsize / 512) - 1;
110: if (b < 0 || b >= menu->numopts)
111: b = 1;
112: menu->cursel = b;
113: };
114: option "512", exit, action { set_fsize(arg, 512); };
115: option "1024", exit, action { set_fsize(arg, 1024); };
116: option "2048", exit, action { set_fsize(arg, 2048); };
117: option "4096", exit, action { set_fsize(arg, 4096); };
118: option "8192", exit, action { set_fsize(arg, 8192); };
119: option "16384", exit, action { set_fsize(arg, 16384); };
120: option "32768", exit, action { set_fsize(arg, 32768); };
121:
1.12 dsl 122: menu mountoptions, title MSG_toggle, y=5, x=30, exitstring MSG_unchanged;
1.16.2.1.2.2! riz 123: display action {
! 124: static int actual_numopt;
! 125: if (!actual_numopt)
! 126: actual_numopt = menu->numopts;
! 127: menu->numopts = actual_numopt -
! 128: (((partinfo *)arg)->pi_fstype != FS_BSDFFS);
! 129: };
1.11 dsl 130: option "async", exit, action
131: { ((partinfo *)arg)->pi_flags ^= PIF_ASYNC; };
132: option "noatime", exit, action
133: { ((partinfo *)arg)->pi_flags ^= PIF_NOATIME; };
1.12 dsl 134: option "nodev", exit, action
135: { ((partinfo *)arg)->pi_flags ^= PIF_NODEV; };
1.11 dsl 136: option "nodevmtime", exit, action
137: { ((partinfo *)arg)->pi_flags ^= PIF_NODEVMTIME; };
1.12 dsl 138: option "noexec", exit, action
139: { ((partinfo *)arg)->pi_flags ^= PIF_NOEXEC; };
140: option "nosuid", exit, action
141: { ((partinfo *)arg)->pi_flags ^= PIF_NOSUID; };
1.11 dsl 142: option "softdep", exit, action
143: { ((partinfo *)arg)->pi_flags ^= PIF_SOFTDEP; };
1.6 dsl 144:
1.13 dsl 145: menu netbsd, title MSG_NetBSD_VERSION_Install_System, y=-1,
1.6 dsl 146: exit, exitstring MSG_Exit_Install_System;
147: display action { toplevel(); };
148: option MSG_Install_NetBSD_to_hard_disk,
149: action { do_install(); };
150: option MSG_Upgrade_NetBSD_on_a_hard_disk,
151: action { do_upgrade(); };
152: option MSG_Re_install_sets_or_install_additional_sets,
153: action { do_reinstall_sets(); };
154: option MSG_Reboot_the_computer, exit,
155: action (endwin) { system("/sbin/reboot -q"); };
156: option MSG_Utility_menu, sub menu utility;
157:
158: menu utility, title MSG_NetBSD_VERSION_Utilities, exit;
159: option MSG_Run_bin_sh,
160: action (endwin) { system("/bin/sh"); };
161: option MSG_Set_timezone,
1.7 dsl 162: action { set_timezone(); };
1.6 dsl 163: option MSG_Configure_network,
164: action {
165: extern int network_up;
166:
167: network_up = 0;
168: config_network();
169: };
170: /* option MSG_Partition a disk; XXX add later. */
171: option MSG_Logging_functions, action { do_logging(); };
172: option MSG_Halt_the_system, exit,
173: action (endwin) { system("/sbin/halt -q"); };
174:
1.16 dsl 175: menu yesno, y=-10;
1.15 dsl 176: display action { menu->title = arg ? arg : MSG_yes_or_no; };
1.6 dsl 177: option MSG_Yes, exit, action {yesno = 1;};
178: option MSG_No, exit, action {yesno = 0;};
179:
1.16 dsl 180: menu noyes, y=-10;
1.15 dsl 181: display action { menu->title = arg ? arg : MSG_yes_or_no; };
1.6 dsl 182: option MSG_No, exit, action {yesno = 0;};
183: option MSG_Yes, exit, action {yesno = 1;};
184:
1.16 dsl 185: menu ok, no shortcut, y=-10;
1.15 dsl 186: display action { menu->title = arg; };
187: option MSG_Hit_enter_to_continue, exit;
1.6 dsl 188:
1.16.2.1.2.1 snj 189: menu layout, sub menu, y=-1, title MSG_Choose_your_installation;
1.10 dsl 190: option MSG_Set_Sizes, exit, action { layoutkind = 1; };
1.7 dsl 191: option MSG_Use_Existing, exit, action { layoutkind = 4; };
1.6 dsl 192:
1.16.2.1.2.1 snj 193: menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier;
1.10 dsl 194: display action {
195: if (sizemult == current_cylsize)
196: menu->cursel = 1;
197: else if (sizemult == 1)
198: menu->cursel = 2;
199: };
1.6 dsl 200: option MSG_Megabytes, exit, action
201: { sizemult = MEG / sectorsize;
202: multname = msg_string(MSG_megname);
203: };
204: option MSG_Cylinders, exit, action
205: { sizemult = current_cylsize;
206: multname = msg_string(MSG_cylname);
207: };
208: option MSG_Sectors, exit, action
209: { sizemult = 1;
210: multname = msg_string(MSG_secname);
211: };
212:
213: menu distmedium, title MSG_Select_medium;
1.14 dsl 214: display action { umount_mnt2(); msg_display(MSG_distmedium); };
215: option MSG_cdrom, exit, action { *(int *)arg = get_via_cdrom(); };
1.16.2.1.2.1 snj 216: option MSG_ftp, exit, action { *(int *)arg = get_via_ftp("ftp"); };
217: option MSG_http, exit, action { *(int *)arg = get_via_ftp("http"); };
218: option MSG_nfs, exit, action { *(int *)arg = get_via_nfs(); };
1.14 dsl 219: option MSG_floppy, exit, action { *(int *)arg = get_via_floppy(); };
220: option MSG_local_fs, exit, action { *(int *)arg = get_via_localfs(); };
221: option MSG_local_dir, exit, action { *(int *)arg = get_via_localdir();};
222: option MSG_none, exit, action { *(int *)arg = -2; };
1.6 dsl 223:
224: menu distset, title MSG_Select_your_distribution;
225: display action { msg_display (MSG_distset); };
226: option MSG_Full_installation, exit;
227: option MSG_Custom_installation, exit, action { customise_sets(); };
228:
229: menu ftpsource, title MSG_Change;
1.7 dsl 230: display action {
231: msg_clear();
1.16.2.1.2.1 snj 232: msg_table_add(MSG_ftpsource, arg, ftp_host, ftp_dir, set_dir,
1.16.2.1 tron 233: ftp_user, strcmp(ftp_user, "ftp") == 0 || ftp_pass[0] == 0
1.7 dsl 234: ? ftp_pass : msg_string(MSG_hidden),
235: ftp_proxy);
1.6 dsl 236: };
237: option MSG_Host, action
1.16.2.1 tron 238: { msg_prompt_win(MSG_Host, -1, 12, 0, 0,
239: ftp_host, ftp_host, sizeof ftp_host); };
240: option MSG_Base_dir, action
241: { msg_prompt_win(MSG_Base_dir, -1, 12, 0, 0,
242: ftp_dir, ftp_dir, sizeof ftp_dir); };
243: option MSG_Set_dir, action
244: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0,
245: set_dir, set_dir, sizeof set_dir); };
1.6 dsl 246: option MSG_User, action
1.16.2.1 tron 247: { msg_prompt_win(MSG_User, -1, 12, 0, 0,
248: ftp_user, ftp_user, sizeof ftp_user);
1.7 dsl 249: ftp_pass[0] = 0;
1.6 dsl 250: };
251: option MSG_Password, action
252: { if (strcmp(ftp_user, "ftp") == 0)
1.16.2.1 tron 253: msg_prompt_win(MSG_email, -1, 12, 0, 0,
254: ftp_pass, ftp_pass, sizeof ftp_pass);
1.6 dsl 255: else {
1.16.2.1 tron 256: msg_prompt_noecho(MSG_Password, "",
257: ftp_pass, sizeof ftp_pass);
1.6 dsl 258: }
259: };
260: option MSG_Proxy, action
1.16.2.1 tron 261: { msg_prompt_win(MSG_Proxy, -1, 12, 0, 0,
262: ftp_proxy, ftp_proxy, sizeof ftp_proxy);
1.16.2.1.2.1 snj 263: if (strcmp(ftp_proxy, "") == 0) {
1.6 dsl 264: unsetenv("ftp_proxy");
1.16.2.1.2.1 snj 265: unsetenv("http_proxy");
266: } else {
1.6 dsl 267: setenv("ftp_proxy", ftp_proxy, 1);
1.16.2.1.2.1 snj 268: setenv("http_proxy", ftp_proxy, 1);
269: }
1.6 dsl 270: };
271: option MSG_Get_Distribution, exit;
272:
273: menu nfssource, title MSG_Change;
274: display action
1.16.2.1 tron 275: { msg_display(MSG_nfssource, nfs_host, nfs_dir, set_dir); };
1.6 dsl 276: option MSG_Host, action
1.16.2.1 tron 277: { msg_prompt_win(MSG_Host, -1, 12, 0, 0,
278: nfs_host, nfs_host, sizeof nfs_host); };
279: option MSG_Base_dir, action
280: { msg_prompt_win(MSG_Base_dir, -1, 12, 0, 0,
281: nfs_dir, nfs_dir, sizeof nfs_dir); };
282: option MSG_Set_dir, action
283: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0,
284: set_dir, set_dir, sizeof set_dir); };
1.6 dsl 285: option MSG_Continue, exit;
286:
287: menu nfsbadmount, title MSG_What_do_you_want_to_do;
288: option MSG_Try_again, exit, sub menu nfssource, action
289: { yesno = 1; ignorerror = 0; };
290: option MSG_Give_up, exit, action
291: { yesno = 0; ignorerror = 0; };
292: option MSG_Ignore_continue_anyway, exit, action
293: { yesno = 1; ignorerror = 1; };
294:
295:
296: menu fdremount, title MSG_What_do_you_want_to_do;
297: option MSG_Try_again, exit, action { yesno = 1; };
298: option MSG_Set_finished, exit, action { yesno = 2; };
299: option MSG_Abort_install, exit, action { yesno = 0; };
300:
301: menu fdok, title MSG_Hit_enter_to_continue;
302: option MSG_OK, exit, action { yesno = 1; };
303: option MSG_Set_finished, exit, action { yesno = 2; };
304: option MSG_Abort_install, exit, action { yesno = 0; };
305:
306: menu crypttype, title MSG_Password_cipher, y=16;
307: option MSG_DES, exit, action { yesno = 1; };
308: option MSG_MD5, exit, action { yesno = 2; };
309: option MSG_Blowfish_2_7_round, exit, action { yesno = 3; };
310: option MSG_do_not_change, exit, action { yesno = 0; };
311:
312: menu cdromsource, title MSG_Change;
313: display action
1.16.2.1 tron 314: { msg_display(MSG_cdromsource, cdrom_dev, set_dir); };
1.6 dsl 315: option MSG_Device, action
1.16.2.1 tron 316: { msg_prompt_win(MSG_dev, -1, 12, 0, 0,
317: cdrom_dev, cdrom_dev, sizeof cdrom_dev); };
318: option MSG_Set_dir, action
319: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0,
320: set_dir, set_dir, sizeof set_dir); };
1.6 dsl 321: option MSG_Continue, exit;
322:
323: menu cdrombadmount, title MSG_What_do_you_want_to_do;
1.16.2.1 tron 324: display action
325: { msg_display(MSG_cdrombadmount, cdrom_dev); };
326: option MSG_Try_again, exit, action
327: { yesno = 1; };
1.6 dsl 328: option MSG_Give_up, exit, action
1.16.2.1 tron 329: { yesno = 0; };
1.6 dsl 330:
331:
332: menu localfssource, title MSG_Change;
333: display action
1.16.2.1 tron 334: { msg_display(MSG_localfssource, localfs_dev, localfs_fs,
335: localfs_dir, set_dir); };
1.6 dsl 336: option MSG_Device, action
1.16.2.1 tron 337: { msg_prompt_win(MSG_dev, -1, 12, 0, 0,
338: localfs_dev, localfs_dev, sizeof localfs_dev);};
1.6 dsl 339: option MSG_File_system, action
1.16.2.1 tron 340: { msg_prompt_win(MSG_filesys, -1, 12, 0, 0,
341: localfs_fs, localfs_fs, sizeof localfs_fs); };
342: option MSG_Base_dir, action
343: { msg_prompt_win(MSG_Base_dir, -1, 12, 0, 0,
344: localfs_dir, localfs_dir, sizeof localfs_dir);};
345: option MSG_Set_dir, action
346: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0,
347: set_dir, set_dir, sizeof set_dir); };
1.6 dsl 348: option MSG_Continue, exit;
349:
350: menu localfsbadmount, title MSG_What_do_you_want_to_do;
351: option MSG_Try_again, exit, sub menu localfssource, action
352: { yesno = 1; ignorerror = 0; };
353: option MSG_Give_up, exit, action
354: { yesno = 0; ignorerror = 0; };
355: option MSG_Ignore_continue_anyway, exit, action
356: { yesno = 1; ignorerror = 1; };
357:
358: menu localdirsource, title MSG_Change;
359: display action
1.16.2.1 tron 360: { msg_display(MSG_localdir, localfs_dir, set_dir); };
361: option MSG_Base_dir, action
362: { msg_prompt_win(MSG_Base_dir, -1, 12, 0, 0, localfs_dir, localfs_dir, 60); };
363: option MSG_Set_dir, action
364: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0, set_dir, set_dir, 60); };
1.6 dsl 365: option MSG_Continue, exit;
366:
367: menu namesrv6, title MSG_Select_IPv6_DNS_server;
368: option "ns9.iij.ad.jp", exit, action
369: {
370: #ifdef INET6
371: strlcpy(net_namesvr6, "2001:240::1", sizeof(net_namesvr6));
372: yesno = 1;
373: #else
374: yesno = 0;
375: #endif
376: };
377: option "ns-wide.wide.ad.jp", exit, action
378: {
379: #ifdef INET6
380: strlcpy(net_namesvr6, "2001:200:0:1::3", sizeof(net_namesvr6));
381: yesno = 1;
382: #else
383: yesno = 0;
384: #endif
385: };
386: option "light.imasy.or.jp", exit, action
387: {
388: #ifdef INET6
389: strlcpy(net_namesvr6, "3ffe:505:0:1:2a0:c9ff:fe61:6521",
390: sizeof(net_namesvr6));
391: yesno = 1;
392: #else
393: yesno = 0;
394: #endif
395: };
396: option MSG_other, exit, action
397: { yesno = 0; };
398:
399: menu rootsh, title MSG_Root_shell;
1.16.2.1.2.1 snj 400: option "/bin/sh", exit, action {*(const char **)arg = "/bin/sh";};
401: option "/bin/ksh", exit, action {*(const char **)arg = "/bin/ksh";};
402: option "/bin/csh", exit, action {*(const char **)arg = "/bin/csh";};
1.6 dsl 403:
404: menu extract, title MSG_Select_set_extraction_verbosity;
1.16.2.1 tron 405: display action { menu->cursel = *(int *)arg; };
406: option MSG_Progress_bar, exit, action { *(int *)arg = 0; };
407: option MSG_Silent, exit, action { *(int *)arg = 1; };
408: option MSG_Verbose, exit, action { *(int *)arg = 2; };
CVSweb <webmaster@jp.NetBSD.org>