diff options
Diffstat (limited to 'lib/MDV/Draklive/Media.pm')
-rw-r--r-- | lib/MDV/Draklive/Media.pm | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/MDV/Draklive/Media.pm b/lib/MDV/Draklive/Media.pm index bb938ff..f86d01e 100644 --- a/lib/MDV/Draklive/Media.pm +++ b/lib/MDV/Draklive/Media.pm @@ -5,6 +5,21 @@ use MDV::Draklive::Storage; use POSIX; use common; +sub new { + my ($media) = @_; + + bless $media, 'MDV::Draklive::Media'; + + $media->{partitions} ||= [ { mntpoint => '/' } ]; + + for $mntpoint (qw(/ OEM_RESCUE)) { + my $part = find { $_->{mntpoint} eq $mntpoint } @{$media->{partitions}}; + $part->{fs_type} ||= $media->get_media_setting('fs'); + } + + $media; +} + sub get_initrd_path { my ($media) = @_; '/' . $media->{storage} . '/initrd.gz'; @@ -61,13 +76,6 @@ sub find_boot_partition_index { sub supplement_partitions { my ($media, $total_size) = @_; - $media->{partitions} ||= [ { mntpoint => '/' } ]; - - for $mntpoint (qw(/ OEM_RESCUE)) { - my $part = find { $_->{mntpoint} eq $mntpoint } @{$media->{partitions}}; - $part->{fs_type} ||= $media->get_media_setting('fs'); - } - my $correction = 1.2; my $slash = find { $_->{mntpoint} eq '/' } @{$media->{partitions}}; $slash->{size} ||= POSIX::ceil($total_size * $correction / $common::SECTORSIZE); |