summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdraklive15
-rw-r--r--lib/MDV/Draklive/Media.pm5
2 files changed, 10 insertions, 10 deletions
diff --git a/draklive b/draklive
index 3a1f1b9..4e72694 100755
--- a/draklive
+++ b/draklive
@@ -1022,15 +1022,10 @@ sub list_selected_loopbacks {
$live->{settings}{pack} ? @{$live->{packs}{$live->{settings}{pack}} || []} : ());
}
-sub get_media_label {
- my ($media) = @_;
- first($media->get_media_setting('source') =~ /^LABEL=(.*)$/);
-}
-
sub get_media_device {
my ($live, $opts) = @_;
return $opts->{device} if $opts->{device};
- my $label = get_media_label($live->{media}) or return $live->{media}->get_media_setting('source');
+ my $label = $live->{media}->get_media_label or return $live->{media}->get_media_setting('source');
my $device = chomp_(`readlink -f /dev/disk/by-label/$label`)
or die "unable to find device for /dev/disk/by-label/$label\n";
$device;
@@ -1044,7 +1039,7 @@ sub get_media_prefix {
sub get_media_source_for_nash {
my ($media) = @_;
- my $label = get_media_label($media);
+ my $label = $media->get_media_label;
#- strip vfat labels to 11 chars and upper-case it
$label && $media->get_media_setting('fs') eq 'vfat' ?
'LABEL=' . uc(substr($label, 0, 11)) :
@@ -1159,7 +1154,7 @@ sub get_cdrom_master_path {
sub create_cdrom_master {
my ($live, $opts) = @_;
- my $label = get_media_label($live->{media}) or die "the source device must be described by a label\n";
+ my $label = $live->{media}->get_media_label or die "the source device must be described by a label\n";
my $dest;
unless ($opts->{onthefly}) {
$dest = get_cdrom_master_path($live, $opts);
@@ -1408,7 +1403,7 @@ sub record_usb_master {
my $media_boot = get_media_prefix($live, 'boot', $opts->{boot});
my $media_loopbacks = get_media_prefix($live, 'loopbacks', $opts->{boot});
- if (my $label = !$opts->{boot_only} && $opts->{device} && get_media_label($media)) {
+ if (my $label = !$opts->{boot_only} && $opts->{device} && $media->get_media_label) {
set_device_label($opts->{device}, $media->get_media_setting('fs'), $label);
}
my $device = get_media_device($live, $opts)
@@ -1472,7 +1467,7 @@ sub record_harddisk_master {
my $media_boot = get_media_prefix($live, 'boot', $opts->{boot});
my $media_loopbacks = get_media_prefix($live, 'loopbacks', $opts->{boot});
- if (my $label = !$opts->{boot_only} && $opts->{device} && get_media_label($media)) {
+ if (my $label = !$opts->{boot_only} && $opts->{device} && $media->get_media_label) {
set_device_label($opts->{device}, $media->get_media_setting('fs'), $label);
}
my $device = get_media_device($live, $opts)
diff --git a/lib/MDV/Draklive/Media.pm b/lib/MDV/Draklive/Media.pm
index a6242c1..6cd5d33 100644
--- a/lib/MDV/Draklive/Media.pm
+++ b/lib/MDV/Draklive/Media.pm
@@ -29,4 +29,9 @@ sub get_media_fs_module {
$fs eq 'iso9660' ? 'isofs' : $fs eq 'ext2' ? @{[]} : $fs;
}
+sub get_media_label {
+ my ($media) = @_;
+ first($media->get_media_setting('source') =~ /^LABEL=(.*)$/);
+}
+
1;