diff options
-rwxr-xr-x | draklive | 18 | ||||
-rw-r--r-- | lib/MDV/Draklive/Media.pm | 6 |
2 files changed, 12 insertions, 12 deletions
@@ -665,7 +665,7 @@ sub build_syslinux_cfg { my ($live, $media, $opts) = @_; my $append = get_default_append($live, $opts); #- syslinux wants files at root (used with vfat fs) - my $to_root = get_boot_setting($media, 'fs', $opts) eq 'vfat'; + my $to_root = $media->get_boot_setting('fs', $opts) eq 'vfat'; my $boot = get_media_prefix($live, 'boot', $opts->{boot}); my ($initrd, $kernel, $bootlogo, $help) = map { $to_root ? basename($_) : $_ } map { $boot . $_ } $media->get_initrd_path, @syslinux_boot_files; @@ -1022,12 +1022,6 @@ sub list_selected_loopbacks { $live->{settings}{pack} ? @{$live->{packs}{$live->{settings}{pack}} || []} : ()); } -#- for actions that support an optional boot storage type -sub get_boot_setting { - my ($media, $setting, $opts) = @_; - $opts->{boot} ? $storage{$opts->{boot}}{$setting} : get_media_setting($media, $setting); -} - #- for user-customisable media setting, that can override storage setting sub get_media_setting { my ($media, $setting) = @_; @@ -1056,7 +1050,7 @@ sub get_media_device { sub get_media_prefix { my ($live, $setting, $o_boot) = @_; - my $hidden = $live->{system}{hide_media_dirs} && get_boot_setting($live->{media}, 'can_hide', { boot => $o_boot }); + my $hidden = $live->{system}{hide_media_dirs} && $live->{media}->get_boot_setting('can_hide', { boot => $o_boot }); $live->{prefix}{media}{$hidden ? "hidden_$setting" : $setting}; } @@ -1304,7 +1298,7 @@ sub create_disk_master { sub create_master { my ($live, $opts) = @_; - if (my $create = get_boot_setting($live->{media}, 'create', $opts)) { + if (my $create = $live->{media}->get_boot_setting('create', $opts)) { $create->($live, $opts); } else { warn "not implemented yet\n"; @@ -1335,7 +1329,7 @@ sub format_device { my ($live, $opts) = @_; get_media_device($live, $opts) or die "no device defined in media configuration\n"; - if (my $format = get_boot_setting($live->{media}, 'format', $opts)) { + if (my $format = $live->{media}->get_boot_setting('format', $opts)) { $format->($live, $opts); } else { warn "not implemented yet\n"; @@ -1368,7 +1362,7 @@ sub install_usb_bootloader { my ($live, $media, $opts) = @_; my $media_boot = get_media_prefix($live, 'boot', $opts->{boot}); my $device = get_media_device($live, $opts); - my $bootloader = get_boot_setting($media, 'bootloader', $opts); + my $bootloader = $media->get_boot_setting('bootloader', $opts); member($bootloader, 'grub', 'syslinux') or die "no bootloader defined in media configuration\n"; my $grub_device_map = $live->{mnt} . $media_boot . "/grub/device.map"; @@ -1537,7 +1531,7 @@ sub record_harddisk_master { sub record_master { my ($live, $opts) = @_; - if (my $record = get_boot_setting($live->{media}, 'record', $opts)) { + if (my $record = $live->{media}->get_boot_setting('record', $opts)) { $record->($live, $opts); } else { warn "not implemented yet\n"; diff --git a/lib/MDV/Draklive/Media.pm b/lib/MDV/Draklive/Media.pm index 27eea42..e3fa1ac 100644 --- a/lib/MDV/Draklive/Media.pm +++ b/lib/MDV/Draklive/Media.pm @@ -11,4 +11,10 @@ sub get_storage_setting { $storage{$media->{storage}}{$setting}; } +#- for actions that support an optional boot storage type +sub get_boot_setting { + my ($media, $setting, $opts) = @_; + $opts->{boot} ? $storage{$opts->{boot}}{$setting} : get_media_setting($media, $setting); +} + 1; |