From 445348796f67ee14f85d84291877d766834237a9 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 28 Oct 2008 23:52:39 +0000 Subject: move device_allocate_file and device_mkfs in MDV::Draklive::Utils --- lib/MDV/Draklive/Utils.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/MDV/Draklive/Utils.pm') diff --git a/lib/MDV/Draklive/Utils.pm b/lib/MDV/Draklive/Utils.pm index d1b98e3..3fae6a9 100644 --- a/lib/MDV/Draklive/Utils.pm +++ b/lib/MDV/Draklive/Utils.pm @@ -51,4 +51,21 @@ sub mtools_run_ { &run_; } +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"; + } +} + 1; -- cgit v1.2.1