UNIX_TIMESTAMP(NOW())-$cutoff"; $result = mysql_run_query( 'SELECT DISTINCT ' . '`mirror_statuses`.`country_code`,' . '`mirror_statuses`.`country`' . ' FROM `mirror_statuses`' . ' WHERE ' . $filter . ' ORDER BY `mirror_statuses`.`country`' ); $countries = array( array( 'country_code' => 'all', 'country' => 'All' ) ); while ($row = $result -> fetch_assoc()) $countries[] = $row; $result = mysql_run_query( 'SELECT DISTINCT ' . '`mirror_statuses`.`protocol`' . ' FROM `mirror_statuses`' . ' WHERE ' . $filter . ' ORDER BY `mirror_statuses`.`protocol`' ); $protocols = array( ); while ($row = $result -> fetch_assoc()) $protocols[] = $row['protocol']; $ip_versions = array('4', '6'); # archinstall sends no country, so we can not take this as a hint here whether # we come via the form or not if ( count($_GET) > 1 ) { if (array_key_exists('use_mirror_status', $_GET)) $order = '(`mirror_statuses`.`start`-`mirror_statuses`.`last_sync`) DESC'; else $order = '`mirror_statuses`.`country`,' . 'SUBSTRING(' . '`mirror_statuses`.`url`,' . '1+CHAR_LENGTH(`mirror_statuses`.`protocol`)' . '),' . '`mirror_statuses`.`protocol`'; $request = '&' . preg_replace(',^.*\?,', '', $_SERVER['REQUEST_URI']) . '&'; if (array_key_exists('protocol', $_GET)) { $filter .= ' AND `mirror_statuses`.`protocol` IN ('; foreach ($protocols as $protocol) if (strpos($request, '&protocol=' . $protocol . '&') !== false) $filter .= '"' . $protocol . '",'; $filter .= '"")'; } if (strpos($request, '&country=all&') !== false || strpos($request, "&country=") === false ) { // country us all or doesn't exist (archinsetall) => do not filter by country } else { $filter .= ' AND `mirror_statuses`.`country_code` IN ('; foreach ($countries as $country) if (strpos($request, '&country=' . $country['country_code'] . '&') !== false) $filter .= '"' . $country['country_code'] . '",'; $filter .= '"")'; } if (array_key_exists('ip_version', $_GET)) { $filter .= ' AND (0'; foreach ($ip_versions as $ip_version) if (strpos($request, '&ip_version=' . $ip_version . '&') !== false) $filter .= ' OR `mirror_statuses`.`ipv' . $ip_version . '`'; $filter .= ')'; } $result = mysql_run_query( 'SELECT DISTINCT ' . ' `mirror_statuses`.`country`,' . ' `mirror_statuses`.`url`' . ' FROM `mirror_statuses`' . ' WHERE ' . $filter . ' ORDER BY ' . $order ); while ($row = $result -> fetch_assoc()) $mirrors[] = $row; header('Content-Type: text/plain'); print "##\n"; print "## Arch Linux 32 repository mirrorlist\n"; print "## Generated on " . date('Y-m-d') . "\n"; print "##\n"; $last_country = 'Mordor'; foreach ($mirrors as $mirror) { if ($mirror['country'] != $last_country) { print "\n"; print "## " . $mirror['country'] . "\n"; $last_country = $mirror['country']; } print "#Server = " . $mirror['url'] . '$arch/$repo' . "\n"; } die(); } print_header('Pacman Mirrorlist Generator', 'home'); ?>
This page generates the most up-to-date mirrorlist possible for Arch Linux 32. The data used here comes straight from the developers' internal mirror database used to track mirror availability and tiering. There are two main options: get a mirrorlist with every available mirror, or get a mirrorlist tailored to your geography.
An up-to-date mirrorlist is available containing all currently active mirrors, optionally filtering by protocol. These URLs requires no GET or POST parameters so they can be fetched from the command line if desired.
The following form can generate a custom up-to-date
pacman
mirrorlist based on geography and desired protocol(s).
Simply replace the contents of
/etc/pacman.d/mirrorlist
with your generated list.
Additionally, the mirror status data can be incorporated into the generated mirror list and used to only list up to date mirrors.