Home | History | Annotate | Line # | Download | only in sysinst
menus.pm revision 1.2.2.1
      1  1.2.2.1  msaitoh /*	$NetBSD: menus.pm,v 1.2.2.1 2020/01/28 10:17:58 msaitoh 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.2.2.1  msaitoh /* arg is a struct part_entry* */
     36      1.1      rin menu pmdiskentry, x=50, y=5, exit, default exit;
     37  1.2.2.1  msaitoh 	display action { pmdiskentry_enable(menu, arg); };
     38  1.2.2.1  msaitoh 	option MSG_edit_parts, exit, action { pm_edit_partitions(arg); };
     39  1.2.2.1  msaitoh 	option MSG_switch_parts, exit, action {
     40  1.2.2.1  msaitoh 		struct pm_devs *my_pm = pm_from_pe(arg);
     41  1.2.2.1  msaitoh 		const char *err;
     42  1.2.2.1  msaitoh 
     43  1.2.2.1  msaitoh 		if (!convert_scheme(my_pm, false, &err))
     44  1.2.2.1  msaitoh 			err_msg_win(err);
     45  1.2.2.1  msaitoh 		else
     46  1.2.2.1  msaitoh 			pm_partusage(my_pm, -1, 1);
     47      1.2   martin 	};
     48  1.2.2.1  msaitoh 	option MSG_fmtasraid, exit, action
     49  1.2.2.1  msaitoh 	{
     50  1.2.2.1  msaitoh 		pm_whole_disk(arg, SY_NEWRAID);
     51  1.2.2.1  msaitoh 	};
     52  1.2.2.1  msaitoh 	option MSG_fmtaslvm, exit, action
     53  1.2.2.1  msaitoh 	{
     54  1.2.2.1  msaitoh 		part_id new_part;
     55  1.2.2.1  msaitoh 
     56  1.2.2.1  msaitoh 		new_part = pm_whole_disk(arg, SY_NEWLVM);
     57  1.2.2.1  msaitoh 		if (new_part != NO_PART)
     58  1.2.2.1  msaitoh 			pm_set_lvmpv(pm_from_pe(arg), new_part, true);
     59  1.2.2.1  msaitoh 	};
     60  1.2.2.1  msaitoh 	option MSG_encrypt, exit, action
     61  1.2.2.1  msaitoh 	{
     62  1.2.2.1  msaitoh 		part_id new_part;
     63  1.2.2.1  msaitoh 		new_part = pm_whole_disk(arg, SY_NEWCGD);
     64  1.2.2.1  msaitoh 		if (new_part != NO_PART)
     65  1.2.2.1  msaitoh 			 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.2.2.1  msaitoh /* arg is a struct part_entry* */
     78      1.1      rin menu pmpartentry, x=50, y=5, exit, default exit;
     79  1.2.2.1  msaitoh 	option MSG_edit, exit, action
     80  1.2.2.1  msaitoh 	{
     81  1.2.2.1  msaitoh 		struct part_entry *cur_pe = arg;
     82  1.2.2.1  msaitoh 		pm->unsaved = 1;
     83  1.2.2.1  msaitoh 		pm_editpart(cur_pe->id);
     84  1.2.2.1  msaitoh 		pm_partusage(pm, cur_pe->id, 1);
     85  1.2.2.1  msaitoh 	};
     86  1.2.2.1  msaitoh 	option MSG_fmtasraid, exit, action {
     87  1.2.2.1  msaitoh 		if (pm->no_part) {
     88  1.2.2.1  msaitoh 			hit_enter_to_continue(NULL, MSG_notsupported);
     89  1.2.2.1  msaitoh 			return -1;
     90  1.2.2.1  msaitoh 		}
     91  1.2.2.1  msaitoh 		struct part_entry *cur_pe = arg;
     92  1.2.2.1  msaitoh 		pm->unsaved = 1;
     93  1.2.2.1  msaitoh 		pm_partusage(pm, cur_pe->id, 1);
     94  1.2.2.1  msaitoh 		pm_setfstype(pm, cur_pe->id, FS_RAID, 0);
     95  1.2.2.1  msaitoh 	};
     96  1.2.2.1  msaitoh 	option MSG_fmtaslvm, exit, action {
     97  1.2.2.1  msaitoh 		if (pm->no_part) {
     98  1.2.2.1  msaitoh 			hit_enter_to_continue(NULL, MSG_notsupported);
     99  1.2.2.1  msaitoh 			return -1;
    100  1.2.2.1  msaitoh 		}
    101  1.2.2.1  msaitoh 		struct part_entry *cur_pe = arg;
    102  1.2.2.1  msaitoh 		pm->unsaved = 1;
    103  1.2.2.1  msaitoh 		pm_partusage(pm, cur_pe->id, 1);
    104  1.2.2.1  msaitoh 		pm_setfstype(pm, cur_pe->id, FS_BSDFFS, 2);
    105  1.2.2.1  msaitoh 		pm_set_lvmpv(pm, cur_pe->id, true);
    106  1.2.2.1  msaitoh 	};
    107  1.2.2.1  msaitoh 	option MSG_encrypt, exit, action {
    108  1.2.2.1  msaitoh 		if (pm->no_part) {
    109  1.2.2.1  msaitoh 			hit_enter_to_continue(NULL, MSG_notsupported);
    110  1.2.2.1  msaitoh 			return -1;
    111  1.2.2.1  msaitoh 		}
    112  1.2.2.1  msaitoh 		struct part_entry *cur_pe = arg;
    113      1.2   martin 		pm->unsaved = 1;
    114  1.2.2.1  msaitoh 		pm_partusage(pm, cur_pe->id, 1);
    115  1.2.2.1  msaitoh 		pm_setfstype(pm, cur_pe->id, FS_CGD, 0);
    116  1.2.2.1  msaitoh 		pm_cgd_edit_old(cur_pe);
    117  1.2.2.1  msaitoh 	};
    118      1.2   martin 	option MSG_erase, next menu shred_modes;
    119  1.2.2.1  msaitoh 	option MSG_doumount, exit, action {
    120  1.2.2.1  msaitoh 		struct part_entry *cur_pe = arg;
    121  1.2.2.1  msaitoh 		pm_umount(pm, cur_pe->id);
    122  1.2.2.1  msaitoh 	};
    123  1.2.2.1  msaitoh 	option MSG_Delete_partition, exit, action {
    124  1.2.2.1  msaitoh 		struct part_entry *cur_pe = arg;
    125  1.2.2.1  msaitoh 		pm->unsaved = 1;
    126  1.2.2.1  msaitoh 		pm_partusage(pm, cur_pe->id, 1);
    127  1.2.2.1  msaitoh 		if (pm->no_part)
    128  1.2.2.1  msaitoh 			pm_unconfigure(pm);
    129  1.2.2.1  msaitoh 		else
    130  1.2.2.1  msaitoh 			pm_setfstype(pm, cur_pe->id, FS_UNUSED, 0);
    131  1.2.2.1  msaitoh 	};
    132      1.1      rin 
    133  1.2.2.1  msaitoh /* arg is a struct part_entry* */
    134      1.1      rin menu shred_modes, x=50, y=5, exit, default exit;
    135  1.2.2.1  msaitoh 	option MSG_fillzeros, exit,
    136  1.2.2.1  msaitoh 		action { pm_shred(arg, SHRED_ZEROS); };
    137      1.1      rin 	option MSG_fillrandom,	exit,
    138  1.2.2.1  msaitoh 		action { pm_shred(arg, SHRED_RANDOM); };
    139      1.1      rin 
    140  1.2.2.1  msaitoh /* 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.2.2.1  msaitoh /* arg is a const char ** set to the selected encryption type */
    148      1.1      rin menu cgd_enctype;
    149  1.2.2.1  msaitoh 	option "aes-xts", exit, action { *(const char**)arg = "aes-xts"; };
    150  1.2.2.1  msaitoh 	option "aes-cbc", exit, action { *(const char**)arg = "aes-cbc"; };
    151  1.2.2.1  msaitoh 	option "3des-cbc", exit, action { *(const char**)arg = "3des-cbc"; };
    152  1.2.2.1  msaitoh 	option "blowfish-cbc", exit, action
    153  1.2.2.1  msaitoh 				{ *(const char**)arg = "blowfish-cbc"; };
    154      1.1      rin 
    155  1.2.2.1  msaitoh /* arg is a const char ** set to the requested iv type */
    156      1.1      rin menu cgd_ivtype;
    157  1.2.2.1  msaitoh 	option "encblkno1", exit, action { *(const char**)arg = "encblkno1"; };
    158  1.2.2.1  msaitoh 	option "encblkno8", exit, action { *(const char**)arg = "encblkno8"; };
    159      1.1      rin 
    160  1.2.2.1  msaitoh /* arg is const char ** set to the key gen type */
    161      1.1      rin menu cgd_keygentype;
    162  1.2.2.1  msaitoh 	option "pkcs5_pbkdf2/sha1", exit, action
    163  1.2.2.1  msaitoh 				 { *(const char**)arg = "pkcs5_pbkdf2/sha1"; };
    164  1.2.2.1  msaitoh 	option "pkcs5_pbkdf2", exit, action
    165  1.2.2.1  msaitoh 				{ *(const char**)arg = "pkcs5_pbkdf2"; };
    166  1.2.2.1  msaitoh 	option "storedkey", exit, action
    167  1.2.2.1  msaitoh 				{ *(const char**)arg = "storedkey"; };
    168  1.2.2.1  msaitoh 	option "randomkey", exit, action
    169  1.2.2.1  msaitoh 				{ *(const char**)arg = "randomkey"; };
    170  1.2.2.1  msaitoh 	option "urandomkey", exit, action
    171  1.2.2.1  msaitoh 				{ *(const char**)arg = "urandomkey"; };
    172  1.2.2.1  msaitoh 	option "shell_cmd", exit, action
    173  1.2.2.1  msaitoh 				{ *(const char**)arg = "shell_cmd"; };
    174      1.1      rin 
    175  1.2.2.1  msaitoh /* art is a const char ** set to the requested verification type */
    176      1.1      rin menu cgd_verifytype;
    177  1.2.2.1  msaitoh 	option "none",		exit, action { *(const char**)arg = "none"; };
    178  1.2.2.1  msaitoh 	option "disklabel",	exit, action { *(const char**)arg = "disklabel"; };
    179  1.2.2.1  msaitoh 	option "MBR",		exit, action { *(const char**)arg = "mbr"; };
    180  1.2.2.1  msaitoh 	option "GPT",		exit, action { *(const char**)arg = "gpt"; };
    181  1.2.2.1  msaitoh 	option "ffs",		exit, action { *(const char**)arg = "ffs"; };
    182  1.2.2.1  msaitoh 	option "re-enter",	exit, action { *(const char**)arg = "re-enter"; };
    183