summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2009-09-11 13:09:18 +0000
committerOlivier Blin <oblin@mandriva.com>2009-09-11 13:09:18 +0000
commit836fcd32803f03499522dbd332f0b7047b79287d (patch)
tree09634a5da31c1cceb17b7f77c87aec74b849621e /lib
parente31d6a0a327bb9d63e912df578afa2da96898063 (diff)
downloaddraklive-836fcd32803f03499522dbd332f0b7047b79287d.tar
draklive-836fcd32803f03499522dbd332f0b7047b79287d.tar.gz
draklive-836fcd32803f03499522dbd332f0b7047b79287d.tar.bz2
draklive-836fcd32803f03499522dbd332f0b7047b79287d.tar.xz
draklive-836fcd32803f03499522dbd332f0b7047b79287d.zip
initialize default partitions earlier (required when building boot files)
Diffstat (limited to 'lib')
-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);