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