menus.pm revision 1.1.4.2 1 1.1.4.2 christos /* $NetBSD: menus.pm,v 1.1.4.2 2019/06/10 22:10:38 christos Exp $ */
2 1.1.4.2 christos /* NetBSD: menus.mi,v 1.14 2018/09/11 08:05:18 martin Exp */
3 1.1.4.2 christos
4 1.1.4.2 christos /*-
5 1.1.4.2 christos * Copyright (c) 2003 The NetBSD Foundation, Inc.
6 1.1.4.2 christos * All rights reserved.
7 1.1.4.2 christos *
8 1.1.4.2 christos * This code is derived from software contributed to The NetBSD Foundation
9 1.1.4.2 christos * by David Laight.
10 1.1.4.2 christos *
11 1.1.4.2 christos * Redistribution and use in source and binary forms, with or without
12 1.1.4.2 christos * modification, are permitted provided that the following conditions
13 1.1.4.2 christos * are met:
14 1.1.4.2 christos * 1. Redistributions of source code must retain the above copyright
15 1.1.4.2 christos * notice, this list of conditions and the following disclaimer.
16 1.1.4.2 christos * 2. Redistributions in binary form must reproduce the above copyright
17 1.1.4.2 christos * notice, this list of conditions and the following disclaimer in the
18 1.1.4.2 christos * documentation and/or other materials provided with the distribution.
19 1.1.4.2 christos *
20 1.1.4.2 christos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 1.1.4.2 christos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 1.1.4.2 christos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 1.1.4.2 christos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 1.1.4.2 christos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 1.1.4.2 christos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 1.1.4.2 christos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 1.1.4.2 christos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.1.4.2 christos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.1.4.2 christos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.1.4.2 christos * POSSIBILITY OF SUCH DAMAGE.
31 1.1.4.2 christos */
32 1.1.4.2 christos
33 1.1.4.2 christos /* Menu system definitions -- extended partitioning */
34 1.1.4.2 christos
35 1.1.4.2 christos menu pmdiskentry, x=50, y=5, exit, default exit;
36 1.1.4.2 christos option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
37 1.1.4.2 christos option MSG_editmbr, exit, action { md_get_info();
38 1.1.4.2 christos md_pre_disklabel();
39 1.1.4.2 christos memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);};
40 1.1.4.2 christos option MSG_switchgpt, exit, action { if (pm_gpt_convert(pm) == 0)
41 1.1.4.2 christos pm_partusage(pm, -1, 1); };
42 1.1.4.2 christos option MSG_renamedisk, exit, action { pm->unsaved = 1; pm_rename(pm); };
43 1.1.4.2 christos option MSG_fmtasraid, exit, action { pm->unsaved = 1;
44 1.1.4.2 christos pm_partusage(pm, -1, 1);
45 1.1.4.2 christos layoutkind = LY_NEWRAID;
46 1.1.4.2 christos md_make_bsd_partitions();};
47 1.1.4.2 christos option MSG_fmtaslvm, exit, action { pm->unsaved = 1;
48 1.1.4.2 christos pm_partusage(pm, -1, 1);
49 1.1.4.2 christos layoutkind = LY_NEWLVM;
50 1.1.4.2 christos md_make_bsd_partitions(); };
51 1.1.4.2 christos option MSG_encrypt, exit, action { pm->unsaved = 1;
52 1.1.4.2 christos pm_partusage(pm, -1, 1);
53 1.1.4.2 christos layoutkind = LY_NEWCGD;
54 1.1.4.2 christos md_make_bsd_partitions();
55 1.1.4.2 christos pm_cgd_edit(0, &(part_entry_t)
56 1.1.4.2 christos {.dev_ptr = pm, .dev_num = PART_E}
57 1.1.4.2 christos ); };
58 1.1.4.2 christos option MSG_setbootable, exit, action { pm->unsaved = 1;
59 1.1.4.2 christos pm->bootable = !pm->bootable; };
60 1.1.4.2 christos option MSG_erase, next menu shred_modes;
61 1.1.4.2 christos option MSG_undo, exit, action { label_read(); pm->unsaved = 0;
62 1.1.4.2 christos pm_partusage(pm, -1, 1); };
63 1.1.4.2 christos option MSG_unconfig, exit, action { if (pm_unconfigure(pm) == 0)
64 1.1.4.2 christos pm_partusage(pm, -1, 1); };
65 1.1.4.2 christos
66 1.1.4.2 christos menu pmpartentry, x=50, y=5, exit, default exit;
67 1.1.4.2 christos option MSG_edit, exit, action {
68 1.1.4.2 christos pm->unsaved = 1;
69 1.1.4.2 christos int tpfs = pm->bsdlabel[*(int*)arg].pi_fstype;
70 1.1.4.2 christos int tplvm = pm->bsdlabel[*(int*)arg].lvmpv;
71 1.1.4.2 christos pm_editpart(*(int*)arg);
72 1.1.4.2 christos if (tpfs != pm->bsdlabel[*(int*)arg].pi_fstype ||
73 1.1.4.2 christos tplvm != pm->bsdlabel[*(int*)arg].lvmpv)
74 1.1.4.2 christos /* Oops, partition type changed */
75 1.1.4.2 christos pm_partusage(pm, *(int*)arg, 1);
76 1.1.4.2 christos };
77 1.1.4.2 christos option MSG_fmtasraid, exit, action {
78 1.1.4.2 christos if (pm->gpt || pm->isspecial) {
79 1.1.4.2 christos process_menu(MENU_ok, __UNCONST(MSG_notsupported));
80 1.1.4.2 christos return -1;
81 1.1.4.2 christos }
82 1.1.4.2 christos pm->unsaved = 1;
83 1.1.4.2 christos pm_partusage(pm, *(int*)arg, 1);
84 1.1.4.2 christos pm_setfstype(pm, *(int*)arg, FS_RAID);
85 1.1.4.2 christos };
86 1.1.4.2 christos option MSG_fmtaslvm, exit, action {
87 1.1.4.2 christos if (pm->gpt || pm->isspecial) {
88 1.1.4.2 christos process_menu(MENU_ok, __UNCONST(MSG_notsupported));
89 1.1.4.2 christos return -1;
90 1.1.4.2 christos }
91 1.1.4.2 christos pm->unsaved = 1;
92 1.1.4.2 christos pm_partusage(pm, *(int*)arg, 1);
93 1.1.4.2 christos pm_setfstype(pm, *(int*)arg, FS_BSDFFS);
94 1.1.4.2 christos pm->bsdlabel[*(int*)arg].lvmpv = 1;
95 1.1.4.2 christos };
96 1.1.4.2 christos option MSG_encrypt, exit, action {
97 1.1.4.2 christos if (pm->gpt || pm->isspecial) {
98 1.1.4.2 christos process_menu(MENU_ok, __UNCONST(MSG_notsupported));
99 1.1.4.2 christos return -1;
100 1.1.4.2 christos }
101 1.1.4.2 christos pm->unsaved = 1;
102 1.1.4.2 christos pm_partusage(pm, *(int*)arg, 1);
103 1.1.4.2 christos pm_setfstype(pm, *(int*)arg, FS_CGD);
104 1.1.4.2 christos pm_cgd_edit(0,
105 1.1.4.2 christos &(part_entry_t){.dev_ptr = pm,
106 1.1.4.2 christos .dev_num = *(int*)arg});
107 1.1.4.2 christos };
108 1.1.4.2 christos option MSG_erase, next menu shred_modes;
109 1.1.4.2 christos option MSG_doumount, exit, action { pm_umount(pm, *(int*)arg); };
110 1.1.4.2 christos option MSG_Delete_partition, exit, action {
111 1.1.4.2 christos pm->unsaved = 1;
112 1.1.4.2 christos pm_partusage(pm, *(int*)arg, 1);
113 1.1.4.2 christos if (pm->isspecial)
114 1.1.4.2 christos pm_unconfigure(pm);
115 1.1.4.2 christos else
116 1.1.4.2 christos pm->bsdlabel[*(int*)arg].pi_fstype = FS_UNUSED;
117 1.1.4.2 christos };
118 1.1.4.2 christos
119 1.1.4.2 christos menu pmgptentry, x=50, y=8, exit, default exit;
120 1.1.4.2 christos option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
121 1.1.4.2 christos option MSG_switchmbr, exit, action { if (pm_gpt_convert(pm) == 0)
122 1.1.4.2 christos pm_partusage(pm, -1, 1); };
123 1.1.4.2 christos option MSG_setbootable, exit, action { pm->unsaved = 1;
124 1.1.4.2 christos pm->bootable = !pm->bootable; };
125 1.1.4.2 christos option MSG_erase, next menu shred_modes;
126 1.1.4.2 christos option MSG_undo, exit, action { label_read(); pm->unsaved = 0;
127 1.1.4.2 christos pm_partusage(pm, -1, 1); };
128 1.1.4.2 christos option MSG_unconfig, exit, action { if (pm_unconfigure(pm) == 0)
129 1.1.4.2 christos pm_partusage(pm, -1, 1); };
130 1.1.4.2 christos
131 1.1.4.2 christos menu shred_modes, x=50, y=5, exit, default exit;
132 1.1.4.2 christos option MSG_fillzeros, exit,
133 1.1.4.2 christos action { pm_shred(pm, *(int*)arg, SHRED_ZEROS); };
134 1.1.4.2 christos option MSG_fillrandom, exit,
135 1.1.4.2 christos action { pm_shred(pm, *(int*)arg, SHRED_RANDOM); };
136 1.1.4.2 christos option MSG_fillcrypto, exit,
137 1.1.4.2 christos action { pm_shred(pm, *(int*)arg, SHRED_CRYPTO); };
138 1.1.4.2 christos
139 1.1.4.2 christos menu raidlevel;
140 1.1.4.2 christos option MSG_raid0, exit, action { *(int *)arg = 0; };
141 1.1.4.2 christos option MSG_raid1, exit, action { *(int *)arg = 1; };
142 1.1.4.2 christos option MSG_raid4, exit, action { *(int *)arg = 4; };
143 1.1.4.2 christos option MSG_raid5, exit, action { *(int *)arg = 5; };
144 1.1.4.2 christos
145 1.1.4.2 christos menu cgd_enctype;
146 1.1.4.2 christos option "aes-xts", exit, action { *(const char**)arg = "aes-xts"; };
147 1.1.4.2 christos option "aes-cbc", exit, action { *(const char**)arg = "aes-cbc"; };
148 1.1.4.2 christos option "3des-cbc", exit, action { *(const char**)arg = "3des-cbc"; };
149 1.1.4.2 christos option "blowfish-cbc", exit, action { *(const char**)arg = "blowfish-cbc"; };
150 1.1.4.2 christos
151 1.1.4.2 christos menu cgd_ivtype;
152 1.1.4.2 christos option "encblkno1", exit, action { *(const char**)arg = "encblkno1"; };
153 1.1.4.2 christos option "encblkno8", exit, action { *(const char**)arg = "encblkno8"; };
154 1.1.4.2 christos
155 1.1.4.2 christos menu cgd_keygentype;
156 1.1.4.2 christos option "pkcs5_pbkdf2/sha1", exit, action { *(const char**)arg = "pkcs5_pbkdf2/sha1"; };
157 1.1.4.2 christos option "pkcs5_pbkdf2", exit, action { *(const char**)arg = "pkcs5_pbkdf2"; };
158 1.1.4.2 christos option "storedkey", exit, action { *(const char**)arg = "storedkey"; };
159 1.1.4.2 christos option "randomkey", exit, action { *(const char**)arg = "randomkey"; };
160 1.1.4.2 christos option "urandomkey", exit, action { *(const char**)arg = "urandomkey"; };
161 1.1.4.2 christos option "shell_cmd", exit, action { *(const char**)arg = "shell_cmd"; };
162 1.1.4.2 christos
163 1.1.4.2 christos menu cgd_verifytype;
164 1.1.4.2 christos option "none", exit, action { *(const char**)arg = "none"; };
165 1.1.4.2 christos option "disklabel", exit, action { *(const char**)arg = "disklabel"; };
166 1.1.4.2 christos option "ffs", exit, action { *(const char**)arg = "ffs"; };
167 1.1.4.2 christos option "re-enter", exit, action { *(const char**)arg = "re-enter"; };
168