diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-10-28 23:52:39 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-10-28 23:52:39 +0000 |
commit | 445348796f67ee14f85d84291877d766834237a9 (patch) | |
tree | c8faac791b01f319565b364ddee6ca0f371408c3 /lib/MDV/Draklive | |
parent | 970bbb3887e4d1ca89ee1ca117defaa85c6845e7 (diff) | |
download | drakiso-445348796f67ee14f85d84291877d766834237a9.tar drakiso-445348796f67ee14f85d84291877d766834237a9.tar.gz drakiso-445348796f67ee14f85d84291877d766834237a9.tar.bz2 drakiso-445348796f67ee14f85d84291877d766834237a9.tar.xz drakiso-445348796f67ee14f85d84291877d766834237a9.zip |
move device_allocate_file and device_mkfs in MDV::Draklive::Utils
Diffstat (limited to 'lib/MDV/Draklive')
-rw-r--r-- | lib/MDV/Draklive/Utils.pm | 17 |
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; |