Add an (expert) option to manually edit partitions, inspired by PR 57100.
This commit is contained in:
parent
c5acd70fc9
commit
ec5e52a94f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bsddisklabel.c,v 1.68 2022/12/15 15:11:44 martin Exp $ */
|
||||
/* $NetBSD: bsddisklabel.c,v 1.69 2022/12/15 15:32:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -779,6 +779,13 @@ set_use_default_sizes(menudesc *m, void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_use_empty_parts(menudesc *m, void *arg)
|
||||
{
|
||||
((arg_rep_int*)arg)->rv = LY_USENONE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if there is a reasonable pre-existing partition for
|
||||
* NetBSD.
|
||||
|
@ -813,7 +820,7 @@ ask_layout(struct disk_partitions *parts, bool have_existing)
|
|||
const char *args[2];
|
||||
int menu;
|
||||
size_t num_opts;
|
||||
menu_ent options[4], *opt;
|
||||
menu_ent options[5], *opt;
|
||||
|
||||
args[0] = msg_string(parts->pscheme->name);
|
||||
args[1] = msg_string(parts->pscheme->short_name);
|
||||
|
@ -844,6 +851,12 @@ ask_layout(struct disk_partitions *parts, bool have_existing)
|
|||
opt++;
|
||||
num_opts++;
|
||||
|
||||
opt->opt_name = MSG_Use_Empty_Parts;
|
||||
opt->opt_flags = OPT_EXIT;
|
||||
opt->opt_action = set_use_empty_parts;
|
||||
opt++;
|
||||
num_opts++;
|
||||
|
||||
if (num_available_part_schemes > 1 &&
|
||||
parts->parent == NULL) {
|
||||
opt->opt_name = MSG_Use_Different_Part_Scheme;
|
||||
|
@ -1833,6 +1846,19 @@ make_bsd_partitions(struct install_partition_desc *install)
|
|||
if (layoutkind == LY_OTHERSCHEME) {
|
||||
parts->pscheme->destroy_part_scheme(parts);
|
||||
return -1;
|
||||
} else if (layoutkind == LY_USENONE) {
|
||||
struct disk_part_free_space space;
|
||||
size_t cnt;
|
||||
|
||||
empty_usage_set_from_parts(&wanted, parts);
|
||||
cnt = parts->pscheme->get_free_spaces(parts, &space, 1,
|
||||
0, parts->pscheme->get_part_alignment(parts), 0, -1);
|
||||
p_start = p_size = 0;
|
||||
if (cnt == 1) {
|
||||
p_start = space.start;
|
||||
p_size = space.size;
|
||||
wanted.cur_free_space = space.size;
|
||||
}
|
||||
} else if (layoutkind == LY_USEDEFAULT) {
|
||||
replace_by_default(parts, p_start, p_size,
|
||||
&wanted);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: defs.h,v 1.87 2022/07/11 15:12:24 martin Exp $ */
|
||||
/* $NetBSD: defs.h,v 1.88 2022/12/15 15:32:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -117,6 +117,7 @@ enum layout_type {
|
|||
LY_SETSIZES, /* edit sizes */
|
||||
LY_USEDEFAULT, /* use default sizes */
|
||||
LY_USEFULL, /* use full disk for NetBSD */
|
||||
LY_USENONE, /* start with empty partitions, manual mode */
|
||||
LY_ERROR /* used for "abort" in menu */
|
||||
};
|
||||
|
||||
|
@ -894,6 +895,8 @@ int set_menu_select(menudesc *, void *);
|
|||
const char *safectime(time_t *);
|
||||
bool use_tgz_for_set(const char*);
|
||||
const char *set_postfix(const char*);
|
||||
bool empty_usage_set_from_parts(struct partition_usage_set*,
|
||||
struct disk_partitions*);
|
||||
bool usage_set_from_parts(struct partition_usage_set*,
|
||||
struct disk_partitions*);
|
||||
bool usage_set_from_install_desc(struct partition_usage_set*,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msg.mi.de,v 1.42 2022/11/30 15:53:35 martin Exp $ */
|
||||
/* $NetBSD: msg.mi.de,v 1.43 2022/12/15 15:32:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -1109,6 +1109,12 @@ message Set_Sizes {Gr
|
|||
*/
|
||||
message Use_Default_Parts {Standard-Partitionsgößen verwenden}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
*/
|
||||
message Use_Empty_Parts {Partitionen frei definieren}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = current partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msg.mi.en,v 1.45 2022/11/30 15:53:35 martin Exp $ */
|
||||
/* $NetBSD: msg.mi.en,v 1.46 2022/12/15 15:32:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -1043,6 +1043,12 @@ message Set_Sizes {Set sizes of NetBSD partitions}
|
|||
*/
|
||||
message Use_Default_Parts {Use default partition sizes}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
*/
|
||||
message Use_Empty_Parts {Manually define partitions}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = current partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msg.mi.es,v 1.38 2022/11/30 15:53:35 martin Exp $ */
|
||||
/* $NetBSD: msg.mi.es,v 1.39 2022/12/15 15:32:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -1070,6 +1070,12 @@ message Set_Sizes {Establecer los tama
|
|||
*/
|
||||
message Use_Default_Parts {Use default partition sizes}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
*/
|
||||
message Use_Empty_Parts {Manually define partitions}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = current partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msg.mi.fr,v 1.43 2022/11/30 15:53:35 martin Exp $ */
|
||||
/* $NetBSD: msg.mi.fr,v 1.44 2022/12/15 15:32:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -1120,6 +1120,12 @@ message Set_Sizes {Sp
|
|||
*/
|
||||
message Use_Default_Parts {Use default partition sizes}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
*/
|
||||
message Use_Empty_Parts {Manually define partitions}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = current partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msg.mi.pl,v 1.44 2022/11/30 15:53:35 martin Exp $ */
|
||||
/* $NetBSD: msg.mi.pl,v 1.45 2022/12/15 15:32:04 martin Exp $ */
|
||||
/* Based on english version: */
|
||||
/* NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp */
|
||||
|
||||
|
@ -1036,6 +1036,12 @@ message Set_Sizes {Ustaw rozmiary partycji NetBSD}
|
|||
*/
|
||||
message Use_Default_Parts {Uzyj domyslnych rozmiarow partycji}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
*/
|
||||
message Use_Empty_Parts {Manually define partitions}
|
||||
|
||||
/* Called with: Example
|
||||
* $0 = current partitioning name Master Boot Record (MBR)
|
||||
* $1 = short version of $0 MBR
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: util.c,v 1.69 2022/07/10 10:52:41 martin Exp $ */
|
||||
/* $NetBSD: util.c,v 1.70 2022/12/15 15:32:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -2458,6 +2458,16 @@ usage_info_list_from_parts(struct part_usage_info **list, size_t *count,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
empty_usage_set_from_parts(struct partition_usage_set *wanted,
|
||||
struct disk_partitions *parts)
|
||||
{
|
||||
memset(wanted, 0, sizeof(*wanted));
|
||||
wanted->parts = parts;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
usage_set_from_parts(struct partition_usage_set *wanted,
|
||||
struct disk_partitions *parts)
|
||||
|
|
Loading…
Reference in New Issue