menus.mi revision 1.29 1 1.29 martin /* $NetBSD: menus.mi,v 1.29 2023/12/17 18:46:42 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.28 abs action (endwin) { system("/bin/sh -i -E"); };
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.25 martin config_network(1);
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.26 martin partman(NULL);
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.29 martin option {src_legend(menu, MSG_Host, ftp.xfer_host[
370 1.29 martin XFER_HOST((uintptr_t)((arg_rv*)arg)->arg)]);},
371 1.29 martin action { src_prompt(MSG_Host, ftp.xfer_host[
372 1.29 martin XFER_HOST((uintptr_t)((arg_rv*)arg)->arg)],
373 1.29 martin sizeof ftp.xfer_host[XFER_HOST(
374 1.29 martin (uintptr_t)((arg_rv*)arg)->arg)]); };
375 1.1 dholland option {src_legend(menu, MSG_Base_dir, ftp.dir);},
376 1.1 dholland action { src_prompt(MSG_Base_dir, ftp.dir, sizeof ftp.dir); };
377 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
378 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
379 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
380 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
381 1.27 christos option {src_legend(menu, MSG_Dist_postfix, dist_postfix);},
382 1.27 christos action { src_prompt(MSG_Dist_postfix, dist_postfix, sizeof dist_postfix); };
383 1.1 dholland option {src_legend(menu, MSG_User, ftp.user);},
384 1.1 dholland action { src_prompt(MSG_User, ftp.user, sizeof ftp.user);
385 1.1 dholland ftp.pass[0] = 0;
386 1.1 dholland };
387 1.1 dholland option {src_legend(menu, MSG_Password,
388 1.1 dholland strcmp(ftp.user, "ftp") == 0 || ftp.pass[0] == 0
389 1.1 dholland ? ftp.pass : msg_string(MSG_hidden));},
390 1.1 dholland action { if (strcmp(ftp.user, "ftp") == 0)
391 1.1 dholland src_prompt(MSG_email, ftp.pass, sizeof ftp.pass);
392 1.1 dholland else {
393 1.1 dholland msg_prompt_noecho(MSG_Password, "",
394 1.1 dholland ftp.pass, sizeof ftp.pass);
395 1.1 dholland }
396 1.1 dholland };
397 1.1 dholland option {src_legend(menu, MSG_Proxy, ftp.proxy);},
398 1.1 dholland action { src_prompt(MSG_Proxy, ftp.proxy, sizeof ftp.proxy);
399 1.1 dholland if (strcmp(ftp.proxy, "") == 0) {
400 1.1 dholland unsetenv("ftp_proxy");
401 1.1 dholland unsetenv("http_proxy");
402 1.1 dholland } else {
403 1.1 dholland setenv("ftp_proxy", ftp.proxy, 1);
404 1.1 dholland setenv("http_proxy", ftp.proxy, 1);
405 1.1 dholland }
406 1.1 dholland };
407 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
408 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
409 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
410 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
411 1.10 martin action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
412 1.2 martin option MSG_Configure_network,
413 1.2 martin action {
414 1.2 martin extern int network_up;
415 1.2 martin network_up = 0;
416 1.25 martin config_network(1);
417 1.2 martin };
418 1.9 martin option MSG_exit_menu_generic, exit, action { ((arg_rv*)arg)->rv = SET_RETRY; };
419 1.1 dholland
420 1.1 dholland
421 1.1 dholland menu nfssource, y=-4, x=0, w=70, no box, no clear,
422 1.2 martin exitstring MSG_Get_Distribution;
423 1.22 martin display action { const char suff[] = "." SETS_TAR_SUFF;
424 1.22 martin msg_display_subst(MSG_nfssource, 1, &suff); };
425 1.1 dholland option {src_legend(menu, MSG_Host, nfs_host);},
426 1.1 dholland action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); };
427 1.1 dholland option {src_legend(menu, MSG_Base_dir, nfs_dir);},
428 1.1 dholland action { src_prompt(MSG_Base_dir, nfs_dir, sizeof nfs_dir); };
429 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
430 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
431 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
432 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
433 1.27 christos option {src_legend(menu, MSG_Dist_postfix, dist_postfix);},
434 1.27 christos action { src_prompt(MSG_Dist_postfix, dist_postfix, sizeof dist_postfix); };
435 1.2 martin option MSG_Configure_network,
436 1.2 martin action {
437 1.2 martin extern int network_up;
438 1.2 martin network_up = 0;
439 1.25 martin config_network(1);
440 1.2 martin };
441 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
442 1.1 dholland
443 1.1 dholland menu fdremount, title MSG_What_do_you_want_to_do;
444 1.1 dholland option MSG_Try_again, exit, action { *(int *)arg = SET_CONTINUE; };
445 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
446 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
447 1.1 dholland
448 1.1 dholland menu fdok, title MSG_What_do_you_want_to_do;
449 1.1 dholland option MSG_OK, exit, action { *(int *)arg = SET_CONTINUE; };
450 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
451 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
452 1.1 dholland
453 1.1 dholland menu fd_type, title MSG_fd_type, y=16;
454 1.1 dholland option "msdos", exit, action { fd_type = "msdos"; };
455 1.1 dholland option "ffs", exit, action { fd_type = "ffs"; };
456 1.1 dholland .if ADOS_FLOPPY
457 1.1 dholland option "ados", exit, action { fd_type = "ados"; };
458 1.1 dholland .endif
459 1.1 dholland
460 1.1 dholland menu floppysource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
461 1.1 dholland display action { msg_display(MSG_floppysource); };
462 1.1 dholland option {src_legend(menu, MSG_Device, fd_dev);},
463 1.1 dholland action { src_prompt(MSG_dev, fd_dev, sizeof fd_dev); };
464 1.1 dholland option {src_legend(menu, MSG_fd_type, fd_type);}, sub menu fd_type;
465 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
466 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
467 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
468 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
469 1.10 martin action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
470 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
471 1.1 dholland
472 1.1 dholland menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
473 1.22 martin display action { const char suff[] = "." SETS_TAR_SUFF;
474 1.23 martin msg_display_add_subst(MSG_cdromsource, 1, &suff); };
475 1.1 dholland option {src_legend(menu, MSG_Device, cdrom_dev);},
476 1.1 dholland action { src_prompt(MSG_dev, cdrom_dev, sizeof cdrom_dev); };
477 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
478 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
479 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
480 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
481 1.27 christos option {src_legend(menu, MSG_Dist_postfix, dist_postfix);},
482 1.27 christos action { src_prompt(MSG_Dist_postfix, dist_postfix, sizeof dist_postfix); };
483 1.23 martin option MSG_abort_install, exit, action { *((int*)arg) = SET_ABANDON; };
484 1.23 martin option MSG_source_sel_retry, exit, action { *((int*)arg) = SET_RETRY; };
485 1.1 dholland
486 1.1 dholland menu localfssource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
487 1.22 martin display action { const char suff[] = "." SETS_TAR_SUFF;
488 1.22 martin msg_display_subst(MSG_localfssource, 1, &suff); };
489 1.1 dholland option {src_legend(menu, MSG_Device, localfs_dev);},
490 1.1 dholland action { src_prompt(MSG_dev, localfs_dev, sizeof localfs_dev);};
491 1.1 dholland option {src_legend(menu, MSG_File_system, localfs_fs);},
492 1.1 dholland action { src_prompt(MSG_filesys, localfs_fs, sizeof localfs_fs); };
493 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
494 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, sizeof localfs_dir);};
495 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
496 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
497 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
498 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
499 1.27 christos option {src_legend(menu, MSG_Dist_postfix, dist_postfix);},
500 1.27 christos action { src_prompt(MSG_Dist_postfix, dist_postfix, sizeof dist_postfix); };
501 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
502 1.1 dholland
503 1.1 dholland menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
504 1.22 martin display action { const char suff[] = "." SETS_TAR_SUFF;
505 1.22 martin msg_display_subst(MSG_localdir, 1, &suff); };
506 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
507 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, 60); };
508 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
509 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, 60); };
510 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
511 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, 60); };
512 1.27 christos option {src_legend(menu, MSG_Dist_postfix, dist_postfix);},
513 1.27 christos action { src_prompt(MSG_Dist_postfix, dist_postfix, 60); };
514 1.9 martin option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
515 1.1 dholland
516 1.6 roy menu namesrv6, title MSG_Select_DNS_server;
517 1.6 roy option "google-public-dns-a.google.com (IPv4)", exit, action
518 1.6 roy {
519 1.6 roy #ifdef INET6
520 1.6 roy strlcpy(net_namesvr, "8.8.8.8",
521 1.6 roy sizeof(net_namesvr));
522 1.9 martin *((int*)arg) = 1;
523 1.6 roy #else
524 1.9 martin *((int*)arg) = 0;
525 1.6 roy #endif
526 1.6 roy };
527 1.6 roy option "google-public-dns-b.google.com (IPv4)", exit, action
528 1.6 roy {
529 1.6 roy #ifdef INET6
530 1.6 roy strlcpy(net_namesvr, "8.8.4.4",
531 1.6 roy sizeof(net_namesvr));
532 1.9 martin *((int*)arg) = 1;
533 1.6 roy #else
534 1.9 martin *((int*)arg) = 0;
535 1.6 roy #endif
536 1.6 roy };
537 1.6 roy option "google-public-dns-a.google.com (IPv6)", exit, action
538 1.1 dholland {
539 1.1 dholland #ifdef INET6
540 1.5 roy strlcpy(net_namesvr, "2001:4860:4860::8888",
541 1.5 roy sizeof(net_namesvr));
542 1.9 martin *((int*)arg) = 1;
543 1.1 dholland #else
544 1.9 martin *((int*)arg) = 0;
545 1.1 dholland #endif
546 1.1 dholland };
547 1.6 roy option "google-public-dns-b.google.com (IPv6)", exit, action
548 1.1 dholland {
549 1.1 dholland #ifdef INET6
550 1.5 roy strlcpy(net_namesvr, "2001:4860:4860::8844",
551 1.5 roy sizeof(net_namesvr));
552 1.9 martin *((int*)arg) = 1;
553 1.1 dholland #else
554 1.9 martin *((int*)arg) = 0;
555 1.1 dholland #endif
556 1.1 dholland };
557 1.1 dholland option MSG_other, exit, action
558 1.9 martin { *((int*)arg) = 0; };
559 1.1 dholland
560 1.1 dholland menu rootsh, title MSG_Root_shell, no clear;
561 1.1 dholland option "/bin/sh", exit, action {*(const char **)arg = "/bin/sh";};
562 1.1 dholland option "/bin/ksh", exit, action {*(const char **)arg = "/bin/ksh";};
563 1.1 dholland option "/bin/csh", exit, action {*(const char **)arg = "/bin/csh";};
564 1.1 dholland
565 1.1 dholland menu zeroconf, title "Zeroconf", no clear;
566 1.1 dholland option "run mdnsd only", exit, action {*(const char **)arg = "mdnsd";};
567 1.1 dholland option "run mdnsd and resolve local names", exit, action {*(const char **) arg = "mdnsd+nsswitch";};
568 1.1 dholland option "do not run mdnsd", exit, action {*(const char **)arg = "No";};
569 1.1 dholland
570 1.1 dholland menu binpkg, y=-4, x=0, w=70, no box, no clear,
571 1.1 dholland exitstring MSG_Install_pkgin;
572 1.1 dholland display action { msg_display(MSG_pkgpath); };
573 1.29 martin option {src_legend(menu, MSG_Host,
574 1.29 martin pkg.xfer_host[XFER_HOST(pkg.xfer)]);},
575 1.29 martin action { src_prompt(MSG_Host,
576 1.29 martin pkg.xfer_host[XFER_HOST(pkg.xfer)],
577 1.29 martin sizeof pkg.xfer_host[XFER_HOST(pkg.xfer)]); };
578 1.1 dholland option {src_legend(menu, MSG_Base_dir, pkg.dir);},
579 1.1 dholland action { src_prompt(MSG_Base_dir, pkg.dir, sizeof pkg.dir); };
580 1.1 dholland option {src_legend(menu, MSG_Pkg_dir, pkg_dir);},
581 1.1 dholland action { src_prompt(MSG_Pkg_dir, pkg_dir, sizeof pkg_dir); };
582 1.1 dholland option {src_legend(menu, MSG_User, pkg.user);},
583 1.1 dholland action { src_prompt(MSG_User, pkg.user, sizeof pkg.user);
584 1.1 dholland pkg.pass[0] = 0;
585 1.1 dholland };
586 1.1 dholland option {src_legend(menu, MSG_Password,
587 1.1 dholland strcmp(pkg.user, "ftp") == 0 || pkg.pass[0] == 0
588 1.1 dholland ? pkg.pass : msg_string(MSG_hidden));},
589 1.1 dholland action { if (strcmp(pkg.user, "ftp") == 0)
590 1.1 dholland src_prompt(MSG_email, pkg.pass, sizeof pkg.pass);
591 1.1 dholland else {
592 1.1 dholland msg_prompt_noecho(MSG_Password, "",
593 1.1 dholland pkg.pass, sizeof pkg.pass);
594 1.1 dholland }
595 1.1 dholland };
596 1.1 dholland option {src_legend(menu, MSG_Proxy, pkg.proxy);},
597 1.1 dholland action { src_prompt(MSG_Proxy, pkg.proxy, sizeof pkg.proxy);
598 1.1 dholland if (strcmp(pkg.proxy, "") == 0) {
599 1.1 dholland unsetenv("ftp_proxy");
600 1.1 dholland unsetenv("http_proxy");
601 1.1 dholland } else {
602 1.1 dholland setenv("ftp_proxy", pkg.proxy, 1);
603 1.1 dholland setenv("http_proxy", pkg.proxy, 1);
604 1.1 dholland }
605 1.1 dholland };
606 1.9 martin option {src_legend(menu, "Additional packages", (char*)(((arg_rv*)arg)->arg)); }, /*TODO*/
607 1.9 martin action { src_prompt("Additional packages", (char*)(((arg_rv*)arg)->arg),
608 1.2 martin sizeof(char) * STRSIZE); };
609 1.2 martin option MSG_Configure_network,
610 1.2 martin action {
611 1.2 martin extern int network_up;
612 1.2 martin network_up = 0;
613 1.25 martin config_network(1);
614 1.2 martin mnt_net_config();
615 1.2 martin };
616 1.14 martin option {src_legend(menu, MSG_transfer_method, url_proto(pkg.xfer));},
617 1.14 martin action { pkg.xfer = (pkg.xfer+1) % (XFER_MAX+1); };
618 1.9 martin option MSG_quit_pkgs_install, exit, action { ((arg_rv*)arg)->rv = SET_SKIP; };
619 1.1 dholland
620 1.1 dholland menu pkgsrc, y=-4, x=0, w=70, no box, no clear,
621 1.1 dholland exit, exitstring MSG_Install_pkgsrc;
622 1.1 dholland display action { msg_display(MSG_pkgsrc); };
623 1.29 martin option {src_legend(menu, MSG_Host, pkgsrc.xfer_host[
624 1.29 martin XFER_HOST(pkgsrc.xfer)]);},
625 1.29 martin action { src_prompt(MSG_Host,
626 1.29 martin pkgsrc.xfer_host[XFER_HOST(pkgsrc.xfer)],
627 1.29 martin sizeof pkgsrc.xfer_host[XFER_HOST(pkgsrc.xfer)]); };
628 1.1 dholland option {src_legend(menu, MSG_Pkgsrc_dir, pkgsrc_dir);},
629 1.1 dholland action { src_prompt(MSG_Pkgsrc_dir, pkgsrc_dir, sizeof pkgsrc_dir); };
630 1.1 dholland option {src_legend(menu, MSG_User, pkgsrc.user);},
631 1.1 dholland action { src_prompt(MSG_User, pkgsrc.user, sizeof pkgsrc.user);
632 1.1 dholland pkgsrc.pass[0] = 0;
633 1.1 dholland };
634 1.1 dholland option {src_legend(menu, MSG_Password,
635 1.1 dholland strcmp(pkgsrc.user, "ftp") == 0 || pkgsrc.pass[0] == 0
636 1.1 dholland ? pkgsrc.pass : msg_string(MSG_hidden));},
637 1.1 dholland action { if (strcmp(pkgsrc.user, "ftp") == 0)
638 1.1 dholland src_prompt(MSG_email, pkgsrc.pass, sizeof pkgsrc.pass);
639 1.1 dholland else {
640 1.1 dholland msg_prompt_noecho(MSG_Password, "",
641 1.1 dholland pkgsrc.pass, sizeof pkgsrc.pass);
642 1.1 dholland }
643 1.1 dholland };
644 1.1 dholland option {src_legend(menu, MSG_Proxy, pkgsrc.proxy);},
645 1.1 dholland action { src_prompt(MSG_Proxy, pkgsrc.proxy, sizeof pkgsrc.proxy);
646 1.1 dholland if (strcmp(pkgsrc.proxy, "") == 0) {
647 1.1 dholland unsetenv("ftp_proxy");
648 1.1 dholland unsetenv("http_proxy");
649 1.1 dholland } else {
650 1.1 dholland setenv("ftp_proxy", pkgsrc.proxy, 1);
651 1.1 dholland setenv("http_proxy", pkgsrc.proxy, 1);
652 1.1 dholland }
653 1.1 dholland };
654 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
655 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
656 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
657 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
658 1.10 martin action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
659 1.14 martin option {src_legend(menu, MSG_transfer_method, url_proto(pkgsrc.xfer));},
660 1.14 martin action { pkgsrc.xfer = (pkgsrc.xfer+1) % (XFER_MAX+1); };
661 1.9 martin option MSG_quit_pkgsrc, exit, action { *((int*)arg) = SET_SKIP;};
662 1.1 dholland
663 1.1 dholland menu usersh, title MSG_User_shell, no clear;
664 1.1 dholland option "/bin/sh", exit, action { ushell = "/bin/sh";};
665 1.1 dholland option "/bin/ksh", exit, action { ushell = "/bin/ksh";};
666 1.1 dholland option "/bin/csh", exit, action { ushell = "/bin/csh";};
667 1.17 martin
668 1.17 martin menu convertscheme, title MSG_cvtscheme_hdr;
669 1.17 martin option MSG_cvtscheme_keep, exit, action { *(int*)arg = 0; };
670 1.17 martin option MSG_cvtscheme_delete, exit, action { *(int*)arg = 1; };
671 1.17 martin option MSG_cvtscheme_convert, exit, action { *(int*)arg = 2; };
672 1.17 martin option MSG_cvtscheme_abort, exit, action { *(int*)arg = 3; };
673 1.17 martin
674 1.17 martin
675 1.17 martin menu reedit, title MSG_reeditpart, y=-10;
676 1.17 martin expand action { expand_all_option_texts(menu, arg); };
677 1.17 martin option MSG_reedit_partitions, exit,
678 1.17 martin action {((arg_rep_int*)arg)->rv = 1;};
679 1.17 martin option MSG_use_partitions_anyway, exit,
680 1.17 martin action {((arg_rep_int*)arg)->rv = 2;};
681 1.17 martin option MSG_abort_installation, exit,
682 1.17 martin action {((arg_rep_int*)arg)->rv = 0;};
683