Home | History | Annotate | Line # | Download | only in sysinst
menus.mi revision 1.10
      1  1.10    martin /*	$NetBSD: menus.mi,v 1.10 2015/05/11 13:07:57 martin Exp $	*/
      2   1.1  dholland 
      3   1.1  dholland /*-
      4   1.1  dholland  * Copyright (c) 2003 The NetBSD Foundation, Inc.
      5   1.1  dholland  * All rights reserved.
      6   1.1  dholland  *
      7   1.1  dholland  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1  dholland  * by David Laight.
      9   1.1  dholland  *
     10   1.1  dholland  * Redistribution and use in source and binary forms, with or without
     11   1.1  dholland  * modification, are permitted provided that the following conditions
     12   1.1  dholland  * are met:
     13   1.1  dholland  * 1. Redistributions of source code must retain the above copyright
     14   1.1  dholland  *    notice, this list of conditions and the following disclaimer.
     15   1.1  dholland  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1  dholland  *    notice, this list of conditions and the following disclaimer in the
     17   1.1  dholland  *    documentation and/or other materials provided with the distribution.
     18   1.1  dholland  *
     19   1.1  dholland  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20   1.1  dholland  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21   1.1  dholland  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22   1.1  dholland  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23   1.1  dholland  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24   1.1  dholland  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25   1.1  dholland  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26   1.1  dholland  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27   1.1  dholland  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28   1.1  dholland  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29   1.1  dholland  * POSSIBILITY OF SUCH DAMAGE.
     30   1.1  dholland  */
     31   1.1  dholland 
     32   1.1  dholland /*
     33   1.1  dholland  * Menu system definitions -- machine and language independent
     34   1.1  dholland  *
     35   1.1  dholland  * Some menus may be called directly in the code rather than via the
     36   1.1  dholland  * menu system.
     37   1.1  dholland  *
     38   1.1  dholland  *  This file must be first in the sed command line.
     39   1.1  dholland  *
     40   1.1  dholland  */
     41   1.1  dholland 
     42   1.1  dholland {
     43   1.1  dholland #include <stdio.h>
     44   1.1  dholland #include <time.h>
     45   1.1  dholland #include <curses.h>
     46   1.1  dholland #include "defs.h"
     47   1.1  dholland #include "md.h"
     48   1.1  dholland #include "msg_defs.h"
     49   1.1  dholland #include "menu_defs.h"
     50   1.1  dholland 
     51   1.2    martin static menudesc menu_def[];
     52   1.2    martin 
     53   1.1  dholland static void
     54   1.1  dholland src_legend(menudesc *menu, const char *legend, const char *text)
     55   1.1  dholland {
     56   1.1  dholland         wprintw(menu->mw, "%-25s %.50s", MSG_XLAT(legend), MSG_XLAT(text));
     57   1.1  dholland }
     58   1.1  dholland 
     59   1.1  dholland static void
     60   1.1  dholland src_prompt(const char *prompt, char *buf, size_t size)
     61   1.1  dholland {
     62   1.1  dholland 	msg_prompt_win(prompt, -1, 12, 0, 0, buf, buf, size);
     63   1.1  dholland }
     64   1.2    martin 
     65   1.4    martin static void
     66   1.4    martin remove_sub_menu(int menuID)
     67   1.2    martin {
     68   1.2    martin 
     69   1.2    martin 	for (size_t i = 0; i < DYN_MENU_START; i++) {
     70   1.2    martin 		for (int j = 0; j < menu_def[i].numopts; j++) {
     71   1.2    martin 			if ((menu_def[i].opts[j].opt_flags & OPT_SUB)
     72   1.4    martin 			    && menu_def[i].opts[j].opt_menu == menuID) {
     73   1.2    martin 
     74   1.2    martin 				for (int k = j + 1; k < menu_def[i].numopts;
     75   1.2    martin 				    k++) {
     76   1.2    martin 					menu_def[i].opts[k-1] =
     77   1.2    martin 					    menu_def[i].opts[k];
     78   1.2    martin 				}
     79   1.2    martin 				menu_def[i].numopts--;
     80   1.2    martin 				return;
     81   1.2    martin 
     82   1.2    martin 			}
     83   1.2    martin 		}
     84   1.2    martin 	}
     85   1.2    martin }
     86   1.2    martin 
     87   1.4    martin static void
     88   1.4    martin remove_menu_option(int menuID, const char *option)
     89   1.4    martin {
     90   1.4    martin 
     91   1.4    martin 	for (int j = 0; j < menu_def[menuID].numopts; j++) {
     92   1.4    martin 		if (menu_def[menuID].opts[j].opt_name == option) {
     93   1.4    martin 			for (int k = j + 1; k < menu_def[menuID].numopts;
     94   1.4    martin 			    k++) {
     95   1.4    martin 				menu_def[menuID].opts[k-1] =
     96   1.4    martin 				    menu_def[menuID].opts[k];
     97   1.4    martin 			}
     98   1.4    martin 			menu_def[menuID].numopts--;
     99   1.4    martin 			return;
    100   1.4    martin 
    101   1.4    martin 		}
    102   1.4    martin 	}
    103   1.4    martin }
    104   1.4    martin 
    105   1.4    martin void
    106   1.4    martin remove_color_options()
    107   1.4    martin {
    108   1.4    martin 	/*
    109   1.4    martin 	 * Current terminal type does not support colors, so remove all
    110   1.4    martin 	 * menu entries (actually that is: Utils/Color Scheme) that do not
    111   1.4    martin 	 * make any sense in this case.
    112   1.4    martin 	 */
    113   1.4    martin 	remove_sub_menu(MENU_colors);
    114   1.4    martin }
    115   1.4    martin 
    116   1.4    martin void
    117   1.4    martin remove_raid_options()
    118   1.4    martin {
    119   1.4    martin 	/*
    120   1.4    martin 	 * No raidframe available, remove the following menu entries:
    121   1.4    martin 	 */
    122   1.4    martin 	remove_menu_option(MENU_pmdiskentry, MSG_fmtasraid);
    123   1.4    martin 	remove_menu_option(MENU_pmpartentry, MSG_fmtasraid);
    124   1.4    martin }
    125   1.4    martin 
    126   1.4    martin void
    127   1.4    martin remove_lvm_options()
    128   1.4    martin {
    129   1.4    martin 	/*
    130   1.4    martin 	 * No LVM available, remove the following menu entries:
    131   1.4    martin 	 */
    132   1.4    martin 	remove_menu_option(MENU_pmdiskentry, MSG_fmtaslvm);
    133   1.4    martin 	remove_menu_option(MENU_pmpartentry, MSG_fmtaslvm);
    134   1.4    martin }
    135   1.4    martin 
    136   1.4    martin void
    137   1.4    martin remove_gpt_options()
    138   1.4    martin {
    139   1.4    martin 	/*
    140   1.4    martin 	 * No GPT available, remove the following menu entries:
    141   1.4    martin 	 */
    142   1.4    martin 	remove_menu_option(MENU_pmdiskentry, MSG_switchgpt);
    143   1.4    martin 	remove_menu_option(MENU_pmpartentry, MSG_switchgpt);
    144   1.4    martin }
    145   1.4    martin 
    146   1.4    martin void
    147   1.4    martin remove_cgd_options()
    148   1.4    martin {
    149   1.4    martin 	/*
    150   1.4    martin 	 * No CGD available, remove the following menu entries:
    151   1.4    martin 	 */
    152   1.4    martin 	remove_menu_option(MENU_pmdiskentry, MSG_encrypt);
    153   1.4    martin 	remove_menu_option(MENU_pmpartentry, MSG_encrypt);
    154   1.4    martin }
    155   1.4    martin 
    156   1.1  dholland }
    157   1.1  dholland 
    158   1.1  dholland default y=12, no exit, scrollable;
    159   1.1  dholland 
    160   1.1  dholland allow dynamic menus;
    161   1.1  dholland allow dynamic messages;
    162   1.1  dholland error action {
    163   1.1  dholland 	fprintf (stderr, "Could not initialize menu system, please check "
    164   1.1  dholland 	    "your terminal type.\n");
    165   1.1  dholland 	exit(4);
    166   1.1  dholland };
    167   1.1  dholland 
    168   1.1  dholland menu selfskind, title MSG_Select_the_type, exitstring MSG_unchanged, y=6, x=30;
    169   1.1  dholland 	display action {
    170   1.1  dholland 		partinfo *p = arg;
    171   1.1  dholland 		switch (p->pi_fstype) {
    172   1.1  dholland 		case FS_UNUSED:	menu->cursel = 0; break;
    173   1.1  dholland 		case FS_BSDFFS:
    174   1.1  dholland 		    menu->cursel = p->pi_flags & PIF_FFSv2 ? 2 : 1;
    175   1.1  dholland 		    break;
    176   1.1  dholland 		case FS_SWAP:	menu->cursel = 3; break;
    177   1.1  dholland 		case FS_MSDOS:	menu->cursel = 4; break;
    178   1.1  dholland 		case FS_BSDLFS:	menu->cursel = 5; break;
    179   1.1  dholland 		default	:	menu->cursel = 6; break;
    180   1.1  dholland 		};
    181   1.1  dholland 	};
    182   1.1  dholland 	option "unused", exit, action
    183   1.1  dholland 	    { memset(arg, 0, sizeof (partinfo)); };
    184   1.1  dholland 	option "FFSv1", exit, action { set_ptype(arg, FS_BSDFFS, 0); };
    185   1.1  dholland 	option "FFSv2", exit, action { set_ptype(arg, FS_BSDFFS, PIF_FFSv2); };
    186   1.1  dholland 	option "swap",  exit, action { set_ptype(arg, FS_SWAP, 0); };
    187   1.1  dholland 	option "msdos", exit, action { set_ptype(arg, FS_MSDOS, 0); };
    188   1.1  dholland 	option "LFS",   exit, action { set_ptype(arg, FS_BSDLFS, 0); };
    189   1.1  dholland 	option MSG_other_types, action
    190   1.1  dholland 	    { extern int all_fstype_menu;
    191   1.1  dholland 	      m->opts[m->cursel].opt_menu = all_fstype_menu; };
    192   1.1  dholland 
    193   1.1  dholland menu selbsize, title MSG_Select_file_system_block_size, y=10, x=40;
    194   1.1  dholland 	display action {
    195   1.1  dholland 		partinfo *pi = arg;
    196   1.1  dholland 		int b;
    197   1.1  dholland 		b = ffs(pi->pi_fsize * pi->pi_frag / 4096) - 1;
    198   1.1  dholland 		if (b < 0 || b >= menu->numopts)
    199   1.1  dholland 			b = 1;
    200   1.1  dholland 		menu->cursel = b;
    201   1.1  dholland 	};
    202   1.1  dholland 	option  "4096", exit, action { set_bsize(arg, 4096); };
    203   1.1  dholland 	option  "8192", exit, action { set_bsize(arg, 8192); };
    204   1.1  dholland 	option "16384", exit, action { set_bsize(arg, 16384); };
    205   1.1  dholland 	option "32768", exit, action { set_bsize(arg, 32768); };
    206   1.1  dholland 
    207   1.1  dholland menu selfsize, title MSG_Select_file_system_fragment_size, y=11, x=40;
    208   1.1  dholland 	display action {
    209   1.1  dholland 		partinfo *pi = arg;
    210   1.1  dholland 		int b;
    211   1.1  dholland 		b = ffs(pi->pi_fsize / 512) - 1;
    212   1.1  dholland 		if (b < 0 || b >= menu->numopts)
    213   1.1  dholland 			b = 1;
    214   1.1  dholland 		menu->cursel = b;
    215   1.1  dholland 	};
    216   1.1  dholland 	option   "512", exit, action { set_fsize(arg, 512); };
    217   1.1  dholland 	option  "1024", exit, action { set_fsize(arg, 1024); };
    218   1.1  dholland 	option  "2048", exit, action { set_fsize(arg, 2048); };
    219   1.1  dholland 	option  "4096", exit, action { set_fsize(arg, 4096); };
    220   1.1  dholland 	option  "8192", exit, action { set_fsize(arg, 8192); };
    221   1.1  dholland 	option "16384", exit, action { set_fsize(arg, 16384); };
    222   1.1  dholland 	option "32768", exit, action { set_fsize(arg, 32768); };
    223   1.1  dholland 
    224   1.1  dholland menu mountoptions, title MSG_toggle, y=5, x=30, exitstring MSG_unchanged;
    225   1.1  dholland 	display action {
    226   1.1  dholland 		static int actual_numopt;
    227   1.1  dholland 		if (!actual_numopt)
    228   1.1  dholland 			actual_numopt = menu->numopts;
    229   1.1  dholland 		menu->numopts = actual_numopt -
    230   1.1  dholland 			(((partinfo *)arg)->pi_fstype !=  FS_BSDFFS);
    231   1.1  dholland 	};
    232   1.1  dholland 	option "log", exit, action
    233   1.1  dholland 		{ ((partinfo *)arg)->pi_flags ^= PIF_LOG; };
    234   1.1  dholland 	option "async", exit, action
    235   1.1  dholland 		{ ((partinfo *)arg)->pi_flags ^= PIF_ASYNC; };
    236   1.1  dholland 	option "noatime", exit, action
    237   1.1  dholland 		{ ((partinfo *)arg)->pi_flags ^= PIF_NOATIME; };
    238   1.1  dholland 	option "nodev", exit, action
    239   1.1  dholland 		{ ((partinfo *)arg)->pi_flags ^= PIF_NODEV; };
    240   1.1  dholland 	option "nodevmtime", exit, action
    241   1.1  dholland 		{ ((partinfo *)arg)->pi_flags ^= PIF_NODEVMTIME; };
    242   1.1  dholland 	option "noexec", exit, action
    243   1.1  dholland 		{ ((partinfo *)arg)->pi_flags ^= PIF_NOEXEC; };
    244   1.1  dholland 	option "nosuid", exit, action
    245   1.1  dholland 		{ ((partinfo *)arg)->pi_flags ^= PIF_NOSUID; };
    246   1.1  dholland 
    247   1.1  dholland menu netbsd, title MSG_NetBSD_VERSION_Install_System, y=-1,
    248   1.1  dholland     exit, exitstring MSG_Exit_Install_System;
    249   1.1  dholland 	display action  { toplevel(); };
    250   1.1  dholland 	option MSG_Install_NetBSD_to_hard_disk,
    251   1.1  dholland 		action { do_install(); };
    252   1.1  dholland 	option MSG_Upgrade_NetBSD_on_a_hard_disk,
    253   1.1  dholland 		action { do_upgrade(); };
    254   1.1  dholland 	option MSG_Re_install_sets_or_install_additional_sets,
    255   1.1  dholland 		action { do_reinstall_sets(); };
    256   1.1  dholland 	option MSG_Reboot_the_computer, exit,
    257   1.1  dholland 		action (endwin) { system("/sbin/reboot -q"); };
    258   1.1  dholland 	option MSG_Utility_menu, sub menu utility;
    259   1.1  dholland 	option MSG_Config_menu, action { do_configmenu(); };
    260   1.1  dholland 
    261   1.1  dholland menu utility, title MSG_NetBSD_VERSION_Utilities, exit,
    262   1.2    martin 		exitstring MSG_exit_menu_generic;
    263   1.1  dholland 	display action  { toplevel(); };
    264   1.1  dholland 	option MSG_Run_bin_sh,
    265   1.1  dholland 		action (endwin) { system("/bin/sh"); };
    266   1.1  dholland 	option MSG_Set_timezone,
    267   1.1  dholland 		action { set_timezone(); };
    268   1.1  dholland 	option MSG_Configure_network,
    269   1.1  dholland 		action {
    270   1.1  dholland 			extern int network_up;
    271   1.1  dholland 			network_up = 0;
    272   1.1  dholland 			config_network();
    273   1.1  dholland 		};
    274   1.2    martin 	option MSG_Partition_a_disk, action { partman_go = 1; partman(); };
    275   1.1  dholland 	option MSG_Logging_functions, action { do_logging(); };
    276   1.2    martin 	option MSG_Color_scheme, sub menu colors;
    277   1.1  dholland 	option MSG_Halt_the_system, exit,
    278   1.1  dholland 		action (endwin) { system("/sbin/halt -q"); };
    279   1.1  dholland 
    280   1.2    martin menu colors, title MSG_Color_scheme, exit,
    281   1.2    martin 		exitstring MSG_exit_menu_generic;
    282   1.2    martin 	option MSG_White_on_black, action { do_coloring(COLOR_WHITE,COLOR_BLACK); };
    283   1.2    martin 	option MSG_Black_on_white, action { do_coloring(COLOR_BLACK,COLOR_WHITE); };
    284   1.2    martin 	option MSG_White_on_blue,  action { do_coloring(COLOR_WHITE,COLOR_BLUE); };
    285   1.2    martin 	option MSG_Green_on_black, action { do_coloring(COLOR_GREEN,COLOR_BLACK); };
    286   1.2    martin 
    287   1.2    martin 
    288   1.1  dholland menu yesno, y=-10;
    289   1.9    martin 	display action { arg_rv *p = arg;
    290   1.9    martin 		menu->title = p->arg ? p->arg : MSG_yes_or_no; };
    291   1.9    martin 	option MSG_Yes, exit, action  { ((arg_rv*)arg)->rv = 1; };
    292   1.9    martin 	option MSG_No,  exit, action  { ((arg_rv*)arg)->rv = 0; };
    293   1.1  dholland 
    294   1.1  dholland menu noyes, y=-10;
    295   1.9    martin 	display action { arg_rv *p = arg;
    296   1.9    martin 		menu->title = p->arg ? p->arg : MSG_yes_or_no; };
    297   1.9    martin 	option MSG_No,  exit, action  { ((arg_rv*)arg)->rv = 0; };
    298   1.9    martin 	option MSG_Yes, exit, action  { ((arg_rv*)arg)->rv = 1; };
    299   1.1  dholland 
    300   1.1  dholland menu ok, no shortcut, y=-10;
    301   1.1  dholland 	display action { menu->title = arg; };
    302   1.1  dholland 	option MSG_Hit_enter_to_continue, exit;
    303   1.1  dholland 
    304   1.1  dholland menu layout, sub menu, y=-1, title  MSG_Choose_your_installation;
    305   1.2    martin 	option MSG_Set_Sizes, 	  exit, action { layoutkind = LY_SETNEW; };
    306   1.2    martin 	option MSG_Use_Existing,  exit, action { layoutkind = LY_USEEXIST; };
    307   1.1  dholland 
    308   1.1  dholland menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier;
    309   1.1  dholland 	display action {
    310   1.2    martin 		if (sizemult == pm->current_cylsize)
    311   1.1  dholland 			menu->cursel = 1;
    312   1.1  dholland 		else if (sizemult == 1)
    313   1.1  dholland 			menu->cursel = 2;
    314   1.1  dholland 		};
    315   1.1  dholland 	option MSG_Megabytes, exit, action
    316   1.2    martin 		{ sizemult = MEG / pm->sectorsize;
    317   1.1  dholland 		  multname = msg_string(MSG_megname);
    318   1.1  dholland 		};
    319   1.1  dholland 	option MSG_Cylinders, exit, action
    320   1.2    martin 		{ sizemult = pm->current_cylsize;
    321   1.1  dholland 		  multname = msg_string(MSG_cylname);
    322   1.1  dholland 		};
    323   1.1  dholland 	option MSG_Sectors, exit, action
    324   1.1  dholland 		{ sizemult = 1;
    325   1.1  dholland 		  multname = msg_string(MSG_secname);
    326   1.1  dholland 		};
    327   1.1  dholland 
    328   1.1  dholland menu distmedium, title MSG_Select_medium, y=-5;
    329   1.1  dholland 	option MSG_cdrom,     exit, action { *(int *)arg = get_via_cdrom(); };
    330   1.1  dholland 	option MSG_ftp,	      exit, action { *(int *)arg = get_via_ftp("ftp"); };
    331   1.1  dholland 	option MSG_http,      exit, action { *(int *)arg = get_via_ftp("http"); };
    332   1.1  dholland 	option MSG_nfs,	      exit, action { *(int *)arg = get_via_nfs(); };
    333   1.1  dholland 	option MSG_floppy,    exit, action { *(int *)arg = get_via_floppy(); };
    334   1.1  dholland 	option MSG_local_fs,  exit, action { *(int *)arg = get_via_localfs(); };
    335   1.1  dholland 	option MSG_local_dir, exit, action { *(int *)arg = get_via_localdir();};
    336   1.1  dholland 	option MSG_Skip_set,  exit, action { *(int *)arg = SET_SKIP; };
    337   1.1  dholland 	option MSG_Skip_group,exit, action { *(int *)arg = SET_SKIP_GROUP; };
    338   1.1  dholland 	option MSG_Abandon,   exit, action { *(int *)arg = SET_ABANDON; };
    339   1.1  dholland 
    340   1.3    martin menu distset, title MSG_Select_your_distribution, exit,
    341   1.3    martin 	    no default exit, exitstring MSG_Abandon;
    342   1.1  dholland 	display action { msg_display (MSG_distset); };
    343   1.2    martin 	option MSG_Full_installation, exit, action { *(int *)arg = 1; init_set_status(0);  };
    344   1.2    martin 	option MSG_Full_installation_nox, exit, action { *(int *)arg = 1; init_set_status(SFLAG_NOX); };
    345   1.2    martin 	option MSG_Minimal_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); };
    346   1.2    martin 	option MSG_Custom_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); customise_sets(); };
    347   1.1  dholland 
    348   1.1  dholland menu ftpsource, y=-4, x=0, w=70, no box, no clear,
    349   1.1  dholland 	    exitstring MSG_Get_Distribution;
    350   1.9    martin 	display action { msg_display(MSG_ftpsource, ((arg_rv*)arg)->arg); };
    351   1.1  dholland 	option {src_legend(menu, MSG_Host, ftp.host);},
    352   1.1  dholland 		action { src_prompt(MSG_Host, ftp.host, sizeof ftp.host); };
    353   1.1  dholland 	option {src_legend(menu, MSG_Base_dir, ftp.dir);},
    354   1.1  dholland 		action { src_prompt(MSG_Base_dir, ftp.dir, sizeof ftp.dir); };
    355   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
    356   1.1  dholland 		action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
    357   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
    358   1.1  dholland 		action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
    359   1.1  dholland 	option {src_legend(menu, MSG_User, ftp.user);},
    360   1.1  dholland 		action { src_prompt(MSG_User, ftp.user, sizeof ftp.user);
    361   1.1  dholland 			ftp.pass[0] = 0;
    362   1.1  dholland 		};
    363   1.1  dholland 	option {src_legend(menu, MSG_Password,
    364   1.1  dholland 		    strcmp(ftp.user, "ftp") == 0 || ftp.pass[0] == 0
    365   1.1  dholland 			? ftp.pass : msg_string(MSG_hidden));},
    366   1.1  dholland 		action { if (strcmp(ftp.user, "ftp") == 0)
    367   1.1  dholland 			src_prompt(MSG_email, ftp.pass, sizeof ftp.pass);
    368   1.1  dholland 		  else {
    369   1.1  dholland 			msg_prompt_noecho(MSG_Password, "",
    370   1.1  dholland 					ftp.pass, sizeof ftp.pass);
    371   1.1  dholland 		  }
    372   1.1  dholland 		};
    373   1.1  dholland 	option {src_legend(menu, MSG_Proxy, ftp.proxy);},
    374   1.1  dholland 		action { src_prompt(MSG_Proxy, ftp.proxy, sizeof ftp.proxy);
    375   1.1  dholland 		  if (strcmp(ftp.proxy, "") == 0) {
    376   1.1  dholland 			unsetenv("ftp_proxy");
    377   1.1  dholland 			unsetenv("http_proxy");
    378   1.1  dholland 		  } else {
    379   1.1  dholland 			setenv("ftp_proxy", ftp.proxy, 1);
    380   1.1  dholland 			setenv("http_proxy", ftp.proxy, 1);
    381   1.1  dholland 		  }
    382   1.1  dholland 		};
    383   1.1  dholland 	option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
    384   1.1  dholland 		action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
    385   1.1  dholland 	option {src_legend(menu, MSG_delete_xfer_file,
    386   1.1  dholland 			clean_xfer_dir ? MSG_Yes : MSG_No);},
    387  1.10    martin 		action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
    388   1.2    martin 	option MSG_Configure_network,
    389   1.2    martin 		action {
    390   1.2    martin 			extern int network_up;
    391   1.2    martin 			network_up = 0;
    392   1.2    martin 			config_network();
    393   1.2    martin 		};
    394   1.9    martin 	option MSG_exit_menu_generic, exit, action { ((arg_rv*)arg)->rv = SET_RETRY; };
    395   1.1  dholland 
    396   1.1  dholland 
    397   1.1  dholland menu nfssource, y=-4, x=0, w=70, no box, no clear,
    398   1.2    martin 	    exitstring MSG_Get_Distribution;
    399   1.1  dholland 	display action { msg_display(MSG_nfssource); };
    400   1.1  dholland 	option {src_legend(menu, MSG_Host, nfs_host);},
    401   1.1  dholland 		action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); };
    402   1.1  dholland 	option {src_legend(menu, MSG_Base_dir, nfs_dir);},
    403   1.1  dholland 		action { src_prompt(MSG_Base_dir, nfs_dir, sizeof nfs_dir); };
    404   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
    405   1.1  dholland 		action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
    406   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
    407   1.1  dholland 		action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
    408   1.2    martin 	option MSG_Configure_network,
    409   1.2    martin 		action {
    410   1.2    martin 			extern int network_up;
    411   1.2    martin 			network_up = 0;
    412   1.2    martin 			config_network();
    413   1.2    martin 		};
    414   1.9    martin 	option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
    415   1.1  dholland 
    416   1.1  dholland menu fdremount, title MSG_What_do_you_want_to_do;
    417   1.1  dholland 	option MSG_Try_again, exit, action { *(int *)arg = SET_CONTINUE; };
    418   1.1  dholland 	option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
    419   1.1  dholland 	option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
    420   1.1  dholland 
    421   1.1  dholland menu fdok, title MSG_What_do_you_want_to_do;
    422   1.1  dholland 	option MSG_OK, exit, action { *(int *)arg = SET_CONTINUE; };
    423   1.1  dholland 	option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; };
    424   1.1  dholland 	option MSG_Abort_fetch, exit, action { *(int *)arg = SET_RETRY; };
    425   1.1  dholland 
    426   1.1  dholland menu fd_type, title MSG_fd_type, y=16;
    427   1.1  dholland 	option "msdos", exit, action { fd_type = "msdos"; };
    428   1.1  dholland 	option "ffs",   exit, action { fd_type = "ffs"; };
    429   1.1  dholland .if ADOS_FLOPPY
    430   1.1  dholland 	option "ados",  exit, action { fd_type = "ados"; };
    431   1.1  dholland .endif
    432   1.1  dholland 
    433   1.1  dholland menu floppysource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
    434   1.1  dholland 	display action { msg_display(MSG_floppysource); };
    435   1.1  dholland 	option {src_legend(menu, MSG_Device, fd_dev);},
    436   1.1  dholland 		action { src_prompt(MSG_dev, fd_dev, sizeof fd_dev); };
    437   1.1  dholland 	option {src_legend(menu, MSG_fd_type, fd_type);}, sub menu fd_type;
    438   1.1  dholland 	option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
    439   1.1  dholland 		action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
    440   1.1  dholland 	option {src_legend(menu, MSG_delete_xfer_file,
    441   1.1  dholland 			clean_xfer_dir ? MSG_Yes : MSG_No);},
    442  1.10    martin 		action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
    443   1.9    martin 	option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
    444   1.1  dholland 
    445   1.1  dholland menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
    446   1.1  dholland 	display action { msg_display(MSG_cdromsource); };
    447   1.1  dholland 	option {src_legend(menu, MSG_Device, cdrom_dev);},
    448   1.1  dholland 		action { src_prompt(MSG_dev, cdrom_dev, sizeof cdrom_dev); };
    449   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
    450   1.1  dholland 		action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
    451   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
    452   1.1  dholland 		action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
    453   1.9    martin 	option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
    454   1.1  dholland 
    455   1.1  dholland menu localfssource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
    456   1.1  dholland 	display action { msg_display(MSG_localfssource); };
    457   1.1  dholland 	option {src_legend(menu, MSG_Device, localfs_dev);},
    458   1.1  dholland 		action { src_prompt(MSG_dev, localfs_dev, sizeof localfs_dev);};
    459   1.1  dholland 	option {src_legend(menu, MSG_File_system, localfs_fs);},
    460   1.1  dholland 		action { src_prompt(MSG_filesys, localfs_fs, sizeof localfs_fs); };
    461   1.1  dholland 	option {src_legend(menu, MSG_Base_dir, localfs_dir);},
    462   1.1  dholland 		action { src_prompt(MSG_Base_dir, localfs_dir, sizeof localfs_dir);};
    463   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
    464   1.1  dholland 		action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
    465   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
    466   1.1  dholland 		action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
    467   1.9    martin 	option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
    468   1.1  dholland 
    469   1.1  dholland menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
    470   1.1  dholland 	display action { msg_display(MSG_localdir); };
    471   1.1  dholland 	option {src_legend(menu, MSG_Base_dir, localfs_dir);},
    472   1.1  dholland 		action { src_prompt(MSG_Base_dir, localfs_dir, 60); };
    473   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_bin, set_dir_bin);},
    474   1.1  dholland 		action { src_prompt(MSG_Set_dir_bin, set_dir_bin, 60); };
    475   1.1  dholland 	option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
    476   1.1  dholland 		action { src_prompt(MSG_Set_dir_src, set_dir_src, 60); };
    477   1.9    martin 	option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
    478   1.1  dholland 
    479   1.6       roy menu namesrv6, title MSG_Select_DNS_server;
    480   1.6       roy 	option "google-public-dns-a.google.com (IPv4)", exit, action
    481   1.6       roy 		{
    482   1.6       roy #ifdef INET6
    483   1.6       roy 		  strlcpy(net_namesvr, "8.8.8.8",
    484   1.6       roy 		      sizeof(net_namesvr));
    485   1.9    martin 		  *((int*)arg) = 1;
    486   1.6       roy #else
    487   1.9    martin 		  *((int*)arg) = 0;
    488   1.6       roy #endif
    489   1.6       roy 		};
    490   1.6       roy 	option "google-public-dns-b.google.com (IPv4)", exit, action
    491   1.6       roy 		{
    492   1.6       roy #ifdef INET6
    493   1.6       roy 		  strlcpy(net_namesvr, "8.8.4.4",
    494   1.6       roy 		      sizeof(net_namesvr));
    495   1.9    martin 		  *((int*)arg) = 1;
    496   1.6       roy #else
    497   1.9    martin 		  *((int*)arg) = 0;
    498   1.6       roy #endif
    499   1.6       roy 		};
    500   1.6       roy 	option "google-public-dns-a.google.com (IPv6)", exit, action
    501   1.1  dholland 		{
    502   1.1  dholland #ifdef INET6
    503   1.5       roy 		  strlcpy(net_namesvr, "2001:4860:4860::8888",
    504   1.5       roy 		      sizeof(net_namesvr));
    505   1.9    martin 		  *((int*)arg) = 1;
    506   1.1  dholland #else
    507   1.9    martin 		  *((int*)arg) = 0;
    508   1.1  dholland #endif
    509   1.1  dholland 		};
    510   1.6       roy 	option "google-public-dns-b.google.com (IPv6)", exit, action
    511   1.1  dholland 		{
    512   1.1  dholland #ifdef INET6
    513   1.5       roy 		  strlcpy(net_namesvr, "2001:4860:4860::8844",
    514   1.5       roy 		      sizeof(net_namesvr));
    515   1.9    martin 		  *((int*)arg) = 1;
    516   1.1  dholland #else
    517   1.9    martin 		  *((int*)arg) = 0;
    518   1.1  dholland #endif
    519   1.1  dholland 		};
    520   1.1  dholland 	option MSG_other, exit, action
    521   1.9    martin 		{ *((int*)arg) = 0; };
    522   1.1  dholland 
    523   1.1  dholland menu rootsh, title MSG_Root_shell, no clear;
    524   1.1  dholland 	option "/bin/sh",  exit, action {*(const char **)arg = "/bin/sh";};
    525   1.1  dholland 	option "/bin/ksh", exit, action {*(const char **)arg = "/bin/ksh";};
    526   1.1  dholland 	option "/bin/csh", exit, action {*(const char **)arg = "/bin/csh";};
    527   1.1  dholland 
    528   1.1  dholland menu zeroconf, title "Zeroconf", no clear;
    529   1.1  dholland 	option "run mdnsd only", exit, action {*(const char **)arg = "mdnsd";};
    530   1.1  dholland 	option "run mdnsd and resolve local names", exit, action {*(const char **) arg = "mdnsd+nsswitch";};
    531   1.1  dholland 	option "do not run mdnsd", exit, action {*(const char **)arg = "No";};
    532   1.1  dholland 
    533   1.1  dholland menu binpkg, y=-4, x=0, w=70, no box, no clear,
    534   1.1  dholland 	    exitstring MSG_Install_pkgin;
    535   1.1  dholland 	display action { msg_display(MSG_pkgpath); };
    536   1.1  dholland 	option {src_legend(menu, MSG_Host, pkg.host);},
    537   1.1  dholland 		action { src_prompt(MSG_Host, pkg.host, sizeof pkg.host); };
    538   1.1  dholland 	option {src_legend(menu, MSG_Base_dir, pkg.dir);},
    539   1.1  dholland 		action { src_prompt(MSG_Base_dir, pkg.dir, sizeof pkg.dir); };
    540   1.1  dholland 	option {src_legend(menu, MSG_Pkg_dir, pkg_dir);},
    541   1.1  dholland 		action { src_prompt(MSG_Pkg_dir, pkg_dir, sizeof pkg_dir); };
    542   1.1  dholland 	option {src_legend(menu, MSG_User, pkg.user);},
    543   1.1  dholland 		action { src_prompt(MSG_User, pkg.user, sizeof pkg.user);
    544   1.1  dholland 			pkg.pass[0] = 0;
    545   1.1  dholland 		};
    546   1.1  dholland 	option {src_legend(menu, MSG_Password,
    547   1.1  dholland 		    strcmp(pkg.user, "ftp") == 0 || pkg.pass[0] == 0
    548   1.1  dholland 			? pkg.pass : msg_string(MSG_hidden));},
    549   1.1  dholland 		action { if (strcmp(pkg.user, "ftp") == 0)
    550   1.1  dholland 			src_prompt(MSG_email, pkg.pass, sizeof pkg.pass);
    551   1.1  dholland 		  else {
    552   1.1  dholland 			msg_prompt_noecho(MSG_Password, "",
    553   1.1  dholland 					pkg.pass, sizeof pkg.pass);
    554   1.1  dholland 		  }
    555   1.1  dholland 		};
    556   1.1  dholland 	option {src_legend(menu, MSG_Proxy, pkg.proxy);},
    557   1.1  dholland 		action { src_prompt(MSG_Proxy, pkg.proxy, sizeof pkg.proxy);
    558   1.1  dholland 		  if (strcmp(pkg.proxy, "") == 0) {
    559   1.1  dholland 			unsetenv("ftp_proxy");
    560   1.1  dholland 			unsetenv("http_proxy");
    561   1.1  dholland 		  } else {
    562   1.1  dholland 			setenv("ftp_proxy", pkg.proxy, 1);
    563   1.1  dholland 			setenv("http_proxy", pkg.proxy, 1);
    564   1.1  dholland 		  }
    565   1.1  dholland 		};
    566   1.9    martin 	option {src_legend(menu, "Additional packages", (char*)(((arg_rv*)arg)->arg)); }, /*TODO*/
    567   1.9    martin 		action { src_prompt("Additional packages", (char*)(((arg_rv*)arg)->arg),
    568   1.2    martin 			 sizeof(char) * STRSIZE); };
    569   1.2    martin 	option MSG_Configure_network,
    570   1.2    martin 		action {
    571   1.2    martin 			extern int network_up;
    572   1.2    martin 			network_up = 0;
    573   1.2    martin 			config_network();
    574   1.2    martin 			mnt_net_config();
    575   1.2    martin 		};
    576   1.9    martin 	option MSG_quit_pkgs_install, exit, action { ((arg_rv*)arg)->rv = SET_SKIP; };
    577   1.1  dholland 
    578   1.1  dholland menu pkgsrc, y=-4, x=0, w=70, no box, no clear,
    579   1.1  dholland 	    exit, exitstring MSG_Install_pkgsrc;
    580   1.1  dholland 	display action { msg_display(MSG_pkgsrc); };
    581   1.1  dholland 	option {src_legend(menu, MSG_Host, pkgsrc.host);},
    582   1.1  dholland 		action { src_prompt(MSG_Host, pkgsrc.host,
    583   1.1  dholland 			sizeof pkgsrc.host); };
    584   1.1  dholland 	option {src_legend(menu, MSG_Pkgsrc_dir, pkgsrc_dir);},
    585   1.1  dholland 		action { src_prompt(MSG_Pkgsrc_dir, pkgsrc_dir, sizeof pkgsrc_dir); };
    586   1.1  dholland 	option {src_legend(menu, MSG_User, pkgsrc.user);},
    587   1.1  dholland 		action { src_prompt(MSG_User, pkgsrc.user, sizeof pkgsrc.user);
    588   1.1  dholland 			pkgsrc.pass[0] = 0;
    589   1.1  dholland 		};
    590   1.1  dholland 	option {src_legend(menu, MSG_Password,
    591   1.1  dholland 		    strcmp(pkgsrc.user, "ftp") == 0 || pkgsrc.pass[0] == 0
    592   1.1  dholland 			? pkgsrc.pass : msg_string(MSG_hidden));},
    593   1.1  dholland 		action { if (strcmp(pkgsrc.user, "ftp") == 0)
    594   1.1  dholland 			src_prompt(MSG_email, pkgsrc.pass, sizeof pkgsrc.pass);
    595   1.1  dholland 		  else {
    596   1.1  dholland 			msg_prompt_noecho(MSG_Password, "",
    597   1.1  dholland 					pkgsrc.pass, sizeof pkgsrc.pass);
    598   1.1  dholland 		  }
    599   1.1  dholland 		};
    600   1.1  dholland 	option {src_legend(menu, MSG_Proxy, pkgsrc.proxy);},
    601   1.1  dholland 		action { src_prompt(MSG_Proxy, pkgsrc.proxy, sizeof pkgsrc.proxy);
    602   1.1  dholland 		  if (strcmp(pkgsrc.proxy, "") == 0) {
    603   1.1  dholland 			unsetenv("ftp_proxy");
    604   1.1  dholland 			unsetenv("http_proxy");
    605   1.1  dholland 		  } else {
    606   1.1  dholland 			setenv("ftp_proxy", pkgsrc.proxy, 1);
    607   1.1  dholland 			setenv("http_proxy", pkgsrc.proxy, 1);
    608   1.1  dholland 		  }
    609   1.1  dholland 		};
    610   1.1  dholland 	option {src_legend(menu, MSG_Xfer_dir, xfer_dir);},
    611   1.1  dholland 		action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
    612   1.1  dholland 	option {src_legend(menu, MSG_delete_xfer_file,
    613   1.1  dholland 			clean_xfer_dir ? MSG_Yes : MSG_No);},
    614  1.10    martin 		action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
    615   1.9    martin 	option MSG_quit_pkgsrc, exit, action { *((int*)arg) = SET_SKIP;};
    616   1.1  dholland 
    617   1.1  dholland menu usersh, title MSG_User_shell, no clear;
    618   1.1  dholland 	option "/bin/sh",  exit, action { ushell = "/bin/sh";};
    619   1.1  dholland 	option "/bin/ksh", exit, action { ushell = "/bin/ksh";};
    620   1.1  dholland 	option "/bin/csh", exit, action { ushell = "/bin/csh";};
    621   1.2    martin 
    622   1.2    martin 
    623   1.2    martin menu pmdiskentry, x=50, y=5, exit, default exit;
    624   1.2    martin 	option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
    625   1.2    martin 	option MSG_editmbr,		exit, action { md_get_info();
    626   1.2    martin 											md_pre_disklabel();
    627   1.2    martin 											memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);};
    628   1.2    martin 	option MSG_switchgpt,	exit, action { if (pm_gpt_convert(pm) == 0)
    629   1.2    martin 												pm_partusage(pm, -1, 1); };
    630   1.2    martin 	option MSG_renamedisk,	exit, action { pm->unsaved = 1; pm_rename(pm); };
    631   1.2    martin 	option MSG_fmtasraid,	exit, action { pm->unsaved = 1;
    632   1.2    martin 											pm_partusage(pm, -1, 1);
    633   1.2    martin 											layoutkind = LY_NEWRAID;
    634   1.2    martin 											md_make_bsd_partitions();};
    635   1.2    martin 	option MSG_fmtaslvm,	exit, action { pm->unsaved = 1;
    636   1.2    martin 											pm_partusage(pm, -1, 1);
    637   1.2    martin 											layoutkind = LY_NEWLVM;
    638   1.2    martin 											md_make_bsd_partitions(); };
    639   1.2    martin 	option MSG_encrypt,		exit, action { pm->unsaved = 1;
    640   1.2    martin 											pm_partusage(pm, -1, 1);
    641   1.2    martin 											layoutkind = LY_NEWCGD;
    642   1.2    martin 											md_make_bsd_partitions();
    643   1.2    martin 											pm_cgd_edit(0, &(part_entry_t)
    644   1.2    martin 												{.dev_ptr = pm, .dev_num = PART_E}
    645   1.2    martin 											); };
    646   1.2    martin 	option MSG_setbootable,	exit, action { pm->unsaved = 1;
    647   1.2    martin 											pm->bootable = !pm->bootable; };
    648   1.2    martin 	option MSG_erase,		next menu shred_modes;
    649   1.2    martin 	option MSG_undo,		exit, action { label_read(); pm->unsaved = 0;
    650   1.2    martin 											pm_partusage(pm, -1, 1); };
    651   1.2    martin 	option MSG_unconfig,	exit, action { if (pm_unconfigure(pm) == 0)
    652   1.2    martin 												pm_partusage(pm, -1, 1); };
    653   1.2    martin 
    654   1.2    martin menu pmpartentry, x=50, y=5, exit, default exit;
    655   1.2    martin 	option MSG_edit,		exit, action {
    656   1.2    martin 									pm->unsaved = 1;
    657   1.2    martin 									int tpfs = pm->bsdlabel[*(int*)arg].pi_fstype;
    658   1.2    martin 									int tplvm = pm->bsdlabel[*(int*)arg].lvmpv;
    659   1.2    martin 									pm_editpart(*(int*)arg);
    660   1.2    martin 									if (tpfs != pm->bsdlabel[*(int*)arg].pi_fstype ||
    661   1.2    martin 										tplvm != pm->bsdlabel[*(int*)arg].lvmpv)
    662   1.2    martin 										/* Oops, partition type changed */
    663   1.2    martin 										pm_partusage(pm, *(int*)arg, 1);
    664   1.2    martin 								};
    665   1.2    martin 	option MSG_fmtasraid,	exit, action {
    666   1.2    martin 									if (pm->gpt || pm->isspecial) {
    667   1.2    martin 										process_menu(MENU_ok, deconst(MSG_notsupported));
    668   1.2    martin 										return -1;
    669   1.2    martin 									}
    670   1.2    martin 									pm->unsaved = 1;
    671   1.2    martin 									pm_partusage(pm, *(int*)arg, 1);
    672   1.2    martin 									pm_setfstype(pm, *(int*)arg, FS_RAID);
    673   1.2    martin 								};
    674   1.2    martin 	option MSG_fmtaslvm,	exit, action {
    675   1.2    martin 									if (pm->gpt || pm->isspecial) {
    676   1.2    martin 										process_menu(MENU_ok, deconst(MSG_notsupported));
    677   1.2    martin 										return -1;
    678   1.2    martin 									}
    679   1.2    martin 									pm->unsaved = 1;
    680   1.2    martin 									pm_partusage(pm, *(int*)arg, 1);
    681   1.2    martin 									pm_setfstype(pm, *(int*)arg, FS_BSDFFS);
    682   1.2    martin 								    pm->bsdlabel[*(int*)arg].lvmpv = 1;
    683   1.2    martin 								};
    684   1.2    martin 	option MSG_encrypt,		exit, action {
    685   1.2    martin 									if (pm->gpt || pm->isspecial) {
    686   1.2    martin 										process_menu(MENU_ok, deconst(MSG_notsupported));
    687   1.2    martin 										return -1;
    688   1.2    martin 									}
    689   1.2    martin 									pm->unsaved = 1;
    690   1.2    martin 									pm_partusage(pm, *(int*)arg, 1);
    691   1.2    martin 									pm_setfstype(pm, *(int*)arg, FS_CGD);
    692   1.2    martin 									pm_cgd_edit(0,
    693   1.2    martin 										&(part_entry_t){.dev_ptr = pm,
    694   1.2    martin 														.dev_num = *(int*)arg});
    695   1.2    martin 								};
    696   1.2    martin 	option MSG_erase,		next menu shred_modes;
    697   1.2    martin 	option MSG_doumount,	exit, action { pm_umount(pm, *(int*)arg); };
    698   1.2    martin 	option MSG_Delete_partition,	exit, action {
    699   1.2    martin 									pm->unsaved = 1;
    700   1.2    martin 									pm_partusage(pm, *(int*)arg, 1);
    701   1.2    martin 									if (pm->isspecial)
    702   1.2    martin 										pm_unconfigure(pm);
    703   1.2    martin 									else
    704   1.2    martin 										pm->bsdlabel[*(int*)arg].pi_fstype = FS_UNUSED;
    705   1.2    martin 									};
    706   1.2    martin 
    707   1.2    martin menu pmgptentry, x=50, y=8, exit, default exit;
    708   1.2    martin 	option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
    709   1.2    martin 	option MSG_switchmbr,	exit, action { if (pm_gpt_convert(pm) == 0)
    710   1.2    martin 												pm_partusage(pm, -1, 1); };
    711   1.2    martin 	option MSG_setbootable,	exit, action { pm->unsaved = 1;
    712   1.2    martin 												pm->bootable = !pm->bootable; };
    713   1.2    martin 	option MSG_erase,		next menu shred_modes;
    714   1.2    martin 	option MSG_undo,		exit, action { label_read(); pm->unsaved = 0;
    715   1.2    martin 											pm_partusage(pm, -1, 1); };
    716   1.2    martin 	option MSG_unconfig,	exit, action { if (pm_unconfigure(pm) == 0)
    717   1.2    martin 												pm_partusage(pm, -1, 1); };
    718   1.2    martin 
    719   1.2    martin menu shred_modes, x=50, y=5, exit, default exit;
    720   1.2    martin 	option MSG_fillzeros,	exit,
    721   1.2    martin 							action { pm_shred(pm, *(int*)arg, SHRED_ZEROS); };
    722   1.2    martin 	option MSG_fillrandom,	exit,
    723   1.2    martin 							action { pm_shred(pm, *(int*)arg, SHRED_RANDOM); };
    724   1.2    martin 	option MSG_fillcrypto,	exit,
    725   1.2    martin 							action { pm_shred(pm, *(int*)arg, SHRED_CRYPTO); };
    726   1.2    martin 
    727   1.2    martin menu raidlevel;
    728   1.2    martin 	option MSG_raid0, exit, action { *(int *)arg = 0; };
    729   1.2    martin 	option MSG_raid1, exit, action { *(int *)arg = 1; };
    730   1.2    martin 	option MSG_raid4, exit, action { *(int *)arg = 4; };
    731   1.2    martin 	option MSG_raid5, exit, action { *(int *)arg = 5; };
    732   1.2    martin 
    733   1.2    martin menu cgd_enctype;
    734   1.2    martin 	option "aes-cbc",			exit, action { *(const char**)arg = "aes-cbc"; };
    735   1.2    martin 	option "3des-cbc",			exit, action { *(const char**)arg = "3des-cbc"; };
    736   1.2    martin 	option "blowfish-cbc",		exit, action { *(const char**)arg = "blowfish-cbc"; };
    737   1.2    martin 
    738   1.2    martin menu cgd_ivtype;
    739   1.2    martin 	option "encblkno1",			exit, action { *(const char**)arg = "encblkno1"; };
    740   1.2    martin 	option "encblkno8",			exit, action { *(const char**)arg = "encblkno8"; };
    741   1.2    martin 
    742   1.2    martin menu cgd_keygentype;
    743   1.2    martin 	option "pkcs5_pbkdf2/sha1",	exit, action { *(const char**)arg = "pkcs5_pbkdf2/sha1"; };
    744   1.2    martin 	option "pkcs5_pbkdf2",		exit, action { *(const char**)arg = "pkcs5_pbkdf2"; };
    745   1.2    martin 	option "storedkey",			exit, action { *(const char**)arg = "storedkey"; };
    746   1.2    martin 	option "randomkey",			exit, action { *(const char**)arg = "randomkey"; };
    747   1.2    martin 	option "urandomkey",		exit, action { *(const char**)arg = "urandomkey"; };
    748   1.2    martin 	option "shell_cmd",			exit, action { *(const char**)arg = "shell_cmd"; };
    749   1.2    martin 
    750   1.2    martin menu cgd_verifytype;
    751   1.2    martin 	option "none",				exit, action { *(const char**)arg = "none"; };
    752   1.2    martin 	option "disklabel",			exit, action { *(const char**)arg = "disklabel"; };
    753   1.2    martin 	option "ffs",				exit, action { *(const char**)arg = "ffs"; };
    754   1.2    martin 	option "re-enter",			exit, action { *(const char**)arg = "re-enter"; };
    755