From 3f131c081f0cfdb4677c76d5391b0a76682307ff Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 16 Dec 2018 00:18:39 +0000 Subject: drakclassic: get missing settings from repo product.id file. --- lib/MGA/DrakISO/BuildMedia.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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) = @_; -- cgit v1.2.1