Home | History | Annotate | Line # | Download | only in sysinst
menus.pm revision 1.1
      1  1.1  rin /*	$NetBSD: menus.pm,v 1.1 2018/09/20 12:27:42 rin 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.1  rin menu pmdiskentry, x=50, y=5, exit, default exit;
     36  1.1  rin 	option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
     37  1.1  rin 	option MSG_editmbr,		exit, action { md_get_info();
     38  1.1  rin 											md_pre_disklabel();
     39  1.1  rin 											memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);};
     40  1.1  rin 	option MSG_switchgpt,	exit, action { if (pm_gpt_convert(pm) == 0)
     41  1.1  rin 												pm_partusage(pm, -1, 1); };
     42  1.1  rin 	option MSG_renamedisk,	exit, action { pm->unsaved = 1; pm_rename(pm); };
     43  1.1  rin 	option MSG_fmtasraid,	exit, action { pm->unsaved = 1;
     44  1.1  rin 											pm_partusage(pm, -1, 1);
     45  1.1  rin 											layoutkind = LY_NEWRAID;
     46  1.1  rin 											md_make_bsd_partitions();};
     47  1.1  rin 	option MSG_fmtaslvm,	exit, action { pm->unsaved = 1;
     48  1.1  rin 											pm_partusage(pm, -1, 1);
     49  1.1  rin 											layoutkind = LY_NEWLVM;
     50  1.1  rin 											md_make_bsd_partitions(); };
     51  1.1  rin 	option MSG_encrypt,		exit, action { pm->unsaved = 1;
     52  1.1  rin 											pm_partusage(pm, -1, 1);
     53  1.1  rin 											layoutkind = LY_NEWCGD;
     54  1.1  rin 											md_make_bsd_partitions();
     55  1.1  rin 											pm_cgd_edit(0, &(part_entry_t)
     56  1.1  rin 												{.dev_ptr = pm, .dev_num = PART_E}
     57  1.1  rin 											); };
     58  1.1  rin 	option MSG_setbootable,	exit, action { pm->unsaved = 1;
     59  1.1  rin 											pm->bootable = !pm->bootable; };
     60  1.1  rin 	option MSG_erase,		next menu shred_modes;
     61  1.1  rin 	option MSG_undo,		exit, action { label_read(); pm->unsaved = 0;
     62  1.1  rin 											pm_partusage(pm, -1, 1); };
     63  1.1  rin 	option MSG_unconfig,	exit, action { if (pm_unconfigure(pm) == 0)
     64  1.1  rin 												pm_partusage(pm, -1, 1); };
     65  1.1  rin 
     66  1.1  rin menu pmpartentry, x=50, y=5, exit, default exit;
     67  1.1  rin 	option MSG_edit,		exit, action { 
     68  1.1  rin 									pm->unsaved = 1;
     69  1.1  rin 									int tpfs = pm->bsdlabel[*(int*)arg].pi_fstype;
     70  1.1  rin 									int tplvm = pm->bsdlabel[*(int*)arg].lvmpv;
     71  1.1  rin 									pm_editpart(*(int*)arg);
     72  1.1  rin 									if (tpfs != pm->bsdlabel[*(int*)arg].pi_fstype ||
     73  1.1  rin 										tplvm != pm->bsdlabel[*(int*)arg].lvmpv)
     74  1.1  rin 										/* Oops, partition type changed */
     75  1.1  rin 										pm_partusage(pm, *(int*)arg, 1);
     76  1.1  rin 								};
     77  1.1  rin 	option MSG_fmtasraid,	exit, action {
     78  1.1  rin 									if (pm->gpt || pm->isspecial) {
     79  1.1  rin 										process_menu(MENU_ok, __UNCONST(MSG_notsupported));
     80  1.1  rin 										return -1;
     81  1.1  rin 									}
     82  1.1  rin 									pm->unsaved = 1;
     83  1.1  rin 									pm_partusage(pm, *(int*)arg, 1);
     84  1.1  rin 									pm_setfstype(pm, *(int*)arg, FS_RAID);
     85  1.1  rin 								};
     86  1.1  rin 	option MSG_fmtaslvm,	exit, action {
     87  1.1  rin 									if (pm->gpt || pm->isspecial) {
     88  1.1  rin 										process_menu(MENU_ok, __UNCONST(MSG_notsupported));
     89  1.1  rin 										return -1;
     90  1.1  rin 									}
     91  1.1  rin 									pm->unsaved = 1;
     92  1.1  rin 									pm_partusage(pm, *(int*)arg, 1);
     93  1.1  rin 									pm_setfstype(pm, *(int*)arg, FS_BSDFFS);
     94  1.1  rin 								    pm->bsdlabel[*(int*)arg].lvmpv = 1;
     95  1.1  rin 								};
     96  1.1  rin 	option MSG_encrypt,		exit, action {
     97  1.1  rin 									if (pm->gpt || pm->isspecial) {
     98  1.1  rin 										process_menu(MENU_ok, __UNCONST(MSG_notsupported));
     99  1.1  rin 										return -1;
    100  1.1  rin 									}
    101  1.1  rin 									pm->unsaved = 1;
    102  1.1  rin 									pm_partusage(pm, *(int*)arg, 1);
    103  1.1  rin 									pm_setfstype(pm, *(int*)arg, FS_CGD);
    104  1.1  rin 									pm_cgd_edit(0,
    105  1.1  rin 										&(part_entry_t){.dev_ptr = pm,
    106  1.1  rin 														.dev_num = *(int*)arg});
    107  1.1  rin 								};
    108  1.1  rin 	option MSG_erase,		next menu shred_modes;
    109  1.1  rin 	option MSG_doumount,	exit, action { pm_umount(pm, *(int*)arg); };
    110  1.1  rin 	option MSG_Delete_partition,	exit, action {
    111  1.1  rin 									pm->unsaved = 1;
    112  1.1  rin 									pm_partusage(pm, *(int*)arg, 1);
    113  1.1  rin 									if (pm->isspecial)
    114  1.1  rin 										pm_unconfigure(pm);
    115  1.1  rin 									else
    116  1.1  rin 										pm->bsdlabel[*(int*)arg].pi_fstype = FS_UNUSED;
    117  1.1  rin 									};
    118  1.1  rin 
    119  1.1  rin menu pmgptentry, x=50, y=8, exit, default exit;
    120  1.1  rin 	option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
    121  1.1  rin 	option MSG_switchmbr,	exit, action { if (pm_gpt_convert(pm) == 0)
    122  1.1  rin 												pm_partusage(pm, -1, 1); };
    123  1.1  rin 	option MSG_setbootable,	exit, action { pm->unsaved = 1;
    124  1.1  rin 												pm->bootable = !pm->bootable; };
    125  1.1  rin 	option MSG_erase,		next menu shred_modes;
    126  1.1  rin 	option MSG_undo,		exit, action { label_read(); pm->unsaved = 0;
    127  1.1  rin 											pm_partusage(pm, -1, 1); };
    128  1.1  rin 	option MSG_unconfig,	exit, action { if (pm_unconfigure(pm) == 0)
    129  1.1  rin 												pm_partusage(pm, -1, 1); };
    130  1.1  rin 
    131  1.1  rin menu shred_modes, x=50, y=5, exit, default exit;
    132  1.1  rin 	option MSG_fillzeros,	exit,
    133  1.1  rin 							action { pm_shred(pm, *(int*)arg, SHRED_ZEROS); };
    134  1.1  rin 	option MSG_fillrandom,	exit,
    135  1.1  rin 							action { pm_shred(pm, *(int*)arg, SHRED_RANDOM); };
    136  1.1  rin 	option MSG_fillcrypto,	exit,
    137  1.1  rin 							action { pm_shred(pm, *(int*)arg, SHRED_CRYPTO); };
    138  1.1  rin 
    139  1.1  rin menu raidlevel;
    140  1.1  rin 	option MSG_raid0, exit, action { *(int *)arg = 0; };
    141  1.1  rin 	option MSG_raid1, exit, action { *(int *)arg = 1; };
    142  1.1  rin 	option MSG_raid4, exit, action { *(int *)arg = 4; };
    143  1.1  rin 	option MSG_raid5, exit, action { *(int *)arg = 5; };
    144  1.1  rin 
    145  1.1  rin menu cgd_enctype;
    146  1.1  rin 	option "aes-xts",			exit, action { *(const char**)arg = "aes-xts"; };
    147  1.1  rin 	option "aes-cbc",			exit, action { *(const char**)arg = "aes-cbc"; };
    148  1.1  rin 	option "3des-cbc",			exit, action { *(const char**)arg = "3des-cbc"; };
    149  1.1  rin 	option "blowfish-cbc",		exit, action { *(const char**)arg = "blowfish-cbc"; };
    150  1.1  rin 
    151  1.1  rin menu cgd_ivtype;
    152  1.1  rin 	option "encblkno1",			exit, action { *(const char**)arg = "encblkno1"; };
    153  1.1  rin 	option "encblkno8",			exit, action { *(const char**)arg = "encblkno8"; };
    154  1.1  rin 
    155  1.1  rin menu cgd_keygentype;
    156  1.1  rin 	option "pkcs5_pbkdf2/sha1",	exit, action { *(const char**)arg = "pkcs5_pbkdf2/sha1"; };
    157  1.1  rin 	option "pkcs5_pbkdf2",		exit, action { *(const char**)arg = "pkcs5_pbkdf2"; };
    158  1.1  rin 	option "storedkey",			exit, action { *(const char**)arg = "storedkey"; };
    159  1.1  rin 	option "randomkey",			exit, action { *(const char**)arg = "randomkey"; };
    160  1.1  rin 	option "urandomkey",		exit, action { *(const char**)arg = "urandomkey"; };
    161  1.1  rin 	option "shell_cmd",			exit, action { *(const char**)arg = "shell_cmd"; };
    162  1.1  rin 
    163  1.1  rin menu cgd_verifytype;
    164  1.1  rin 	option "none",				exit, action { *(const char**)arg = "none"; };
    165  1.1  rin 	option "disklabel",			exit, action { *(const char**)arg = "disklabel"; };
    166  1.1  rin 	option "ffs",				exit, action { *(const char**)arg = "ffs"; };
    167  1.1  rin 	option "re-enter",			exit, action { *(const char**)arg = "re-enter"; };
    168