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