diff options
Diffstat (limited to 'lib/MDV/Draklive/Utils.pm')
-rw-r--r-- | lib/MDV/Draklive/Utils.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/MDV/Draklive/Utils.pm b/lib/MDV/Draklive/Utils.pm index 12ce647..94be289 100644 --- a/lib/MDV/Draklive/Utils.pm +++ b/lib/MDV/Draklive/Utils.pm @@ -64,13 +64,17 @@ sub device_allocate_file { #- format $device as type $type # FIXME: use fs::format sub device_mkfs { - my ($device, $type, $o_inode_size) = @_; + my ($device, $type, $o_label, $o_inode_size) = @_; if ($type eq 'vfat') { - run_('mkfs.vfat', $device); + run_('mkfs.vfat', if_(defined $o_label, '-L', $o_label), $device); } elsif (member($type, 'ext2', 'ext3', 'ext4')) { - run_("mkfs.$type", "-m", 0, if_($o_inode_size, '-I', $o_inode_size), if_(!-b $device, '-F'), $device); + run_("mkfs.$type", "-m", 0, + if_(defined $o_label, '-L', $o_label), + if_($o_inode_size, '-I', $o_inode_size), + if_(!-b $device, '-F'), + $device); } elsif ($type eq 'swap') { - run_('mkswap', $device); + run_('mkswap', if_(defined $o_label, '-L', $o_label), $device); } else { die "unable to mkfs for unsupported media type $type\n"; } |