summaryrefslogtreecommitdiffstats
path: root/lib/MDV/Draklive/Utils.pm
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 /lib/MDV/Draklive/Utils.pm
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 'lib/MDV/Draklive/Utils.pm')
-rw-r--r--lib/MDV/Draklive/Utils.pm17
1 files changed, 17 insertions, 0 deletions
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;