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