menus.mi revision 1.1 1 1.1 dholland /* $NetBSD: menus.mi,v 1.1 2014/07/26 19:30:44 dholland 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.1 dholland static void
52 1.1 dholland src_legend(menudesc *menu, const char *legend, const char *text)
53 1.1 dholland {
54 1.1 dholland wprintw(menu->mw, "%-25s %.50s", MSG_XLAT(legend), MSG_XLAT(text));
55 1.1 dholland }
56 1.1 dholland
57 1.1 dholland static void
58 1.1 dholland src_prompt(const char *prompt, char *buf, size_t size)
59 1.1 dholland {
60 1.1 dholland msg_prompt_win(prompt, -1, 12, 0, 0, buf, buf, size);
61 1.1 dholland }
62 1.1 dholland }
63 1.1 dholland
64 1.1 dholland default y=12, no exit, scrollable;
65 1.1 dholland
66 1.1 dholland allow dynamic menus;
67 1.1 dholland allow dynamic messages;
68 1.1 dholland error action {
69 1.1 dholland fprintf (stderr, "Could not initialize menu system, please check "
70 1.1 dholland "your terminal type.\n");
71 1.1 dholland exit(4);
72 1.1 dholland };
73 1.1 dholland
74 1.1 dholland menu selfskind, title MSG_Select_the_type, exitstring MSG_unchanged, y=6, x=30;
75 1.1 dholland display action {
76 1.1 dholland partinfo *p = arg;
77 1.1 dholland switch (p->pi_fstype) {
78 1.1 dholland case FS_UNUSED: menu->cursel = 0; break;
79 1.1 dholland case FS_BSDFFS:
80 1.1 dholland menu->cursel = p->pi_flags & PIF_FFSv2 ? 2 : 1;
81 1.1 dholland break;
82 1.1 dholland case FS_SWAP: menu->cursel = 3; break;
83 1.1 dholland case FS_MSDOS: menu->cursel = 4; break;
84 1.1 dholland case FS_BSDLFS: menu->cursel = 5; break;
85 1.1 dholland default : menu->cursel = 6; break;
86 1.1 dholland };
87 1.1 dholland };
88 1.1 dholland option "unused", exit, action
89 1.1 dholland { memset(arg, 0, sizeof (partinfo)); };
90 1.1 dholland option "FFSv1", exit, action { set_ptype(arg, FS_BSDFFS, 0); };
91 1.1 dholland option "FFSv2", exit, action { set_ptype(arg, FS_BSDFFS, PIF_FFSv2); };
92 1.1 dholland option "swap", exit, action { set_ptype(arg, FS_SWAP, 0); };
93 1.1 dholland option "msdos", exit, action { set_ptype(arg, FS_MSDOS, 0); };
94 1.1 dholland option "LFS", exit, action { set_ptype(arg, FS_BSDLFS, 0); };
95 1.1 dholland option MSG_other_types, action
96 1.1 dholland { extern int all_fstype_menu;
97 1.1 dholland m->opts[m->cursel].opt_menu = all_fstype_menu; };
98 1.1 dholland
99 1.1 dholland menu selbsize, title MSG_Select_file_system_block_size, y=10, x=40;
100 1.1 dholland display action {
101 1.1 dholland partinfo *pi = arg;
102 1.1 dholland int b;
103 1.1 dholland b = ffs(pi->pi_fsize * pi->pi_frag / 4096) - 1;
104 1.1 dholland if (b < 0 || b >= menu->numopts)
105 1.1 dholland b = 1;
106 1.1 dholland menu->cursel = b;
107 1.1 dholland };
108 1.1 dholland option "4096", exit, action { set_bsize(arg, 4096); };
109 1.1 dholland option "8192", exit, action { set_bsize(arg, 8192); };
110 1.1 dholland option "16384", exit, action { set_bsize(arg, 16384); };
111 1.1 dholland option "32768", exit, action { set_bsize(arg, 32768); };
112 1.1 dholland
113 1.1 dholland menu selfsize, title MSG_Select_file_system_fragment_size, y=11, x=40;
114 1.1 dholland display action {
115 1.1 dholland partinfo *pi = arg;
116 1.1 dholland int b;
117 1.1 dholland b = ffs(pi->pi_fsize / 512) - 1;
118 1.1 dholland if (b < 0 || b >= menu->numopts)
119 1.1 dholland b = 1;
120 1.1 dholland menu->cursel = b;
121 1.1 dholland };
122 1.1 dholland option "512", exit, action { set_fsize(arg, 512); };
123 1.1 dholland option "1024", exit, action { set_fsize(arg, 1024); };
124 1.1 dholland option "2048", exit, action { set_fsize(arg, 2048); };
125 1.1 dholland option "4096", exit, action { set_fsize(arg, 4096); };
126 1.1 dholland option "8192", exit, action { set_fsize(arg, 8192); };
127 1.1 dholland option "16384", exit, action { set_fsize(arg, 16384); };
128 1.1 dholland option "32768", exit, action { set_fsize(arg, 32768); };
129 1.1 dholland
130 1.1 dholland menu mountoptions, title MSG_toggle, y=5, x=30, exitstring MSG_unchanged;
131 1.1 dholland display action {
132 1.1 dholland static int actual_numopt;
133 1.1 dholland if (!actual_numopt)
134 1.1 dholland actual_numopt = menu->numopts;
135 1.1 dholland menu->numopts = actual_numopt -
136 1.1 dholland (((partinfo *)arg)->pi_fstype != FS_BSDFFS);
137 1.1 dholland };
138 1.1 dholland option "log", exit, action
139 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_LOG; };
140 1.1 dholland option "async", exit, action
141 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_ASYNC; };
142 1.1 dholland option "noatime", exit, action
143 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NOATIME; };
144 1.1 dholland option "nodev", exit, action
145 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NODEV; };
146 1.1 dholland option "nodevmtime", exit, action
147 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NODEVMTIME; };
148 1.1 dholland option "noexec", exit, action
149 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NOEXEC; };
150 1.1 dholland option "nosuid", exit, action
151 1.1 dholland { ((partinfo *)arg)->pi_flags ^= PIF_NOSUID; };
152 1.1 dholland
153 1.1 dholland menu netbsd, title MSG_NetBSD_VERSION_Install_System, y=-1,
154 1.1 dholland exit, exitstring MSG_Exit_Install_System;
155 1.1 dholland display action { toplevel(); };
156 1.1 dholland option MSG_Install_NetBSD_to_hard_disk,
157 1.1 dholland action { do_install(); };
158 1.1 dholland option MSG_Upgrade_NetBSD_on_a_hard_disk,
159 1.1 dholland action { do_upgrade(); };
160 1.1 dholland option MSG_Re_install_sets_or_install_additional_sets,
161 1.1 dholland action { do_reinstall_sets(); };
162 1.1 dholland option MSG_Reboot_the_computer, exit,
163 1.1 dholland action (endwin) { system("/sbin/reboot -q"); };
164 1.1 dholland option MSG_Utility_menu, sub menu utility;
165 1.1 dholland option MSG_Config_menu, action { do_configmenu(); };
166 1.1 dholland
167 1.1 dholland menu utility, title MSG_NetBSD_VERSION_Utilities, exit,
168 1.1 dholland exitstring MSG_exit_utility_menu;
169 1.1 dholland display action { toplevel(); };
170 1.1 dholland option MSG_Run_bin_sh,
171 1.1 dholland action (endwin) { system("/bin/sh"); };
172 1.1 dholland option MSG_Set_timezone,
173 1.1 dholland action { set_timezone(); };
174 1.1 dholland option MSG_Configure_network,
175 1.1 dholland action {
176 1.1 dholland extern int network_up;
177 1.1 dholland
178 1.1 dholland network_up = 0;
179 1.1 dholland config_network();
180 1.1 dholland };
181 1.1 dholland /* option MSG_Partition a disk; XXX add later. */
182 1.1 dholland option MSG_Logging_functions, action { do_logging(); };
183 1.1 dholland option MSG_Halt_the_system, exit,
184 1.1 dholland action (endwin) { system("/sbin/halt -q"); };
185 1.1 dholland
186 1.1 dholland menu yesno, y=-10;
187 1.1 dholland display action { menu->title = arg ? arg : MSG_yes_or_no; };
188 1.1 dholland option MSG_Yes, exit, action {yesno = 1;};
189 1.1 dholland option MSG_No, exit, action {yesno = 0;};
190 1.1 dholland
191 1.1 dholland menu noyes, y=-10;
192 1.1 dholland display action { menu->title = arg ? arg : MSG_yes_or_no; };
193 1.1 dholland option MSG_No, exit, action {yesno = 0;};
194 1.1 dholland option MSG_Yes, exit, action {yesno = 1;};
195 1.1 dholland
196 1.1 dholland menu ok, no shortcut, y=-10;
197 1.1 dholland display action { menu->title = arg; };
198 1.1 dholland option MSG_Hit_enter_to_continue, exit;
199 1.1 dholland
200 1.1 dholland menu layout, sub menu, y=-1, title MSG_Choose_your_installation;
201 1.1 dholland option MSG_Set_Sizes, exit, action { layoutkind = 1; };
202 1.1 dholland option MSG_Use_Existing, exit, action { layoutkind = 4; };
203 1.1 dholland
204 1.1 dholland menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier;
205 1.1 dholland display action {
206 1.1 dholland if (sizemult == current_cylsize)
207 1.1 dholland menu->cursel = 1;
208 1.1 dholland else if (sizemult == 1)
209 1.1 dholland menu->cursel = 2;
210 1.1 dholland };
211 1.1 dholland option MSG_Megabytes, exit, action
212 1.1 dholland { sizemult = MEG / sectorsize;
213 1.1 dholland multname = msg_string(MSG_megname);
214 1.1 dholland };
215 1.1 dholland option MSG_Cylinders, exit, action
216 1.1 dholland { sizemult = current_cylsize;
217 1.1 dholland multname = msg_string(MSG_cylname);
218 1.1 dholland };
219 1.1 dholland option MSG_Sectors, exit, action
220 1.1 dholland { sizemult = 1;
221 1.1 dholland multname = msg_string(MSG_secname);
222 1.1 dholland };
223 1.1 dholland
224 1.1 dholland menu distmedium, title MSG_Select_medium, y=-5;
225 1.1 dholland option MSG_cdrom, exit, action { *(int *)arg = get_via_cdrom(); };
226 1.1 dholland option MSG_ftp, exit, action { *(int *)arg = get_via_ftp("ftp"); };
227 1.1 dholland option MSG_http, exit, action { *(int *)arg = get_via_ftp("http"); };
228 1.1 dholland option MSG_nfs, exit, action { *(int *)arg = get_via_nfs(); };
229 1.1 dholland option MSG_floppy, exit, action { *(int *)arg = get_via_floppy(); };
230 1.1 dholland option MSG_local_fs, exit, action { *(int *)arg = get_via_localfs(); };
231 1.1 dholland option MSG_local_dir, exit, action { *(int *)arg = get_via_localdir();};
232 1.1 dholland option MSG_Skip_set, exit, action { *(int *)arg = SET_SKIP; };
233 1.1 dholland option MSG_Skip_group,exit, action { *(int *)arg = SET_SKIP_GROUP; };
234 1.1 dholland option MSG_Abandon, exit, action { *(int *)arg = SET_ABANDON; };
235 1.1 dholland
236 1.1 dholland menu distset, title MSG_Select_your_distribution;
237 1.1 dholland display action { msg_display (MSG_distset); };
238 1.1 dholland option MSG_Full_installation, exit, action { init_set_status(0); };
239 1.1 dholland option MSG_Full_installation_nox, exit, action { init_set_status(SFLAG_NOX); };
240 1.1 dholland option MSG_Minimal_installation, exit, action { init_set_status(SFLAG_MINIMAL); };
241 1.1 dholland option MSG_Custom_installation, exit, action { init_set_status(SFLAG_MINIMAL); customise_sets(); };
242 1.1 dholland
243 1.1 dholland menu ftpsource, y=-4, x=0, w=70, no box, no clear,
244 1.1 dholland exitstring MSG_Get_Distribution;
245 1.1 dholland display action { msg_display(MSG_ftpsource, arg); };
246 1.1 dholland option {src_legend(menu, MSG_Host, ftp.host);},
247 1.1 dholland action { src_prompt(MSG_Host, ftp.host, sizeof ftp.host); };
248 1.1 dholland option {src_legend(menu, MSG_Base_dir, ftp.dir);},
249 1.1 dholland action { src_prompt(MSG_Base_dir, ftp.dir, sizeof ftp.dir); };
250 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
251 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
252 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
253 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
254 1.1 dholland option {src_legend(menu, MSG_User, ftp.user);},
255 1.1 dholland action { src_prompt(MSG_User, ftp.user, sizeof ftp.user);
256 1.1 dholland ftp.pass[0] = 0;
257 1.1 dholland };
258 1.1 dholland option {src_legend(menu, MSG_Password,
259 1.1 dholland strcmp(ftp.user, "ftp") == 0 || ftp.pass[0] == 0
260 1.1 dholland ? ftp.pass : msg_string(MSG_hidden));},
261 1.1 dholland action { if (strcmp(ftp.user, "ftp") == 0)
262 1.1 dholland src_prompt(MSG_email, ftp.pass, sizeof ftp.pass);
263 1.1 dholland else {
264 1.1 dholland msg_prompt_noecho(MSG_Password, "",
265 1.1 dholland ftp.pass, sizeof ftp.pass);
266 1.1 dholland }
267 1.1 dholland };
268 1.1 dholland option {src_legend(menu, MSG_Proxy, ftp.proxy);},
269 1.1 dholland action { src_prompt(MSG_Proxy, ftp.proxy, sizeof ftp.proxy);
270 1.1 dholland if (strcmp(ftp.proxy, "") == 0) {
271 1.1 dholland unsetenv("ftp_proxy");
272 1.1 dholland unsetenv("http_proxy");
273 1.1 dholland } else {
274 1.1 dholland setenv("ftp_proxy", ftp.proxy, 1);
275 1.1 dholland setenv("http_proxy", ftp.proxy, 1);
276 1.1 dholland }
277 1.1 dholland };
278 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
279 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
280 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
281 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
282 1.1 dholland action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file));
283 1.1 dholland clean_xfer_dir = yesno; };
284 1.1 dholland
285 1.1 dholland
286 1.1 dholland menu nfssource, y=-4, x=0, w=70, no box, no clear,
287 1.1 dholland exitstring MSG_Continue;
288 1.1 dholland display action { msg_display(MSG_nfssource); };
289 1.1 dholland option {src_legend(menu, MSG_Host, nfs_host);},
290 1.1 dholland action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); };
291 1.1 dholland option {src_legend(menu, MSG_Base_dir, nfs_dir);},
292 1.1 dholland action { src_prompt(MSG_Base_dir, nfs_dir, sizeof nfs_dir); };
293 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
294 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
295 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
296 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
297 1.1 dholland
298 1.1 dholland menu fdremount, title MSG_What_do_you_want_to_do;
299 1.1 dholland option MSG_Try_again, exit, action { *(int *)arg = SET_CONTINUE; };
300 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
301 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
302 1.1 dholland
303 1.1 dholland menu fdok, title MSG_What_do_you_want_to_do;
304 1.1 dholland option MSG_OK, exit, action { *(int *)arg = SET_CONTINUE; };
305 1.1 dholland option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
306 1.1 dholland option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
307 1.1 dholland
308 1.1 dholland menu fd_type, title MSG_fd_type, y=16;
309 1.1 dholland option "msdos", exit, action { fd_type = "msdos"; };
310 1.1 dholland option "ffs", exit, action { fd_type = "ffs"; };
311 1.1 dholland .if ADOS_FLOPPY
312 1.1 dholland option "ados", exit, action { fd_type = "ados"; };
313 1.1 dholland .endif
314 1.1 dholland
315 1.1 dholland menu floppysource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
316 1.1 dholland display action { msg_display(MSG_floppysource); };
317 1.1 dholland option {src_legend(menu, MSG_Device, fd_dev);},
318 1.1 dholland action { src_prompt(MSG_dev, fd_dev, sizeof fd_dev); };
319 1.1 dholland option {src_legend(menu, MSG_fd_type, fd_type);}, sub menu fd_type;
320 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
321 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
322 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
323 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
324 1.1 dholland action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file));
325 1.1 dholland clean_xfer_dir = yesno; };
326 1.1 dholland
327 1.1 dholland menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
328 1.1 dholland display action { msg_display(MSG_cdromsource); };
329 1.1 dholland option {src_legend(menu, MSG_Device, cdrom_dev);},
330 1.1 dholland action { src_prompt(MSG_dev, cdrom_dev, sizeof cdrom_dev); };
331 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
332 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
333 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
334 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
335 1.1 dholland
336 1.1 dholland menu localfssource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
337 1.1 dholland display action { msg_display(MSG_localfssource); };
338 1.1 dholland option {src_legend(menu, MSG_Device, localfs_dev);},
339 1.1 dholland action { src_prompt(MSG_dev, localfs_dev, sizeof localfs_dev);};
340 1.1 dholland option {src_legend(menu, MSG_File_system, localfs_fs);},
341 1.1 dholland action { src_prompt(MSG_filesys, localfs_fs, sizeof localfs_fs); };
342 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
343 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, sizeof localfs_dir);};
344 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
345 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
346 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
347 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
348 1.1 dholland
349 1.1 dholland menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
350 1.1 dholland display action { msg_display(MSG_localdir); };
351 1.1 dholland option {src_legend(menu, MSG_Base_dir, localfs_dir);},
352 1.1 dholland action { src_prompt(MSG_Base_dir, localfs_dir, 60); };
353 1.1 dholland option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
354 1.1 dholland action { src_prompt(MSG_Set_dir_bin, set_dir_bin, 60); };
355 1.1 dholland option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
356 1.1 dholland action { src_prompt(MSG_Set_dir_src, set_dir_src, 60); };
357 1.1 dholland
358 1.1 dholland menu namesrv6, title MSG_Select_IPv6_DNS_server;
359 1.1 dholland option "google-public-dns-a.google.com", exit, action
360 1.1 dholland {
361 1.1 dholland #ifdef INET6
362 1.1 dholland strlcpy(net_namesvr6, "2001:4860:4860::8888",
363 1.1 dholland sizeof(net_namesvr6));
364 1.1 dholland yesno = 1;
365 1.1 dholland #else
366 1.1 dholland yesno = 0;
367 1.1 dholland #endif
368 1.1 dholland };
369 1.1 dholland option "google-public-dns-b.google.com", exit, action
370 1.1 dholland {
371 1.1 dholland #ifdef INET6
372 1.1 dholland strlcpy(net_namesvr6, "2001:4860:4860::8844",
373 1.1 dholland sizeof(net_namesvr6));
374 1.1 dholland yesno = 1;
375 1.1 dholland #else
376 1.1 dholland yesno = 0;
377 1.1 dholland #endif
378 1.1 dholland };
379 1.1 dholland option MSG_other, exit, action
380 1.1 dholland { yesno = 0; };
381 1.1 dholland
382 1.1 dholland menu rootsh, title MSG_Root_shell, no clear;
383 1.1 dholland option "/bin/sh", exit, action {*(const char **)arg = "/bin/sh";};
384 1.1 dholland option "/bin/ksh", exit, action {*(const char **)arg = "/bin/ksh";};
385 1.1 dholland option "/bin/csh", exit, action {*(const char **)arg = "/bin/csh";};
386 1.1 dholland
387 1.1 dholland menu zeroconf, title "Zeroconf", no clear;
388 1.1 dholland option "run mdnsd only", exit, action {*(const char **)arg = "mdnsd";};
389 1.1 dholland option "run mdnsd and resolve local names", exit, action {*(const char **) arg = "mdnsd+nsswitch";};
390 1.1 dholland option "do not run mdnsd", exit, action {*(const char **)arg = "No";};
391 1.1 dholland
392 1.1 dholland menu binpkg, y=-4, x=0, w=70, no box, no clear,
393 1.1 dholland exitstring MSG_Install_pkgin;
394 1.1 dholland display action { msg_display(MSG_pkgpath); };
395 1.1 dholland option {src_legend(menu, MSG_Host, pkg.host);},
396 1.1 dholland action { src_prompt(MSG_Host, pkg.host, sizeof pkg.host); };
397 1.1 dholland option {src_legend(menu, MSG_Base_dir, pkg.dir);},
398 1.1 dholland action { src_prompt(MSG_Base_dir, pkg.dir, sizeof pkg.dir); };
399 1.1 dholland option {src_legend(menu, MSG_Pkg_dir, pkg_dir);},
400 1.1 dholland action { src_prompt(MSG_Pkg_dir, pkg_dir, sizeof pkg_dir); };
401 1.1 dholland option {src_legend(menu, MSG_User, pkg.user);},
402 1.1 dholland action { src_prompt(MSG_User, pkg.user, sizeof pkg.user);
403 1.1 dholland pkg.pass[0] = 0;
404 1.1 dholland };
405 1.1 dholland option {src_legend(menu, MSG_Password,
406 1.1 dholland strcmp(pkg.user, "ftp") == 0 || pkg.pass[0] == 0
407 1.1 dholland ? pkg.pass : msg_string(MSG_hidden));},
408 1.1 dholland action { if (strcmp(pkg.user, "ftp") == 0)
409 1.1 dholland src_prompt(MSG_email, pkg.pass, sizeof pkg.pass);
410 1.1 dholland else {
411 1.1 dholland msg_prompt_noecho(MSG_Password, "",
412 1.1 dholland pkg.pass, sizeof pkg.pass);
413 1.1 dholland }
414 1.1 dholland };
415 1.1 dholland option {src_legend(menu, MSG_Proxy, pkg.proxy);},
416 1.1 dholland action { src_prompt(MSG_Proxy, pkg.proxy, sizeof pkg.proxy);
417 1.1 dholland if (strcmp(pkg.proxy, "") == 0) {
418 1.1 dholland unsetenv("ftp_proxy");
419 1.1 dholland unsetenv("http_proxy");
420 1.1 dholland } else {
421 1.1 dholland setenv("ftp_proxy", pkg.proxy, 1);
422 1.1 dholland setenv("http_proxy", pkg.proxy, 1);
423 1.1 dholland }
424 1.1 dholland };
425 1.1 dholland
426 1.1 dholland menu pkgsrc, y=-4, x=0, w=70, no box, no clear,
427 1.1 dholland exit, exitstring MSG_Install_pkgsrc;
428 1.1 dholland display action { msg_display(MSG_pkgsrc); };
429 1.1 dholland option {src_legend(menu, MSG_Host, pkgsrc.host);},
430 1.1 dholland action { src_prompt(MSG_Host, pkgsrc.host,
431 1.1 dholland sizeof pkgsrc.host); };
432 1.1 dholland option {src_legend(menu, MSG_Pkgsrc_dir, pkgsrc_dir);},
433 1.1 dholland action { src_prompt(MSG_Pkgsrc_dir, pkgsrc_dir, sizeof pkgsrc_dir); };
434 1.1 dholland option {src_legend(menu, MSG_User, pkgsrc.user);},
435 1.1 dholland action { src_prompt(MSG_User, pkgsrc.user, sizeof pkgsrc.user);
436 1.1 dholland pkgsrc.pass[0] = 0;
437 1.1 dholland };
438 1.1 dholland option {src_legend(menu, MSG_Password,
439 1.1 dholland strcmp(pkgsrc.user, "ftp") == 0 || pkgsrc.pass[0] == 0
440 1.1 dholland ? pkgsrc.pass : msg_string(MSG_hidden));},
441 1.1 dholland action { if (strcmp(pkgsrc.user, "ftp") == 0)
442 1.1 dholland src_prompt(MSG_email, pkgsrc.pass, sizeof pkgsrc.pass);
443 1.1 dholland else {
444 1.1 dholland msg_prompt_noecho(MSG_Password, "",
445 1.1 dholland pkgsrc.pass, sizeof pkgsrc.pass);
446 1.1 dholland }
447 1.1 dholland };
448 1.1 dholland option {src_legend(menu, MSG_Proxy, pkgsrc.proxy);},
449 1.1 dholland action { src_prompt(MSG_Proxy, pkgsrc.proxy, sizeof pkgsrc.proxy);
450 1.1 dholland if (strcmp(pkgsrc.proxy, "") == 0) {
451 1.1 dholland unsetenv("ftp_proxy");
452 1.1 dholland unsetenv("http_proxy");
453 1.1 dholland } else {
454 1.1 dholland setenv("ftp_proxy", pkgsrc.proxy, 1);
455 1.1 dholland setenv("http_proxy", pkgsrc.proxy, 1);
456 1.1 dholland }
457 1.1 dholland };
458 1.1 dholland option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
459 1.1 dholland action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
460 1.1 dholland option {src_legend(menu, MSG_delete_xfer_file,
461 1.1 dholland clean_xfer_dir ? MSG_Yes : MSG_No);},
462 1.1 dholland action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file));
463 1.1 dholland clean_xfer_dir = yesno; };
464 1.1 dholland option MSG_quit_pkgsrc, exit, action { yesno = 0;};
465 1.1 dholland
466 1.1 dholland menu usersh, title MSG_User_shell, no clear;
467 1.1 dholland option "/bin/sh", exit, action { ushell = "/bin/sh";};
468 1.1 dholland option "/bin/ksh", exit, action { ushell = "/bin/ksh";};
469 1.1 dholland option "/bin/csh", exit, action { ushell = "/bin/csh";};
470