summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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;