menus.entropy revision 1.1 1 1.1 martin /* $NetBSD: menus.entropy,v 1.1 2020/11/04 14:29:40 martin Exp $ */
2 1.1 martin
3 1.1 martin /*-
4 1.1 martin * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 1.1 martin * All rights reserved.
6 1.1 martin *
7 1.1 martin * This code is derived from software contributed to The NetBSD Foundation
8 1.1 martin * by David Laight.
9 1.1 martin *
10 1.1 martin * Redistribution and use in source and binary forms, with or without
11 1.1 martin * modification, are permitted provided that the following conditions
12 1.1 martin * are met:
13 1.1 martin * 1. Redistributions of source code must retain the above copyright
14 1.1 martin * notice, this list of conditions and the following disclaimer.
15 1.1 martin * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 martin * notice, this list of conditions and the following disclaimer in the
17 1.1 martin * documentation and/or other materials provided with the distribution.
18 1.1 martin *
19 1.1 martin * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 martin * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 martin * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 martin * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 martin * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 martin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 martin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 martin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 martin * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 martin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 martin * POSSIBILITY OF SUCH DAMAGE.
30 1.1 martin */
31 1.1 martin
32 1.1 martin /* Menu system definitions -- entropy setup */
33 1.1 martin
34 1.1 martin /* arg is an int*, returning a magic value for the selected menu option */
35 1.1 martin menu not_enough_entropy, title MSG_not_enough_entropy, y=-1, no box, clear,
36 1.1 martin exit, exitstring MSG_abort_installation;
37 1.1 martin option MSG_entropy_add_manually, exit,
38 1.1 martin action { *((int*)arg) = 1; };
39 1.1 martin option MSG_entropy_download_seed, exit,
40 1.1 martin action { *((int*)arg) = 2; };
41 1.1 martin option MSG_entropy_download_raw, exit,
42 1.1 martin action { *((int*)arg) = 3; };
43 1.1 martin option MSG_entropy_retry, exit,
44 1.1 martin action { *((int*)arg) = 4; };
45 1.1 martin
46 1.1 martin
47 1.1 martin /* arg is an int*, returning a magic value for the selected menu option */
48 1.1 martin menu entropy_select_file, title MSG_entropy_select_file, y=-5, box,
49 1.1 martin exit, exitstring MSG_cancel;
50 1.1 martin option MSG_entropy_add_download_http, exit,
51 1.1 martin action { *((int*)arg) = 1; };
52 1.1 martin option MSG_entropy_add_download_ftp, exit,
53 1.1 martin action { *((int*)arg) = 2; };
54 1.1 martin option MSG_entropy_add_nfs, exit,
55 1.1 martin action { *((int*)arg) = 3; };
56 1.1 martin option MSG_entropy_add_local, exit,
57 1.1 martin action { *((int*)arg) = 4; };
58 1.1 martin
59 1.1 martin
60 1.1 martin /* arg is an int*, set to SET_RETRY when the menu is aborted */
61 1.1 martin menu entropy_nfssource, y=-5, x=0, w=70, no box, no clear,
62 1.1 martin exitstring MSG_load_entropy;
63 1.1 martin option {src_legend(menu, MSG_Host, nfs_host);},
64 1.1 martin action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); };
65 1.1 martin option {src_legend(menu, MSG_Base_dir, nfs_dir);},
66 1.1 martin action { src_prompt(MSG_Base_dir, nfs_dir, sizeof nfs_dir); };
67 1.1 martin option {src_legend(menu, MSG_entropy_file, entropy_file);},
68 1.1 martin action { src_prompt(MSG_set_entropy_file, entropy_file, sizeof entropy_file); };
69 1.1 martin option MSG_cancel, exit,
70 1.1 martin action { *((int*)arg) = SET_RETRY; };
71 1.1 martin
72 1.1 martin
73 1.1 martin /* arg is an arg_rv*, pointing to a struct ftpinfo and a return value */
74 1.1 martin menu entropy_ftpsource, y=-4, x=0, w=70, no box, no clear,
75 1.1 martin exitstring MSG_download_entropy;
76 1.1 martin option {src_legend(menu, MSG_Host,
77 1.1 martin ((struct ftpinfo*)((arg_rv*)arg)->arg)->xfer_host[
78 1.1 martin ((struct ftpinfo*)((arg_rv*)arg)->arg)->xfer]);},
79 1.1 martin action { struct ftpinfo *fpi = (struct ftpinfo*)((arg_rv*)arg)->arg;
80 1.1 martin src_prompt(MSG_Host, fpi->xfer_host[fpi->xfer],
81 1.1 martin sizeof fpi->xfer_host[fpi->xfer]); };
82 1.1 martin option {src_legend(menu, MSG_entropy_path_and_file, entropy_file);},
83 1.1 martin action { src_prompt(MSG_entropy_path_and_file,
84 1.1 martin entropy_file, sizeof entropy_file); };
85 1.1 martin option {src_legend(menu, MSG_User,
86 1.1 martin ((struct ftpinfo*)((arg_rv*)arg)->arg)->user);},
87 1.1 martin action { struct ftpinfo *fpi = (struct ftpinfo*)((arg_rv*)arg)->arg;
88 1.1 martin src_prompt(MSG_User, fpi->user, sizeof fpi->user);
89 1.1 martin fpi->pass[0] = 0;
90 1.1 martin };
91 1.1 martin option {src_legend(menu, MSG_Password,
92 1.1 martin strcmp(((struct ftpinfo*)((arg_rv*)arg)->arg)->user,
93 1.1 martin "ftp") == 0 ||
94 1.1 martin ((struct ftpinfo*)((arg_rv*)arg)->arg)->pass[0] == 0
95 1.1 martin ? ((struct ftpinfo*)((arg_rv*)arg)->arg)->pass
96 1.1 martin : msg_string(MSG_hidden));},
97 1.1 martin action { struct ftpinfo *fpi = (struct ftpinfo*)((arg_rv*)arg)->arg;
98 1.1 martin if (strcmp(fpi->user, "ftp") == 0)
99 1.1 martin src_prompt(MSG_email, fpi->pass, sizeof fpi->pass);
100 1.1 martin else {
101 1.1 martin msg_prompt_noecho(MSG_Password, "",
102 1.1 martin fpi->pass, sizeof fpi->pass);
103 1.1 martin }
104 1.1 martin };
105 1.1 martin option {src_legend(menu, MSG_Proxy,
106 1.1 martin ((struct ftpinfo*)((arg_rv*)arg)->arg)->proxy);},
107 1.1 martin action { struct ftpinfo *fpi = (struct ftpinfo*)((arg_rv*)arg)->arg;
108 1.1 martin src_prompt(MSG_Proxy, fpi->proxy, sizeof fpi->proxy);
109 1.1 martin if (strcmp(fpi->proxy, "") == 0) {
110 1.1 martin unsetenv("ftp_proxy");
111 1.1 martin unsetenv("http_proxy");
112 1.1 martin } else {
113 1.1 martin setenv("ftp_proxy", fpi->proxy, 1);
114 1.1 martin setenv("http_proxy", fpi->proxy, 1);
115 1.1 martin }
116 1.1 martin };
117 1.1 martin option MSG_cancel, exit, action { ((arg_rv*)arg)->rv = SET_RETRY; };
118 1.1 martin
119 1.1 martin
120 1.1 martin /* arg is an int*, set to SET_RETRY when the menu is aborted */
121 1.1 martin menu entropy_localfs, y=-4, x=0, w=70, no box, no clear,
122 1.1 martin exitstring MSG_load_entropy;
123 1.1 martin display action { msg_display(MSG_entropy_localfs); };
124 1.1 martin option {src_legend(menu, MSG_Device, localfs_dev);},
125 1.1 martin action { src_prompt(MSG_dev, localfs_dev, sizeof localfs_dev);};
126 1.1 martin option {src_legend(menu, MSG_File_system, localfs_fs);},
127 1.1 martin action { src_prompt(MSG_filesys, localfs_fs, sizeof localfs_fs); };
128 1.1 martin option {src_legend(menu, MSG_entropy_path_and_file, entropy_file);},
129 1.1 martin action { src_prompt(MSG_entropy_path_and_file, entropy_file, sizeof entropy_file);};
130 1.1 martin option MSG_cancel, exit, action { *((int*)arg) = SET_RETRY; };
131 1.1 martin
132