Home | History | Annotate | Line # | Download | only in sysinst
      1  1.3  martin /*	$NetBSD: menus.pm,v 1.3 2020/01/09 13:22:30 martin Exp $	*/
      2  1.1     rin /*	NetBSD: menus.mi,v 1.14 2018/09/11 08:05:18 martin Exp 		*/
      3  1.1     rin 
      4  1.1     rin /*-
      5  1.1     rin  * Copyright (c) 2003 The NetBSD Foundation, Inc.
      6  1.1     rin  * All rights reserved.
      7  1.1     rin  *
      8  1.1     rin  * This code is derived from software contributed to The NetBSD Foundation
      9  1.1     rin  * by David Laight.
     10  1.1     rin  *
     11  1.1     rin  * Redistribution and use in source and binary forms, with or without
     12  1.1     rin  * modification, are permitted provided that the following conditions
     13  1.1     rin  * are met:
     14  1.1     rin  * 1. Redistributions of source code must retain the above copyright
     15  1.1     rin  *    notice, this list of conditions and the following disclaimer.
     16  1.1     rin  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.1     rin  *    notice, this list of conditions and the following disclaimer in the
     18  1.1     rin  *    documentation and/or other materials provided with the distribution.
     19  1.1     rin  *
     20  1.1     rin  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21  1.1     rin  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22  1.1     rin  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23  1.1     rin  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24  1.1     rin  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25  1.1     rin  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26  1.1     rin  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27  1.1     rin  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28  1.1     rin  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29  1.1     rin  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30  1.1     rin  * POSSIBILITY OF SUCH DAMAGE.
     31  1.1     rin  */
     32  1.1     rin 
     33  1.1     rin /* Menu system definitions -- extended partitioning */
     34  1.1     rin 
     35  1.3  martin /* arg is a struct part_entry* */
     36  1.1     rin menu pmdiskentry, x=50, y=5, exit, default exit;
     37  1.3  martin 	display action { pmdiskentry_enable(menu, arg); };
     38  1.3  martin 	option MSG_edit_parts, exit, action { pm_edit_partitions(arg); };
     39  1.3  martin 	option MSG_switch_parts, exit, action {
     40  1.3  martin 		struct pm_devs *my_pm = pm_from_pe(arg);
     41  1.3  martin 		const char *err;
     42  1.3  martin 
     43  1.3  martin 		if (!convert_scheme(my_pm, false, &err))
     44  1.3  martin 			err_msg_win(err);
     45  1.3  martin 		else
     46  1.3  martin 			pm_partusage(my_pm, -1, 1);
     47  1.2  martin 	};
     48  1.3  martin 	option MSG_fmtasraid, exit, action
     49  1.3  martin 	{
     50  1.3  martin 		pm_whole_disk(arg, SY_NEWRAID);
     51  1.3  martin 	};
     52  1.3  martin 	option MSG_fmtaslvm, exit, action
     53  1.3  martin 	{
     54  1.3  martin 		part_id new_part;
     55  1.3  martin 
     56  1.3  martin 		new_part = pm_whole_disk(arg, SY_NEWLVM);
     57  1.3  martin 		if (new_part != NO_PART)
     58  1.3  martin 			pm_set_lvmpv(pm_from_pe(arg), new_part, true);
     59  1.3  martin 	};
     60  1.3  martin 	option MSG_encrypt, exit, action
     61  1.3  martin 	{
     62  1.3  martin 		part_id new_part;
     63  1.3  martin 		new_part = pm_whole_disk(arg, SY_NEWCGD);
     64  1.3  martin 		if (new_part != NO_PART)
     65  1.3  martin 			 pm_cgd_edit_new(pm_from_pe(arg), new_part);
     66  1.2  martin 	};
     67  1.1     rin 	option MSG_erase,		next menu shred_modes;
     68  1.2  martin 	option MSG_undo,		exit, action {
     69  1.2  martin 				/* label_read(); */ pm->unsaved = 0;
     70  1.2  martin 				pm_partusage(pm, -1, 1);
     71  1.2  martin 	};
     72  1.2  martin 	option MSG_unconfig,	exit, action {
     73  1.2  martin 				if (pm_unconfigure(pm) == 0)
     74  1.2  martin 					pm_partusage(pm, -1, 1);
     75  1.2  martin 	};
     76  1.1     rin 
     77  1.3  martin /* arg is a struct part_entry* */
     78  1.1     rin menu pmpartentry, x=50, y=5, exit, default exit;
     79  1.3  martin 	option MSG_edit, exit, action
     80  1.3  martin 	{
     81  1.3  martin 		struct part_entry *cur_pe = arg;
     82  1.3  martin 		pm->unsaved = 1;
     83  1.3  martin 		pm_editpart(cur_pe->id);
     84  1.3  martin 		pm_partusage(pm, cur_pe->id, 1);
     85  1.3  martin 	};
     86  1.3  martin 	option MSG_fmtasraid, exit, action {
     87  1.3  martin 		if (pm->no_part) {
     88  1.3  martin 			hit_enter_to_continue(NULL, MSG_notsupported);
     89  1.3  martin 			return -1;
     90  1.3  martin 		}
     91  1.3  martin 		struct part_entry *cur_pe = arg;
     92  1.3  martin 		pm->unsaved = 1;
     93  1.3  martin 		pm_partusage(pm, cur_pe->id, 1);
     94  1.3  martin 		pm_setfstype(pm, cur_pe->id, FS_RAID, 0);
     95  1.3  martin 	};
     96  1.3  martin 	option MSG_fmtaslvm, exit, action {
     97  1.3  martin 		if (pm->no_part) {
     98  1.3  martin 			hit_enter_to_continue(NULL, MSG_notsupported);
     99  1.3  martin 			return -1;
    100  1.3  martin 		}
    101  1.3  martin 		struct part_entry *cur_pe = arg;
    102  1.3  martin 		pm->unsaved = 1;
    103  1.3  martin 		pm_partusage(pm, cur_pe->id, 1);
    104  1.3  martin 		pm_setfstype(pm, cur_pe->id, FS_BSDFFS, 2);
    105  1.3  martin 		pm_set_lvmpv(pm, cur_pe->id, true);
    106  1.3  martin 	};
    107  1.3  martin 	option MSG_encrypt, exit, action {
    108  1.3  martin 		if (pm->no_part) {
    109  1.3  martin 			hit_enter_to_continue(NULL, MSG_notsupported);
    110  1.3  martin 			return -1;
    111  1.3  martin 		}
    112  1.3  martin 		struct part_entry *cur_pe = arg;
    113  1.2  martin 		pm->unsaved = 1;
    114  1.3  martin 		pm_partusage(pm, cur_pe->id, 1);
    115  1.3  martin 		pm_setfstype(pm, cur_pe->id, FS_CGD, 0);
    116  1.3  martin 		pm_cgd_edit_old(cur_pe);
    117  1.3  martin 	};
    118  1.2  martin 	option MSG_erase, next menu shred_modes;
    119  1.3  martin 	option MSG_doumount, exit, action {
    120  1.3  martin 		struct part_entry *cur_pe = arg;
    121  1.3  martin 		pm_umount(pm, cur_pe->id);
    122  1.3  martin 	};
    123  1.3  martin 	option MSG_Delete_partition, exit, action {
    124  1.3  martin 		struct part_entry *cur_pe = arg;
    125  1.3  martin 		pm->unsaved = 1;
    126  1.3  martin 		pm_partusage(pm, cur_pe->id, 1);
    127  1.3  martin 		if (pm->no_part)
    128  1.3  martin 			pm_unconfigure(pm);
    129  1.3  martin 		else
    130  1.3  martin 			pm_setfstype(pm, cur_pe->id, FS_UNUSED, 0);
    131  1.3  martin 	};
    132  1.1     rin 
    133  1.3  martin /* arg is a struct part_entry* */
    134  1.1     rin menu shred_modes, x=50, y=5, exit, default exit;
    135  1.3  martin 	option MSG_fillzeros, exit,
    136  1.3  martin 		action { pm_shred(arg, SHRED_ZEROS); };
    137  1.1     rin 	option MSG_fillrandom,	exit,
    138  1.3  martin 		action { pm_shred(arg, SHRED_RANDOM); };
    139  1.1     rin 
    140  1.3  martin /* arg is a int pointer for the requested raid level */
    141  1.1     rin menu raidlevel;
    142  1.1     rin 	option MSG_raid0, exit, action { *(int *)arg = 0; };
    143  1.1     rin 	option MSG_raid1, exit, action { *(int *)arg = 1; };
    144  1.1     rin 	option MSG_raid4, exit, action { *(int *)arg = 4; };
    145  1.1     rin 	option MSG_raid5, exit, action { *(int *)arg = 5; };
    146  1.1     rin 
    147  1.3  martin /* arg is a const char ** set to the selected encryption type */
    148  1.1     rin menu cgd_enctype;
    149  1.3  martin 	option "aes-xts", exit, action { *(const char**)arg = "aes-xts"; };
    150  1.3  martin 	option "aes-cbc", exit, action { *(const char**)arg = "aes-cbc"; };
    151  1.3  martin 	option "3des-cbc", exit, action { *(const char**)arg = "3des-cbc"; };
    152  1.3  martin 	option "blowfish-cbc", exit, action
    153  1.3  martin 				{ *(const char**)arg = "blowfish-cbc"; };
    154  1.1     rin 
    155  1.3  martin /* arg is a const char ** set to the requested iv type */
    156  1.1     rin menu cgd_ivtype;
    157  1.3  martin 	option "encblkno1", exit, action { *(const char**)arg = "encblkno1"; };
    158  1.3  martin 	option "encblkno8", exit, action { *(const char**)arg = "encblkno8"; };
    159  1.1     rin 
    160  1.3  martin /* arg is const char ** set to the key gen type */
    161  1.1     rin menu cgd_keygentype;
    162  1.3  martin 	option "pkcs5_pbkdf2/sha1", exit, action
    163  1.3  martin 				 { *(const char**)arg = "pkcs5_pbkdf2/sha1"; };
    164  1.3  martin 	option "pkcs5_pbkdf2", exit, action
    165  1.3  martin 				{ *(const char**)arg = "pkcs5_pbkdf2"; };
    166  1.3  martin 	option "storedkey", exit, action
    167  1.3  martin 				{ *(const char**)arg = "storedkey"; };
    168  1.3  martin 	option "randomkey", exit, action
    169  1.3  martin 				{ *(const char**)arg = "randomkey"; };
    170  1.3  martin 	option "urandomkey", exit, action
    171  1.3  martin 				{ *(const char**)arg = "urandomkey"; };
    172  1.3  martin 	option "shell_cmd", exit, action
    173  1.3  martin 				{ *(const char**)arg = "shell_cmd"; };
    174  1.1     rin 
    175  1.3  martin /* art is a const char ** set to the requested verification type */
    176  1.1     rin menu cgd_verifytype;
    177  1.3  martin 	option "none",		exit, action { *(const char**)arg = "none"; };
    178  1.3  martin 	option "disklabel",	exit, action { *(const char**)arg = "disklabel"; };
    179  1.3  martin 	option "MBR",		exit, action { *(const char**)arg = "mbr"; };
    180  1.3  martin 	option "GPT",		exit, action { *(const char**)arg = "gpt"; };
    181  1.3  martin 	option "ffs",		exit, action { *(const char**)arg = "ffs"; };
    182  1.3  martin 	option "re-enter",	exit, action { *(const char**)arg = "re-enter"; };
    183