summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2009-06-26 16:19:22 +0000
committerOlivier Blin <oblin@mandriva.com>2009-06-26 16:19:22 +0000
commit75b2a8f97703a430cac0cd1fc46cf479e5414899 (patch)
tree98a301dd5450de2a0e4e5ebe5056536ae6e84a3a
parent6063a57556ced49de2bccf18f83cccfee672bac2 (diff)
downloaddraklive-75b2a8f97703a430cac0cd1fc46cf479e5414899.tar
draklive-75b2a8f97703a430cac0cd1fc46cf479e5414899.tar.gz
draklive-75b2a8f97703a430cac0cd1fc46cf479e5414899.tar.bz2
draklive-75b2a8f97703a430cac0cd1fc46cf479e5414899.tar.xz
draklive-75b2a8f97703a430cac0cd1fc46cf479e5414899.zip
split allocate_partition
-rwxr-xr-xdraklive23
1 files changed, 14 insertions, 9 deletions
diff --git a/draklive b/draklive
index c2ff4d4..81eb070 100755
--- a/draklive
+++ b/draklive
@@ -654,6 +654,19 @@ sub get_disk_master_path {
$live->get_builddir . $live->{prefix}{build}{dist} . '/' . $live->get_name . '.img';
}
+sub allocate_partition {
+ my ($dest, $sector_size, $fs, $o_inode_size) = @_;
+ my ($part_start, $part_nb_sectors) = run_program::get_stdout("sfdisk -d $dest") =~ /start=\s*(\d+),\s*size=\s*(\d+)/;
+
+ require devices;
+ my $loop = devices::find_free_loop();
+ run_('losetup', '-o', $part_start * $sector_size, '-s', $part_nb_sectors * $sector_size, $loop, $dest)
+ or die "unable to setup loop device";
+ MDV::Draklive::Utils::device_mkfs($loop, $fs, $o_inode_size) or die "unable to format $dest\n";
+
+ return $loop;
+}
+
sub allocate_master {
my ($dest, $size, $fs, $o_inode_size) = @_;
mkdir_p(dirname($dest));
@@ -687,15 +700,7 @@ w
EOF
close($fdisk) or die "unable to run fdisk\n" . ("$!" ? "Error closing fdisk pipe: $!" : "Exit status $? from fdisk");
- my ($part_start, $part_nb_sectors) = run_program::get_stdout("sfdisk -d $dest") =~ /start=\s*(\d+),\s*size=\s*(\d+)/;
-
- require devices;
- my $loop = devices::find_free_loop();
- run_('losetup', '-o', $part_start * $sector_size, '-s', $part_nb_sectors * $sector_size, $loop, $dest)
- or die "unable to setup loop device";
- MDV::Draklive::Utils::device_mkfs($loop, $fs, $o_inode_size) or die "unable to format $dest\n";
-
- return $loop;
+ return allocate_partition($dest, $sector_size, $fs, $o_inode_size);
}
sub create_disk_master {