slitaz-dev-tools rev 75
mirror-tools/mirror-info/index.php: build mirror list
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Apr 22 17:15:45 2011 +0200 (2011-04-22) |
parents | 40de46e49b0b |
children | 2ed2aa3f16a9 |
files | mirror-tools/mirror-info/index.php mirror-tools/mirror-info/pics/website/cdrom.png |
line diff
1.1 --- a/mirror-tools/mirror-info/index.php Fri Apr 15 17:12:32 2011 +0000 1.2 +++ b/mirror-tools/mirror-info/index.php Fri Apr 22 17:15:45 2011 +0200 1.3 @@ -9,12 +9,21 @@ 1.4 <meta name="author" content="SliTaz Contributors" /> 1.5 <link rel="shortcut icon" href="/css/favicon.ico" /> 1.6 <link rel="stylesheet" type="text/css" href="/css/slitaz.css" /> 1.7 + <style type="text/css"> 1.8 +#copy { 1.9 + text-align: center; 1.10 +} 1.11 + 1.12 +#bottom { 1.13 + text-align: center; 1.14 +} 1.15 + </style> 1.16 </head> 1.17 <body> 1.18 1.19 <!-- Header --> 1.20 <div id="header"> 1.21 - <a href="http://<?php echo $_SERVER["HTTP_HOST"]; ?>"><img id="logo" 1.22 + <a href="http://<?php echo $_SERVER["HTTP_HOST"]; ?>/"><img id="logo" 1.23 src="/css/pics/website/logo.png" 1.24 title="<?php echo $_SERVER["HTTP_HOST"]; ?>" alt="<?php echo $_SERVER["HTTP_HOST"]; ?>" /></a> 1.25 <p id="titre">#!/project/<?php echo preg_replace('/(\w+).*/i','$1',$_SERVER["HTTP_HOST"]); ?></p> 1.26 @@ -126,6 +135,8 @@ 1.27 (<a href="http://mirror.slitaz.org/awstats.pl?config=scn.slitaz.org" target="_blank">stats</a>)</li> 1.28 <li><a href="http://pizza.slitaz.org/">pizza.slitaz.org</a> - SliTaz Flavor builder. 1.29 (<a href="http://mirror.slitaz.org/awstats.pl?config=pizza.mirror.slitaz.org" target="_blank">stats</a>)</li> 1.30 + <li><a href="http://tiny.slitaz.org/">tiny.slitaz.org</a> - Tiny SliTaz builder. 1.31 + (<a href="http://mirror.slitaz.org/awstats.pl?config=tiny.mirror.slitaz.org" target="_blank">stats</a>)</li> 1.32 <li><a href="https://ajaxterm.slitaz.org/">ajaxterm.slitaz.org</a> - Slitaz Web Console. 1.33 (<a href="http://mirror.slitaz.org/awstats.pl?config=ajaxterm.slitaz.org" target="_blank">stats</a>)</li> 1.34 </ul> 1.35 @@ -155,77 +166,119 @@ 1.36 alt="mirrors" /></a>Mirrors</h3> 1.37 Most mirrors are updated using the url: <b>rsync://mirror.slitaz.org/slitaz/</b> 1.38 (<a href="http://mirror.slitaz.org/awstats.pl?config=rsync">stats</a>) 1.39 + <pre> 1.40 +rsync -azH --delete rsync://mirror.slitaz.org/slitaz/ /local/slitaz/mirror/ </pre> 1.41 + New mirrors should be announced on the 1.42 + <a href="http://www.slitaz.org/en/mailing-list.html">mailing list</a>. 1.43 <ul> 1.44 - <li><a href="http://en.utrace.de/?query=mirror.switch.ch"> 1.45 - <img title="map" src="pics/website/ch.png" alt="map" /></a> 1.46 - <a href="http://mirror.switch.ch/ftp/mirror/slitaz/"> 1.47 - http://mirror.switch.ch/ftp/mirror/slitaz/</a> or 1.48 - <a href="ftp://mirror.switch.ch/mirror/slitaz/">ftp</a></li> 1.49 - <li><a href="http://en.utrace.de/?query=www.gtlib.gatech.edu"> 1.50 - <img title="map" src="pics/website/us.png" alt="map" /></a> 1.51 - <a href="http://www.gtlib.gatech.edu/pub/slitaz/"> 1.52 - http://www.gtlib.gatech.edu/pub/slitaz/</a> or 1.53 - <a href="ftp://ftp.gtlib.gatech.edu/pub/slitaz/">ftp</a> or 1.54 - <a href="rsync://www.gtlib.gatech.edu/slitaz/">rsync</a></li> 1.55 - <li><a href="http://en.utrace.de/?query=download.tuxfamily.org"> 1.56 - <img title="map" src="pics/website/fr.png" alt="map" /></a> 1.57 - <a href="http://download.tuxfamily.org/slitaz/"> 1.58 - http://download.tuxfamily.org/slitaz/</a> or 1.59 - <a href="ftp://download.tuxfamily.org/slitaz/">ftp</a> or 1.60 - <a href="rsync://download.tuxfamily.org/pub/slitaz/">rsync</a></li> 1.61 - <!-- li><a href="http://www.linuxembarque.com/slitaz/mirror/"> 1.62 - <img title="map" src="pics/website/fr.png" alt="map" /></a> 1.63 - <a href="http://www.linuxembarque.com/slitaz/mirror/"> 1.64 - http://www.linuxembarque.com/slitaz/mirror/</a></li --> 1.65 - <li><a href="http://en.utrace.de/?query=mirror.lupaworld.com"> 1.66 - <img title="map" src="pics/website/cn.png" alt="map" /></a> 1.67 - <a href="http://mirror.lupaworld.com/slitaz/"> 1.68 - http://mirror.lupaworld.com/slitaz/</a></li> 1.69 - <li><a href="http://en.utrace.de/?query=slitaz.c3sl.ufpr.br"> 1.70 - <img title="map" src="pics/website/br.png" alt="map" /></a> 1.71 - <a href="http://slitaz.c3sl.ufpr.br/"> 1.72 - http://slitaz.c3sl.ufpr.br/</a> or 1.73 - <a href="ftp://slitaz.c3sl.ufpr.br/slitaz/">ftp</a> or 1.74 - <a href="rsync://slitaz.c3sl.ufpr.br/slitaz/">rsync</a></li> 1.75 - <li><a href="http://en.utrace.de/?query=slitaz.mirror.garr.it"> 1.76 - <img title="map" src="pics/website/it.png" alt="map" /></a> 1.77 - <a href="http://slitaz.mirror.garr.it/mirrors/slitaz/"> 1.78 - http://slitaz.mirror.garr.it/mirrors/slitaz/</a> or 1.79 - <a href="ftp://slitaz.mirror.garr.it/mirrors/slitaz/">ftp</a> or 1.80 - <a href="rsync://slitaz.mirror.garr.it/mirrors/slitaz/">rsync</a></li> 1.81 - <!-- li><a href="http://mirror.drustvo-dns.si/slitaz/"> 1.82 - http://mirror.drustvo-dns.si/slitaz/</a></li --> 1.83 - <li><a href="http://en.utrace.de/?query=ftp.pina.si"> 1.84 - <img title="map" src="pics/website/si.png" alt="map" /></a> 1.85 - <a href="ftp://ftp.pina.si/slitaz/"> 1.86 - ftp://ftp.pina.si/slitaz/</a></li> 1.87 - <li><a href="http://en.utrace.de/?query=distro.ibiblio.org"> 1.88 - <img title="map" src="pics/website/us.png" alt="map" /></a> 1.89 - <a href="http://distro.ibiblio.org/pub/linux/distributions/slitaz/"> 1.90 - http://distro.ibiblio.org/pub/linux/distributions/slitaz/</a> or 1.91 - <a href="ftp://distro.ibiblio.org/pub/linux/distributions/slitaz/">ftp</a></li> 1.92 - <li><a href="http://en.utrace.de/?query=ftp.vim.org"> 1.93 - <img title="map" src="pics/website/nl.png" alt="map" /></a> 1.94 - <a href="http://ftp.vim.org/ftp/os/Linux/distr/slitaz/"> 1.95 - http://ftp.vim.org/ftp/os/Linux/distr/slitaz/</a> or 1.96 - <a href="ftp://ftp.vim.org/mirror/os/Linux/distr/slitaz/"> 1.97 - ftp</a></li> 1.98 - <li><a href="http://en.utrace.de/?query=ftp.nedit.org"> 1.99 - <img title="map" src="pics/website/nl.png" alt="map" /></a> 1.100 - <a href="http://ftp.nedit.org/ftp/ftp/pub/os/Linux/distr/slitaz/"> 1.101 - http://ftp.nedit.org/ftp/ftp/pub/os/Linux/distr/slitaz/</a> or 1.102 - <a href="ftp://ftp.nedit.org/ftp/ftp/pub/os/Linux/distr/slitaz/"> 1.103 - ftp</a></li> 1.104 - <li><a href="http://en.utrace.de/?query=ftp.ch.xemacs.org"> 1.105 - <img title="map" src="pics/website/ch.png" alt="map" /></a> 1.106 - <a href="http://ftp.ch.xemacs.org/ftp/pool/2/mirror/slitaz/" /> 1.107 - http://ftp.ch.xemacs.org/ftp/pool/2/mirror/slitaz/</a> or 1.108 - <a href="ftp://ftp.ch.xemacs.org//pool/2/mirror/slitaz/" /> 1.109 - ftp</a></li> 1.110 +<?php 1.111 +$output_url_file=""; 1.112 +$output_url_handler; 1.113 +$mirrors_url_file="/tmp/mirrors"; 1.114 + 1.115 +function test_url($link) 1.116 +{ 1.117 + global $output_url_file; 1.118 + global $mirrors_url_file; 1.119 + global $output_url_handler; 1.120 + 1.121 + if ($output_url_file != "") { 1.122 + if (shell_exec("busybox wget -s $link/README && echo -n OK") == "OK") { 1.123 + fwrite($output_url_handler,$link."\n"); 1.124 + return TRUE; 1.125 + } 1.126 + return FALSE; 1.127 + } 1.128 + return shell_exec("grep -qs ^$link$ $mirrors_url_file && echo -n OK") == "OK"; 1.129 +} 1.130 + 1.131 +if (! file_exists($mirrors_url_file)) { 1.132 + $output_url_file = tempnam('/tmp','mkmirrors'); 1.133 + $output_url_handler = fopen($output_url_file, "w"); 1.134 + fwrite($output_url_handler,"http://mirror.slitaz.org/\n"); 1.135 +} 1.136 + 1.137 +foreach (array( 1.138 + array( "flag" => "ch", 1.139 + "http" => "http://mirror.switch.ch/ftp/mirror/slitaz/", 1.140 + "ftp" => "ftp://mirror.switch.ch/mirror/slitaz/"), 1.141 + array( "flag" => "us", 1.142 + "http" => "http://www.gtlib.gatech.edu/pub/slitaz/", 1.143 + "ftp" => "ftp://ftp.gtlib.gatech.edu/pub/slitaz/", 1.144 + "rsync" => "rsync://www.gtlib.gatech.edu/slitaz/"), 1.145 + array( "flag" => "fr", 1.146 + "http" => "http://download.tuxfamily.org/slitaz/", 1.147 + "ftp" => "ftp://download.tuxfamily.org/slitaz/", 1.148 + "rsync" => "rsync://download.tuxfamily.org/pub/slitaz/"), 1.149 + array( "flag" => "fr", 1.150 + "http" => "http://www.linuxembarque.com/slitaz/mirror/"), 1.151 + array( "flag" => "cn", 1.152 + "http" => "http://mirror.lupaworld.com/slitaz/"), 1.153 + array( "flag" => "br", 1.154 + "http" => "http://slitaz.c3sl.ufpr.br/", 1.155 + "ftp" => "ftp://slitaz.c3sl.ufpr.br/slitaz/", 1.156 + "rsync" => "rsync://slitaz.c3sl.ufpr.br/slitaz/"), 1.157 + array( "flag" => "it", 1.158 + "http" => "http://slitaz.mirror.garr.it/mirrors/slitaz/", 1.159 + "ftp" => "ftp://slitaz.mirror.garr.it/mirrors/slitaz/", 1.160 + "rsync" => "rsync://slitaz.mirror.garr.it/mirrors/slitaz/"), 1.161 + array( "flag" => "si", 1.162 + "http" => "http://mirror.drustvo-dns.si/slitaz/"), 1.163 + array( "flag" => "si", 1.164 + "ftp" => "ftp://ftp.pina.si/slitaz/"), 1.165 + array( "flag" => "us", 1.166 + "http" => "http://distro.ibiblio.org/pub/linux/distributions/slitaz/", 1.167 + "ftp" => "ftp://distro.ibiblio.org/pub/linux/distributions/slitaz/"), 1.168 + array( "flag" => "nl", 1.169 + "http" => "http://ftp.vim.org/ftp/os/Linux/distr/slitaz/", 1.170 + "ftp" => "ftp://ftp.vim.org/mirror/os/Linux/distr/slitaz/"), 1.171 + array( "flag" => "nl", 1.172 + "http" => "http://ftp.nedit.org/ftp/ftp/pub/os/Linux/distr/slitaz/", 1.173 + "ftp" => "ftp://ftp.nedit.org/ftp/ftp/pub/os/Linux/distr/slitaz/"), 1.174 + array( "flag" => "ch", 1.175 + "http" => "http://ftp.ch.xemacs.org/ftp/pool/2/mirror/slitaz/", 1.176 + "ftp" => "ftp://ftp.ch.xemacs.org//pool/2/mirror/slitaz/"), 1.177 + array( "flag" => "us", 1.178 + "http" => "http://mirror.clarkson.edu/slitaz/", 1.179 + "rsync" => "rsync://mirror.clarkson.edu/slitaz/")) as $mirror) { 1.180 + $flag = "pics/website/".$mirror["flag"].".png"; 1.181 + $head = TRUE; 1.182 + foreach(array("http", "ftp") as $proto) { 1.183 + if (!isset($mirror[$proto])) continue; 1.184 + $link = $mirror[$proto]; 1.185 + if (!test_url($link)) continue; 1.186 + $serveur = parse_url($link, PHP_URL_HOST); 1.187 + if ($head) echo <<<EOT 1.188 + <li><a href="http://en.utrace.de/?query=$serveur"> 1.189 + <img title="map" src="$flag" alt="map" /></a> 1.190 + <a href="$link">$link</a> 1.191 +EOT; 1.192 + else echo <<<EOT 1.193 + or <a href="$link">$proto</a> 1.194 +EOT; 1.195 + $head = FALSE; 1.196 + } 1.197 + if ($head) continue; 1.198 + if (isset($mirror["rsync"])) { 1.199 + $link = $mirror["rsync"]; 1.200 + echo <<<EOT 1.201 + or <a href="$link">rsync</a> 1.202 +EOT; 1.203 + } 1.204 + echo " </li>\n"; 1.205 +} 1.206 + 1.207 +if ($output_url_file != "") { 1.208 + fclose($output_url_handler); 1.209 + rename($output_url_file, $mirrors_url_file); 1.210 + chmod($mirrors_url_file, 0644); 1.211 +} 1.212 + 1.213 +?> 1.214 </ul> 1.215 1.216 <a name="builds"></a> 1.217 -<h3><img title="Daily builds" src="pics/website/monitor.png" alt="builds" /> 1.218 +<h3><img title="Daily builds" src="pics/website/cdrom.png" alt="builds" /> 1.219 Daily builds</h3> 1.220 1.221 <?php 1.222 @@ -233,12 +286,10 @@ 1.223 { 1.224 echo '<a name="'.$anchor.'"></a>'; 1.225 echo "<a href=\"$url\">"; 1.226 -system("stat -c '<h4>%y %n</h4>' ".$file." | sed -e 's/.000000000//' -e 's|/var/log/\(.*\).log|\\1.iso|'"); 1.227 +system("stat -c '<h4>%y %n</h4>' ".$file." | sed 's/.000000000//;s|/var/log/\(.*\).log|\\1.iso|'"); 1.228 echo "</a>"; 1.229 echo "<pre>"; 1.230 -system("cat ".$file." | sed -e 's/.\[[0-9][^mG]*.//g' | awk '". 1.231 -'{ if (/\[/) { n=index($0,"["); printf("%s%s%s\n",substr($0,1,n-1),'. 1.232 -'substr("\t\t\t\t\t\t\t",1,9-(n/8)),substr($0,n)); } else print }'."'"); 1.233 +system("sed 's/.\[[0-9][^mG]*.//g;:a;s/^\(.\{1,68\}\)\(\[ [A-Za-z]* \]\)/\\1 \\2/;ta' < $file"); 1.234 echo "</pre>"; 1.235 } 1.236
2.1 Binary file mirror-tools/mirror-info/pics/website/cdrom.png has changed