Annotation of src/distrib/utils/sysinst/menus.mi, Revision 1.19
1.19 ! dsl 1: /* $NetBSD: menus.mi,v 1.18 2004/08/14 16:06:37 dsl 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.15 dsl 82: option "FFSv1", exit, action
83: { set_ptype(arg, FS_BSDFFS, 0, 8192); };
84: option "FFSv2", exit, action
85: { set_ptype(arg, FS_BSDFFS, PIF_FFSv2, 8192); };
1.5 dsl 86: option "swap", exit, action
1.15 dsl 87: { set_ptype(arg, FS_SWAP, 0, 0); };
1.5 dsl 88: option "msdos", exit, action
1.15 dsl 89: { set_ptype(arg, FS_MSDOS, 0, 0); };
90: option "LFS", exit, action
91: { set_ptype(arg, FS_BSDLFS, 0, 8192); };
1.10 dsl 92: option MSG_other_types, action
93: { extern int all_fstype_menu;
94: m->opts[m->cursel].opt_menu = all_fstype_menu; };
1.5 dsl 95:
1.11 dsl 96: menu selbsize, title MSG_Select_file_system_block_size, y=10, x=40;
97: display action {
98: partinfo *pi = arg;
99: int b;
100: b = ffs(pi->pi_fsize * pi->pi_frag / 4096) - 1;
101: if (b < 0 || b >= menu->numopts)
102: b = 1;
103: menu->cursel = b;
104: };
105: option "4096", exit, action { set_bsize(arg, 4096); };
1.5 dsl 106: option "8192", exit, action { set_bsize(arg, 8192); };
107: option "16384", exit, action { set_bsize(arg, 16384); };
108: option "32768", exit, action { set_bsize(arg, 32768); };
109:
1.11 dsl 110: menu selfsize, title MSG_Select_file_system_fragment_size, y=11, x=40;
111: display action {
112: partinfo *pi = arg;
113: int b;
114: b = ffs(pi->pi_fsize / 512) - 1;
115: if (b < 0 || b >= menu->numopts)
116: b = 1;
117: menu->cursel = b;
118: };
119: option "512", exit, action { set_fsize(arg, 512); };
120: option "1024", exit, action { set_fsize(arg, 1024); };
121: option "2048", exit, action { set_fsize(arg, 2048); };
122: option "4096", exit, action { set_fsize(arg, 4096); };
123: option "8192", exit, action { set_fsize(arg, 8192); };
124: option "16384", exit, action { set_fsize(arg, 16384); };
125: option "32768", exit, action { set_fsize(arg, 32768); };
126:
1.12 dsl 127: menu mountoptions, title MSG_toggle, y=5, x=30, exitstring MSG_unchanged;
1.11 dsl 128: option "async", exit, action
129: { ((partinfo *)arg)->pi_flags ^= PIF_ASYNC; };
130: option "noatime", exit, action
131: { ((partinfo *)arg)->pi_flags ^= PIF_NOATIME; };
1.12 dsl 132: option "nodev", exit, action
133: { ((partinfo *)arg)->pi_flags ^= PIF_NODEV; };
1.11 dsl 134: option "nodevmtime", exit, action
135: { ((partinfo *)arg)->pi_flags ^= PIF_NODEVMTIME; };
1.12 dsl 136: option "noexec", exit, action
137: { ((partinfo *)arg)->pi_flags ^= PIF_NOEXEC; };
138: option "nosuid", exit, action
139: { ((partinfo *)arg)->pi_flags ^= PIF_NOSUID; };
1.11 dsl 140: option "softdep", exit, action
141: { ((partinfo *)arg)->pi_flags ^= PIF_SOFTDEP; };
1.6 dsl 142:
1.13 dsl 143: menu netbsd, title MSG_NetBSD_VERSION_Install_System, y=-1,
1.6 dsl 144: exit, exitstring MSG_Exit_Install_System;
145: display action { toplevel(); };
146: option MSG_Install_NetBSD_to_hard_disk,
147: action { do_install(); };
148: option MSG_Upgrade_NetBSD_on_a_hard_disk,
149: action { do_upgrade(); };
150: option MSG_Re_install_sets_or_install_additional_sets,
151: action { do_reinstall_sets(); };
152: option MSG_Reboot_the_computer, exit,
153: action (endwin) { system("/sbin/reboot -q"); };
154: option MSG_Utility_menu, sub menu utility;
155:
156: menu utility, title MSG_NetBSD_VERSION_Utilities, exit;
157: option MSG_Run_bin_sh,
158: action (endwin) { system("/bin/sh"); };
159: option MSG_Set_timezone,
1.7 dsl 160: action { set_timezone(); };
1.6 dsl 161: option MSG_Configure_network,
162: action {
163: extern int network_up;
164:
165: network_up = 0;
166: config_network();
167: };
168: /* option MSG_Partition a disk; XXX add later. */
169: option MSG_Logging_functions, action { do_logging(); };
170: option MSG_Halt_the_system, exit,
171: action (endwin) { system("/sbin/halt -q"); };
172:
1.16 dsl 173: menu yesno, y=-10;
1.15 dsl 174: display action { menu->title = arg ? arg : MSG_yes_or_no; };
1.6 dsl 175: option MSG_Yes, exit, action {yesno = 1;};
176: option MSG_No, exit, action {yesno = 0;};
177:
1.16 dsl 178: menu noyes, y=-10;
1.15 dsl 179: display action { menu->title = arg ? arg : MSG_yes_or_no; };
1.6 dsl 180: option MSG_No, exit, action {yesno = 0;};
181: option MSG_Yes, exit, action {yesno = 1;};
182:
1.16 dsl 183: menu ok, no shortcut, y=-10;
1.15 dsl 184: display action { menu->title = arg; };
185: option MSG_Hit_enter_to_continue, exit;
1.6 dsl 186:
1.18 dsl 187: menu layout, sub menu, y=-1, title MSG_Choose_your_installation;
1.10 dsl 188: option MSG_Set_Sizes, exit, action { layoutkind = 1; };
1.7 dsl 189: option MSG_Use_Existing, exit, action { layoutkind = 4; };
1.6 dsl 190:
1.18 dsl 191: menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier;
1.10 dsl 192: display action {
193: if (sizemult == current_cylsize)
194: menu->cursel = 1;
195: else if (sizemult == 1)
196: menu->cursel = 2;
197: };
1.6 dsl 198: option MSG_Megabytes, exit, action
199: { sizemult = MEG / sectorsize;
200: multname = msg_string(MSG_megname);
201: };
202: option MSG_Cylinders, exit, action
203: { sizemult = current_cylsize;
204: multname = msg_string(MSG_cylname);
205: };
206: option MSG_Sectors, exit, action
207: { sizemult = 1;
208: multname = msg_string(MSG_secname);
209: };
210:
211: menu distmedium, title MSG_Select_medium;
1.14 dsl 212: display action { umount_mnt2(); msg_display(MSG_distmedium); };
1.19 ! dsl 213: option MSG_cdrom, exit, action { *(int *)arg = get_via_cdrom(); };
! 214: option MSG_ftp, exit, action { *(int *)arg = get_via_ftp("ftp"); };
! 215: option MSG_http, exit, action { *(int *)arg = get_via_ftp("http"); };
1.14 dsl 216: option MSG_nfs, exit, action { *(int *)arg = get_via_nfs(); };
217: option MSG_floppy, exit, action { *(int *)arg = get_via_floppy(); };
218: option MSG_local_fs, exit, action { *(int *)arg = get_via_localfs(); };
219: option MSG_local_dir, exit, action { *(int *)arg = get_via_localdir();};
220: option MSG_none, exit, action { *(int *)arg = -2; };
1.6 dsl 221:
222: menu distset, title MSG_Select_your_distribution;
223: display action { msg_display (MSG_distset); };
224: option MSG_Full_installation, exit;
225: option MSG_Custom_installation, exit, action { customise_sets(); };
226:
227: menu ftpsource, title MSG_Change;
1.7 dsl 228: display action {
229: msg_clear();
1.19 ! dsl 230: msg_table_add(MSG_ftpsource, arg, ftp_host, ftp_dir, set_dir,
1.17 dsl 231: ftp_user, strcmp(ftp_user, "ftp") == 0 || ftp_pass[0] == 0
1.7 dsl 232: ? ftp_pass : msg_string(MSG_hidden),
233: ftp_proxy);
1.6 dsl 234: };
235: option MSG_Host, action
1.17 dsl 236: { msg_prompt_win(MSG_Host, -1, 12, 0, 0,
237: ftp_host, ftp_host, sizeof ftp_host); };
238: option MSG_Base_dir, action
239: { msg_prompt_win(MSG_Base_dir, -1, 12, 0, 0,
240: ftp_dir, ftp_dir, sizeof ftp_dir); };
241: option MSG_Set_dir, action
242: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0,
243: set_dir, set_dir, sizeof set_dir); };
1.6 dsl 244: option MSG_User, action
1.17 dsl 245: { msg_prompt_win(MSG_User, -1, 12, 0, 0,
246: ftp_user, ftp_user, sizeof ftp_user);
1.7 dsl 247: ftp_pass[0] = 0;
1.6 dsl 248: };
249: option MSG_Password, action
250: { if (strcmp(ftp_user, "ftp") == 0)
1.17 dsl 251: msg_prompt_win(MSG_email, -1, 12, 0, 0,
252: ftp_pass, ftp_pass, sizeof ftp_pass);
1.6 dsl 253: else {
1.17 dsl 254: msg_prompt_noecho(MSG_Password, "",
255: ftp_pass, sizeof ftp_pass);
1.6 dsl 256: }
257: };
258: option MSG_Proxy, action
1.17 dsl 259: { msg_prompt_win(MSG_Proxy, -1, 12, 0, 0,
260: ftp_proxy, ftp_proxy, sizeof ftp_proxy);
1.19 ! dsl 261: if (strcmp(ftp_proxy, "") == 0) {
1.6 dsl 262: unsetenv("ftp_proxy");
1.19 ! dsl 263: unsetenv("http_proxy");
! 264: } else {
1.6 dsl 265: setenv("ftp_proxy", ftp_proxy, 1);
1.19 ! dsl 266: setenv("http_proxy", ftp_proxy, 1);
! 267: }
1.6 dsl 268: };
269: option MSG_Get_Distribution, exit;
270:
271: menu nfssource, title MSG_Change;
272: display action
1.17 dsl 273: { msg_display(MSG_nfssource, nfs_host, nfs_dir, set_dir); };
1.6 dsl 274: option MSG_Host, action
1.17 dsl 275: { msg_prompt_win(MSG_Host, -1, 12, 0, 0,
276: nfs_host, nfs_host, sizeof nfs_host); };
277: option MSG_Base_dir, action
278: { msg_prompt_win(MSG_Base_dir, -1, 12, 0, 0,
279: nfs_dir, nfs_dir, sizeof nfs_dir); };
280: option MSG_Set_dir, action
281: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0,
282: set_dir, set_dir, sizeof set_dir); };
1.6 dsl 283: option MSG_Continue, exit;
284:
285: menu nfsbadmount, title MSG_What_do_you_want_to_do;
286: option MSG_Try_again, exit, sub menu nfssource, action
287: { yesno = 1; ignorerror = 0; };
288: option MSG_Give_up, exit, action
289: { yesno = 0; ignorerror = 0; };
290: option MSG_Ignore_continue_anyway, exit, action
291: { yesno = 1; ignorerror = 1; };
292:
293:
294: menu fdremount, title MSG_What_do_you_want_to_do;
295: option MSG_Try_again, exit, action { yesno = 1; };
296: option MSG_Set_finished, exit, action { yesno = 2; };
297: option MSG_Abort_install, exit, action { yesno = 0; };
298:
299: menu fdok, title MSG_Hit_enter_to_continue;
300: option MSG_OK, exit, action { yesno = 1; };
301: option MSG_Set_finished, exit, action { yesno = 2; };
302: option MSG_Abort_install, exit, action { yesno = 0; };
303:
304: menu crypttype, title MSG_Password_cipher, y=16;
305: option MSG_DES, exit, action { yesno = 1; };
306: option MSG_MD5, exit, action { yesno = 2; };
307: option MSG_Blowfish_2_7_round, exit, action { yesno = 3; };
308: option MSG_do_not_change, exit, action { yesno = 0; };
309:
310: menu cdromsource, title MSG_Change;
311: display action
1.17 dsl 312: { msg_display(MSG_cdromsource, cdrom_dev, set_dir); };
1.6 dsl 313: option MSG_Device, action
1.17 dsl 314: { msg_prompt_win(MSG_dev, -1, 12, 0, 0,
315: cdrom_dev, cdrom_dev, sizeof cdrom_dev); };
316: option MSG_Set_dir, action
317: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0,
318: set_dir, set_dir, sizeof set_dir); };
1.6 dsl 319: option MSG_Continue, exit;
320:
321: menu cdrombadmount, title MSG_What_do_you_want_to_do;
1.17 dsl 322: display action
323: { msg_display(MSG_cdrombadmount, cdrom_dev); };
324: option MSG_Try_again, exit, action
325: { yesno = 1; };
1.6 dsl 326: option MSG_Give_up, exit, action
1.17 dsl 327: { yesno = 0; };
1.6 dsl 328:
329:
330: menu localfssource, title MSG_Change;
331: display action
1.17 dsl 332: { msg_display(MSG_localfssource, localfs_dev, localfs_fs,
333: localfs_dir, set_dir); };
1.6 dsl 334: option MSG_Device, action
1.17 dsl 335: { msg_prompt_win(MSG_dev, -1, 12, 0, 0,
336: localfs_dev, localfs_dev, sizeof localfs_dev);};
1.6 dsl 337: option MSG_File_system, action
1.17 dsl 338: { msg_prompt_win(MSG_filesys, -1, 12, 0, 0,
339: localfs_fs, localfs_fs, sizeof localfs_fs); };
340: option MSG_Base_dir, action
341: { msg_prompt_win(MSG_Base_dir, -1, 12, 0, 0,
342: localfs_dir, localfs_dir, sizeof localfs_dir);};
343: option MSG_Set_dir, action
344: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0,
345: set_dir, set_dir, sizeof set_dir); };
1.6 dsl 346: option MSG_Continue, exit;
347:
348: menu localfsbadmount, title MSG_What_do_you_want_to_do;
349: option MSG_Try_again, exit, sub menu localfssource, action
350: { yesno = 1; ignorerror = 0; };
351: option MSG_Give_up, exit, action
352: { yesno = 0; ignorerror = 0; };
353: option MSG_Ignore_continue_anyway, exit, action
354: { yesno = 1; ignorerror = 1; };
355:
356: menu localdirsource, title MSG_Change;
357: display action
1.17 dsl 358: { msg_display(MSG_localdir, localfs_dir, set_dir); };
359: option MSG_Base_dir, action
360: { msg_prompt_win(MSG_Base_dir, -1, 12, 0, 0, localfs_dir, localfs_dir, 60); };
361: option MSG_Set_dir, action
362: { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0, set_dir, set_dir, 60); };
1.6 dsl 363: option MSG_Continue, exit;
364:
365: menu namesrv6, title MSG_Select_IPv6_DNS_server;
366: option "ns9.iij.ad.jp", exit, action
367: {
368: #ifdef INET6
369: strlcpy(net_namesvr6, "2001:240::1", sizeof(net_namesvr6));
370: yesno = 1;
371: #else
372: yesno = 0;
373: #endif
374: };
375: option "ns-wide.wide.ad.jp", exit, action
376: {
377: #ifdef INET6
378: strlcpy(net_namesvr6, "2001:200:0:1::3", sizeof(net_namesvr6));
379: yesno = 1;
380: #else
381: yesno = 0;
382: #endif
383: };
384: option "light.imasy.or.jp", exit, action
385: {
386: #ifdef INET6
387: strlcpy(net_namesvr6, "3ffe:505:0:1:2a0:c9ff:fe61:6521",
388: sizeof(net_namesvr6));
389: yesno = 1;
390: #else
391: yesno = 0;
392: #endif
393: };
394: option MSG_other, exit, action
395: { yesno = 0; };
396:
397: menu rootsh, title MSG_Root_shell;
398: option "/bin/csh", exit, action {shellpath = "/bin/csh";};
399: option "/bin/ksh", exit, action {shellpath = "/bin/ksh";};
400: option "/bin/sh", exit, action {shellpath = "/bin/sh";};
401:
402: menu extract, title MSG_Select_set_extraction_verbosity;
1.17 dsl 403: display action { menu->cursel = *(int *)arg; };
404: option MSG_Progress_bar, exit, action { *(int *)arg = 0; };
405: option MSG_Silent, exit, action { *(int *)arg = 1; };
406: option MSG_Verbose, exit, action { *(int *)arg = 2; };
CVSweb <webmaster@jp.NetBSD.org>