summaryrefslogtreecommitdiffstats
path: root/draklive
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-10-28 23:52:39 +0000
committerOlivier Blin <oblin@mandriva.com>2008-10-28 23:52:39 +0000
commit445348796f67ee14f85d84291877d766834237a9 (patch)
treec8faac791b01f319565b364ddee6ca0f371408c3 /draklive
parent970bbb3887e4d1ca89ee1ca117defaa85c6845e7 (diff)
downloaddraklive-445348796f67ee14f85d84291877d766834237a9.tar
draklive-445348796f67ee14f85d84291877d766834237a9.tar.gz
draklive-445348796f67ee14f85d84291877d766834237a9.tar.bz2
draklive-445348796f67ee14f85d84291877d766834237a9.tar.xz
draklive-445348796f67ee14f85d84291877d766834237a9.zip
move device_allocate_file and device_mkfs in MDV::Draklive::Utils
Diffstat (limited to 'draklive')
-rwxr-xr-xdraklive27
1 files changed, 5 insertions, 22 deletions
diff --git a/draklive b/draklive
index 3066715..a9d0316 100755
--- a/draklive
+++ b/draklive
@@ -245,8 +245,8 @@ my %loop;
my ($live, $dir) = @_;
my $dest = $live->get_builddir . $live->{prefix}{build}{loopbacks} . $dir->{path} . $loop{loopfs}{extension};
mkdir_p(dirname($dest));
- device_allocate_file($dest, $dir->{pre_allocate});
- device_mkfs($dest, $dir->{fs}) if !defined $dir->{min_size};
+ MDV::Draklive::Utils::device_allocate_file($dest, $dir->{pre_allocate});
+ MDV::Draklive::Utils::device_mkfs($dest, $dir->{fs}) if !defined $dir->{min_size};
},
mount => sub {
my ($live, $dir) = @_;
@@ -1039,23 +1039,6 @@ sub create_classical_bootloader {
output_p($live->get_system_root . '/boot/grub/menu.lst', build_grub_cfg_raw($live, $live->{media}, "/initrd.img", {}, $part_nb));
}
-sub device_allocate_file {
- my ($device, $size) = @_;
- run_('dd', "of=$device", 'count=0', 'bs=1', "seek=" . removeXiBSuffix($size));
-}
-
-#- format $device as type $type
-sub device_mkfs {
- my ($device, $type) = @_;
- if ($type eq 'vfat') {
- run_('mkfs.vfat', $device);
- } elsif (member($type, 'ext2', 'ext3')) {
- run_("mkfs.$type", "-m", 0, if_(!-b $device, '-F'), $device);
- } else {
- die "unable to mkfs for unsupported media type $type\n";
- }
-}
-
sub set_device_label {
my ($device, $type, $label) = @_;
if ($type eq 'vfat') {
@@ -1147,7 +1130,7 @@ sub allocate_master {
my $disk_size = $size + $track_size;
my $cylinders = int($disk_size / $cylinder_size);
- device_allocate_file($dest, $disk_size);
+ MDV::Draklive::Utils::device_allocate_file($dest, $disk_size);
#- FIXME: use parted?
require fs::type;
@@ -1174,7 +1157,7 @@ EOF
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";
- device_mkfs($loop, $fs) or die "unable to format $dest\n";
+ MDV::Draklive::Utils::device_mkfs($loop, $fs) or die "unable to format $dest\n";
return $loop;
}
@@ -1222,7 +1205,7 @@ sub format_usb_device {
my ($live, $opts) = @_;
my $device = get_media_device($live, $opts);
maybe_umount_device($device);
- device_mkfs($device, $live->{media}->get_media_setting('fs'))
+ MDV::Draklive::Utils::device_mkfs($device, $live->{media}->get_media_setting('fs'))
or die "unable to format device $device\n";
}