summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/MDV/Draklive/Config.pm6
-rw-r--r--lib/MDV/Draklive/Media.pm22
2 files changed, 17 insertions, 11 deletions
diff --git a/lib/MDV/Draklive/Config.pm b/lib/MDV/Draklive/Config.pm
index 7b83f0f..99ca16a 100644
--- a/lib/MDV/Draklive/Config.pm
+++ b/lib/MDV/Draklive/Config.pm
@@ -77,13 +77,11 @@ sub complete_config {
$live->{settings}{arch} ||= chomp_(`rpm --eval '%{_target_cpu}'`);
$live->{media}{title} ||= "live";
- foreach (
+ $_ = MDV::Draklive::Media::new($_) foreach (
$live->{media},
($live->{replicator} ? $live->{replicator}{media} : ()),
($live->{oem_rescue} ? $live->{oem_rescue}{media} : ()),
- ) {
- bless $_, 'MDV::Draklive::Media';
- }
+ );
mkdir_p($live->get_builddir);
mkdir_p($live->get_system_root);
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);