slitaz-forge diff pangolin/web/index.php @ rev 434

Add pangolin web interface and update pangolin tool
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jan 19 19:34:21 2014 +0100 (2014-01-19)
parents
children 37fadd188b73
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/pangolin/web/index.php	Sun Jan 19 19:34:21 2014 +0100
     1.3 @@ -0,0 +1,305 @@
     1.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     1.5 +    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     1.6 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     1.7 +<head>
     1.8 +	<title>SliTaz Pangolin</title>
     1.9 +	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    1.10 +	<meta name="description" content="slitaz pangolin server" />
    1.11 +	<meta name="robots" content="index, nofollow" />
    1.12 +	<meta name="author" content="SliTaz Contributors" />
    1.13 +	<link rel="shortcut icon" href="favicon.ico" />
    1.14 +	<link rel="stylesheet" type="text/css" href="slitaz.css" />
    1.15 +</head>
    1.16 +<body>
    1.17 +
    1.18 +<!-- Header -->
    1.19 +<div id="header">
    1.20 +	<div id="logo"></div>
    1.21 +	<div id="network">
    1.22 +		<a href="http://www.slitaz.org/">Home</a>
    1.23 +		<a href="http://scn.slitaz.org/">Community</a>
    1.24 +		<a href="http://doc.slitaz.org/">Doc</a>
    1.25 +		<a href="http://forum.slitaz.org/">Forum</a>
    1.26 +		<a href="http://irc.slitaz.org/">IRC</a>
    1.27 +		<a href="http://slitaz.pro/">Pro</a>
    1.28 +		<a href="http://shop.slitaz.org/">Shop</a>
    1.29 +		<a href="http://bugs.slitaz.org">Bugs</a>
    1.30 +		<a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
    1.31 +	</div>
    1.32 +	<h1><a href="http://www.slitaz.org/">SliTaz Pangolin</a></h1>
    1.33 +</div>
    1.34 +
    1.35 +<!-- Block -->
    1.36 +<div id="block">
    1.37 +	<!-- Navigation -->
    1.38 +	<div id="block_nav">
    1.39 +		<h4><img src="images/development.png" alt="development.png" />Developers Corner</h4>
    1.40 +		<div class="right_box">
    1.41 +			<ul>
    1.42 +				<li><a href="http://tank.slitaz.org/">Tank Server</a></li>
    1.43 +				<li><a href="http://mirror.slitaz.org/">Main Mirror</a></li>
    1.44 +			</ul>
    1.45 +		</div>
    1.46 +		<div class="left_box">
    1.47 +			<ul>
    1.48 +				<li><a href="http://www.slitaz.org/en/devel/">Devel Doc</a></li>
    1.49 +				<li><a href="http://people.slitaz.org/">SliTaz People</a></li>
    1.50 +				<li><a href="http://cook.slitaz.org/">Cooker</a></li>
    1.51 +				<li><a href="http://pizza.slitaz.me/">Pizza Builder</a></li>
    1.52 +			</ul>
    1.53 +		</div>
    1.54 +	</div>
    1.55 +	<!-- Information/image -->
    1.56 +	<div id="block_info">
    1.57 +		<h4>Codename: pangolin - Maintainer: erjo</h4>
    1.58 +		<p>
    1.59 +			This is the SliTaz GNU/Linux main server and build host. 
    1.60 +			The server runs naturally SliTaz and provides some services
    1.61 +			to all contributors.
    1.62 +		</p>
    1.63 +		<p>
    1.64 +			Pangolin CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .
    1.65 +			"s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
    1.66 +			" awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
    1.67 +			"if (n == 4) printf \"quad \"; print s }' ")?> -
    1.68 +			<?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
    1.69 +			"n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
    1.70 +			"printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?>
    1.71 +			- Located in Paris, 
    1.72 +			France. Pangolin is also monitored by RRDtool which provides 
    1.73 +			<a href="graphs.php">graphical stats</a>.
    1.74 +		</p>
    1.75 +	</div>
    1.76 +</div>
    1.77 +
    1.78 +<!-- Content -->
    1.79 +<div id="content">
    1.80 +
    1.81 +<h2><a href="graphs.php"><img 
    1.82 +	style="vertical-align: middle; padding: 0 4px 4px 0;"
    1.83 +	title="Pangolin RRDtool graphs" alt="graphs"
    1.84 +    src="images/monitor.png" /></a>System stats</h2>
    1.85 +
    1.86 +<h4>Uptime</h4>
    1.87 +
    1.88 +<pre class="package">
    1.89 +<?php
    1.90 +system("uptime | sed 's/^\s*//'");
    1.91 +?>
    1.92 +</pre>
    1.93 +
    1.94 +<h4>Disk usage</h4>
    1.95 +<pre class="package">
    1.96 +<?php
    1.97 +system("df -h | sed '/^rootfs/d' | grep  '\(^/dev\|Filesystem\)'");
    1.98 +?>
    1.99 +</pre>
   1.100 +
   1.101 +<h4>Network</h4>
   1.102 +<pre class="package">
   1.103 +<?php
   1.104 +system("ifconfig eth0 | awk '{ if (/X packet/ || /X byte/) print }' | sed 's/^\s*//'");
   1.105 +?>
   1.106 +</pre>
   1.107 +
   1.108 +<h2><a href="/stats/awstats.pl?config=www.slitaz.org"><img
   1.109 +	style="vertical-align: middle; padding: 0 4px 4px 0;"
   1.110 +	title="Pangolin Virtual hosts" alt="vhosts"
   1.111 +    src="images/network.png" /></a>Virtual hosts</h2>
   1.112 +
   1.113 +<ul>
   1.114 +	<li><a href="http://www.slitaz.org/">www.slitaz.org</a> - SliTaz Website.
   1.115 +	(<a href="/stats/awstats.pl?config=www.slitaz.org">stats</a>)</li>
   1.116 +	<li><a href="http://doc.slitaz.org/">doc.slitaz.org</a> - Documentation platform.</li>
   1.117 +	<li><a href="http://forum.slitaz.org/">forum.slitaz.org</a> - SliTaz support forum.</li>
   1.118 +	<li><a href="http://vanilla.slitaz.org/">vanilla.slitaz.org</a> - previous SliTaz forum.</li>
   1.119 +	<li><a href="http://hg.slitaz.org/">hg.slitaz.org</a> - Mercurial repositories.</li>
   1.120 +	<li><a href="http://pizza.slitaz.me/">pizza.slitaz.me</a> - SliTaz flavor builder.</li>
   1.121 +	<li><a href="http://scn.slitaz.org/">scn.slitaz.org</a> - Community platform.</li>
   1.122 +</ul>
   1.123 +
   1.124 +<h2><img
   1.125 +	style="vertical-align: middle; padding: 0 4px 4px 0;"
   1.126 +	title="Erjo Virtual hosts" alt="vhosts"
   1.127 +    src="images/network.png" />Other hosts</h2>
   1.128 +
   1.129 +<p>
   1.130 +	These services are hosted by some individual sponsors who gracefully offer
   1.131 +	resources to the SliTaz project.
   1.132 +</p>
   1.133 +<ul>
   1.134 +	<li><a href="http://mirror.slitaz.org/">mirror.slitaz.org</a> - SliTaz main mirror and replicas.
   1.135 +		(<a href="http://mirror.slitaz.org/info/">more...</a>)</li>
   1.136 +	<li><a href="http://pkgs.slitaz.org/">pkgs.slitaz.org</a> - Packages Web interface.</li>
   1.137 +	<li><a href="http://tiny.slitaz.org/">tiny.slitaz.org</a> - Tiny SliTaz builder.</li>
   1.138 +	<!-- ajaxterm archives console-mirror demo dvd floppy ssh usbkey -->
   1.139 +	<li><a href="http://boot.slitaz.org/">boot.slitaz.org</a> - gPXE Web boot.</li>
   1.140 +	<li><a href="http://cook.slitaz.org/">cook.slitaz.org</a> - SliTaz Build Bot.</li>
   1.141 +	<li><a href="http://people.slitaz.org/">people.slitaz.org</a> - SliTaz People stuff.</li>
   1.142 +	<li><a href="http://slitaz.pro/">slitaz.pro</a> - SliTaz Professional services.</li>
   1.143 +	<!-- bb cloud ssfs stats store tank -->
   1.144 +</ul>
   1.145 +    
   1.146 +<a name="mirrors"></a>
   1.147 +<h2><a href="http://mirror.slitaz.org/info/"> <img
   1.148 +	style="vertical-align: middle; padding: 0 4px 4px 0;"
   1.149 +	src="images/network.png"
   1.150 +	title="Secondary mirrors" alt="mirrors" /></a>Mirrors</h2>
   1.151 +	Most mirrors are updated using the url: <b>rsync://mirror.slitaz.org/slitaz/</b>
   1.152 +	(<a href="http://mirror.slitaz.org/awstats.pl?config=rsync">stats</a>)
   1.153 +	<pre>
   1.154 +rsync -azH --delete rsync://mirror.slitaz.org/slitaz/ /local/slitaz/mirror/ </pre>
   1.155 +	New mirrors should be announced on the 
   1.156 +	<a href="http://www.slitaz.org/en/mailing-list.html">mailing list</a>.
   1.157 +<ul>
   1.158 +<?php
   1.159 +$output_url_file="";
   1.160 +$output_url_handler;
   1.161 +$mirrors_url_file="./mirrors";
   1.162 +
   1.163 +function test_url($link, $proto)
   1.164 +{
   1.165 +	global $output_url_file;
   1.166 +	global $mirrors_url_file;
   1.167 +	global $output_url_handler;
   1.168 +	
   1.169 +	if ($output_url_file != "") {
   1.170 +		switch($proto) {
   1.171 +		case "http" :
   1.172 +		case "ftp" :
   1.173 +			$cmd = "busybox wget -s $link/README" ;
   1.174 +			break;
   1.175 +		case "rsync" :
   1.176 +			$cmd = "rsync $link > /dev/null 2>&1" ;
   1.177 +			break;
   1.178 +		default :
   1.179 +			return FALSE;
   1.180 +		}
   1.181 +		if (shell_exec("$cmd && echo -n OK") == "OK") {
   1.182 +			fwrite($output_url_handler,$link."\n");
   1.183 +			return TRUE;
   1.184 +		} 
   1.185 +		return FALSE;
   1.186 +	}
   1.187 +	return shell_exec("grep -qs ^$link$ $mirrors_url_file && echo -n OK") == "OK"; 
   1.188 +}
   1.189 +
   1.190 +if (! file_exists($mirrors_url_file)) {
   1.191 +	$output_url_file = tempnam('/tmp','mkmirrors');
   1.192 +	$output_url_handler = fopen($output_url_file, "w");
   1.193 +	fwrite($output_url_handler,"http://mirror.slitaz.org/\n");
   1.194 +	fwrite($output_url_handler,"rsync://mirror.slitaz.org/\n");
   1.195 +}
   1.196 +
   1.197 +# Flags icons from http://www.famfamfam.com/lab/icons/flags/famfamfam_flag_icons.zip
   1.198 +foreach (array(
   1.199 +	array(	"flag"  => "ch",
   1.200 +		"http"  => "http://mirror.switch.ch/ftp/mirror/slitaz/",
   1.201 +		"ftp"   => "ftp://mirror.switch.ch/mirror/slitaz/"),
   1.202 +	array(	"flag"  => "us",
   1.203 +		"http"  => "http://www.gtlib.gatech.edu/pub/slitaz/",
   1.204 +		"ftp"   => "ftp://ftp.gtlib.gatech.edu/pub/slitaz/",
   1.205 +		"rsync" => "rsync://www.gtlib.gatech.edu/slitaz/"),
   1.206 +	array(	"flag"  => "fr",
   1.207 +		"http"  => "http://download.tuxfamily.org/slitaz/",
   1.208 +		"ftp"   => "ftp://download.tuxfamily.org/slitaz/",
   1.209 +		"rsync" => "rsync://download.tuxfamily.org/pub/slitaz/"),
   1.210 +	array(	"flag"  => "fr",
   1.211 +		"http"  => "http://www.linuxembarque.com/slitaz/mirror/"),
   1.212 +	array(	"flag"  => "cn",
   1.213 +		"http"  => "http://mirror.lupaworld.com/slitaz/"),
   1.214 +	array(	"flag"  => "cn",
   1.215 +		"http"  => "http://ks.lupaworld.com/slitaz/"),
   1.216 +	array(	"flag"  => "br",
   1.217 +		"http"  => "http://slitaz.c3sl.ufpr.br/",
   1.218 +		"ftp"   => "ftp://slitaz.c3sl.ufpr.br/slitaz/",
   1.219 +		"rsync" => "rsync://slitaz.c3sl.ufpr.br/slitaz/"),
   1.220 +	array(	"flag"  => "it",
   1.221 +		"http"  => "http://slitaz.mirror.garr.it/mirrors/slitaz/",
   1.222 +		"ftp"   => "ftp://slitaz.mirror.garr.it/mirrors/slitaz/",
   1.223 +		"rsync" => "rsync://slitaz.mirror.garr.it/mirrors/slitaz/"),
   1.224 +	array(	"flag"  => "si",
   1.225 +		"http"  => "http://mirror.drustvo-dns.si/slitaz/"),
   1.226 +	array(	"flag"  => "si",
   1.227 +		"ftp"   => "ftp://ftp.pina.si/slitaz/"),
   1.228 +	array(	"flag"  => "us",
   1.229 +		"http"  => "http://distro.ibiblio.org/pub/linux/distributions/slitaz/",
   1.230 +		"ftp"   => "ftp://distro.ibiblio.org/pub/linux/distributions/slitaz/"),
   1.231 +	array(	"flag"  => "nl",
   1.232 +		"http"  => "http://ftp.vim.org/ftp/os/Linux/distr/slitaz/",
   1.233 +		"ftp"   => "ftp://ftp.vim.org/mirror/os/Linux/distr/slitaz/"),
   1.234 +	array(	"flag"  => "nl",
   1.235 +		"http"  => "http://ftp.nedit.org/ftp/ftp/pub/os/Linux/distr/slitaz/",
   1.236 +		"ftp"   => "ftp://ftp.nedit.org/ftp/ftp/pub/os/Linux/distr/slitaz/"),
   1.237 +	array(	"flag"  => "ch",
   1.238 +		"http"  => "http://ftp.ch.xemacs.org/ftp/pool/2/mirror/slitaz/",
   1.239 +		"ftp"   => "ftp://ftp.ch.xemacs.org//pool/2/mirror/slitaz/"),
   1.240 +	array(	"flag"  => "de",
   1.241 +		"http"  => "http://ftp.uni-stuttgart.de/slitaz/",
   1.242 +		"ftp"   => "ftp://ftp.uni-stuttgart.de/slitaz/"),
   1.243 +	array(	"flag"  => "ro",
   1.244 +		"http"  => "http://ftp.info.uvt.ro/pub/slitaz/",
   1.245 +		"ftp"   => "ftp://ftp.info.uvt.ro/pub/slitaz/",
   1.246 +		"rsync" => "rsync://ftp.info.uvt.ro/ftp/pub/slitaz/"),
   1.247 +	array(	"flag"  => "au",
   1.248 +		"http"  => "http://mirror.iprimus.com/slitaz/"),
   1.249 +	array(	"flag"  => "au",
   1.250 +		"http"  => "http://mirror01.ipgn.com.au/slitaz/"),
   1.251 +	array(	"flag"  => "us",
   1.252 +		"http"  => "http://mirror.clarkson.edu/slitaz/",
   1.253 +		"rsync" => "rsync://mirror.clarkson.edu/slitaz/")) as $mirror) {
   1.254 +	$flag = "pics/website/".$mirror["flag"].".png";
   1.255 +	$head = TRUE;
   1.256 +	foreach(array("http", "ftp", "rsync") as $proto) {
   1.257 +		if (!isset($mirror[$proto])) continue;
   1.258 +		$link = $mirror[$proto];
   1.259 +		if (!test_url($link, $proto)) continue;
   1.260 +		$serveur = parse_url($link, PHP_URL_HOST);
   1.261 +		if ($head) echo <<<EOT
   1.262 +	<li><a href="http://en.utrace.de/?query=$serveur">
   1.263 +		<img title="map" src="$flag" alt="map" /></a>
   1.264 +		<a href="$link">$link</a>
   1.265 +EOT;
   1.266 +		else echo <<<EOT
   1.267 +		or <a href="$link">$proto</a>
   1.268 +EOT;
   1.269 +		$head = FALSE;
   1.270 +	}
   1.271 +	if ($head) continue;
   1.272 +	echo "	</li>\n";
   1.273 +}
   1.274 +
   1.275 +if ($output_url_file != "") {
   1.276 +	fclose($output_url_handler);
   1.277 +	rename($output_url_file, $mirrors_url_file);
   1.278 +	chmod($mirrors_url_file, 0644);
   1.279 +}
   1.280 +
   1.281 +?>
   1.282 +</ul>
   1.283 +
   1.284 +<!-- End of content -->
   1.285 +</div>
   1.286 +
   1.287 +<!-- Footer -->
   1.288 +<div id="footer">
   1.289 +	Copyright &copy; <span class="year"></span>
   1.290 +	<a href="http://www.slitaz.org/">SliTaz</a> - Network:
   1.291 +	<a href="http://scn.slitaz.org/">Community</a>
   1.292 +	<a href="http://doc.slitaz.org/">Doc</a>
   1.293 +	<a href="http://forum.slitaz.org/">Forum</a>
   1.294 +	<a href="http://pkgs.slitaz.org/">Packages</a>
   1.295 +	<a href="http://bugs.slitaz.org">Bugs</a>
   1.296 +	<a href="http://hg.slitaz.org/">Hg</a>
   1.297 +	<p>
   1.298 +		SliTaz @
   1.299 +		<a href="http://twitter.com/slitaz">Twitter</a>
   1.300 +		<a href="http://www.facebook.com/slitaz">Facebook</a>
   1.301 +		<a href="http://distrowatch.com/slitaz">Distrowatch</a>
   1.302 +		<a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a>
   1.303 +		<a href="http://flattr.com/profile/slitaz">Flattr</a>
   1.304 +	</p>
   1.305 +</div>
   1.306 +
   1.307 +</body>
   1.308 +</html>