diff options
-rwxr-xr-x | draklive | 41 | ||||
-rw-r--r-- | lib/MDV/Draklive/Storage.pm | 39 |
2 files changed, 42 insertions, 38 deletions
@@ -38,42 +38,7 @@ use MDV::Draklive::Progress; use MDV::Draklive::Loopback; use MDV::Draklive::Initrd; use MDV::Draklive::Config; - -my %storage = ( - cdrom => { - modules => 'bus/firewire|usb disk/firewire|hardware_raid|ide|sata|scsi|usb', - media_modules => 'disk/cdrom', - fs => 'iso9660', - can_hide => 0, - source => 'LABEL=MDVCDROOT', - read_only => 1, - detect => \&detect_devices::burners, - create => \&create_cdrom_master, - format => \&format_cdrom_device, - record_needs_master => 1, - record => \&record_cdrom_master, - }, - usb => { - modules => 'bus/usb disk/usb', - media_modules => 'disk/raw', - fs => 'vfat', - can_hide => 1, - bootloader => 'grub', - source => 'LABEL=MDVUSBROOT', - detect => sub { grep { detect_devices::isKeyUsb($_) } detect_devices::get() }, - create => \&create_disk_master, - format => \&format_usb_device, - record => \&record_usb_master, - image => \&create_disk_image, - replicator => \&create_usb_replicator, - }, - harddisk => { - fs => 'ext3', - create => \&create_disk_master, - record => \&record_harddisk_master, - image => \&create_disk_image, - }, -); +use MDV::Draklive::Storage; sub get_syslinux_path { my ($media, $opts) = @_; @@ -1136,7 +1101,7 @@ sub copy_wizard { }, post => sub { my $boot = $live->{settings}{builddir} . $media_boot; - @available_storage = sort(grep { -d "$boot/$_" && exists $storage{$_}{detect} } all($boot)); + @available_storage = sort(grep { -d "$boot/$_" && exists $MDV::Draklive::Storage::storage_types{$_}{detect} } all($boot)); if (@available_storage == 1) { $storage = $available_storage[0]; return 'device'; @@ -1153,7 +1118,7 @@ sub copy_wizard { device => { name => N("Please select the device that will contain the new live system"), pre => sub { - my %devices = map { $_->{device} => $_ } $storage{$storage}{detect}->(); + my %devices = map { $_->{device} => $_ } $MDV::Draklive::Storage::storage_types{$storage}{detect}->(); $_->{formatted_name} = $_->{usb_description} || $_->{info} || $_->{device} foreach values %devices; @available_devices = (); require fs::proc_partitions; diff --git a/lib/MDV/Draklive/Storage.pm b/lib/MDV/Draklive/Storage.pm new file mode 100644 index 0000000..4949d11 --- /dev/null +++ b/lib/MDV/Draklive/Storage.pm @@ -0,0 +1,39 @@ +package MDV::Draklive::Storage; + +our %storage_types = ( + cdrom => { + modules => 'bus/firewire|usb disk/firewire|hardware_raid|ide|sata|scsi|usb', + media_modules => 'disk/cdrom', + fs => 'iso9660', + can_hide => 0, + source => 'LABEL=MDVCDROOT', + read_only => 1, + detect => \&detect_devices::burners, + create => \&create_cdrom_master, + format => \&format_cdrom_device, + record_needs_master => 1, + record => \&record_cdrom_master, + }, + usb => { + modules => 'bus/usb disk/usb', + media_modules => 'disk/raw', + fs => 'vfat', + can_hide => 1, + bootloader => 'grub', + source => 'LABEL=MDVUSBROOT', + detect => sub { grep { detect_devices::isKeyUsb($_) } detect_devices::get() }, + create => \&create_disk_master, + format => \&format_usb_device, + record => \&record_usb_master, + image => \&create_disk_image, + replicator => \&create_usb_replicator, + }, + harddisk => { + fs => 'ext3', + create => \&create_disk_master, + record => \&record_harddisk_master, + image => \&create_disk_image, + }, +); + +1; |