summaryrefslogtreecommitdiffstats
path: root/lib/MGA/DrakISO
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2018-12-16 00:18:39 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2018-12-16 00:18:39 +0000
commit3f131c081f0cfdb4677c76d5391b0a76682307ff (patch)
tree6d7649a1503ebcb33be3d67bbe51b18c7988c11a /lib/MGA/DrakISO
parent7a576632911be26f2432f664151613a92b35db93 (diff)
downloaddrakiso-3f131c081f0cfdb4677c76d5391b0a76682307ff.tar
drakiso-3f131c081f0cfdb4677c76d5391b0a76682307ff.tar.gz
drakiso-3f131c081f0cfdb4677c76d5391b0a76682307ff.tar.bz2
drakiso-3f131c081f0cfdb4677c76d5391b0a76682307ff.tar.xz
drakiso-3f131c081f0cfdb4677c76d5391b0a76682307ff.zip
drakclassic: get missing settings from repo product.id file.
Diffstat (limited to 'lib/MGA/DrakISO')
-rw-r--r--lib/MGA/DrakISO/BuildMedia.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/MGA/DrakISO/BuildMedia.pm b/lib/MGA/DrakISO/BuildMedia.pm
index bede84b..a1ce11b 100644
--- a/lib/MGA/DrakISO/BuildMedia.pm
+++ b/lib/MGA/DrakISO/BuildMedia.pm
@@ -84,6 +84,8 @@ sub prepare_media {
# Nothing in this directory is needed after we exit this function.
mkdir_p($build->get_build_dir('tmp'));
+ read_repo_product_id($build);
+
prepare_urpmi_media($build);
get_available_packages($build);
@@ -560,6 +562,27 @@ sub check_installer_media {
# Miscellaneous File Creation
###############################################################################
+sub read_repo_product_id {
+ my ($build) = @_;
+
+ my $src_file = $build->{settings}{repository} . '/' . $build->{settings}{arch} . '/product.id';
+ my $product_id;
+ if ($src_file =~ m!^(ftp|http)://!) {
+ $product_id = `curl --silent $src_file`;
+ $? and die "ERROR: couldn't fetch product.id file from repository\n";
+ } else {
+ $product_id = cat_($src_file);
+ }
+
+ my %h = map { if_(/(.*?)=(.*)/, $1 => $2) } split(',', $product_id);
+
+ foreach my $setting (qw(type version branch product)) {
+ next if defined $build->{settings}{$setting};
+ $h{$setting} or die "ERROR: $setting field missing from product.id\n";
+ $build->{settings}{$setting} = $h{$setting};
+ }
+}
+
sub create_product_id {
my ($build, $file) = @_;