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 --- draklive | 8 +------- lib/MDV/Draklive/Utils.pm | 12 ++++++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/draklive b/draklive index 0f1ad2a..a96b5bd 100755 --- a/draklive +++ b/draklive @@ -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"; } -- cgit v1.2.1