menus.mi revision 1.17 1 1.17 martin /* $NetBSD: menus.mi,v 1.17 2019/06/12 06:20:17 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_gpt_options()
199 1.4 martin {
200 1.4 martin /*
201 1.4 martin * No GPT available, remove the following menu entries:
202 1.4 martin */
203 1.4 martin remove_menu_option(MENU_pmdiskentry, MSG_switchgpt);
204 1.4 martin remove_menu_option(MENU_pmpartentry, MSG_switchgpt);
205 1.4 martin }
206 1.4 martin
207 1.4 martin void
208 1.4 martin remove_cgd_options()
209 1.4 martin {
210 1.4 martin /*
211 1.4 martin * No CGD available, remove the following menu entries:
212 1.4 martin */
213 1.4 martin remove_menu_option(MENU_pmdiskentry, MSG_encrypt);
214 1.4 martin remove_menu_option(MENU_pmpartentry, MSG_encrypt);
215 1.4 martin }
216 1.15 rin #endif
217 1.4 martin
218 1.1 dholland }
219 1.1 dholland
220 1.1 dholland default y=12, no exit, scrollable;
221 1.1 dholland
222 1.1 dholland allow dynamic menus;
223 1.1 dholland allow dynamic messages;
224 1.17 martin allow expand;
225 1.17 martin
226 1.1 dholland error action {
227 1.1 dholland fprintf (stderr, "Could not initialize menu system, please check "
228 1.1 dholland "your terminal type.\n");
229 1.1 dholland exit(4);
230 1.1 dholland };
231 1.1 dholland
232 1.17 martin /*
233 1.17 martin * Called with arg = struct single_part_fs_edit*
234 1.17 martin */
235 1.1 dholland menu mountoptions, title MSG_toggle, y=5, x=30, exitstring MSG_unchanged;
236 1.17 martin /*
237 1.17 martin * XXX - enable / disable options depending on FS type in
238 1.17 martin * display action
239 1.17 martin */
240 1.1 dholland option "log", exit, action
241 1.17 martin { struct single_part_fs_edit *edit = arg;
242 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_LOG; };
243 1.1 dholland option "async", exit, action
244 1.17 martin { struct single_part_fs_edit *edit = arg;
245 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_ASYNC; };
246 1.1 dholland option "noatime", exit, action
247 1.17 martin { struct single_part_fs_edit *edit = arg;
248 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NOATIME; };
249 1.1 dholland option "nodev", exit, action
250 1.17 martin { struct single_part_fs_edit *edit = arg;
251 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NODEV; };
252 1.1 dholland option "nodevmtime", exit, action
253 1.17 martin { struct single_part_fs_edit *edit = arg;
254 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NODEVMTIME; };
255 1.1 dholland option "noexec", exit, action
256 1.17 martin { struct single_part_fs_edit *edit = arg;
257 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NOEXEC; };
258 1.1 dholland option "nosuid", exit, action
259 1.17 martin { struct single_part_fs_edit *edit = arg;
260 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NOSUID; };
261 1.17 martin option "noauto", exit, action
262 1.17 martin { struct single_part_fs_edit *edit = arg;
263 1.17 martin edit->pset->infos[edit->index].mountflags ^= PUIMNT_NOAUTO; };
264 1.1 dholland
265 1.1 dholland menu netbsd, title MSG_NetBSD_VERSION_Install_System, y=-1,
266 1.1 dholland exit, exitstring MSG_Exit_Install_System;
267 1.1 dholland display action { toplevel(); };
268 1.1 dholland option MSG_Install_NetBSD_to_hard_disk,
269 1.1 dholland action { do_install(); };
270 1.1 dholland option MSG_Upgrade_NetBSD_on_a_hard_disk,
271 1.1 dholland action { do_upgrade(); };
272 1.1 dholland option MSG_Re_install_sets_or_install_additional_sets,
273 1.17 martin action { do_reinstall_sets(NULL); };
274 1.1 dholland option MSG_Reboot_the_computer, exit,
275 1.1 dholland action (endwin) { system("/sbin/reboot -q"); };
276 1.1 dholland option MSG_Utility_menu, sub menu utility;
277 1.17 martin option MSG_Config_menu, action { do_configmenu(NULL); };
278 1.1 dholland
279 1.1 dholland menu utility, title MSG_NetBSD_VERSION_Utilities, exit,
280 1.2 martin exitstring MSG_exit_menu_generic;
281 1.1 dholland display action { toplevel(); };
282 1.1 dholland option MSG_Run_bin_sh,
283 1.1 dholland action (endwin) { system("/bin/sh"); };
284 1.1 dholland option MSG_Set_timezone,
285 1.1 dholland action { set_timezone(); };
286 1.1 dholland option MSG_Configure_network,
287 1.1 dholland action {
288 1.1 dholland extern int network_up;
289 1.1 dholland network_up = 0;
290 1.1 dholland config_network();
291 1.1 dholland };
292 1.15 rin option MSG_Partition_a_disk,
293 1.15 rin action {
294 1.15 rin #ifndef NO_PARTMAN
295 1.15 rin partman_go = 1;
296 1.15 rin partman();
297 1.15 rin #endif
298 1.15 rin };
299 1.1 dholland option MSG_Logging_functions, action { do_logging(); };
300 1.2 martin option MSG_Color_scheme, sub menu colors;
301 1.1 dholland option MSG_Halt_the_system, exit,
302 1.1 dholland action (endwin) { system("/sbin/halt -q"); };
303 1.1 dholland
304 1.2 martin menu colors, title MSG_Color_scheme, exit,
305 1.2 martin exitstring MSG_exit_menu_generic;
306 1.2 martin option MSG_White_on_black, action { do_coloring(COLOR_WHITE,COLOR_BLACK); };
307 1.2 martin option MSG_Black_on_white, action { do_coloring(COLOR_BLACK,COLOR_WHITE); };
308 1.2 martin option MSG_White_on_blue, action { do_coloring(COLOR_WHITE,COLOR_BLUE); };
309 1.2 martin option MSG_Green_on_black, action { do_coloring(COLOR_GREEN,COLOR_BLACK); };
310 1.2 martin
311 1.2 martin
312 1.1 dholland menu yesno, y=-10;
313 1.9 martin display action { arg_rv *p = arg;
314 1.9 martin menu->title = p->arg ? p->arg : MSG_yes_or_no; };
315 1.9 martin option MSG_Yes, exit, action { ((arg_rv*)arg)->rv = 1; };
316 1.9 martin option MSG_No, exit, action { ((arg_rv*)arg)->rv = 0; };
317 1.1 dholland
318 1.1 dholland menu noyes, y=-10;
319 1.9 martin display action { arg_rv *p = arg;
320 1.9 martin menu->title = p->arg ? p->arg : MSG_yes_or_no; };
321 1.9 martin option MSG_No, exit, action { ((arg_rv*)arg)->rv = 0; };
322 1.9 martin option MSG_Yes, exit, action { ((arg_rv*)arg)->rv = 1; };
323 1.1 dholland
324 1.1 dholland menu ok, no shortcut, y=-10;
325 1.1 dholland display action { menu->title = arg; };
326 1.1 dholland option MSG_Hit_enter_to_continue, exit;
327 1.1 dholland
328 1.1 dholland menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier;
329 1.1 dholland display action {
330 1.2 martin if (sizemult == pm->current_cylsize)
331 1.17 martin menu->cursel = 2;
332 1.1 dholland else if (sizemult == 1)
333 1.17 martin menu->cursel = 3;
334 1.17 martin else if (sizemult == (GIG/512))
335 1.17 martin menu->cursel = 0;
336 1.17 martin else
337 1.17 martin menu->cursel = 1; };
338 1.17 martin option MSG_Gigabytes, exit, action { set_sizemult(GIG/512); };
339 1.17 martin option MSG_Megabytes, exit, action { set_sizemult(MEG/512); };
340 1.17 martin option MSG_Cylinders, exit, action { set_sizemult(pm->current_cylsize); };
341 1.17 martin option MSG_Sectors, exit, action { set_sizemult(1); };
342 1.17 martin
343 1.17 martin menu ptnsize_replace_existing_partition, sub menu, y=0,
344 1.17 martin title MSG_ptnsize_replace_existing;
345 1.17 martin display action { menu->cursel = 1; };
346 1.17 martin option MSG_Yes, exit, action { *((int*)arg) = 1; };
347 1.17 martin option MSG_cancel, exit, action { *((int*)arg) = 0; };
348 1.1 dholland
349 1.1 dholland menu distmedium, title MSG_Select_medium, y=-5;
350 1.1 dholland option MSG_cdrom, exit, action { *(int *)arg = get_via_cdrom(); };
351 1.14 martin option MSG_http, exit, action { *(int *)arg = get_via_ftp(XFER_HTTP); };
352 1.14 martin option MSG_ftp, exit, action { *(int *)arg = get_via_ftp(XFER_FTP); };
353 1.1 dholland option MSG_nfs, exit, action { *(int *)arg = get_via_nfs(); };
354 1.1 dholland option MSG_floppy, exit, action { *(int *)arg = get_via_floppy(); };
355 1.1 dholland option MSG_local_fs, exit, action { *(int *)arg = get_via_localfs(); };
356 1.1 dholland option MSG_local_dir, exit, action { *(int *)arg = get_via_localdir();};
357 1.1 dholland option MSG_Skip_set, exit, action { *(int *)arg = SET_SKIP; };
358 1.1 dholland option MSG_Skip_group,exit, action { *(int *)arg = SET_SKIP_GROUP; };
359 1.1 dholland option MSG_Abandon, exit, action { *(int *)arg = SET_ABANDON; };
360 1.1 dholland
361 1.3 martin menu distset, title MSG_Select_your_distribution, exit,
362 1.3 martin no default exit, exitstring MSG_Abandon;
363 1.1 dholland display action { msg_display (MSG_distset); };
364 1.2 martin option MSG_Full_installation, exit, action { *(int *)arg = 1; init_set_status(0); };
365 1.2 martin option MSG_Full_installation_nox, exit, action { *(int *)arg = 1; init_set_status(SFLAG_NOX); };
366 1.2 martin option MSG_Minimal_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); };
367 1.2 martin option MSG_Custom_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); customise_sets(); };
368 1.1 dholland
369 1.1 dholland menu ftpsource, y=-4, x=0, w=70, no box, no clear,
370 1.1 dholland exitstring MSG_Get_Distribution;
371 1.14 martin display action { msg_display(MSG_ftpsource, url_proto((uintptr_t)((arg_rv*)arg)->arg)); };
372 1.14 martin option {src_legend(menu, MSG_Host, ftp.xfer_host[(uintptr_t)((arg_rv*)arg)->arg]);},
373 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]); };
374 1.1 dholland option {src_legend(menu, MSG_Base_dir, ftp.dir);},
375 1.1 dholland action { src_prompt(MSG_Base_dir, ftp.dir, sizeof ftp.dir); };
376 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
377 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
378 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
379 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
380 1.1 dholland option {src_legend(menu, MSG_User, ftp.user);},
381 1.1 dholland action { src_prompt(MSG_User, ftp.user, sizeof ftp.user);
382 1.1 dholland ftp.pass[0] = 0;
383 1.1 dholland };
384 1.1 dholland option {src_legend(menu, MSG_Password,
385 1.1 dholland strcmp(ftp.user, "ftp") == 0 || ftp.pass[0] == 0
386 1.1 dholland ? ftp.pass : msg_string(MSG_hidden));},
387 1.1 dholland action { if (strcmp(ftp.user, "ftp") == 0)
388 1.1 dholland src_prompt(MSG_email, ftp.pass, sizeof ftp.pass);
389 1.1 dholland else {
390 1.1 dholland msg_prompt_noecho(MSG_Password, "",
391 1.1 dholland ftp.pass, sizeof ftp.pass);
392 1.1 dholland }
393 1.1 dholland };
394 1.1 dholland option {src_legend(menu, MSG_Proxy, ftp.proxy);},
395 1.1 dholland action { src_prompt(MSG_Proxy, ftp.proxy, sizeof ftp.proxy);
396 1.1 dholland if (strcmp(ftp.proxy, "") == 0) {
397 1.1 dholland unsetenv("ftp_proxy");
398 1.1 dholland unsetenv("http_proxy");
399 1.1 dholland } else {
400 1.1 dholland setenv("ftp_proxy", ftp.proxy, 1);
401 1.1 dholland setenv("http_proxy", ftp.proxy, 1);
402 1.1 dholland }
403 1.1 dholland };
404 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
405 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
406 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
407 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
408 1.10 martin action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
409 1.2 martin option MSG_Configure_network,
410 1.2 martin action {
411 1.2 martin extern int network_up;
412 1.2 martin network_up = 0;
413 1.2 martin config_network();
414 1.2 martin };
415 1.9 martin option MSG_exit_menu_generic, exit, action { ((arg_rv*)arg)->rv = SET_RETRY; };
416 1.1 dholland
417 1.1 dholland
418 1.1 dholland menu nfssource, y=-4, x=0, w=70, no box, no clear,
419 1.2 martin exitstring MSG_Get_Distribution;
420 1.1 dholland display action { msg_display(MSG_nfssource); };
421 1.1 dholland option {src_legend(menu, MSG_Host, nfs_host);},
422 1.1 dholland action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); };
423 1.1 dholland option {src_legend(menu, MSG_Base_dir, nfs_dir);},
424 1.1 dholland action { src_prompt(MSG_Base_dir, nfs_dir, sizeof nfs_dir); };
425 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
426 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
427 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
428 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
429 1.2 martin option MSG_Configure_network,
430 1.2 martin action {
431 1.2 martin extern int network_up;
432 1.2 martin network_up = 0;
433 1.2 martin config_network();
434 1.2 martin };
435 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
436 1.1 dholland
437 1.1 dholland menu fdremount, title MSG_What_do_you_want_to_do;
438 1.1 dholland option MSG_Try_again, exit, action { *(int *)arg = SET_CONTINUE; };
439 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
440 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
441 1.1 dholland
442 1.1 dholland menu fdok, title MSG_What_do_you_want_to_do;
443 1.1 dholland option MSG_OK, exit, action { *(int *)arg = SET_CONTINUE; };
444 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
445 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
446 1.1 dholland
447 1.1 dholland menu fd_type, title MSG_fd_type, y=16;
448 1.1 dholland option "msdos", exit, action { fd_type = "msdos"; };
449 1.1 dholland option "ffs", exit, action { fd_type = "ffs"; };
450 1.1 dholland .if ADOS_FLOPPY
451 1.1 dholland option "ados", exit, action { fd_type = "ados"; };
452 1.1 dholland .endif
453 1.1 dholland
454 1.1 dholland menu floppysource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
455 1.1 dholland display action { msg_display(MSG_floppysource); };
456 1.1 dholland option {src_legend(menu, MSG_Device, fd_dev);},
457 1.1 dholland action { src_prompt(MSG_dev, fd_dev, sizeof fd_dev); };
458 1.1 dholland option {src_legend(menu, MSG_fd_type, fd_type);}, sub menu fd_type;
459 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
460 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
461 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
462 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
463 1.10 martin action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
464 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
465 1.1 dholland
466 1.1 dholland menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
467 1.1 dholland display action { msg_display(MSG_cdromsource); };
468 1.1 dholland option {src_legend(menu, MSG_Device, cdrom_dev);},
469 1.1 dholland action { src_prompt(MSG_dev, cdrom_dev, sizeof cdrom_dev); };
470 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
471 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
472 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
473 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
474 1.9 martin option MSG_exit_menu_generic, 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.1 dholland display action { msg_display(MSG_localfssource); };
478 1.1 dholland option {src_legend(menu, MSG_Device, localfs_dev);},
479 1.1 dholland action { src_prompt(MSG_dev, localfs_dev, sizeof localfs_dev);};
480 1.1 dholland option {src_legend(menu, MSG_File_system, localfs_fs);},
481 1.1 dholland action { src_prompt(MSG_filesys, localfs_fs, sizeof localfs_fs); };
482 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
483 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, sizeof localfs_dir);};
484 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
485 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
486 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
487 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
488 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
489 1.1 dholland
490 1.1 dholland menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
491 1.1 dholland display action { msg_display(MSG_localdir); };
492 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
493 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, 60); };
494 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
495 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, 60); };
496 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
497 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, 60); };
498 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
499 1.1 dholland
500 1.6 roy menu namesrv6, title MSG_Select_DNS_server;
501 1.6 roy option "google-public-dns-a.google.com (IPv4)", exit, action
502 1.6 roy {
503 1.6 roy #ifdef INET6
504 1.6 roy strlcpy(net_namesvr, "8.8.8.8",
505 1.6 roy sizeof(net_namesvr));
506 1.9 martin *((int*)arg) = 1;
507 1.6 roy #else
508 1.9 martin *((int*)arg) = 0;
509 1.6 roy #endif
510 1.6 roy };
511 1.6 roy option "google-public-dns-b.google.com (IPv4)", exit, action
512 1.6 roy {
513 1.6 roy #ifdef INET6
514 1.6 roy strlcpy(net_namesvr, "8.8.4.4",
515 1.6 roy sizeof(net_namesvr));
516 1.9 martin *((int*)arg) = 1;
517 1.6 roy #else
518 1.9 martin *((int*)arg) = 0;
519 1.6 roy #endif
520 1.6 roy };
521 1.6 roy option "google-public-dns-a.google.com (IPv6)", exit, action
522 1.1 dholland {
523 1.1 dholland #ifdef INET6
524 1.5 roy strlcpy(net_namesvr, "2001:4860:4860::8888",
525 1.5 roy sizeof(net_namesvr));
526 1.9 martin *((int*)arg) = 1;
527 1.1 dholland #else
528 1.9 martin *((int*)arg) = 0;
529 1.1 dholland #endif
530 1.1 dholland };
531 1.6 roy option "google-public-dns-b.google.com (IPv6)", exit, action
532 1.1 dholland {
533 1.1 dholland #ifdef INET6
534 1.5 roy strlcpy(net_namesvr, "2001:4860:4860::8844",
535 1.5 roy sizeof(net_namesvr));
536 1.9 martin *((int*)arg) = 1;
537 1.1 dholland #else
538 1.9 martin *((int*)arg) = 0;
539 1.1 dholland #endif
540 1.1 dholland };
541 1.1 dholland option MSG_other, exit, action
542 1.9 martin { *((int*)arg) = 0; };
543 1.1 dholland
544 1.1 dholland menu rootsh, title MSG_Root_shell, no clear;
545 1.1 dholland option "/bin/sh", exit, action {*(const char **)arg = "/bin/sh";};
546 1.1 dholland option "/bin/ksh", exit, action {*(const char **)arg = "/bin/ksh";};
547 1.1 dholland option "/bin/csh", exit, action {*(const char **)arg = "/bin/csh";};
548 1.1 dholland
549 1.1 dholland menu zeroconf, title "Zeroconf", no clear;
550 1.1 dholland option "run mdnsd only", exit, action {*(const char **)arg = "mdnsd";};
551 1.1 dholland option "run mdnsd and resolve local names", exit, action {*(const char **) arg = "mdnsd+nsswitch";};
552 1.1 dholland option "do not run mdnsd", exit, action {*(const char **)arg = "No";};
553 1.1 dholland
554 1.1 dholland menu binpkg, y=-4, x=0, w=70, no box, no clear,
555 1.1 dholland exitstring MSG_Install_pkgin;
556 1.1 dholland display action { msg_display(MSG_pkgpath); };
557 1.14 martin option {src_legend(menu, MSG_Host, pkg.xfer_host[pkg.xfer]);},
558 1.14 martin action { src_prompt(MSG_Host, pkg.xfer_host[pkg.xfer], sizeof pkg.xfer_host[pkg.xfer]); };
559 1.1 dholland option {src_legend(menu, MSG_Base_dir, pkg.dir);},
560 1.1 dholland action { src_prompt(MSG_Base_dir, pkg.dir, sizeof pkg.dir); };
561 1.1 dholland option {src_legend(menu, MSG_Pkg_dir, pkg_dir);},
562 1.1 dholland action { src_prompt(MSG_Pkg_dir, pkg_dir, sizeof pkg_dir); };
563 1.1 dholland option {src_legend(menu, MSG_User, pkg.user);},
564 1.1 dholland action { src_prompt(MSG_User, pkg.user, sizeof pkg.user);
565 1.1 dholland pkg.pass[0] = 0;
566 1.1 dholland };
567 1.1 dholland option {src_legend(menu, MSG_Password,
568 1.1 dholland strcmp(pkg.user, "ftp") == 0 || pkg.pass[0] == 0
569 1.1 dholland ? pkg.pass : msg_string(MSG_hidden));},
570 1.1 dholland action { if (strcmp(pkg.user, "ftp") == 0)
571 1.1 dholland src_prompt(MSG_email, pkg.pass, sizeof pkg.pass);
572 1.1 dholland else {
573 1.1 dholland msg_prompt_noecho(MSG_Password, "",
574 1.1 dholland pkg.pass, sizeof pkg.pass);
575 1.1 dholland }
576 1.1 dholland };
577 1.1 dholland option {src_legend(menu, MSG_Proxy, pkg.proxy);},
578 1.1 dholland action { src_prompt(MSG_Proxy, pkg.proxy, sizeof pkg.proxy);
579 1.1 dholland if (strcmp(pkg.proxy, "") == 0) {
580 1.1 dholland unsetenv("ftp_proxy");
581 1.1 dholland unsetenv("http_proxy");
582 1.1 dholland } else {
583 1.1 dholland setenv("ftp_proxy", pkg.proxy, 1);
584 1.1 dholland setenv("http_proxy", pkg.proxy, 1);
585 1.1 dholland }
586 1.1 dholland };
587 1.9 martin option {src_legend(menu, "Additional packages", (char*)(((arg_rv*)arg)->arg)); }, /*TODO*/
588 1.9 martin action { src_prompt("Additional packages", (char*)(((arg_rv*)arg)->arg),
589 1.2 martin sizeof(char) * STRSIZE); };
590 1.2 martin option MSG_Configure_network,
591 1.2 martin action {
592 1.2 martin extern int network_up;
593 1.2 martin network_up = 0;
594 1.2 martin config_network();
595 1.2 martin mnt_net_config();
596 1.2 martin };
597 1.14 martin option {src_legend(menu, MSG_transfer_method, url_proto(pkg.xfer));},
598 1.14 martin action { pkg.xfer = (pkg.xfer+1) % (XFER_MAX+1); };
599 1.9 martin option MSG_quit_pkgs_install, exit, action { ((arg_rv*)arg)->rv = SET_SKIP; };
600 1.1 dholland
601 1.1 dholland menu pkgsrc, y=-4, x=0, w=70, no box, no clear,
602 1.1 dholland exit, exitstring MSG_Install_pkgsrc;
603 1.1 dholland display action { msg_display(MSG_pkgsrc); };
604 1.14 martin option {src_legend(menu, MSG_Host, pkgsrc.xfer_host[pkgsrc.xfer]);},
605 1.14 martin action { src_prompt(MSG_Host, pkgsrc.xfer_host[pkgsrc.xfer],
606 1.14 martin sizeof pkgsrc.xfer_host[pkgsrc.xfer]); };
607 1.1 dholland option {src_legend(menu, MSG_Pkgsrc_dir, pkgsrc_dir);},
608 1.1 dholland action { src_prompt(MSG_Pkgsrc_dir, pkgsrc_dir, sizeof pkgsrc_dir); };
609 1.1 dholland option {src_legend(menu, MSG_User, pkgsrc.user);},
610 1.1 dholland action { src_prompt(MSG_User, pkgsrc.user, sizeof pkgsrc.user);
611 1.1 dholland pkgsrc.pass[0] = 0;
612 1.1 dholland };
613 1.1 dholland option {src_legend(menu, MSG_Password,
614 1.1 dholland strcmp(pkgsrc.user, "ftp") == 0 || pkgsrc.pass[0] == 0
615 1.1 dholland ? pkgsrc.pass : msg_string(MSG_hidden));},
616 1.1 dholland action { if (strcmp(pkgsrc.user, "ftp") == 0)
617 1.1 dholland src_prompt(MSG_email, pkgsrc.pass, sizeof pkgsrc.pass);
618 1.1 dholland else {
619 1.1 dholland msg_prompt_noecho(MSG_Password, "",
620 1.1 dholland pkgsrc.pass, sizeof pkgsrc.pass);
621 1.1 dholland }
622 1.1 dholland };
623 1.1 dholland option {src_legend(menu, MSG_Proxy, pkgsrc.proxy);},
624 1.1 dholland action { src_prompt(MSG_Proxy, pkgsrc.proxy, sizeof pkgsrc.proxy);
625 1.1 dholland if (strcmp(pkgsrc.proxy, "") == 0) {
626 1.1 dholland unsetenv("ftp_proxy");
627 1.1 dholland unsetenv("http_proxy");
628 1.1 dholland } else {
629 1.1 dholland setenv("ftp_proxy", pkgsrc.proxy, 1);
630 1.1 dholland setenv("http_proxy", pkgsrc.proxy, 1);
631 1.1 dholland }
632 1.1 dholland };
633 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
634 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
635 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
636 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
637 1.10 martin action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
638 1.14 martin option {src_legend(menu, MSG_transfer_method, url_proto(pkgsrc.xfer));},
639 1.14 martin action { pkgsrc.xfer = (pkgsrc.xfer+1) % (XFER_MAX+1); };
640 1.9 martin option MSG_quit_pkgsrc, exit, action { *((int*)arg) = SET_SKIP;};
641 1.1 dholland
642 1.1 dholland menu usersh, title MSG_User_shell, no clear;
643 1.1 dholland option "/bin/sh", exit, action { ushell = "/bin/sh";};
644 1.1 dholland option "/bin/ksh", exit, action { ushell = "/bin/ksh";};
645 1.1 dholland option "/bin/csh", exit, action { ushell = "/bin/csh";};
646 1.17 martin
647 1.17 martin menu convertscheme, title MSG_cvtscheme_hdr;
648 1.17 martin option MSG_cvtscheme_keep, exit, action { *(int*)arg = 0; };
649 1.17 martin option MSG_cvtscheme_delete, exit, action { *(int*)arg = 1; };
650 1.17 martin option MSG_cvtscheme_convert, exit, action { *(int*)arg = 2; };
651 1.17 martin option MSG_cvtscheme_abort, exit, action { *(int*)arg = 3; };
652 1.17 martin
653 1.17 martin
654 1.17 martin menu reedit, title MSG_reeditpart, y=-10;
655 1.17 martin expand action { expand_all_option_texts(menu, arg); };
656 1.17 martin option MSG_reedit_partitions, exit,
657 1.17 martin action {((arg_rep_int*)arg)->rv = 1;};
658 1.17 martin option MSG_use_partitions_anyway, exit,
659 1.17 martin action {((arg_rep_int*)arg)->rv = 2;};
660 1.17 martin option MSG_abort_installation, exit,
661 1.17 martin action {((arg_rep_int*)arg)->rv = 0;};
662 1.17 martin
663 1.17 martin
664