diff options
-rwxr-xr-x | draklive | 8 | ||||
-rw-r--r-- | lib/MDV/Draklive/Utils.pm | 12 |
2 files changed, 9 insertions, 11 deletions
@@ -785,7 +785,7 @@ sub format_master { my $inode_size = $media->get_media_setting('inode_size'); foreach my $part (@{$media->{partitions}}) { set_part_real_device($hd, $part); - MDV::Draklive::Utils::device_mkfs($part->{real_device}, $part->{fs_type}, $inode_size) + MDV::Draklive::Utils::device_mkfs($part->{real_device}, $part->{fs_type}, $part->{device_LABEL}, $inode_size) or die "unable to format $part->{real_device} in $hd->{file}\n"; devices::del_loop($part->{real_device}) if -f $hd->{file}; } @@ -1024,12 +1024,6 @@ sub record_harddisk_master { my $hd = get_hd_from_file($media, $main_device); supplement_media_partitions($media, $hd); - if (my $label = !$opts->{boot_only} && $media->get_media_label) { - my $slash_idx = $media->find_partition_index('/'); - my $slash = $media->{partitions}[$slash_idx]; - set_device_label($slash->{real_device}, $media->get_media_setting('fs'), $label); - } - mkdir_p($live->{mnt}); foreach my $part (sort { $a->{mntpoint} cmp $b->{mntpoint} } @{$media->{partitions}}) { set_part_real_device($hd, $part); 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"; } |