mirror of
https://github.com/webmin/webmin.git
synced 2025-07-21 23:40:34 +00:00
Fix to display GPT with fdisk
but don't edit
This commit is contained in:
@ -12,6 +12,10 @@ $d || &error($text{'disk_egone'});
|
||||
@parts = @{$d->{'parts'}};
|
||||
&ui_print_header($d->{'desc'}, $text{'disk_title'}, "", undef,
|
||||
@disks == 1 ? 1 : 0, @disks == 1 ? 1 : 0);
|
||||
$caneditpart =
|
||||
$d->{'table'} ne 'gpt' ||
|
||||
($d->{'table'} eq 'gpt' &&
|
||||
&has_command('parted'));
|
||||
|
||||
# Work out links to add partitions
|
||||
foreach $p (@parts) {
|
||||
@ -28,17 +32,22 @@ foreach $p (@parts) {
|
||||
$anyfree++;
|
||||
}
|
||||
}
|
||||
if ($regular < 4 || $disk->{'table'} ne 'msdos') {
|
||||
push(@edlinks, "<a href=\"edit_part.cgi?disk=$d->{'index'}&new=1\">".
|
||||
$text{'index_addpri'}."</a>");
|
||||
if ($caneditpart) {
|
||||
if ($regular < 4 || $disk->{'table'} ne 'msdos') {
|
||||
push(@edlinks, "<a href=\"edit_part.cgi?disk=$d->{'index'}&new=1\">".
|
||||
$text{'index_addpri'}."</a>");
|
||||
}
|
||||
if ($extended) {
|
||||
push(@edlinks, "<a href=\"edit_part.cgi?disk=$d->{'index'}&new=2\">".
|
||||
$text{'index_addlog'}."</a>");
|
||||
}
|
||||
elsif ($regular < 4 && &supports_extended()) {
|
||||
push(@edlinks, "<a href=\"edit_part.cgi?disk=$d->{'index'}&new=3\">".
|
||||
$text{'index_addext'}."</a>");
|
||||
}
|
||||
}
|
||||
if ($extended) {
|
||||
push(@edlinks, "<a href=\"edit_part.cgi?disk=$d->{'index'}&new=2\">".
|
||||
$text{'index_addlog'}."</a>");
|
||||
}
|
||||
elsif ($regular < 4 && &supports_extended()) {
|
||||
push(@edlinks, "<a href=\"edit_part.cgi?disk=$d->{'index'}&new=3\">".
|
||||
$text{'index_addext'}."</a>");
|
||||
else {
|
||||
$wantsparted = 1;
|
||||
}
|
||||
if ($d->{'table'} eq 'unknown') {
|
||||
# Must create a partition table first
|
||||
@ -64,6 +73,10 @@ if ($d->{'table'}) {
|
||||
}
|
||||
print &ui_links_row(\@info),"<p>\n";
|
||||
|
||||
if ($wantsparted) {
|
||||
print "<p>$text{'edit_edisk'}</p>\n";
|
||||
}
|
||||
|
||||
# Show table of partitions, if any
|
||||
if (@parts) {
|
||||
print &ui_links_row(\@edlinks);
|
||||
|
@ -121,7 +121,7 @@ if ($pinfo->{'extended'} || $in{'new'} == 3) {
|
||||
# Extended, cannot change
|
||||
print &ui_table_row($text{'edit_type'}, $text{'extended'});
|
||||
}
|
||||
elsif (($pinfo->{'edittype'} || $in{'new'}) && !$mounted) {
|
||||
elsif (($pinfo->{'edittype'} == 1 || $in{'new'}) && !$mounted) {
|
||||
# Can change
|
||||
print &ui_table_row($text{'edit_type'},
|
||||
&ui_select("type",
|
||||
@ -203,7 +203,7 @@ if (($has_e2label || $has_xfs_db) && &supports_label($pinfo) && !$in{'new'}) {
|
||||
}
|
||||
|
||||
# Show field for partition name
|
||||
if (&supports_name($dinfo) && !$mounted) {
|
||||
if (&supports_name($dinfo) && !$mounted && $pinfo->{'edittype'} != 2) {
|
||||
print &ui_table_row($text{'edit_name'},
|
||||
&ui_textbox("name", $pinfo->{'name'}, 20));
|
||||
}
|
||||
@ -218,17 +218,18 @@ print &ui_table_end();
|
||||
if ($in{'new'}) {
|
||||
print &ui_form_end([ [ undef, $text{'create'} ] ]);
|
||||
}
|
||||
elsif (@stat && $stat[2]) {
|
||||
elsif (@stat && $stat[2] &&
|
||||
$pinfo->{'edittype'} != 2) {
|
||||
print &ui_form_end();
|
||||
print "$text{'edit_inuse'}\n";
|
||||
}
|
||||
else {
|
||||
elsif ($pinfo->{'edittype'} != 2) {
|
||||
print &ui_form_end([ $pinfo->{'extended'} ? ( ) :
|
||||
( [ undef, $text{'save'} ] ),
|
||||
[ 'delete', $text{'delete'} ] ]);
|
||||
}
|
||||
|
||||
if (!$in{'new'} && !$pinfo->{'extended'}) {
|
||||
if (!$in{'new'} && !$pinfo->{'extended'} && $pinfo->{'edittype'} != 2) {
|
||||
my $ui_buttons_content;
|
||||
|
||||
if (!@stat || $stat[2] == 0) {
|
||||
@ -291,6 +292,9 @@ if (!$in{'new'} && !$pinfo->{'extended'}) {
|
||||
print $ui_buttons_content;
|
||||
print &ui_buttons_end();
|
||||
}
|
||||
} elsif (!$mounted &&
|
||||
$pinfo->{'edittype'} == 2) {
|
||||
print "$text{'edit_eparted'}\n";
|
||||
}
|
||||
|
||||
&ui_print_footer("edit_disk.cgi?device=$dinfo->{'device'}",
|
||||
|
@ -517,7 +517,7 @@ while(<FDISK>) {
|
||||
'blocks' => "$+{blocks}",
|
||||
'index' => scalar(@{$disk->{'parts'}}),
|
||||
'dtable' => $disk->{'table'},
|
||||
'edittype' => 1, };
|
||||
'edittype' => 2, };
|
||||
$part->{'desc'} = &partition_description($part->{'device'});
|
||||
$part->{'size'} = ($part->{'end'} - $part->{'start'} + 1) *
|
||||
$disk->{'cylsize'};
|
||||
|
@ -98,6 +98,8 @@ edit_name=Partition name
|
||||
edit_volid=Volume ID
|
||||
edit_blocks=$1 blocks
|
||||
edit_inuse=This partition cannot be changed as it is currently in use or configured for use.
|
||||
edit_eparted=This partition cannot be changed unless <tt>parted</tt> command is installed.
|
||||
edit_edisk=This disk cannot be edited unless <tt>parted</tt> command is installed.
|
||||
edit_mkfs=Create New Filesystem
|
||||
edit_mkfs2=Create Filesystem:
|
||||
edit_mkfsmsg=Builds a new $1 filesystem on this partition, permanently erasing any existing files. You must do this after creating a new partition or changing an existing one.
|
||||
|
Reference in New Issue
Block a user