From b53b453cbb33ddeb9e7b36af564b476282d4747d Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 23 Oct 2009 13:28:38 +0000 Subject: set label at mkfs time --- lib/MDV/Draklive/Utils.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/MDV/Draklive') 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"; } -- cgit v1.2.1