Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with CentOS altarch repositories #22

Merged
merged 2 commits into from Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions centos.php
Expand Up @@ -51,6 +51,9 @@
$mirrors = array('http://vault.centos.org/');
} else {
$mirrors = get_centos_mirrors($release, $arch);
if(empty($mirrors)) {
$mirrors = array('http://mirror.centos.org/centos');
}
}

foreach($mirrors as $mirror) {
Expand Down
9 changes: 6 additions & 3 deletions config.php
Expand Up @@ -50,9 +50,12 @@
);


// Alternative architectures:
// - stable goes to mirror,
// - development goes to packages.nethserver.org
// Architectures:
//
// - "stable" goes to the official NS mirror infrastructure
//
// - "development" goes to mirror.nethserver.org
//
$stable_arches = array(
'x86_64',
);
Expand Down
7 changes: 6 additions & 1 deletion cron.php
Expand Up @@ -32,7 +32,12 @@

$major_releases = array_unique(preg_replace('/^(\d).*/', '$1', $stable_releases));
foreach($major_releases as $release) {
foreach($stable_arches as $arch) {
foreach(array_merge($stable_arches, $development_arches) as $arch) {
// skip altarch for 6 branch
if($release == '6' && $arch != 'x86_64') {
continue;
}

$status = refresh_centos_mirrors_cache($ce_mirror_countries, $release, $arch);
if( ! $status) {
error_log("[ERROR] Failed to write $release $arch cache file");
Expand Down
3 changes: 1 addition & 2 deletions mirrorcache.php
Expand Up @@ -77,6 +77,5 @@ function get_centos_mirrors($release, $arch)
$mirrors = array();
}

// fallback to default mirrorlist or return valid entries
return empty($mirrors) ? array('http://mirror.centos.org/centos') : $mirrors;
return $mirrors;
}
14 changes: 13 additions & 1 deletion nethserver.php
Expand Up @@ -91,10 +91,22 @@
// map to real repository name, extracting the $repo_suffix (required by SCLo):
list($repo, $repo_suffix) = array_merge(explode('-', $ce_repos[$repo], 2), array(''));
if(in_array($nsrelease, $vault_releases)) {
$mirrors = array('http://vault.centos.org');
// CentOS versions served by vault.centos.org
if($arch == 'x86_64') {
$mirrors = array('http://vault.centos.org/centos');
} else {
$mirrors = array('http://vault.centos.org/altarch');
}
} else {
// CentOS versions served by upstream mirror infrastructure
$mirrors = get_centos_mirrors($release, $arch);
if(empty($mirrors)) {
if($arch == 'x86_64') {
$mirrors = array('http://mirror.centos.org/centos');
} else {
$mirrors = array('http://mirror.centos.org/altarch');
}
}
}
} else {
// Serverd only by the NethServer master mirror
Expand Down