From 4fe3fa0731df002a22320458e5e55c5cc1ec5318 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 30 Jul 2009 17:56:44 +0000 Subject: move / size and fs type pre-computing in a new supplement_partitions media method --- lib/MDV/Draklive/Config.pm | 1 - lib/MDV/Draklive/Media.pm | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/MDV') diff --git a/lib/MDV/Draklive/Config.pm b/lib/MDV/Draklive/Config.pm index 3216c4d..9cf96a0 100644 --- a/lib/MDV/Draklive/Config.pm +++ b/lib/MDV/Draklive/Config.pm @@ -79,7 +79,6 @@ sub complete_config { foreach ($live->{media}, if_($live->{replicator}{media}, $live->{replicator}{media}), if_($live->{oem_rescue}{media}, $live->{oem_rescue}{media})) { bless $_, 'MDV::Draklive::Media'; - $_->{partitions} ||= [ { mntpoint => '/' } ]; } mkdir_p($live->get_builddir); diff --git a/lib/MDV/Draklive/Media.pm b/lib/MDV/Draklive/Media.pm index d75eeb4..278d463 100644 --- a/lib/MDV/Draklive/Media.pm +++ b/lib/MDV/Draklive/Media.pm @@ -2,6 +2,7 @@ package MDV::Draklive::Media; use MDK::Common; use MDV::Draklive::Storage; +use common; sub get_initrd_path { my ($media) = @_; @@ -51,4 +52,14 @@ sub find_partition_index { eval { find_index { $_->{mntpoint} eq $mntpoint } @{$media->{partitions}} }; } +sub supplement_partitions { + my ($media, $total_size) = @_; + + $media->{partitions} ||= [ { mntpoint => '/' } ]; + + my $slash = find { $_->{mntpoint} eq '/' } @{$media->{partitions}}; + $slash->{fs_type} ||= $media->get_media_setting('fs'); + $slash->{size} ||= $total_size / $common::SECTORSIZE; +} + 1; -- cgit v1.2.1