menus.mi revision 1.2 1 1.2 martin /* $NetBSD: menus.mi,v 1.2 2014/08/03 16:09:38 martin Exp $ */
2 1.1 dholland
3 1.1 dholland /*-
4 1.1 dholland * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 1.1 dholland * All rights reserved.
6 1.1 dholland *
7 1.1 dholland * This code is derived from software contributed to The NetBSD Foundation
8 1.1 dholland * by David Laight.
9 1.1 dholland *
10 1.1 dholland * Redistribution and use in source and binary forms, with or without
11 1.1 dholland * modification, are permitted provided that the following conditions
12 1.1 dholland * are met:
13 1.1 dholland * 1. Redistributions of source code must retain the above copyright
14 1.1 dholland * notice, this list of conditions and the following disclaimer.
15 1.1 dholland * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 dholland * notice, this list of conditions and the following disclaimer in the
17 1.1 dholland * documentation and/or other materials provided with the distribution.
18 1.1 dholland *
19 1.1 dholland * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 dholland * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 dholland * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 dholland * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 dholland * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 dholland * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 dholland * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 dholland * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 dholland * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 dholland * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 dholland * POSSIBILITY OF SUCH DAMAGE.
30 1.1 dholland */
31 1.1 dholland
32 1.1 dholland /*
33 1.1 dholland * Menu system definitions -- machine and language independent
34 1.1 dholland *
35 1.1 dholland * Some menus may be called directly in the code rather than via the
36 1.1 dholland * menu system.
37 1.1 dholland *
38 1.1 dholland * This file must be first in the sed command line.
39 1.1 dholland *
40 1.1 dholland */
41 1.1 dholland
42 1.1 dholland {
43 1.1 dholland #include <stdio.h>
44 1.1 dholland #include <time.h>
45 1.1 dholland #include <curses.h>
46 1.1 dholland #include "defs.h"
47 1.1 dholland #include "md.h"
48 1.1 dholland #include "msg_defs.h"
49 1.1 dholland #include "menu_defs.h"
50 1.1 dholland
51 1.2 martin static menudesc menu_def[];
52 1.2 martin
53 1.1 dholland static void
54 1.1 dholland src_legend(menudesc *menu, const char *legend, const char *text)
55 1.1 dholland {
56 1.1 dholland wprintw(menu->mw, "%-25s %.50s", MSG_XLAT(legend), MSG_XLAT(text));
57 1.1 dholland }
58 1.1 dholland
59 1.1 dholland static void
60 1.1 dholland src_prompt(const char *prompt, char *buf, size_t size)
61 1.1 dholland {
62 1.1 dholland msg_prompt_win(prompt, -1, 12, 0, 0, buf, buf, size);
63 1.1 dholland }
64 1.2 martin
65 1.2 martin void
66 1.2 martin remove_color_options()
67 1.2 martin {
68 1.2 martin /*
69 1.2 martin * Current terminal type does not support colors, so remove all
70 1.2 martin * menu entries (actually that is: Utils/Color Scheme) that do not
71 1.2 martin * make any sense in this case.
72 1.2 martin */
73 1.2 martin
74 1.2 martin for (size_t i = 0; i < DYN_MENU_START; i++) {
75 1.2 martin for (int j = 0; j < menu_def[i].numopts; j++) {
76 1.2 martin if ((menu_def[i].opts[j].opt_flags & OPT_SUB)
77 1.2 martin && menu_def[i].opts[j].opt_menu == MENU_colors) {
78 1.2 martin
79 1.2 martin for (int k = j + 1; k < menu_def[i].numopts;
80 1.2 martin k++) {
81 1.2 martin menu_def[i].opts[k-1] =
82 1.2 martin menu_def[i].opts[k];
83 1.2 martin }
84 1.2 martin menu_def[i].numopts--;
85 1.2 martin return;
86 1.2 martin
87 1.2 martin }
88 1.2 martin }
89 1.2 martin }
90 1.2 martin }
91 1.2 martin
92 1.1 dholland }
93 1.1 dholland
94 1.1 dholland default y=12, no exit, scrollable;
95 1.1 dholland
96 1.1 dholland allow dynamic menus;
97 1.1 dholland allow dynamic messages;
98 1.1 dholland error action {
99 1.1 dholland fprintf (stderr, "Could not initialize menu system, please check "
100 1.1 dholland "your terminal type.\n");
101 1.1 dholland exit(4);
102 1.1 dholland };
103 1.1 dholland
104 1.1 dholland menu selfskind, title MSG_Select_the_type, exitstring MSG_unchanged, y=6, x=30;
105 1.1 dholland display action {
106 1.1 dholland partinfo *p = arg;
107 1.1 dholland switch (p->pi_fstype) {
108 1.1 dholland case FS_UNUSED: menu->cursel = 0; break;
109 1.1 dholland case FS_BSDFFS:
110 1.1 dholland menu->cursel = p->pi_flags & PIF_FFSv2 ? 2 : 1;
111 1.1 dholland break;
112 1.1 dholland case FS_SWAP: menu->cursel = 3; break;
113 1.1 dholland case FS_MSDOS: menu->cursel = 4; break;
114 1.1 dholland case FS_BSDLFS: menu->cursel = 5; break;
115 1.1 dholland default : menu->cursel = 6; break;
116 1.1 dholland };
117 1.1 dholland };
118 1.1 dholland option "unused", exit, action
119 1.1 dholland { memset(arg, 0, sizeof (partinfo)); };
120 1.1 dholland option "FFSv1", exit, action { set_ptype(arg, FS_BSDFFS, 0); };
121 1.1 dholland option "FFSv2", exit, action { set_ptype(arg, FS_BSDFFS, PIF_FFSv2); };
122 1.1 dholland option "swap", exit, action { set_ptype(arg, FS_SWAP, 0); };
123 1.1 dholland option "msdos", exit, action { set_ptype(arg, FS_MSDOS, 0); };
124 1.1 dholland option "LFS", exit, action { set_ptype(arg, FS_BSDLFS, 0); };
125 1.1 dholland option MSG_other_types, action
126 1.1 dholland { extern int all_fstype_menu;
127 1.1 dholland m->opts[m->cursel].opt_menu = all_fstype_menu; };
128 1.1 dholland
129 1.1 dholland menu selbsize, title MSG_Select_file_system_block_size, y=10, x=40;
130 1.1 dholland display action {
131 1.1 dholland partinfo *pi = arg;
132 1.1 dholland int b;
133 1.1 dholland b = ffs(pi->pi_fsize * pi->pi_frag / 4096) - 1;
134 1.1 dholland if (b < 0 || b >= menu->numopts)
135 1.1 dholland b = 1;
136 1.1 dholland menu->cursel = b;
137 1.1 dholland };
138 1.1 dholland option "4096", exit, action { set_bsize(arg, 4096); };
139 1.1 dholland option "8192", exit, action { set_bsize(arg, 8192); };
140 1.1 dholland option "16384", exit, action { set_bsize(arg, 16384); };
141 1.1 dholland option "32768", exit, action { set_bsize(arg, 32768); };
142 1.1 dholland
143 1.1 dholland menu selfsize, title MSG_Select_file_system_fragment_size, y=11, x=40;
144 1.1 dholland display action {
145 1.1 dholland partinfo *pi = arg;
146 1.1 dholland int b;
147 1.1 dholland b = ffs(pi->pi_fsize / 512) - 1;
148 1.1 dholland if (b < 0 || b >= menu->numopts)
149 1.1 dholland b = 1;
150 1.1 dholland menu->cursel = b;
151 1.1 dholland };
152 1.1 dholland option "512", exit, action { set_fsize(arg, 512); };
153 1.1 dholland option "1024", exit, action { set_fsize(arg, 1024); };
154 1.1 dholland option "2048", exit, action { set_fsize(arg, 2048); };
155 1.1 dholland option "4096", exit, action { set_fsize(arg, 4096); };
156 1.1 dholland option "8192", exit, action { set_fsize(arg, 8192); };
157 1.1 dholland option "16384", exit, action { set_fsize(arg, 16384); };
158 1.1 dholland option "32768", exit, action { set_fsize(arg, 32768); };
159 1.1 dholland
160 1.1 dholland menu mountoptions, title MSG_toggle, y=5, x=30, exitstring MSG_unchanged;
161 1.1 dholland display action {
162 1.1 dholland static int actual_numopt;
163 1.1 dholland if (!actual_numopt)
164 1.1 dholland actual_numopt = menu->numopts;
165 1.1 dholland menu->numopts = actual_numopt -
166 1.1 dholland (((partinfo *)arg)->pi_fstype != FS_BSDFFS);
167 1.1 dholland };
168 1.1 dholland option "log", exit, action
169 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_LOG; };
170 1.1 dholland option "async", exit, action
171 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_ASYNC; };
172 1.1 dholland option "noatime", exit, action
173 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NOATIME; };
174 1.1 dholland option "nodev", exit, action
175 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NODEV; };
176 1.1 dholland option "nodevmtime", exit, action
177 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NODEVMTIME; };
178 1.1 dholland option "noexec", exit, action
179 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NOEXEC; };
180 1.1 dholland option "nosuid", exit, action
181 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NOSUID; };
182 1.1 dholland
183 1.1 dholland menu netbsd, title MSG_NetBSD_VERSION_Install_System, y=-1,
184 1.1 dholland exit, exitstring MSG_Exit_Install_System;
185 1.1 dholland display action { toplevel(); };
186 1.1 dholland option MSG_Install_NetBSD_to_hard_disk,
187 1.1 dholland action { do_install(); };
188 1.1 dholland option MSG_Upgrade_NetBSD_on_a_hard_disk,
189 1.1 dholland action { do_upgrade(); };
190 1.1 dholland option MSG_Re_install_sets_or_install_additional_sets,
191 1.1 dholland action { do_reinstall_sets(); };
192 1.1 dholland option MSG_Reboot_the_computer, exit,
193 1.1 dholland action (endwin) { system("/sbin/reboot -q"); };
194 1.1 dholland option MSG_Utility_menu, sub menu utility;
195 1.1 dholland option MSG_Config_menu, action { do_configmenu(); };
196 1.1 dholland
197 1.1 dholland menu utility, title MSG_NetBSD_VERSION_Utilities, exit,
198 1.2 martin exitstring MSG_exit_menu_generic;
199 1.1 dholland display action { toplevel(); };
200 1.1 dholland option MSG_Run_bin_sh,
201 1.1 dholland action (endwin) { system("/bin/sh"); };
202 1.1 dholland option MSG_Set_timezone,
203 1.1 dholland action { set_timezone(); };
204 1.1 dholland option MSG_Configure_network,
205 1.1 dholland action {
206 1.1 dholland extern int network_up;
207 1.1 dholland network_up = 0;
208 1.1 dholland config_network();
209 1.1 dholland };
210 1.2 martin option MSG_Partition_a_disk, action { partman_go = 1; partman(); };
211 1.1 dholland option MSG_Logging_functions, action { do_logging(); };
212 1.2 martin option MSG_Color_scheme, sub menu colors;
213 1.1 dholland option MSG_Halt_the_system, exit,
214 1.1 dholland action (endwin) { system("/sbin/halt -q"); };
215 1.1 dholland
216 1.2 martin menu colors, title MSG_Color_scheme, exit,
217 1.2 martin exitstring MSG_exit_menu_generic;
218 1.2 martin option MSG_White_on_black, action { do_coloring(COLOR_WHITE,COLOR_BLACK); };
219 1.2 martin option MSG_Black_on_white, action { do_coloring(COLOR_BLACK,COLOR_WHITE); };
220 1.2 martin option MSG_White_on_blue, action { do_coloring(COLOR_WHITE,COLOR_BLUE); };
221 1.2 martin option MSG_Green_on_black, action { do_coloring(COLOR_GREEN,COLOR_BLACK); };
222 1.2 martin
223 1.2 martin
224 1.1 dholland menu yesno, y=-10;
225 1.1 dholland display action { menu->title = arg ? arg : MSG_yes_or_no; };
226 1.1 dholland option MSG_Yes, exit, action {yesno = 1;};
227 1.1 dholland option MSG_No, exit, action {yesno = 0;};
228 1.1 dholland
229 1.1 dholland menu noyes, y=-10;
230 1.1 dholland display action { menu->title = arg ? arg : MSG_yes_or_no; };
231 1.1 dholland option MSG_No, exit, action {yesno = 0;};
232 1.1 dholland option MSG_Yes, exit, action {yesno = 1;};
233 1.1 dholland
234 1.1 dholland menu ok, no shortcut, y=-10;
235 1.1 dholland display action { menu->title = arg; };
236 1.1 dholland option MSG_Hit_enter_to_continue, exit;
237 1.1 dholland
238 1.1 dholland menu layout, sub menu, y=-1, title MSG_Choose_your_installation;
239 1.2 martin option MSG_Set_Sizes, exit, action { layoutkind = LY_SETNEW; };
240 1.2 martin option MSG_Use_Existing, exit, action { layoutkind = LY_USEEXIST; };
241 1.1 dholland
242 1.1 dholland menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier;
243 1.1 dholland display action {
244 1.2 martin if (sizemult == pm->current_cylsize)
245 1.1 dholland menu->cursel = 1;
246 1.1 dholland else if (sizemult == 1)
247 1.1 dholland menu->cursel = 2;
248 1.1 dholland };
249 1.1 dholland option MSG_Megabytes, exit, action
250 1.2 martin { sizemult = MEG / pm->sectorsize;
251 1.1 dholland multname = msg_string(MSG_megname);
252 1.1 dholland };
253 1.1 dholland option MSG_Cylinders, exit, action
254 1.2 martin { sizemult = pm->current_cylsize;
255 1.1 dholland multname = msg_string(MSG_cylname);
256 1.1 dholland };
257 1.1 dholland option MSG_Sectors, exit, action
258 1.1 dholland { sizemult = 1;
259 1.1 dholland multname = msg_string(MSG_secname);
260 1.1 dholland };
261 1.1 dholland
262 1.1 dholland menu distmedium, title MSG_Select_medium, y=-5;
263 1.1 dholland option MSG_cdrom, exit, action { *(int *)arg = get_via_cdrom(); };
264 1.1 dholland option MSG_ftp, exit, action { *(int *)arg = get_via_ftp("ftp"); };
265 1.1 dholland option MSG_http, exit, action { *(int *)arg = get_via_ftp("http"); };
266 1.1 dholland option MSG_nfs, exit, action { *(int *)arg = get_via_nfs(); };
267 1.1 dholland option MSG_floppy, exit, action { *(int *)arg = get_via_floppy(); };
268 1.1 dholland option MSG_local_fs, exit, action { *(int *)arg = get_via_localfs(); };
269 1.1 dholland option MSG_local_dir, exit, action { *(int *)arg = get_via_localdir();};
270 1.1 dholland option MSG_Skip_set, exit, action { *(int *)arg = SET_SKIP; };
271 1.1 dholland option MSG_Skip_group,exit, action { *(int *)arg = SET_SKIP_GROUP; };
272 1.1 dholland option MSG_Abandon, exit, action { *(int *)arg = SET_ABANDON; };
273 1.1 dholland
274 1.2 martin menu distset, title MSG_Select_your_distribution, exit, no default exit;
275 1.1 dholland display action { msg_display (MSG_distset); };
276 1.2 martin option MSG_Full_installation, exit, action { *(int *)arg = 1; init_set_status(0); };
277 1.2 martin option MSG_Full_installation_nox, exit, action { *(int *)arg = 1; init_set_status(SFLAG_NOX); };
278 1.2 martin option MSG_Minimal_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); };
279 1.2 martin option MSG_Custom_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); customise_sets(); };
280 1.1 dholland
281 1.1 dholland menu ftpsource, y=-4, x=0, w=70, no box, no clear,
282 1.1 dholland exitstring MSG_Get_Distribution;
283 1.1 dholland display action { msg_display(MSG_ftpsource, arg); };
284 1.1 dholland option {src_legend(menu, MSG_Host, ftp.host);},
285 1.1 dholland action { src_prompt(MSG_Host, ftp.host, sizeof ftp.host); };
286 1.1 dholland option {src_legend(menu, MSG_Base_dir, ftp.dir);},
287 1.1 dholland action { src_prompt(MSG_Base_dir, ftp.dir, sizeof ftp.dir); };
288 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
289 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
290 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
291 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
292 1.1 dholland option {src_legend(menu, MSG_User, ftp.user);},
293 1.1 dholland action { src_prompt(MSG_User, ftp.user, sizeof ftp.user);
294 1.1 dholland ftp.pass[0] = 0;
295 1.1 dholland };
296 1.1 dholland option {src_legend(menu, MSG_Password,
297 1.1 dholland strcmp(ftp.user, "ftp") == 0 || ftp.pass[0] == 0
298 1.1 dholland ? ftp.pass : msg_string(MSG_hidden));},
299 1.1 dholland action { if (strcmp(ftp.user, "ftp") == 0)
300 1.1 dholland src_prompt(MSG_email, ftp.pass, sizeof ftp.pass);
301 1.1 dholland else {
302 1.1 dholland msg_prompt_noecho(MSG_Password, "",
303 1.1 dholland ftp.pass, sizeof ftp.pass);
304 1.1 dholland }
305 1.1 dholland };
306 1.1 dholland option {src_legend(menu, MSG_Proxy, ftp.proxy);},
307 1.1 dholland action { src_prompt(MSG_Proxy, ftp.proxy, sizeof ftp.proxy);
308 1.1 dholland if (strcmp(ftp.proxy, "") == 0) {
309 1.1 dholland unsetenv("ftp_proxy");
310 1.1 dholland unsetenv("http_proxy");
311 1.1 dholland } else {
312 1.1 dholland setenv("ftp_proxy", ftp.proxy, 1);
313 1.1 dholland setenv("http_proxy", ftp.proxy, 1);
314 1.1 dholland }
315 1.1 dholland };
316 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
317 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
318 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
319 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
320 1.1 dholland action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file));
321 1.1 dholland clean_xfer_dir = yesno; };
322 1.2 martin option MSG_Configure_network,
323 1.2 martin action {
324 1.2 martin extern int network_up;
325 1.2 martin network_up = 0;
326 1.2 martin config_network();
327 1.2 martin };
328 1.2 martin option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
329 1.1 dholland
330 1.1 dholland
331 1.1 dholland menu nfssource, y=-4, x=0, w=70, no box, no clear,
332 1.2 martin exitstring MSG_Get_Distribution;
333 1.1 dholland display action { msg_display(MSG_nfssource); };
334 1.1 dholland option {src_legend(menu, MSG_Host, nfs_host);},
335 1.1 dholland action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); };
336 1.1 dholland option {src_legend(menu, MSG_Base_dir, nfs_dir);},
337 1.1 dholland action { src_prompt(MSG_Base_dir, nfs_dir, sizeof nfs_dir); };
338 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
339 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
340 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
341 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
342 1.2 martin option MSG_Configure_network,
343 1.2 martin action {
344 1.2 martin extern int network_up;
345 1.2 martin network_up = 0;
346 1.2 martin config_network();
347 1.2 martin };
348 1.2 martin option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
349 1.1 dholland
350 1.1 dholland menu fdremount, title MSG_What_do_you_want_to_do;
351 1.1 dholland option MSG_Try_again, exit, action { *(int *)arg = SET_CONTINUE; };
352 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
353 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
354 1.1 dholland
355 1.1 dholland menu fdok, title MSG_What_do_you_want_to_do;
356 1.1 dholland option MSG_OK, exit, action { *(int *)arg = SET_CONTINUE; };
357 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
358 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
359 1.1 dholland
360 1.1 dholland menu fd_type, title MSG_fd_type, y=16;
361 1.1 dholland option "msdos", exit, action { fd_type = "msdos"; };
362 1.1 dholland option "ffs", exit, action { fd_type = "ffs"; };
363 1.1 dholland .if ADOS_FLOPPY
364 1.1 dholland option "ados", exit, action { fd_type = "ados"; };
365 1.1 dholland .endif
366 1.1 dholland
367 1.1 dholland menu floppysource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
368 1.1 dholland display action { msg_display(MSG_floppysource); };
369 1.1 dholland option {src_legend(menu, MSG_Device, fd_dev);},
370 1.1 dholland action { src_prompt(MSG_dev, fd_dev, sizeof fd_dev); };
371 1.1 dholland option {src_legend(menu, MSG_fd_type, fd_type);}, sub menu fd_type;
372 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
373 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
374 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
375 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
376 1.1 dholland action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file));
377 1.1 dholland clean_xfer_dir = yesno; };
378 1.2 martin option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
379 1.1 dholland
380 1.1 dholland menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
381 1.1 dholland display action { msg_display(MSG_cdromsource); };
382 1.1 dholland option {src_legend(menu, MSG_Device, cdrom_dev);},
383 1.1 dholland action { src_prompt(MSG_dev, cdrom_dev, sizeof cdrom_dev); };
384 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
385 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
386 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
387 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
388 1.2 martin option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
389 1.1 dholland
390 1.1 dholland menu localfssource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
391 1.1 dholland display action { msg_display(MSG_localfssource); };
392 1.1 dholland option {src_legend(menu, MSG_Device, localfs_dev);},
393 1.1 dholland action { src_prompt(MSG_dev, localfs_dev, sizeof localfs_dev);};
394 1.1 dholland option {src_legend(menu, MSG_File_system, localfs_fs);},
395 1.1 dholland action { src_prompt(MSG_filesys, localfs_fs, sizeof localfs_fs); };
396 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
397 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, sizeof localfs_dir);};
398 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
399 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
400 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
401 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
402 1.2 martin option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
403 1.1 dholland
404 1.1 dholland menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
405 1.1 dholland display action { msg_display(MSG_localdir); };
406 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
407 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, 60); };
408 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
409 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, 60); };
410 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
411 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, 60); };
412 1.2 martin option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
413 1.1 dholland
414 1.1 dholland menu namesrv6, title MSG_Select_IPv6_DNS_server;
415 1.1 dholland option "google-public-dns-a.google.com", exit, action
416 1.1 dholland {
417 1.1 dholland #ifdef INET6
418 1.1 dholland strlcpy(net_namesvr6, "2001:4860:4860::8888",
419 1.1 dholland sizeof(net_namesvr6));
420 1.1 dholland yesno = 1;
421 1.1 dholland #else
422 1.1 dholland yesno = 0;
423 1.1 dholland #endif
424 1.1 dholland };
425 1.1 dholland option "google-public-dns-b.google.com", exit, action
426 1.1 dholland {
427 1.1 dholland #ifdef INET6
428 1.1 dholland strlcpy(net_namesvr6, "2001:4860:4860::8844",
429 1.1 dholland sizeof(net_namesvr6));
430 1.1 dholland yesno = 1;
431 1.1 dholland #else
432 1.1 dholland yesno = 0;
433 1.1 dholland #endif
434 1.1 dholland };
435 1.1 dholland option MSG_other, exit, action
436 1.1 dholland { yesno = 0; };
437 1.1 dholland
438 1.1 dholland menu rootsh, title MSG_Root_shell, no clear;
439 1.1 dholland option "/bin/sh", exit, action {*(const char **)arg = "/bin/sh";};
440 1.1 dholland option "/bin/ksh", exit, action {*(const char **)arg = "/bin/ksh";};
441 1.1 dholland option "/bin/csh", exit, action {*(const char **)arg = "/bin/csh";};
442 1.1 dholland
443 1.1 dholland menu zeroconf, title "Zeroconf", no clear;
444 1.1 dholland option "run mdnsd only", exit, action {*(const char **)arg = "mdnsd";};
445 1.1 dholland option "run mdnsd and resolve local names", exit, action {*(const char **) arg = "mdnsd+nsswitch";};
446 1.1 dholland option "do not run mdnsd", exit, action {*(const char **)arg = "No";};
447 1.1 dholland
448 1.1 dholland menu binpkg, y=-4, x=0, w=70, no box, no clear,
449 1.1 dholland exitstring MSG_Install_pkgin;
450 1.1 dholland display action { msg_display(MSG_pkgpath); };
451 1.1 dholland option {src_legend(menu, MSG_Host, pkg.host);},
452 1.1 dholland action { src_prompt(MSG_Host, pkg.host, sizeof pkg.host); };
453 1.1 dholland option {src_legend(menu, MSG_Base_dir, pkg.dir);},
454 1.1 dholland action { src_prompt(MSG_Base_dir, pkg.dir, sizeof pkg.dir); };
455 1.1 dholland option {src_legend(menu, MSG_Pkg_dir, pkg_dir);},
456 1.1 dholland action { src_prompt(MSG_Pkg_dir, pkg_dir, sizeof pkg_dir); };
457 1.1 dholland option {src_legend(menu, MSG_User, pkg.user);},
458 1.1 dholland action { src_prompt(MSG_User, pkg.user, sizeof pkg.user);
459 1.1 dholland pkg.pass[0] = 0;
460 1.1 dholland };
461 1.1 dholland option {src_legend(menu, MSG_Password,
462 1.1 dholland strcmp(pkg.user, "ftp") == 0 || pkg.pass[0] == 0
463 1.1 dholland ? pkg.pass : msg_string(MSG_hidden));},
464 1.1 dholland action { if (strcmp(pkg.user, "ftp") == 0)
465 1.1 dholland src_prompt(MSG_email, pkg.pass, sizeof pkg.pass);
466 1.1 dholland else {
467 1.1 dholland msg_prompt_noecho(MSG_Password, "",
468 1.1 dholland pkg.pass, sizeof pkg.pass);
469 1.1 dholland }
470 1.1 dholland };
471 1.1 dholland option {src_legend(menu, MSG_Proxy, pkg.proxy);},
472 1.1 dholland action { src_prompt(MSG_Proxy, pkg.proxy, sizeof pkg.proxy);
473 1.1 dholland if (strcmp(pkg.proxy, "") == 0) {
474 1.1 dholland unsetenv("ftp_proxy");
475 1.1 dholland unsetenv("http_proxy");
476 1.1 dholland } else {
477 1.1 dholland setenv("ftp_proxy", pkg.proxy, 1);
478 1.1 dholland setenv("http_proxy", pkg.proxy, 1);
479 1.1 dholland }
480 1.1 dholland };
481 1.2 martin option {src_legend(menu, "Additional packages", (char*)arg); }, /*TODO*/
482 1.2 martin action { src_prompt("Additional packages", (char*)arg,
483 1.2 martin sizeof(char) * STRSIZE); };
484 1.2 martin option MSG_Configure_network,
485 1.2 martin action {
486 1.2 martin extern int network_up;
487 1.2 martin network_up = 0;
488 1.2 martin config_network();
489 1.2 martin mnt_net_config();
490 1.2 martin };
491 1.2 martin option MSG_quit_pkgs_install, exit, action { yesno = SET_SKIP; };
492 1.1 dholland
493 1.1 dholland menu pkgsrc, y=-4, x=0, w=70, no box, no clear,
494 1.1 dholland exit, exitstring MSG_Install_pkgsrc;
495 1.1 dholland display action { msg_display(MSG_pkgsrc); };
496 1.1 dholland option {src_legend(menu, MSG_Host, pkgsrc.host);},
497 1.1 dholland action { src_prompt(MSG_Host, pkgsrc.host,
498 1.1 dholland sizeof pkgsrc.host); };
499 1.1 dholland option {src_legend(menu, MSG_Pkgsrc_dir, pkgsrc_dir);},
500 1.1 dholland action { src_prompt(MSG_Pkgsrc_dir, pkgsrc_dir, sizeof pkgsrc_dir); };
501 1.1 dholland option {src_legend(menu, MSG_User, pkgsrc.user);},
502 1.1 dholland action { src_prompt(MSG_User, pkgsrc.user, sizeof pkgsrc.user);
503 1.1 dholland pkgsrc.pass[0] = 0;
504 1.1 dholland };
505 1.1 dholland option {src_legend(menu, MSG_Password,
506 1.1 dholland strcmp(pkgsrc.user, "ftp") == 0 || pkgsrc.pass[0] == 0
507 1.1 dholland ? pkgsrc.pass : msg_string(MSG_hidden));},
508 1.1 dholland action { if (strcmp(pkgsrc.user, "ftp") == 0)
509 1.1 dholland src_prompt(MSG_email, pkgsrc.pass, sizeof pkgsrc.pass);
510 1.1 dholland else {
511 1.1 dholland msg_prompt_noecho(MSG_Password, "",
512 1.1 dholland pkgsrc.pass, sizeof pkgsrc.pass);
513 1.1 dholland }
514 1.1 dholland };
515 1.1 dholland option {src_legend(menu, MSG_Proxy, pkgsrc.proxy);},
516 1.1 dholland action { src_prompt(MSG_Proxy, pkgsrc.proxy, sizeof pkgsrc.proxy);
517 1.1 dholland if (strcmp(pkgsrc.proxy, "") == 0) {
518 1.1 dholland unsetenv("ftp_proxy");
519 1.1 dholland unsetenv("http_proxy");
520 1.1 dholland } else {
521 1.1 dholland setenv("ftp_proxy", pkgsrc.proxy, 1);
522 1.1 dholland setenv("http_proxy", pkgsrc.proxy, 1);
523 1.1 dholland }
524 1.1 dholland };
525 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
526 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
527 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
528 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
529 1.1 dholland action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file));
530 1.1 dholland clean_xfer_dir = yesno; };
531 1.1 dholland option MSG_quit_pkgsrc, exit, action { yesno = 0;};
532 1.1 dholland
533 1.1 dholland menu usersh, title MSG_User_shell, no clear;
534 1.1 dholland option "/bin/sh", exit, action { ushell = "/bin/sh";};
535 1.1 dholland option "/bin/ksh", exit, action { ushell = "/bin/ksh";};
536 1.1 dholland option "/bin/csh", exit, action { ushell = "/bin/csh";};
537 1.2 martin
538 1.2 martin
539 1.2 martin menu pmdiskentry, x=50, y=5, exit, default exit;
540 1.2 martin option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
541 1.2 martin option MSG_editmbr, exit, action { md_get_info();
542 1.2 martin md_pre_disklabel();
543 1.2 martin memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);};
544 1.2 martin option MSG_switchgpt, exit, action { if (pm_gpt_convert(pm) == 0)
545 1.2 martin pm_partusage(pm, -1, 1); };
546 1.2 martin option MSG_renamedisk, exit, action { pm->unsaved = 1; pm_rename(pm); };
547 1.2 martin option MSG_fmtasraid, exit, action { pm->unsaved = 1;
548 1.2 martin pm_partusage(pm, -1, 1);
549 1.2 martin layoutkind = LY_NEWRAID;
550 1.2 martin md_make_bsd_partitions();};
551 1.2 martin option MSG_fmtaslvm, exit, action { pm->unsaved = 1;
552 1.2 martin pm_partusage(pm, -1, 1);
553 1.2 martin layoutkind = LY_NEWLVM;
554 1.2 martin md_make_bsd_partitions(); };
555 1.2 martin option MSG_encrypt, exit, action { pm->unsaved = 1;
556 1.2 martin pm_partusage(pm, -1, 1);
557 1.2 martin layoutkind = LY_NEWCGD;
558 1.2 martin md_make_bsd_partitions();
559 1.2 martin pm_cgd_edit(0, &(part_entry_t)
560 1.2 martin {.dev_ptr = pm, .dev_num = PART_E}
561 1.2 martin ); };
562 1.2 martin option MSG_setbootable, exit, action { pm->unsaved = 1;
563 1.2 martin pm->bootable = !pm->bootable; };
564 1.2 martin option MSG_erase, next menu shred_modes;
565 1.2 martin option MSG_undo, exit, action { label_read(); pm->unsaved = 0;
566 1.2 martin pm_partusage(pm, -1, 1); };
567 1.2 martin option MSG_unconfig, exit, action { if (pm_unconfigure(pm) == 0)
568 1.2 martin pm_partusage(pm, -1, 1); };
569 1.2 martin
570 1.2 martin menu pmpartentry, x=50, y=5, exit, default exit;
571 1.2 martin option MSG_edit, exit, action {
572 1.2 martin pm->unsaved = 1;
573 1.2 martin int tpfs = pm->bsdlabel[*(int*)arg].pi_fstype;
574 1.2 martin int tplvm = pm->bsdlabel[*(int*)arg].lvmpv;
575 1.2 martin pm_editpart(*(int*)arg);
576 1.2 martin if (tpfs != pm->bsdlabel[*(int*)arg].pi_fstype ||
577 1.2 martin tplvm != pm->bsdlabel[*(int*)arg].lvmpv)
578 1.2 martin /* Oops, partition type changed */
579 1.2 martin pm_partusage(pm, *(int*)arg, 1);
580 1.2 martin };
581 1.2 martin option MSG_fmtasraid, exit, action {
582 1.2 martin if (pm->gpt || pm->isspecial) {
583 1.2 martin process_menu(MENU_ok, deconst(MSG_notsupported));
584 1.2 martin return -1;
585 1.2 martin }
586 1.2 martin pm->unsaved = 1;
587 1.2 martin pm_partusage(pm, *(int*)arg, 1);
588 1.2 martin pm_setfstype(pm, *(int*)arg, FS_RAID);
589 1.2 martin };
590 1.2 martin option MSG_fmtaslvm, exit, action {
591 1.2 martin if (pm->gpt || pm->isspecial) {
592 1.2 martin process_menu(MENU_ok, deconst(MSG_notsupported));
593 1.2 martin return -1;
594 1.2 martin }
595 1.2 martin pm->unsaved = 1;
596 1.2 martin pm_partusage(pm, *(int*)arg, 1);
597 1.2 martin pm_setfstype(pm, *(int*)arg, FS_BSDFFS);
598 1.2 martin pm->bsdlabel[*(int*)arg].lvmpv = 1;
599 1.2 martin };
600 1.2 martin option MSG_encrypt, exit, action {
601 1.2 martin if (pm->gpt || pm->isspecial) {
602 1.2 martin process_menu(MENU_ok, deconst(MSG_notsupported));
603 1.2 martin return -1;
604 1.2 martin }
605 1.2 martin pm->unsaved = 1;
606 1.2 martin pm_partusage(pm, *(int*)arg, 1);
607 1.2 martin pm_setfstype(pm, *(int*)arg, FS_CGD);
608 1.2 martin pm_cgd_edit(0,
609 1.2 martin &(part_entry_t){.dev_ptr = pm,
610 1.2 martin .dev_num = *(int*)arg});
611 1.2 martin };
612 1.2 martin option MSG_erase, next menu shred_modes;
613 1.2 martin option MSG_doumount, exit, action { pm_umount(pm, *(int*)arg); };
614 1.2 martin option MSG_Delete_partition, exit, action {
615 1.2 martin pm->unsaved = 1;
616 1.2 martin pm_partusage(pm, *(int*)arg, 1);
617 1.2 martin if (pm->isspecial)
618 1.2 martin pm_unconfigure(pm);
619 1.2 martin else
620 1.2 martin pm->bsdlabel[*(int*)arg].pi_fstype = FS_UNUSED;
621 1.2 martin };
622 1.2 martin
623 1.2 martin menu pmgptentry, x=50, y=8, exit, default exit;
624 1.2 martin option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
625 1.2 martin option MSG_switchmbr, exit, action { if (pm_gpt_convert(pm) == 0)
626 1.2 martin pm_partusage(pm, -1, 1); };
627 1.2 martin option MSG_setbootable, exit, action { pm->unsaved = 1;
628 1.2 martin pm->bootable = !pm->bootable; };
629 1.2 martin option MSG_erase, next menu shred_modes;
630 1.2 martin option MSG_undo, exit, action { label_read(); pm->unsaved = 0;
631 1.2 martin pm_partusage(pm, -1, 1); };
632 1.2 martin option MSG_unconfig, exit, action { if (pm_unconfigure(pm) == 0)
633 1.2 martin pm_partusage(pm, -1, 1); };
634 1.2 martin
635 1.2 martin menu shred_modes, x=50, y=5, exit, default exit;
636 1.2 martin option MSG_fillzeros, exit,
637 1.2 martin action { pm_shred(pm, *(int*)arg, SHRED_ZEROS); };
638 1.2 martin option MSG_fillrandom, exit,
639 1.2 martin action { pm_shred(pm, *(int*)arg, SHRED_RANDOM); };
640 1.2 martin option MSG_fillcrypto, exit,
641 1.2 martin action { pm_shred(pm, *(int*)arg, SHRED_CRYPTO); };
642 1.2 martin
643 1.2 martin menu raidlevel;
644 1.2 martin option MSG_raid0, exit, action { *(int *)arg = 0; };
645 1.2 martin option MSG_raid1, exit, action { *(int *)arg = 1; };
646 1.2 martin option MSG_raid4, exit, action { *(int *)arg = 4; };
647 1.2 martin option MSG_raid5, exit, action { *(int *)arg = 5; };
648 1.2 martin
649 1.2 martin menu cgd_enctype;
650 1.2 martin option "aes-cbc", exit, action { *(const char**)arg = "aes-cbc"; };
651 1.2 martin option "3des-cbc", exit, action { *(const char**)arg = "3des-cbc"; };
652 1.2 martin option "blowfish-cbc", exit, action { *(const char**)arg = "blowfish-cbc"; };
653 1.2 martin
654 1.2 martin menu cgd_ivtype;
655 1.2 martin option "encblkno1", exit, action { *(const char**)arg = "encblkno1"; };
656 1.2 martin option "encblkno8", exit, action { *(const char**)arg = "encblkno8"; };
657 1.2 martin
658 1.2 martin menu cgd_keygentype;
659 1.2 martin option "pkcs5_pbkdf2/sha1", exit, action { *(const char**)arg = "pkcs5_pbkdf2/sha1"; };
660 1.2 martin option "pkcs5_pbkdf2", exit, action { *(const char**)arg = "pkcs5_pbkdf2"; };
661 1.2 martin option "storedkey", exit, action { *(const char**)arg = "storedkey"; };
662 1.2 martin option "randomkey", exit, action { *(const char**)arg = "randomkey"; };
663 1.2 martin option "urandomkey", exit, action { *(const char**)arg = "urandomkey"; };
664 1.2 martin option "shell_cmd", exit, action { *(const char**)arg = "shell_cmd"; };
665 1.2 martin
666 1.2 martin menu cgd_verifytype;
667 1.2 martin option "none", exit, action { *(const char**)arg = "none"; };
668 1.2 martin option "disklabel", exit, action { *(const char**)arg = "disklabel"; };
669 1.2 martin option "ffs", exit, action { *(const char**)arg = "ffs"; };
670 1.2 martin option "re-enter", exit, action { *(const char**)arg = "re-enter"; };
671