diff options
author | Manuel Hiebel <leuhmanu@mageia.org> | 2016-05-30 00:07:01 +0200 |
---|---|---|
committer | Manuel Hiebel <leuhmanu@mageia.org> | 2016-05-30 00:07:01 +0200 |
commit | c2aa6e258393542bf149427cb581f634b25577ef (patch) | |
tree | 7555977d8a1b0068d5dbfe8a1ee81e19a55a1ea2 /mirrorlist | |
parent | 5e7039d13e35196fe067d945cc3ba2de280561b0 (diff) | |
download | www-c2aa6e258393542bf149427cb581f634b25577ef.tar www-c2aa6e258393542bf149427cb581f634b25577ef.tar.gz www-c2aa6e258393542bf149427cb581f634b25577ef.tar.bz2 www-c2aa6e258393542bf149427cb581f634b25577ef.tar.xz www-c2aa6e258393542bf149427cb581f634b25577ef.zip |
Yum style repo list (workaround until mirrorbrain is setup)
use setup from mageia.org/downloads
todo: check variables
Diffstat (limited to 'mirrorlist')
-rw-r--r-- | mirrorlist/index.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/mirrorlist/index.php b/mirrorlist/index.php new file mode 100644 index 000000000..69614a769 --- /dev/null +++ b/mirrorlist/index.php @@ -0,0 +1,65 @@ +<?php + +require realpath(__DIR__ . '/../lib/Downloads.php'); +require realpath(__DIR__ . '/../lib/mga_geoip.php'); + +function get($s){ + return $string_var = (string) filter_input(INPUT_GET, $s, FILTER_SANITIZE_STRING); +} + +//TODO +function check($array){ +foreach ($array as $key => $v) { +$getvar = get("$key"); + +$list = implode(", ", $v); + if (in_array($getvar, $v)) { + $out = array($key => $getvar); + }else{ + $out = array("Error" => "Error $key: $getvar - not in list - $list"); + break; + } +} + return $out; +} + + + +$source = $debug = false; + +$release = get('release'); +$arch = get('arch'); +$section = get('section'); +$repo = get('repo'); +$debug = get('debug'); +$source = get('source'); + +$wsd = new Downloads(); +$dl = $wsd->prepare_download(true, null); + +$arraycheck =array( +'release' => array('5', '6', 'cauldron'), +'arch' => array('i586', 'x86_64', 'SRPMS', 'armv5tl', 'armv7hl'), +'section' => array('core', 'nonfree', 'tainted'), +'repo' => array('release', 'updates', 'updates_testing', 'backports', 'backports_testing'), +); + +if ($source){ + $link = "MIRROR/distrib/$release/SRPMS/media/$section/$repo/"; +}elseif ($debug){ + $link = "MIRROR/distrib/$release/$arch/media/debug/$section/$repo/"; +}else{ + $link = "MIRROR/distrib/$release/$arch/media/$section/$repo/"; +} + + +if ($release && $arch && $section && $repo){ + + $out = str_replace('MIRROR', $dl['mirror_url'], $link); + //$out = check($arraycheck); + //print_r($out); +}else{ + $out = "Invalid options"; +} +echo $out; + |