mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
Create default parts on a slice
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
# XXX exclude from Solaris, RPM, Deb
|
||||
# XXX editing parititions and slices
|
||||
# XXX active slice
|
||||
# XXX change slice type
|
||||
# XXX slice start and end overlap?
|
||||
# XXX does this work on MacOS?
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
@@ -15,7 +18,7 @@ use WebminCore;
|
||||
|
||||
sub check_fdisk
|
||||
{
|
||||
foreach my $cmd ("fdisk", "disklabel", "gpart") {
|
||||
foreach my $cmd ("fdisk", "disklabel") {
|
||||
if (!&has_command($cmd)) {
|
||||
return &text('index_ecmd', "<tt>$cmd</tt>");
|
||||
}
|
||||
@@ -250,8 +253,36 @@ my $type = hex($slice->{'type'});
|
||||
my $start = int(($slice->{'startblock'} * $disk->{'blocksize'}) / 1024);
|
||||
my $end = int((($slice->{'startblock'} + $slice->{'blocks'}) *
|
||||
$disk->{'blocksize'}) / 1024);
|
||||
return &execute_fdisk_commands($disk,
|
||||
my $err = &execute_fdisk_commands($disk,
|
||||
[ "p $slice->{'number'} $type ${start}K ${end}K" ]);
|
||||
if (!$err) {
|
||||
$slice->{'device'} = $disk->{'device'}."s".$slice->{'number'};
|
||||
}
|
||||
return $err;
|
||||
}
|
||||
|
||||
# initialize_slice(&disk, &slice)
|
||||
# After a slice is created, put a default label on it
|
||||
sub initialize_slice
|
||||
{
|
||||
my ($disk, $slice) = @_;
|
||||
my $err = &backquote_logged("bsdlabel -w $slice->{'device'}");
|
||||
return $? ? $err : undef;
|
||||
}
|
||||
|
||||
sub list_partition_types
|
||||
{
|
||||
return ( '4.2BSD', 'swap', 'unused', 'vinum' );
|
||||
}
|
||||
|
||||
# create_partition(&disk, &slice, &part)
|
||||
# Create a new partition on some slice
|
||||
sub create_partition
|
||||
{
|
||||
my ($disk, $slice, $part) = @_;
|
||||
# XXX initialize with
|
||||
# XXX bsdlabel -w /dev/ada2s1
|
||||
# XXX if "no valid label found"
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -44,7 +44,14 @@ else {
|
||||
|
||||
if (!$err && $in{'makepart'}) {
|
||||
# Also create a partition
|
||||
# XXX
|
||||
print &text('nslice_parting', $in{'number'}, $disk->{'desc'}),"<p>\n";
|
||||
my $err = &initialize_slice($disk, $slice);
|
||||
if ($err) {
|
||||
print &text('nslice_pfailed', $err),"<p>\n";
|
||||
}
|
||||
else {
|
||||
print &text('nslice_pdone'),"<p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
&ui_print_footer("edit_disk.cgi?device=$in{'device'}",
|
||||
|
||||
@@ -50,6 +50,7 @@ slice_use=Used by
|
||||
slice_none=This slice has no partitions yet.
|
||||
slice_delete=Delete Slice
|
||||
slice_deletedesc=Delete this slice and all partitions and filesystems within it. Any data on those filesystem will be almost certainly unrecoverable.
|
||||
slice_return=list of partitions
|
||||
|
||||
dslice_title=Delete Slice
|
||||
dslice_rusure=Are you sure you want to delete the slice $1? Any partitions and filesystems within it will also be deleted.
|
||||
@@ -66,7 +67,7 @@ nslice_diskblocks=Disk size in blocks
|
||||
nslice_start=Starting block
|
||||
nslice_end=Ending block
|
||||
nslice_type=New slice type
|
||||
nslice_makepart=Also create partition?
|
||||
nslice_makepart=Create default partition?
|
||||
nslice_err=Failed to create slice
|
||||
nslice_enumber=Missing or non-numeric slice number
|
||||
nslice_eclash=A slice with number $1 already exists
|
||||
@@ -77,3 +78,12 @@ nslice_emax=Ending block cannot be larger than the disk size of $1 blocks
|
||||
nslice_creating=Creating slice $1 on $2 ..
|
||||
nslice_failed=.. slice creation failed : $1
|
||||
nslice_done=.. slice added
|
||||
nslice_parting=Create default partitions in slice $1 on $2 ..
|
||||
nslice_pfailed=.. partition creation failed : $1
|
||||
nslice_pdone=.. partition added
|
||||
|
||||
npart_title=Create Partition
|
||||
npart_header=New partition details
|
||||
npart_letter=Partition letter
|
||||
npart_diskblocks=Slice size in blocks
|
||||
npart_type=Partition type
|
||||
|
||||
Reference in New Issue
Block a user