menus.mi revision 1.23 1 1.23 martin /* $NetBSD: menus.mi,v 1.23 2020/10/27 15:28:01 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.17 martin expand_option_text(menudesc *menu, void *arg, int sel)
55 1.17 martin {
56 1.17 martin arg_replace *ar = arg;
57 1.17 martin struct menu_ent *opt = &menu->opts[sel];
58 1.17 martin
59 1.17 martin if (menu->opts[sel].opt_exp_name)
60 1.17 martin return; /* has already been expanded */
61 1.17 martin
62 1.17 martin opt->opt_exp_name =
63 1.17 martin str_arg_subst(MSG_XLAT(opt->opt_name), ar->argc, ar->argv);
64 1.17 martin }
65 1.17 martin
66 1.17 martin void
67 1.17 martin expand_all_option_texts(menudesc *menu, void *arg)
68 1.17 martin {
69 1.17 martin arg_replace *ar = arg;
70 1.17 martin const char *title;
71 1.17 martin int i;
72 1.17 martin
73 1.17 martin if (menu->title != NULL && menu->exp_title == NULL) {
74 1.17 martin title = MSG_XLAT(menu->title);
75 1.17 martin if (needs_expanding(title, ar->argc)) {
76 1.17 martin menu->exp_title = str_arg_subst(title,
77 1.17 martin ar->argc, ar->argv);
78 1.17 martin }
79 1.17 martin }
80 1.17 martin for (i = 0; i < menu->numopts; i++) {
81 1.17 martin const char *t = MSG_XLAT(menu->opts[i].opt_name);
82 1.17 martin
83 1.17 martin if (t == NULL) continue;
84 1.17 martin
85 1.17 martin if (needs_expanding(t, ar->argc))
86 1.17 martin expand_option_text(menu, arg, i);
87 1.17 martin }
88 1.17 martin }
89 1.17 martin
90 1.17 martin /*
91 1.17 martin * Re-create the menu window with heigh/width updated to current state.
92 1.17 martin */
93 1.17 martin void
94 1.17 martin resize_menu_height(menudesc *m)
95 1.17 martin {
96 1.17 martin
97 1.17 martin if (m->mw == NULL)
98 1.17 martin return;
99 1.17 martin
100 1.17 martin wclear(m->mw);
101 1.17 martin if (m->sv_mw) {
102 1.17 martin overwrite(m->sv_mw, m->mw);
103 1.17 martin delwin(m->sv_mw);
104 1.17 martin m->sv_mw = NULL;
105 1.17 martin }
106 1.17 martin wnoutrefresh(m->mw);
107 1.17 martin delwin(m->mw);
108 1.17 martin m->mw = NULL;
109 1.17 martin }
110 1.17 martin
111 1.17 martin static void
112 1.1 dholland src_legend(menudesc *menu, const char *legend, const char *text)
113 1.1 dholland {
114 1.16 martin wprintw(menu->mw, "%-35s %.50s", MSG_XLAT(legend), MSG_XLAT(text));
115 1.1 dholland }
116 1.1 dholland
117 1.1 dholland static void
118 1.1 dholland src_prompt(const char *prompt, char *buf, size_t size)
119 1.1 dholland {
120 1.1 dholland msg_prompt_win(prompt, -1, 12, 0, 0, buf, buf, size);
121 1.1 dholland }
122 1.2 martin
123 1.4 martin static void
124 1.4 martin remove_sub_menu(int menuID)
125 1.2 martin {
126 1.2 martin
127 1.2 martin for (size_t i = 0; i < DYN_MENU_START; i++) {
128 1.2 martin for (int j = 0; j < menu_def[i].numopts; j++) {
129 1.2 martin if ((menu_def[i].opts[j].opt_flags & OPT_SUB)
130 1.4 martin && menu_def[i].opts[j].opt_menu == menuID) {
131 1.2 martin
132 1.2 martin for (int k = j + 1; k < menu_def[i].numopts;
133 1.2 martin k++) {
134 1.2 martin menu_def[i].opts[k-1] =
135 1.2 martin menu_def[i].opts[k];
136 1.2 martin }
137 1.2 martin menu_def[i].numopts--;
138 1.2 martin return;
139 1.2 martin
140 1.2 martin }
141 1.2 martin }
142 1.2 martin }
143 1.2 martin }
144 1.2 martin
145 1.15 rin #ifndef NO_PARTMAN
146 1.4 martin static void
147 1.4 martin remove_menu_option(int menuID, const char *option)
148 1.4 martin {
149 1.4 martin
150 1.4 martin for (int j = 0; j < menu_def[menuID].numopts; j++) {
151 1.4 martin if (menu_def[menuID].opts[j].opt_name == option) {
152 1.4 martin for (int k = j + 1; k < menu_def[menuID].numopts;
153 1.4 martin k++) {
154 1.4 martin menu_def[menuID].opts[k-1] =
155 1.4 martin menu_def[menuID].opts[k];
156 1.4 martin }
157 1.4 martin menu_def[menuID].numopts--;
158 1.4 martin return;
159 1.4 martin
160 1.4 martin }
161 1.4 martin }
162 1.4 martin }
163 1.15 rin #endif
164 1.4 martin
165 1.4 martin void
166 1.4 martin remove_color_options()
167 1.4 martin {
168 1.4 martin /*
169 1.4 martin * Current terminal type does not support colors, so remove all
170 1.4 martin * menu entries (actually that is: Utils/Color Scheme) that do not
171 1.4 martin * make any sense in this case.
172 1.4 martin */
173 1.4 martin remove_sub_menu(MENU_colors);
174 1.4 martin }
175 1.4 martin
176 1.15 rin #ifndef NO_PARTMAN
177 1.4 martin void
178 1.4 martin remove_raid_options()
179 1.4 martin {
180 1.4 martin /*
181 1.4 martin * No raidframe available, remove the following menu entries:
182 1.4 martin */
183 1.4 martin remove_menu_option(MENU_pmdiskentry, MSG_fmtasraid);
184 1.4 martin remove_menu_option(MENU_pmpartentry, MSG_fmtasraid);
185 1.4 martin }
186 1.4 martin
187 1.4 martin void
188 1.4 martin remove_lvm_options()
189 1.4 martin {
190 1.4 martin /*
191 1.4 martin * No LVM available, remove the following menu entries:
192 1.4 martin */
193 1.4 martin remove_menu_option(MENU_pmdiskentry, MSG_fmtaslvm);
194 1.4 martin remove_menu_option(MENU_pmpartentry, MSG_fmtaslvm);
195 1.4 martin }
196 1.4 martin
197 1.4 martin void
198 1.4 martin remove_cgd_options()
199 1.4 martin {
200 1.4 martin /*
201 1.4 martin * No CGD available, remove the following menu entries:
202 1.4 martin */
203 1.4 martin remove_menu_option(MENU_pmdiskentry, MSG_encrypt);
204 1.4 martin remove_menu_option(MENU_pmpartentry, MSG_encrypt);
205 1.4 martin }
206 1.15 rin #endif
207 1.4 martin
208 1.1 dholland }
209 1.1 dholland
210 1.1 dholland default y=12, no exit, scrollable;
211 1.1 dholland
212 1.1 dholland allow dynamic menus;
213 1.1 dholland allow dynamic messages;
214 1.17 martin allow expand;
215 1.17 martin
216 1.1 dholland error action {
217 1.1 dholland fprintf (stderr, "Could not initialize menu system, please check "
218 1.1 dholland "your terminal type.\n");
219 1.1 dholland exit(4);
220 1.1 dholland };
221 1.1 dholland
222 1.17 martin /*
223 1.17 martin * Called with arg = struct single_part_fs_edit*
224 1.17 martin */
225 1.1 dholland menu mountoptions, title MSG_toggle, y=5, x=30, exitstring MSG_unchanged;
226 1.17 martin /*
227 1.17 martin * XXX - enable / disable options depending on FS type in
228 1.17 martin * display action
229 1.17 martin */
230 1.1 dholland option "log", exit, action
231 1.17 martin { struct single_part_fs_edit *edit = arg;
232 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_LOG; };
233 1.1 dholland option "async", exit, action
234 1.17 martin { struct single_part_fs_edit *edit = arg;
235 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_ASYNC; };
236 1.1 dholland option "noatime", exit, action
237 1.17 martin { struct single_part_fs_edit *edit = arg;
238 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NOATIME; };
239 1.1 dholland option "nodev", exit, action
240 1.17 martin { struct single_part_fs_edit *edit = arg;
241 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NODEV; };
242 1.1 dholland option "nodevmtime", exit, action
243 1.17 martin { struct single_part_fs_edit *edit = arg;
244 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NODEVMTIME; };
245 1.1 dholland option "noexec", exit, action
246 1.17 martin { struct single_part_fs_edit *edit = arg;
247 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NOEXEC; };
248 1.1 dholland option "nosuid", exit, action
249 1.17 martin { struct single_part_fs_edit *edit = arg;
250 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NOSUID; };
251 1.17 martin option "noauto", exit, action
252 1.17 martin { struct single_part_fs_edit *edit = arg;
253 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NOAUTO; };
254 1.1 dholland
255 1.1 dholland menu netbsd, title MSG_NetBSD_VERSION_Install_System, y=-1,
256 1.1 dholland exit, exitstring MSG_Exit_Install_System;
257 1.1 dholland display action { toplevel(); };
258 1.1 dholland option MSG_Install_NetBSD_to_hard_disk,
259 1.1 dholland action { do_install(); };
260 1.1 dholland option MSG_Upgrade_NetBSD_on_a_hard_disk,
261 1.1 dholland action { do_upgrade(); };
262 1.1 dholland option MSG_Re_install_sets_or_install_additional_sets,
263 1.19 martin action { do_reinstall_sets(); };
264 1.1 dholland option MSG_Reboot_the_computer, exit,
265 1.1 dholland action (endwin) { system("/sbin/reboot -q"); };
266 1.1 dholland option MSG_Utility_menu, sub menu utility;
267 1.17 martin option MSG_Config_menu, action { do_configmenu(NULL); };
268 1.1 dholland
269 1.1 dholland menu utility, title MSG_NetBSD_VERSION_Utilities, exit,
270 1.2 martin exitstring MSG_exit_menu_generic;
271 1.1 dholland display action { toplevel(); };
272 1.1 dholland option MSG_Run_bin_sh,
273 1.1 dholland action (endwin) { system("/bin/sh"); };
274 1.1 dholland option MSG_Set_timezone,
275 1.1 dholland action { set_timezone(); };
276 1.1 dholland option MSG_Configure_network,
277 1.1 dholland action {
278 1.1 dholland extern int network_up;
279 1.1 dholland network_up = 0;
280 1.1 dholland config_network();
281 1.1 dholland };
282 1.15 rin option MSG_Partition_a_disk,
283 1.15 rin action {
284 1.15 rin #ifndef NO_PARTMAN
285 1.15 rin partman_go = 1;
286 1.15 rin partman();
287 1.15 rin #endif
288 1.15 rin };
289 1.1 dholland option MSG_Logging_functions, action { do_logging(); };
290 1.2 martin option MSG_Color_scheme, sub menu colors;
291 1.1 dholland option MSG_Halt_the_system, exit,
292 1.1 dholland action (endwin) { system("/sbin/halt -q"); };
293 1.1 dholland
294 1.2 martin menu colors, title MSG_Color_scheme, exit,
295 1.2 martin exitstring MSG_exit_menu_generic;
296 1.2 martin option MSG_White_on_black, action { do_coloring(COLOR_WHITE,COLOR_BLACK); };
297 1.2 martin option MSG_Black_on_white, action { do_coloring(COLOR_BLACK,COLOR_WHITE); };
298 1.2 martin option MSG_White_on_blue, action { do_coloring(COLOR_WHITE,COLOR_BLUE); };
299 1.2 martin option MSG_Green_on_black, action { do_coloring(COLOR_GREEN,COLOR_BLACK); };
300 1.2 martin
301 1.2 martin
302 1.1 dholland menu yesno, y=-10;
303 1.9 martin display action { arg_rv *p = arg;
304 1.9 martin menu->title = p->arg ? p->arg : MSG_yes_or_no; };
305 1.9 martin option MSG_Yes, exit, action { ((arg_rv*)arg)->rv = 1; };
306 1.9 martin option MSG_No, exit, action { ((arg_rv*)arg)->rv = 0; };
307 1.1 dholland
308 1.1 dholland menu noyes, y=-10;
309 1.9 martin display action { arg_rv *p = arg;
310 1.9 martin menu->title = p->arg ? p->arg : MSG_yes_or_no; };
311 1.9 martin option MSG_No, exit, action { ((arg_rv*)arg)->rv = 0; };
312 1.9 martin option MSG_Yes, exit, action { ((arg_rv*)arg)->rv = 1; };
313 1.1 dholland
314 1.1 dholland menu ok, no shortcut, y=-10;
315 1.1 dholland display action { menu->title = arg; };
316 1.1 dholland option MSG_Hit_enter_to_continue, exit;
317 1.1 dholland
318 1.1 dholland menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier;
319 1.1 dholland display action {
320 1.2 martin if (sizemult == pm->current_cylsize)
321 1.17 martin menu->cursel = 2;
322 1.1 dholland else if (sizemult == 1)
323 1.17 martin menu->cursel = 3;
324 1.21 martin else if (sizemult == (GIG/pm->sectorsize))
325 1.17 martin menu->cursel = 0;
326 1.17 martin else
327 1.17 martin menu->cursel = 1; };
328 1.21 martin option MSG_Gigabytes, exit, action
329 1.21 martin { set_sizemult(GIG, pm->sectorsize); };
330 1.21 martin option MSG_Megabytes, exit, action
331 1.21 martin { set_sizemult(MEG, pm->sectorsize); };
332 1.21 martin option MSG_Cylinders, exit, action
333 1.21 martin { set_sizemult(pm->current_cylsize*pm->sectorsize, pm->sectorsize); };
334 1.21 martin option MSG_Sectors, exit, action
335 1.21 martin { set_sizemult(pm->sectorsize, pm->sectorsize); };
336 1.17 martin
337 1.17 martin menu ptnsize_replace_existing_partition, sub menu, y=0,
338 1.17 martin title MSG_ptnsize_replace_existing;
339 1.17 martin display action { menu->cursel = 1; };
340 1.17 martin option MSG_Yes, exit, action { *((int*)arg) = 1; };
341 1.17 martin option MSG_cancel, exit, action { *((int*)arg) = 0; };
342 1.1 dholland
343 1.1 dholland menu distmedium, title MSG_Select_medium, y=-5;
344 1.1 dholland option MSG_cdrom, exit, action { *(int *)arg = get_via_cdrom(); };
345 1.14 martin option MSG_http, exit, action { *(int *)arg = get_via_ftp(XFER_HTTP); };
346 1.14 martin option MSG_ftp, exit, action { *(int *)arg = get_via_ftp(XFER_FTP); };
347 1.1 dholland option MSG_nfs, exit, action { *(int *)arg = get_via_nfs(); };
348 1.1 dholland option MSG_floppy, exit, action { *(int *)arg = get_via_floppy(); };
349 1.1 dholland option MSG_local_fs, exit, action { *(int *)arg = get_via_localfs(); };
350 1.1 dholland option MSG_local_dir, exit, action { *(int *)arg = get_via_localdir();};
351 1.1 dholland option MSG_Skip_set, exit, action { *(int *)arg = SET_SKIP; };
352 1.1 dholland option MSG_Skip_group,exit, action { *(int *)arg = SET_SKIP_GROUP; };
353 1.1 dholland option MSG_Abandon, exit, action { *(int *)arg = SET_ABANDON; };
354 1.1 dholland
355 1.3 martin menu distset, title MSG_Select_your_distribution, exit,
356 1.3 martin no default exit, exitstring MSG_Abandon;
357 1.1 dholland display action { msg_display (MSG_distset); };
358 1.2 martin option MSG_Full_installation, exit, action { *(int *)arg = 1; init_set_status(0); };
359 1.2 martin option MSG_Full_installation_nox, exit, action { *(int *)arg = 1; init_set_status(SFLAG_NOX); };
360 1.2 martin option MSG_Minimal_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); };
361 1.2 martin option MSG_Custom_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); customise_sets(); };
362 1.1 dholland
363 1.1 dholland menu ftpsource, y=-4, x=0, w=70, no box, no clear,
364 1.1 dholland exitstring MSG_Get_Distribution;
365 1.22 martin display action {
366 1.22 martin msg_display_subst(MSG_ftpsource, 2, "." SETS_TAR_SUFF,
367 1.22 martin url_proto((uintptr_t)((arg_rv*)arg)->arg));
368 1.22 martin };
369 1.14 martin option {src_legend(menu, MSG_Host, ftp.xfer_host[(uintptr_t)((arg_rv*)arg)->arg]);},
370 1.14 martin action { src_prompt(MSG_Host, ftp.xfer_host[(uintptr_t)((arg_rv*)arg)->arg], sizeof ftp.xfer_host[(uintptr_t)((arg_rv*)arg)->arg]); };
371 1.1 dholland option {src_legend(menu, MSG_Base_dir, ftp.dir);},
372 1.1 dholland action { src_prompt(MSG_Base_dir, ftp.dir, sizeof ftp.dir); };
373 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
374 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
375 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
376 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
377 1.1 dholland option {src_legend(menu, MSG_User, ftp.user);},
378 1.1 dholland action { src_prompt(MSG_User, ftp.user, sizeof ftp.user);
379 1.1 dholland ftp.pass[0] = 0;
380 1.1 dholland };
381 1.1 dholland option {src_legend(menu, MSG_Password,
382 1.1 dholland strcmp(ftp.user, "ftp") == 0 || ftp.pass[0] == 0
383 1.1 dholland ? ftp.pass : msg_string(MSG_hidden));},
384 1.1 dholland action { if (strcmp(ftp.user, "ftp") == 0)
385 1.1 dholland src_prompt(MSG_email, ftp.pass, sizeof ftp.pass);
386 1.1 dholland else {
387 1.1 dholland msg_prompt_noecho(MSG_Password, "",
388 1.1 dholland ftp.pass, sizeof ftp.pass);
389 1.1 dholland }
390 1.1 dholland };
391 1.1 dholland option {src_legend(menu, MSG_Proxy, ftp.proxy);},
392 1.1 dholland action { src_prompt(MSG_Proxy, ftp.proxy, sizeof ftp.proxy);
393 1.1 dholland if (strcmp(ftp.proxy, "") == 0) {
394 1.1 dholland unsetenv("ftp_proxy");
395 1.1 dholland unsetenv("http_proxy");
396 1.1 dholland } else {
397 1.1 dholland setenv("ftp_proxy", ftp.proxy, 1);
398 1.1 dholland setenv("http_proxy", ftp.proxy, 1);
399 1.1 dholland }
400 1.1 dholland };
401 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
402 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
403 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
404 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
405 1.10 martin action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
406 1.2 martin option MSG_Configure_network,
407 1.2 martin action {
408 1.2 martin extern int network_up;
409 1.2 martin network_up = 0;
410 1.2 martin config_network();
411 1.2 martin };
412 1.9 martin option MSG_exit_menu_generic, exit, action { ((arg_rv*)arg)->rv = SET_RETRY; };
413 1.1 dholland
414 1.1 dholland
415 1.1 dholland menu nfssource, y=-4, x=0, w=70, no box, no clear,
416 1.2 martin exitstring MSG_Get_Distribution;
417 1.22 martin display action { const char suff[] = "." SETS_TAR_SUFF;
418 1.22 martin msg_display_subst(MSG_nfssource, 1, &suff); };
419 1.1 dholland option {src_legend(menu, MSG_Host, nfs_host);},
420 1.1 dholland action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); };
421 1.1 dholland option {src_legend(menu, MSG_Base_dir, nfs_dir);},
422 1.1 dholland action { src_prompt(MSG_Base_dir, nfs_dir, sizeof nfs_dir); };
423 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
424 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
425 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
426 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
427 1.2 martin option MSG_Configure_network,
428 1.2 martin action {
429 1.2 martin extern int network_up;
430 1.2 martin network_up = 0;
431 1.2 martin config_network();
432 1.2 martin };
433 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
434 1.1 dholland
435 1.1 dholland menu fdremount, title MSG_What_do_you_want_to_do;
436 1.1 dholland option MSG_Try_again, exit, action { *(int *)arg = SET_CONTINUE; };
437 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
438 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
439 1.1 dholland
440 1.1 dholland menu fdok, title MSG_What_do_you_want_to_do;
441 1.1 dholland option MSG_OK, exit, action { *(int *)arg = SET_CONTINUE; };
442 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
443 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
444 1.1 dholland
445 1.1 dholland menu fd_type, title MSG_fd_type, y=16;
446 1.1 dholland option "msdos", exit, action { fd_type = "msdos"; };
447 1.1 dholland option "ffs", exit, action { fd_type = "ffs"; };
448 1.1 dholland .if ADOS_FLOPPY
449 1.1 dholland option "ados", exit, action { fd_type = "ados"; };
450 1.1 dholland .endif
451 1.1 dholland
452 1.1 dholland menu floppysource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
453 1.1 dholland display action { msg_display(MSG_floppysource); };
454 1.1 dholland option {src_legend(menu, MSG_Device, fd_dev);},
455 1.1 dholland action { src_prompt(MSG_dev, fd_dev, sizeof fd_dev); };
456 1.1 dholland option {src_legend(menu, MSG_fd_type, fd_type);}, sub menu fd_type;
457 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
458 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
459 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
460 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
461 1.10 martin action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
462 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
463 1.1 dholland
464 1.1 dholland menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
465 1.22 martin display action { const char suff[] = "." SETS_TAR_SUFF;
466 1.23 martin msg_display_add_subst(MSG_cdromsource, 1, &suff); };
467 1.1 dholland option {src_legend(menu, MSG_Device, cdrom_dev);},
468 1.1 dholland action { src_prompt(MSG_dev, cdrom_dev, sizeof cdrom_dev); };
469 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
470 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
471 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
472 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
473 1.23 martin option MSG_abort_install, exit, action { *((int*)arg) = SET_ABANDON; };
474 1.23 martin option MSG_source_sel_retry, exit, action { *((int*)arg) = SET_RETRY; };
475 1.1 dholland
476 1.1 dholland menu localfssource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
477 1.22 martin display action { const char suff[] = "." SETS_TAR_SUFF;
478 1.22 martin msg_display_subst(MSG_localfssource, 1, &suff); };
479 1.1 dholland option {src_legend(menu, MSG_Device, localfs_dev);},
480 1.1 dholland action { src_prompt(MSG_dev, localfs_dev, sizeof localfs_dev);};
481 1.1 dholland option {src_legend(menu, MSG_File_system, localfs_fs);},
482 1.1 dholland action { src_prompt(MSG_filesys, localfs_fs, sizeof localfs_fs); };
483 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
484 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, sizeof localfs_dir);};
485 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
486 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
487 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
488 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
489 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
490 1.1 dholland
491 1.1 dholland menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
492 1.22 martin display action { const char suff[] = "." SETS_TAR_SUFF;
493 1.22 martin msg_display_subst(MSG_localdir, 1, &suff); };
494 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
495 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, 60); };
496 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
497 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, 60); };
498 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
499 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, 60); };
500 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
501 1.1 dholland
502 1.6 roy menu namesrv6, title MSG_Select_DNS_server;
503 1.6 roy option "google-public-dns-a.google.com (IPv4)", exit, action
504 1.6 roy {
505 1.6 roy #ifdef INET6
506 1.6 roy strlcpy(net_namesvr, "8.8.8.8",
507 1.6 roy sizeof(net_namesvr));
508 1.9 martin *((int*)arg) = 1;
509 1.6 roy #else
510 1.9 martin *((int*)arg) = 0;
511 1.6 roy #endif
512 1.6 roy };
513 1.6 roy option "google-public-dns-b.google.com (IPv4)", exit, action
514 1.6 roy {
515 1.6 roy #ifdef INET6
516 1.6 roy strlcpy(net_namesvr, "8.8.4.4",
517 1.6 roy sizeof(net_namesvr));
518 1.9 martin *((int*)arg) = 1;
519 1.6 roy #else
520 1.9 martin *((int*)arg) = 0;
521 1.6 roy #endif
522 1.6 roy };
523 1.6 roy option "google-public-dns-a.google.com (IPv6)", exit, action
524 1.1 dholland {
525 1.1 dholland #ifdef INET6
526 1.5 roy strlcpy(net_namesvr, "2001:4860:4860::8888",
527 1.5 roy sizeof(net_namesvr));
528 1.9 martin *((int*)arg) = 1;
529 1.1 dholland #else
530 1.9 martin *((int*)arg) = 0;
531 1.1 dholland #endif
532 1.1 dholland };
533 1.6 roy option "google-public-dns-b.google.com (IPv6)", exit, action
534 1.1 dholland {
535 1.1 dholland #ifdef INET6
536 1.5 roy strlcpy(net_namesvr, "2001:4860:4860::8844",
537 1.5 roy sizeof(net_namesvr));
538 1.9 martin *((int*)arg) = 1;
539 1.1 dholland #else
540 1.9 martin *((int*)arg) = 0;
541 1.1 dholland #endif
542 1.1 dholland };
543 1.1 dholland option MSG_other, exit, action
544 1.9 martin { *((int*)arg) = 0; };
545 1.1 dholland
546 1.1 dholland menu rootsh, title MSG_Root_shell, no clear;
547 1.1 dholland option "/bin/sh", exit, action {*(const char **)arg = "/bin/sh";};
548 1.1 dholland option "/bin/ksh", exit, action {*(const char **)arg = "/bin/ksh";};
549 1.1 dholland option "/bin/csh", exit, action {*(const char **)arg = "/bin/csh";};
550 1.1 dholland
551 1.1 dholland menu zeroconf, title "Zeroconf", no clear;
552 1.1 dholland option "run mdnsd only", exit, action {*(const char **)arg = "mdnsd";};
553 1.1 dholland option "run mdnsd and resolve local names", exit, action {*(const char **) arg = "mdnsd+nsswitch";};
554 1.1 dholland option "do not run mdnsd", exit, action {*(const char **)arg = "No";};
555 1.1 dholland
556 1.1 dholland menu binpkg, y=-4, x=0, w=70, no box, no clear,
557 1.1 dholland exitstring MSG_Install_pkgin;
558 1.1 dholland display action { msg_display(MSG_pkgpath); };
559 1.14 martin option {src_legend(menu, MSG_Host, pkg.xfer_host[pkg.xfer]);},
560 1.14 martin action { src_prompt(MSG_Host, pkg.xfer_host[pkg.xfer], sizeof pkg.xfer_host[pkg.xfer]); };
561 1.1 dholland option {src_legend(menu, MSG_Base_dir, pkg.dir);},
562 1.1 dholland action { src_prompt(MSG_Base_dir, pkg.dir, sizeof pkg.dir); };
563 1.1 dholland option {src_legend(menu, MSG_Pkg_dir, pkg_dir);},
564 1.1 dholland action { src_prompt(MSG_Pkg_dir, pkg_dir, sizeof pkg_dir); };
565 1.1 dholland option {src_legend(menu, MSG_User, pkg.user);},
566 1.1 dholland action { src_prompt(MSG_User, pkg.user, sizeof pkg.user);
567 1.1 dholland pkg.pass[0] = 0;
568 1.1 dholland };
569 1.1 dholland option {src_legend(menu, MSG_Password,
570 1.1 dholland strcmp(pkg.user, "ftp") == 0 || pkg.pass[0] == 0
571 1.1 dholland ? pkg.pass : msg_string(MSG_hidden));},
572 1.1 dholland action { if (strcmp(pkg.user, "ftp") == 0)
573 1.1 dholland src_prompt(MSG_email, pkg.pass, sizeof pkg.pass);
574 1.1 dholland else {
575 1.1 dholland msg_prompt_noecho(MSG_Password, "",
576 1.1 dholland pkg.pass, sizeof pkg.pass);
577 1.1 dholland }
578 1.1 dholland };
579 1.1 dholland option {src_legend(menu, MSG_Proxy, pkg.proxy);},
580 1.1 dholland action { src_prompt(MSG_Proxy, pkg.proxy, sizeof pkg.proxy);
581 1.1 dholland if (strcmp(pkg.proxy, "") == 0) {
582 1.1 dholland unsetenv("ftp_proxy");
583 1.1 dholland unsetenv("http_proxy");
584 1.1 dholland } else {
585 1.1 dholland setenv("ftp_proxy", pkg.proxy, 1);
586 1.1 dholland setenv("http_proxy", pkg.proxy, 1);
587 1.1 dholland }
588 1.1 dholland };
589 1.9 martin option {src_legend(menu, "Additional packages", (char*)(((arg_rv*)arg)->arg)); }, /*TODO*/
590 1.9 martin action { src_prompt("Additional packages", (char*)(((arg_rv*)arg)->arg),
591 1.2 martin sizeof(char) * STRSIZE); };
592 1.2 martin option MSG_Configure_network,
593 1.2 martin action {
594 1.2 martin extern int network_up;
595 1.2 martin network_up = 0;
596 1.2 martin config_network();
597 1.2 martin mnt_net_config();
598 1.2 martin };
599 1.14 martin option {src_legend(menu, MSG_transfer_method, url_proto(pkg.xfer));},
600 1.14 martin action { pkg.xfer = (pkg.xfer+1) % (XFER_MAX+1); };
601 1.9 martin option MSG_quit_pkgs_install, exit, action { ((arg_rv*)arg)->rv = SET_SKIP; };
602 1.1 dholland
603 1.1 dholland menu pkgsrc, y=-4, x=0, w=70, no box, no clear,
604 1.1 dholland exit, exitstring MSG_Install_pkgsrc;
605 1.1 dholland display action { msg_display(MSG_pkgsrc); };
606 1.14 martin option {src_legend(menu, MSG_Host, pkgsrc.xfer_host[pkgsrc.xfer]);},
607 1.14 martin action { src_prompt(MSG_Host, pkgsrc.xfer_host[pkgsrc.xfer],
608 1.14 martin sizeof pkgsrc.xfer_host[pkgsrc.xfer]); };
609 1.1 dholland option {src_legend(menu, MSG_Pkgsrc_dir, pkgsrc_dir);},
610 1.1 dholland action { src_prompt(MSG_Pkgsrc_dir, pkgsrc_dir, sizeof pkgsrc_dir); };
611 1.1 dholland option {src_legend(menu, MSG_User, pkgsrc.user);},
612 1.1 dholland action { src_prompt(MSG_User, pkgsrc.user, sizeof pkgsrc.user);
613 1.1 dholland pkgsrc.pass[0] = 0;
614 1.1 dholland };
615 1.1 dholland option {src_legend(menu, MSG_Password,
616 1.1 dholland strcmp(pkgsrc.user, "ftp") == 0 || pkgsrc.pass[0] == 0
617 1.1 dholland ? pkgsrc.pass : msg_string(MSG_hidden));},
618 1.1 dholland action { if (strcmp(pkgsrc.user, "ftp") == 0)
619 1.1 dholland src_prompt(MSG_email, pkgsrc.pass, sizeof pkgsrc.pass);
620 1.1 dholland else {
621 1.1 dholland msg_prompt_noecho(MSG_Password, "",
622 1.1 dholland pkgsrc.pass, sizeof pkgsrc.pass);
623 1.1 dholland }
624 1.1 dholland };
625 1.1 dholland option {src_legend(menu, MSG_Proxy, pkgsrc.proxy);},
626 1.1 dholland action { src_prompt(MSG_Proxy, pkgsrc.proxy, sizeof pkgsrc.proxy);
627 1.1 dholland if (strcmp(pkgsrc.proxy, "") == 0) {
628 1.1 dholland unsetenv("ftp_proxy");
629 1.1 dholland unsetenv("http_proxy");
630 1.1 dholland } else {
631 1.1 dholland setenv("ftp_proxy", pkgsrc.proxy, 1);
632 1.1 dholland setenv("http_proxy", pkgsrc.proxy, 1);
633 1.1 dholland }
634 1.1 dholland };
635 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
636 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
637 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
638 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
639 1.10 martin action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
640 1.14 martin option {src_legend(menu, MSG_transfer_method, url_proto(pkgsrc.xfer));},
641 1.14 martin action { pkgsrc.xfer = (pkgsrc.xfer+1) % (XFER_MAX+1); };
642 1.9 martin option MSG_quit_pkgsrc, exit, action { *((int*)arg) = SET_SKIP;};
643 1.1 dholland
644 1.1 dholland menu usersh, title MSG_User_shell, no clear;
645 1.1 dholland option "/bin/sh", exit, action { ushell = "/bin/sh";};
646 1.1 dholland option "/bin/ksh", exit, action { ushell = "/bin/ksh";};
647 1.1 dholland option "/bin/csh", exit, action { ushell = "/bin/csh";};
648 1.17 martin
649 1.17 martin menu convertscheme, title MSG_cvtscheme_hdr;
650 1.17 martin option MSG_cvtscheme_keep, exit, action { *(int*)arg = 0; };
651 1.17 martin option MSG_cvtscheme_delete, exit, action { *(int*)arg = 1; };
652 1.17 martin option MSG_cvtscheme_convert, exit, action { *(int*)arg = 2; };
653 1.17 martin option MSG_cvtscheme_abort, exit, action { *(int*)arg = 3; };
654 1.17 martin
655 1.17 martin
656 1.17 martin menu reedit, title MSG_reeditpart, y=-10;
657 1.17 martin expand action { expand_all_option_texts(menu, arg); };
658 1.17 martin option MSG_reedit_partitions, exit,
659 1.17 martin action {((arg_rep_int*)arg)->rv = 1;};
660 1.17 martin option MSG_use_partitions_anyway, exit,
661 1.17 martin action {((arg_rep_int*)arg)->rv = 2;};
662 1.17 martin option MSG_abort_installation, exit,
663 1.17 martin action {((arg_rep_int*)arg)->rv = 0;};
664 1.17 martin
665 1.17 martin
666