summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-10-28 20:52:38 +0000
committerOlivier Blin <oblin@mandriva.com>2008-10-28 20:52:38 +0000
commit85be56b030be5e5dff618e21f8acc34ff238b89a (patch)
tree7e9874d53de055836b0ccf09d33c9539563cad07
parentd056dbb5e6d9fac1ae32e43642f24be0c57c4007 (diff)
downloaddrakiso-85be56b030be5e5dff618e21f8acc34ff238b89a.tar
drakiso-85be56b030be5e5dff618e21f8acc34ff238b89a.tar.gz
drakiso-85be56b030be5e5dff618e21f8acc34ff238b89a.tar.bz2
drakiso-85be56b030be5e5dff618e21f8acc34ff238b89a.tar.xz
drakiso-85be56b030be5e5dff618e21f8acc34ff238b89a.zip
move get_media_label as method in MDV::Draklive::Media
-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;