slitaz-forge rev 157

mirror: Add mirror info files
author Christophe Lincoln <pankso@slitaz.org>
date Tue Mar 20 13:13:22 2012 +0100 (2012-03-20)
parents 9a4672e2ee84
children 7650464ba7e3
files mirror/Makefile mirror/README mirror/info/bin/makegraphs mirror/info/graphs.php mirror/info/index.php
line diff
     1.1 --- a/mirror/Makefile	Tue Mar 20 12:54:11 2012 +0100
     1.2 +++ b/mirror/Makefile	Tue Mar 20 13:13:22 2012 +0100
     1.3 @@ -3,7 +3,9 @@
     1.4  #
     1.5  
     1.6  PREFIX?=/usr
     1.7 -TINY=/var/www/pizza/tiny
     1.8 +VHOSTS?=/var/www
     1.9 +
    1.10 +TINY=$(VHOSTS)/pizza/tiny
    1.11  REPOS=/home/slitaz/repos
    1.12  
    1.13  all:
    1.14 @@ -11,6 +13,8 @@
    1.15  install:
    1.16  	install -m 0644 files/etc/lighttpd/vhosts.conf /etc/lighttpd
    1.17  	install -m 0644 files/etc/rsyncd.* /etc
    1.18 +	install -m 0644 info/*.php $(VHOSTS)/mirror-info
    1.19 +	install -m 0644 info/bin/* $(VHOSTS)/mirror-info/bin
    1.20  
    1.21  install-tiny:
    1.22  	cp -a $(REPOS)/slitaz-pizza/php/tiny $(TINY)
     2.1 --- a/mirror/README	Tue Mar 20 12:54:11 2012 +0100
     2.2 +++ b/mirror/README	Tue Mar 20 13:13:22 2012 +0100
     2.3 @@ -1,2 +1,12 @@
     2.4 +SliTaz Mirror
     2.5 +===============================================================================
     2.6  
     2.7 -Files used on mirror.slitaz.org
     2.8 +
     2.9 +Files used on mirror.slitaz.org including info web interface.
    2.10 +
    2.11 +
    2.12 +Host : mirror.slitaz.org
    2.13 +IP   : http://195.186.4.162/
    2.14 +
    2.15 +
    2.16 +===============================================================================
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/mirror/info/bin/makegraphs	Tue Mar 20 13:13:22 2012 +0100
     3.3 @@ -0,0 +1,311 @@
     3.4 +#!/bin/sh
     3.5 +#*/5  * * * * /var/www/mirror-info/bin/makegraphs >/dev/null
     3.6 +
     3.7 +# RRD database directory
     3.8 +rrdlog="/var/spool/rrd"
     3.9 +
    3.10 +# Images directory
    3.11 +rrdgraph="/var/www/mirror-info/pics/rrd"
    3.12 +
    3.13 +# Colors
    3.14 +#rrdcolors="--color SHADEA#EAE9EE --color SHADEB#EAE9EE --color BACK#EAE9EE" 
    3.15 +rrdcolors="--color SHADEA#FFFFFF --color SHADEB#FFFFFF --color BACK#FFFFFF" 
    3.16 +rrdgraphargs="-aPNG -i -z --alt-y-grid -w 600 -h 100 -r $rrdcolors"
    3.17 +
    3.18 +[ -d $rrdlog ] || mkdir -p $rrdlog
    3.19 +[ -d $rrdgraph ] || mkdir -p $rrdgraph
    3.20 +
    3.21 +updatecpudata() {
    3.22 +	[ -e "$rrdlog/cpu.rrd" ] || rrdtool create $rrdlog/cpu.rrd --step=300 \
    3.23 +			DS:user:COUNTER:600:0:500000000 \
    3.24 +			DS:system:COUNTER:600:0:500000000 \
    3.25 +			DS:idle:COUNTER:600:0:500000000 \
    3.26 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
    3.27 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
    3.28 +	grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do
    3.29 +		rrdtool update $rrdlog/cpu.rrd -t user:system:idle \
    3.30 +			N:$(( $user + $nice )):$system:$idle
    3.31 +		break
    3.32 +	done
    3.33 +
    3.34 +	[ -e "$rrdlog/cpu2.rrd" ] &&
    3.35 +	grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do
    3.36 +		rrdtool update $rrdlog/cpu2.rrd -t nice:user:system:idle \
    3.37 +			N:$nice:$user:$system:$idle
    3.38 +		break
    3.39 +	done
    3.40 +}
    3.41 +
    3.42 +updatecpugraph() {
    3.43 +	period=$1
    3.44 +	info="$(grep '^model name' /proc/cpuinfo | cut -d: -f2 \
    3.45 +		| sed 's/ * / /g' | head -1)"
    3.46 +	rrdtool graph "$rrdgraph/cpu-$period.png" --start -1$period \
    3.47 +		$rrdgraphargs -l 0 -u 100 -t "cpu usage per $period [$info ]" \
    3.48 +		DEF:user=$rrdlog/cpu.rrd:user:AVERAGE \
    3.49 +		DEF:system=$rrdlog/cpu.rrd:system:AVERAGE \
    3.50 +		DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE \
    3.51 +		'CDEF:total=user,system,idle,+,+' \
    3.52 +		'CDEF:userpct=100,user,total,/,*' \
    3.53 +		'CDEF:systempct=100,system,total,/,*' \
    3.54 +		'CDEF:idlepct=100,idle,total,/,*' \
    3.55 +		'AREA:userpct#0000FF:user cpu usage' \
    3.56 +		'STACK:systempct#FF0000:system cpu usage' \
    3.57 +		'STACK:idlepct#00FF00:idle cpu usage\j'
    3.58 +}
    3.59 +
    3.60 +
    3.61 +updatememgraph() {
    3.62 +	period=$1
    3.63 +	info="$(free | awk '\
    3.64 +{ \
    3.65 +  if (/Mem:/) { \
    3.66 +	if ($2 < 10000) printf "%d KB",$2; \
    3.67 +	else if ($2 < 10000000) printf "%d MB",$2/1024; \
    3.68 +	else printf "%d GB",$2/1024/1024; \
    3.69 +  } \
    3.70 +}')"
    3.71 +	info2="$(free | awk '\
    3.72 +{ \
    3.73 +  if (/Swap:/) { \
    3.74 +	if ($2 < 10000) printf "%d KB",$2; \
    3.75 +	else if ($2 < 10000000) printf "%d MB",$2/1024; \
    3.76 +	else printf "%d GB",$2/1024/1024; \
    3.77 +  } \
    3.78 +}')"
    3.79 +	rrdtool graph "$rrdgraph/memory-$period.png" --start -1$period \
    3.80 +		$rrdgraphargs -l 0 -u 100 \
    3.81 +		-t "memory usage per $period [ $info + $info2 swap ]" \
    3.82 +		DEF:used=$rrdlog/mem.rrd:memused:AVERAGE \
    3.83 +		DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE \
    3.84 +		DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE \
    3.85 +		DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE \
    3.86 +		DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE \
    3.87 +		DEF:swused=$rrdlog/mem.rrd:swapused:AVERAGE \
    3.88 +		DEF:swfree=$rrdlog/mem.rrd:swapfree:AVERAGE \
    3.89 +		'CDEF:total=used,free,+' \
    3.90 +		'CDEF:used2=used,buffer,cache,shared,+,+,-' \
    3.91 +		'CDEF:usedpct=100,used2,total,/,*' \
    3.92 +		'CDEF:sharedpct=100,shared,total,/,*' \
    3.93 +		'CDEF:bufferpct=100,buffer,total,/,*' \
    3.94 +		'CDEF:cachepct=100,cache,total,/,*' \
    3.95 +		'CDEF:freepct=100,free,total,/,*' \
    3.96 +		'CDEF:swtotal=swused,swfree,+' \
    3.97 +		'CDEF:swusedpct=100,swused,swtotal,/,*' \
    3.98 +		'AREA:usedpct#0000FF:used memory' \
    3.99 +		'STACK:sharedpct#FF7F00:shared memory' \
   3.100 +		'STACK:bufferpct#FF00FF:buffered memory' \
   3.101 +		'STACK:cachepct#FFFF00:cached memory' \
   3.102 +		'STACK:freepct#00FF00:free memory' \
   3.103 +		'LINE2:swusedpct#FF0000:used swap\j'
   3.104 +}
   3.105 +
   3.106 +updatememdata () {
   3.107 +	[ -e "$rrdlog/mem.rrd" ] ||
   3.108 +		rrdtool create "$rrdlog/mem.rrd" --step=300 \
   3.109 +			DS:memused:ABSOLUTE:600:0:5000000000 \
   3.110 +			DS:memfree:ABSOLUTE:600:0:5000000000 \
   3.111 +			DS:memshared:ABSOLUTE:600:0:5000000000 \
   3.112 +			DS:membuffers:ABSOLUTE:600:0:5000000000 \
   3.113 +			DS:memcache:ABSOLUTE:600:0:5000000000 \
   3.114 +			DS:swapused:ABSOLUTE:600:0:5000000000 \
   3.115 +			DS:swapfree:ABSOLUTE:600:0:5000000000 \
   3.116 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
   3.117 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
   3.118 +
   3.119 +	while read tag count unit; do
   3.120 +		case "$tag" in
   3.121 +		MemTotal:)  memtotal=$(($count * 1024));;
   3.122 +		MemFree:)   memfree=$(($count * 1024))
   3.123 +			    memused=$(($memtotal - $memfree))
   3.124 +			    memshared=0;;
   3.125 +		MemShared:) memshared=$(($count * 1024));;
   3.126 +		Buffers:)   membuffers=$(($count * 1024));;
   3.127 +		Cached:)    memcache=$(($count * 1024));;
   3.128 +		SwapTotal:) swaptotal=$(($count * 1024));;
   3.129 +		SwapFree:)  swapfree=$(($count * 1024))
   3.130 +			    swapused=$(( $swaptotal - $swapfree));;
   3.131 +		esac
   3.132 +	done < /proc/meminfo
   3.133 +
   3.134 +	rrdtool update "$rrdlog/mem.rrd" \
   3.135 +		-t memused:memfree:memshared:membuffers:memcache:swapused:swapfree \
   3.136 +		"N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree"
   3.137 +}
   3.138 +
   3.139 +getmax() {
   3.140 +	rrdtool fetch $rrdlog/$1.rrd AVERAGE | awk '\
   3.141 +BEGIN {max=0} \
   3.142 +/^[0-9]/ { \
   3.143 +   if ($2 != "nan" && $2 > max) max=$2; \
   3.144 +   if ($3 != "nan" && $3 > max) max=$3; \
   3.145 +} \
   3.146 +END { print max }' | sed 's/,/./'
   3.147 +}
   3.148 +
   3.149 +updatediskgraph() {
   3.150 +	period=$1
   3.151 +	[ "$period" == "day" ] && maxdisk="$(getmax disk)"
   3.152 +	info=""
   3.153 +	[ -r $2 ] &&
   3.154 +	info="[ $(fdisk -l 2> /dev/null | grep "^Disk $2:" | \
   3.155 +		  sed "s|Disk $2: \(.*\), .*|\1|") ]"
   3.156 +	if [ -e /sys/block/${2#/dev/}/device/iodone_cnt ]; then
   3.157 +#		--right-axis-label "I/O state %"
   3.158 +	rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \
   3.159 +		$rrdgraphargs -t "disk access per $period $info" \
   3.160 +		--logarithmic --lower-limit 1 -v "Sectors/second" --units=si \
   3.161 +		DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \
   3.162 +		DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \
   3.163 +		DEF:req=$rrdlog/iodisk.rrd:req:AVERAGE \
   3.164 +		DEF:done=$rrdlog/iodisk.rrd:done:AVERAGE \
   3.165 +		DEF:err=$rrdlog/iodisk.rrd:err:AVERAGE \
   3.166 +		"CDEF:readpct=100,read,$maxdisk,/,*" \
   3.167 +		"CDEF:writepct=100,write,$maxdisk,/,*" \
   3.168 +		"CDEF:errpct=100,err,req,/,*" \
   3.169 +		"CDEF:donepct=100,done,req,/,*" \
   3.170 +		'AREA:readpct#0000FF:sectors read from disk' \
   3.171 +		'STACK:writepct#00FF00:sectors written to disk' \
   3.172 +		'LINE2:donepct#FFFF00:I/O complete' \
   3.173 +		'LINE2:errpct#FF0000:I/O error\j'
   3.174 +	else
   3.175 +	rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \
   3.176 +		$rrdgraphargs -t "disk access per $period $info" \
   3.177 +		--logarithmic --lower-limit 1 -v "Sectors/second" --units=si \
   3.178 +		DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \
   3.179 +		DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \
   3.180 +		"CDEF:readpct=100,read,$maxdisk,/,*" \
   3.181 +		"CDEF:writepct=100,write,$maxdisk,/,*" \
   3.182 +		'AREA:readpct#0000FF:sectors read from disk' \
   3.183 +		'STACK:writepct#00FF00:sectors written to disk'
   3.184 +	fi
   3.185 +}
   3.186 +
   3.187 +updatediskdata() {
   3.188 +	dev=$1
   3.189 +	[ -e "$rrdlog/disk.rrd" ] ||
   3.190 +		rrdtool create "$rrdlog/disk.rrd" --step=300 \
   3.191 +			DS:readsect:COUNTER:600:0:5000000000 \
   3.192 +			DS:writesect:COUNTER:600:0:5000000000 \
   3.193 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
   3.194 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
   3.195 +	[ -e "$rrdlog/iodisk.rrd" ] ||
   3.196 +		rrdtool create "$rrdlog/iodisk.rrd" --step=300 \
   3.197 +			DS:done:GAUGE:600:0:U  DS:err:GAUGE:600:0:U \
   3.198 +			DS:req:GAUGE:600:0:U \
   3.199 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
   3.200 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
   3.201 +
   3.202 +	while read major minor name readreq readsect writereq writesect misc; do
   3.203 +		[ $major = $(( 0x$(stat -c %t $dev) )) ] || continue
   3.204 +		[ $minor = $(( 0x$(stat -c %T $dev) )) ] || continue
   3.205 +		rrdtool update "$rrdlog/disk.rrd" -t readsect:writesect \
   3.206 +			N:$readsect:$writesect
   3.207 +	done < /proc/diskstats
   3.208 +	disk=${dev:0:8}
   3.209 +	dir=/sys/block/${disk#/dev/}/device
   3.210 +	done=$(printf "%d\n" $(cat $dir/iodone_cnt 2> /dev/null) )
   3.211 +	err=$(printf "%d\n" $(cat $dir/ioerr_cnt 2> /dev/null) )
   3.212 +	req=$(printf "%d\n" $(cat $dir/iorequest_cnt 2> /dev/null) )
   3.213 +	rrdtool update "$rrdlog/iodisk.rrd" -t done:err:req N:$done:$err:$req
   3.214 +}
   3.215 +
   3.216 +updateifgraph() {
   3.217 +	interface=$1
   3.218 +	period=$2
   3.219 +	rrdtool graph "$rrdgraph/$interface-$period.png" --start -1$period \
   3.220 +		$rrdgraphargs -t "traffic on $interface graph per $period" \
   3.221 +		--logarithmic -A -v "Bytes/second" --units=si \
   3.222 +		DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE \
   3.223 +		DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE \
   3.224 +		'AREA:incoming#00FF00:incoming traffic' \
   3.225 +		'LINE1:outgoing#0000FF:outgoing traffic\j'
   3.226 +}
   3.227 +
   3.228 +netframes() {
   3.229 +ifconfig $1 | grep "$2 packets" | sed -re "s/.*$3:([0-9]+).*/\1/g"
   3.230 +}
   3.231 +
   3.232 +netstats() {
   3.233 +ifconfig $1 | grep bytes | sed -re "s/.*$2 bytes:([0-9]+).*/\1/g"
   3.234 +}
   3.235 +
   3.236 +updateifdata() {
   3.237 +	interface=$1
   3.238 +	[ -e "$rrdlog/$interface.rrd" ] ||
   3.239 +		rrdtool create "$rrdlog/$interface.rrd" --step=300 \
   3.240 +			DS:incoming:COUNTER:600:0:U \
   3.241 +			DS:outgoing:COUNTER:600:0:U \
   3.242 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
   3.243 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
   3.244 +	[ -e "$rrdlog/packets-$interface.rrd" ] ||
   3.245 +		rrdtool create "$rrdlog/packets-$interface.rrd" --step=300 \
   3.246 +			DS:in:COUNTER:600:0:U      DS:out:COUNTER:600:0:U \
   3.247 +			DS:inerr:COUNTER:600:0:U   DS:outerr:COUNTER:600:0:U \
   3.248 +			DS:indrop:COUNTER:600:0:U  DS:outdrop:COUNTER:600:0:U \
   3.249 +			DS:inov:COUNTER:600:0:U    DS:outov:COUNTER:600:0:U \
   3.250 +			DS:frame:COUNTER:600:0:U   DS:carrier:COUNTER:600:0:U \
   3.251 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
   3.252 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
   3.253 +	rx=$(netstats $interface RX)
   3.254 +	tx=$(netstats $interface TX)
   3.255 +	rrdtool update "$rrdlog/$interface.rrd" -t incoming:outgoing \
   3.256 +		N:${rx:-U}:${tx:-U}
   3.257 +	rx=$(netframes $interface RX packets)
   3.258 +	tx=$(netframes $interface TX packets)
   3.259 +	rxerr=$(netframes $interface RX errors)
   3.260 +	txerr=$(netframes $interface TX errors)
   3.261 +	rxdrop=$(netframes $interface RX dropped)
   3.262 +	txdrop=$(netframes $interface TX dropped)
   3.263 +	rxov=$(netframes $interface RX overruns)
   3.264 +	txov=$(netframes $interface TX overruns)
   3.265 +	frame=$(netframes $interface RX frame)
   3.266 +	carrier=$(netframes $interface TX carrier)
   3.267 +	rrdtool update "$rrdlog/packets-$interface.rrd" \
   3.268 +		-t in:out:inerr:outerr:indrop:outdrop:inov:outov:frame:carrier \
   3.269 +		N:${rx:-U}:${tx:-U}:${rxerr:-U}:${txerr:-U}:${rxdrop:-U}:${txdrop:-U}:${rxov:-U}:${txov:-U}:${frame:-U}:${carrier:-U}
   3.270 +}
   3.271 +
   3.272 +getdisk()
   3.273 +{
   3.274 +	local d
   3.275 +	local i
   3.276 +	d=$(stat -c %04D $1)
   3.277 +	for i in /dev/* ; do 
   3.278 +		[ $(stat -c "%02t%02T" $i) == $d ] || continue
   3.279 +		echo $i
   3.280 +		break
   3.281 +	done
   3.282 +}
   3.283 +
   3.284 +###
   3.285 +### System graphs
   3.286 +###
   3.287 +
   3.288 +updatecpudata
   3.289 +updatecpugraph day
   3.290 +updatecpugraph week
   3.291 +updatecpugraph month
   3.292 +updatecpugraph year
   3.293 +
   3.294 +updatememdata
   3.295 +updatememgraph day
   3.296 +updatememgraph week
   3.297 +updatememgraph month
   3.298 +updatememgraph year
   3.299 +
   3.300 +if [ -e /proc/diskstats ]; then
   3.301 +	disk=$(getdisk $0)
   3.302 +	updatediskdata $disk
   3.303 +	updatediskgraph day ${disk:0:8}
   3.304 +	updatediskgraph week ${disk:0:8}
   3.305 +	updatediskgraph month ${disk:0:8}
   3.306 +	updatediskgraph year ${disk:0:8}
   3.307 +fi
   3.308 +
   3.309 +iface=$(/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }')
   3.310 +updateifdata $iface
   3.311 +updateifgraph $iface day
   3.312 +updateifgraph $iface week
   3.313 +updateifgraph $iface month
   3.314 +updateifgraph $iface year
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/mirror/info/graphs.php	Tue Mar 20 13:13:22 2012 +0100
     4.3 @@ -0,0 +1,145 @@
     4.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     4.5 +    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     4.6 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     4.7 +<head>
     4.8 +	<title>Mirror RRD stats</title>
     4.9 +	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    4.10 +	<meta name="description" content="slitaz mirror rrdtool graphs" />
    4.11 +	<meta name="robots" content="noindex" />
    4.12 +	<meta name="author" content="SliTaz Contributors" />
    4.13 +	<link rel="shortcut icon" href="/css/favicon.ico" />
    4.14 +	<link rel="stylesheet" type="text/css" href="/css/slitaz.css" />
    4.15 +	<style type="text/css">
    4.16 +#copy {
    4.17 +	text-align: center;
    4.18 +}
    4.19 +
    4.20 +#bottom {
    4.21 +	text-align: center;
    4.22 +}
    4.23 +	</style>
    4.24 +</head>
    4.25 +<body>
    4.26 +
    4.27 +<!-- Header -->
    4.28 +<div id="header">
    4.29 +	<div id="logo"></div>
    4.30 +	<div id="network">
    4.31 +		<a href="http://www.slitaz.org/">
    4.32 +		<img src="/css/pics/network.png" alt="network.png" /></a>
    4.33 +		<a href="http://scn.slitaz.org/">Community</a>
    4.34 +		<a href="http://doc.slitaz.org/" title="SliTaz Community Documentation">Doc</a>
    4.35 +		<a href="http://forum.slitaz.org/" title="Slitaz Forum">Forum</a>
    4.36 +		<a href="http://bugs.slitaz.org/" title="Bug Tracking System">Bugs</a>
    4.37 +		<a href="http://hg.slitaz.org/" title="SliTaz repositories">Hg</a>
    4.38 +	</div>
    4.39 +	<h1><a href="http://<?php echo $_SERVER["HTTP_HOST"]; ?>/">SliTaz 
    4.40 +	<?php $host=preg_replace('/(\w+).*/i','$1',$_SERVER["HTTP_HOST"]); echo $host; ?></a></h1>
    4.41 +</div>
    4.42 +
    4.43 +<!-- Block -->
    4.44 +<div id="block">
    4.45 +	<!-- Navigation -->
    4.46 +	<div id="block_nav">
    4.47 +		<h4><img src="/css/pics/development.png" alt="development.png" />Developers Corner</h4>
    4.48 +		<ul>
    4.49 +			<li><a href="http://www.slitaz.org/en/devel/">Website devel</a></li>
    4.50 +			<li><a href="http://scn.slitaz.org/">Community</a></li>
    4.51 +			<li><a href="http://labs.slitaz.org/">Laboratories</a></li>
    4.52 +			<li><a href="http://hg.slitaz.org/">Mercurial Repos</a></li>
    4.53 +			<li><a href="http://cook.slitaz.org/">Build Bot</a></li>
    4.54 +			<li><a href="http://tank.slitaz.org/">Tank Server</a></li>
    4.55 +			<li><a href="http://mirror.slitaz.org/info/">Mirror Server</a></li>
    4.56 +		</ul>
    4.57 +	</div>
    4.58 +	<!-- Information/image -->
    4.59 +	<div id="block_info">
    4.60 +	<h4>Codename: <?php echo $host; ?></h4>
    4.61 +		<p>
    4.62 +			This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz 
    4.63 +			(stable) in an lguest virtual machine provided by 
    4.64 +			<a href="http://www.ads-lu.com/">Allied Data Sys. (ADS)</a>.
    4.65 +		</p>
    4.66 +		<p>
    4.67 +			Mirror CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .         
    4.68 +			"s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
    4.69 +			" awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
    4.70 +			"if (n == 4) printf \"quad \"; print s }' ")?> -
    4.71 +			<?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
    4.72 +			"n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
    4.73 +			"printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located in France next to 
    4.74 +			Roubaix. This page has real time statistics provided by PHP 
    4.75 +			<code>system()</code> Mirror is also monitored by RRDtool which provides 
    4.76 +			<a href="graphs.php">graphical stats</a>.
    4.77 +		</p>
    4.78 +	</div>
    4.79 +</div>
    4.80 +
    4.81 +<!-- Content -->
    4.82 +<div id="content">
    4.83 +
    4.84 +<?php
    4.85 +
    4.86 +$myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
    4.87 +
    4.88 +function one_graphic($img,$name)
    4.89 +{
    4.90 +	echo '<img src="pics/rrd/'.$img.'" title="'.
    4.91 +		$name.'" alt="'.$name.'" />'."\n";
    4.92 +}
    4.93 +
    4.94 +function graphic($res, $img='')
    4.95 +{
    4.96 +	global $myurl;
    4.97 +	if (!$img) $img=$res;
    4.98 +	echo "<a name=\"".$res."\"></a>";
    4.99 +	echo "<a href=\"".$myurl."?stats=".$res."#".$res."\">\n";
   4.100 +	one_graphic($img."-day.png",$res." daily");
   4.101 +	echo "</a>";
   4.102 +	if ($_GET['stats'] == $res) {
   4.103 +		one_graphic($img."-week.png",$res." weekly");
   4.104 +		one_graphic($img."-month.png",$res." monthly");
   4.105 +		one_graphic($img."-year.png",$res." yearly");
   4.106 +	}
   4.107 +}
   4.108 +
   4.109 +echo "<h2>CPU</h2>\n";
   4.110 +graphic("cpu");
   4.111 +echo "<h2>Memory</h2>\n";
   4.112 +graphic("memory");
   4.113 +echo "<h2>Disk</h2>\n";
   4.114 +graphic("disk");
   4.115 +echo "<h2>Network</h2>\n";
   4.116 +$eth = array();
   4.117 +exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth);
   4.118 +graphic("net",$eth[0]);
   4.119 +
   4.120 +?>
   4.121 +
   4.122 +<!-- End of content -->
   4.123 +</div>
   4.124 +
   4.125 +<!-- Start of footer and copy notice -->
   4.126 +<div id="copy">
   4.127 +<p>                                                                          
   4.128 +Last update : <?php echo date('r'); ?>
   4.129 +</p> 
   4.130 +<p>
   4.131 +Copyright &copy; <?php echo date('Y'); ?> <a href="http://www.slitaz.org/">SliTaz</a> -
   4.132 +<a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
   4.133 +</p>
   4.134 +<!-- End of copy -->
   4.135 +</div>
   4.136 +
   4.137 +<!-- Bottom and logo's -->
   4.138 +<div id="bottom">
   4.139 +<p>
   4.140 +<a href="http://validator.w3.org/check?uri=referer"><img
   4.141 +   src="/css/pics/website/xhtml10.png" alt="Valid XHTML 1.0"
   4.142 +   title="Code validé XHTML 1.0"
   4.143 +   style="width: 80px; height: 15px;" /></a>
   4.144 +</p>
   4.145 +</div>
   4.146 +
   4.147 +</body>
   4.148 +</html>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/mirror/info/index.php	Tue Mar 20 13:13:22 2012 +0100
     5.3 @@ -0,0 +1,375 @@
     5.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     5.5 +    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     5.6 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     5.7 +<head>
     5.8 +	<title>SliTaz Mirror</title>
     5.9 +	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    5.10 +	<meta name="description" content="slitaz mirror server" />
    5.11 +	<meta name="robots" content="index, nofollow" />
    5.12 +	<meta name="author" content="SliTaz Contributors" />
    5.13 +	<link rel="shortcut icon" href="/css/favicon.ico" />
    5.14 +	<link rel="stylesheet" type="text/css" href="/css/slitaz.css" />
    5.15 +	<style type="text/css">
    5.16 +#copy {
    5.17 +	text-align: center;
    5.18 +}
    5.19 +
    5.20 +#bottom {
    5.21 +	text-align: center;
    5.22 +}
    5.23 +	</style>
    5.24 +</head>
    5.25 +<body>
    5.26 +
    5.27 +<!-- Header -->
    5.28 +<div id="header">
    5.29 +	<div id="logo"></div>
    5.30 +	<div id="network">
    5.31 +		<a href="http://www.slitaz.org/">
    5.32 +		<img src="/css/pics/network.png" alt="network.png" /></a>
    5.33 +		<a href="http://scn.slitaz.org/">Community</a>
    5.34 +		<a href="http://doc.slitaz.org/" title="SliTaz Community Documentation">Doc</a>
    5.35 +		<a href="http://forum.slitaz.org/" title="Slitaz Forum">Forum</a>
    5.36 +		<a href="http://bugs.slitaz.org/" title="Bug Tracking System">Bugs</a>
    5.37 +		<a href="http://hg.slitaz.org/" title="SliTaz repositories">Hg</a>
    5.38 +	</div>
    5.39 +	<h1><a href="http://<?php echo $_SERVER["HTTP_HOST"]; ?>/">SliTaz 
    5.40 +	<?php $host=preg_replace('/(\w+).*/i','$1',$_SERVER["HTTP_HOST"]); echo $host; ?></a></h1>
    5.41 +</div>
    5.42 +
    5.43 +<!-- Block -->
    5.44 +<div id="block">
    5.45 +	<!-- Navigation -->
    5.46 +	<div id="block_nav">
    5.47 +		<h4><img src="/css/pics/development.png" alt="development.png" />Developers Corner</h4>
    5.48 +		<ul>
    5.49 +			<li><a href="http://www.slitaz.org/en/devel/">Website devel</a></li>
    5.50 +			<li><a href="http://scn.slitaz.org/">Community</a></li>
    5.51 +			<li><a href="http://cook.slitaz.org/">Build Bot</a></li>
    5.52 +			<li><a href="http://tank.slitaz.org/">Tank Server</a></li>
    5.53 +			<li><a href="http://mirror.slitaz.org/info/">Mirror Server</a> -
    5.54 +			<a href="http://mirror.slitaz.org/console/">Console</a>
    5.55 +			</li>
    5.56 +		</ul>
    5.57 +	</div>
    5.58 +	<!-- Information/image -->
    5.59 +	<div id="block_info">
    5.60 +	<h4>Codename: <?php echo $host; ?></h4>
    5.61 +		<p>
    5.62 +			This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz 
    5.63 +			(stable) in an lguest virtual machine provided by 
    5.64 +			<a href="http://www.ads-lu.com/">Allied Data Sys. (ADS)</a>.
    5.65 +		</p>
    5.66 +		<p>
    5.67 +			Mirror CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .         
    5.68 +			"s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
    5.69 +			" awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
    5.70 +			"if (n == 4) printf \"quad \"; print s }' ")?> -
    5.71 +			<?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
    5.72 +			"n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
    5.73 +			"printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located in France next to 
    5.74 +			Roubaix. This page has real time statistics provided by PHP 
    5.75 +			<code>system()</code> Mirror is also monitored by RRDtool which provides 
    5.76 +			<a href="graphs.php">graphical stats</a>.
    5.77 +		</p>
    5.78 +	</div>
    5.79 +</div>
    5.80 +
    5.81 +<!-- Content -->
    5.82 +<div id="content">
    5.83 +
    5.84 +<h2><a href="graphs.php"><img 
    5.85 +	style="vertical-align: middle; padding: 0 4px 0 0;"
    5.86 +	title="Mirror RRDtool graphs" alt="graphs"
    5.87 +    src="pics/website/monitor.png" /></a>System stats</h2>
    5.88 +
    5.89 +<h4>Uptime</h4>
    5.90 +
    5.91 +<pre class="package">
    5.92 +<?php
    5.93 +system("uptime | sed 's/^\s*//'");
    5.94 +?>
    5.95 +</pre>
    5.96 +
    5.97 +<h4>Disk usage</h4>
    5.98 +
    5.99 +<pre class="package">
   5.100 +<?php
   5.101 +system("df -h | sed '/^rootfs/d' | grep  '\(^/dev\|Filesystem\)'");
   5.102 +?>
   5.103 +</pre>
   5.104 +
   5.105 +<h4>Network</h4>
   5.106 +<pre class="package">
   5.107 +<?php
   5.108 +system("ifconfig eth0 | awk '{ if (/X packet/ || /X byte/) print }' | sed 's/^\s*//'");
   5.109 +?>
   5.110 +</pre>
   5.111 +
   5.112 +
   5.113 +<?php if (isset($_GET["all"])) { ?>
   5.114 +<h4>Logins</h4>
   5.115 +<pre class="package">
   5.116 +<?php
   5.117 +system("last");
   5.118 +?>
   5.119 +</pre>
   5.120 +
   5.121 +<h4>Processes</h4>
   5.122 +<pre class="package">
   5.123 +<?php
   5.124 +system("top -n1 -b");
   5.125 +?>
   5.126 +</pre>
   5.127 +<?php } ?>
   5.128 +
   5.129 +<a name="vhosts"></a>
   5.130 +<h3><a href="http://mirror.slitaz.org/awstats.pl?config=info.mirror.slitaz.org" target="_blank">
   5.131 +	<img title="Mirror Virtual hosts" alt="vhosts"
   5.132 +    src="pics/website/vhosts.png" /></a>Virtual hosts</h3>
   5.133 +
   5.134 +<ul>
   5.135 +	<li><a href="http://mirror.slitaz.org/">mirror.slitaz.org</a> - SliTaz Mirror.
   5.136 +	(<a href="http://mirror.slitaz.org/stats" target="_blank">stats</a>)</li>
   5.137 +	<li><a href="http://scn.slitaz.org/">scn.slitaz.org</a> - SliTaz Community Network.
   5.138 +	(<a href="http://mirror.slitaz.org/awstats.pl?config=scn.slitaz.org" target="_blank">stats</a>)</li>
   5.139 +	<li><a href="http://pizza.slitaz.org/">pizza.slitaz.org</a> - SliTaz Flavor builder.
   5.140 +	(<a href="http://mirror.slitaz.org/awstats.pl?config=pizza.mirror.slitaz.org" target="_blank">stats</a>)</li>
   5.141 +	<li><a href="http://tiny.slitaz.org/">tiny.slitaz.org</a> - Tiny SliTaz builder.
   5.142 +	(<a href="http://mirror.slitaz.org/awstats.pl?config=tiny.slitaz.org" target="_blank">stats</a>)</li>
   5.143 +	<li><a href="https://ajaxterm.slitaz.org/">ajaxterm.slitaz.org</a> - Slitaz Web Console.
   5.144 +	(<a href="http://mirror.slitaz.org/awstats.pl?config=ajaxterm.slitaz.org" target="_blank">stats</a>)</li>
   5.145 +</ul>
   5.146 +
   5.147 +<a name="replicas"></a>
   5.148 +<h3><a href="http://mirror.slitaz.org/awstats.pl?config=replicas.mirror.slitaz.org" target="_blank">
   5.149 +         <img title="Tank replicas" alt="replicas"
   5.150 +    src="pics/website/vhosts.png" /></a>Tank replicas</h3>
   5.151 +
   5.152 +<ul>
   5.153 +	<li><a href="http://mirror.slitaz.org/www/">www.slitaz.org</a> - SliTaz Website.
   5.154 +	(<a href="http://www.slitaz.org/" target="_blank">main</a>)</li>
   5.155 +	<li><a href="http://mirror.slitaz.org/doc/">doc.slitaz.org</a> - Documentation.
   5.156 +	(<a href="http://doc.slitaz.org/" target="_blank">main</a>)</li>
   5.157 +	<li><a href="http://mirror.slitaz.org/pkgs/">pkgs.slitaz.org</a> - Packages Web interface.
   5.158 +	(<a href="http://pkgs.slitaz.org/" target="_blank">main</a>)</li>
   5.159 +	<li><a href="http://mirror.slitaz.org/hg/">hg.slitaz.org</a> - Mercurial repositories (read only).
   5.160 +	(<a href="http://hg.slitaz.org/" target="_blank">main</a>
   5.161 +	<a href="http://hg.tuxfamily.org/mercurialroot/slitaz/" target="_blank">tuxfamily</a>)</li>
   5.162 +	<li><a href="http://mirror.slitaz.org/webboot/">boot.slitaz.org</a> - gPXE Web boot.
   5.163 +	(<a href="http://boot.slitaz.org/" target="_blank">main</a>)</li>
   5.164 +</ul>
   5.165 +
   5.166 +<a name="boot"></a>
   5.167 +<h3><a href="http://doc.slitaz.org/en:guides:pxe#web-booting" target="_blank">
   5.168 +	<img title="Web boot" src="pics/website/vhosts.png" 
   5.169 +	 alt="web boot" /></a>Web boot services</h3>
   5.170 +	 The SliTaz mirror provides a <b>tftp</b> access and a 
   5.171 +	 <a href="/pxe">pxe</a> tree. Simply add to your DHCP server configuration file:
   5.172 +	 <ul>
   5.173 +	 <li>for <b>udhcpd</b><!-- siaddr? sname? tftp? -->
   5.174 +	 <pre>
   5.175 +siaddr mirror.slitaz.org
   5.176 +boot_file gpxe.pxe</pre>
   5.177 +	 </li>
   5.178 +	 <li>for <b>dhcpd</b>
   5.179 +	 <pre>
   5.180 +next-server "mirror.slitaz.org"
   5.181 +filemane "gpxe.pxe"</pre>
   5.182 +	 </li>
   5.183 +	 <li>for <b>dnsmasq</b>
   5.184 +	 <pre>
   5.185 +dhcp-boot=gpxe.pxe,mirror.slitaz.org</pre>
   5.186 +	 </li>
   5.187 +	 </ul>
   5.188 +
   5.189 +<a name="mirrors"></a>
   5.190 +<h3><a href="http://mirror.slitaz.org/awstats.pl?config=rsync" target="_blank">
   5.191 +	<img title="Secondary mirrors" src="pics/website/vhosts.png" 
   5.192 +	 alt="mirrors" /></a>Mirrors</h3>
   5.193 +	Most mirrors are updated using the url: <b>rsync://mirror.slitaz.org/slitaz/</b>
   5.194 +	(<a href="http://mirror.slitaz.org/awstats.pl?config=rsync">stats</a>)
   5.195 +	<pre>
   5.196 +rsync -azH --delete rsync://mirror.slitaz.org/slitaz/ /local/slitaz/mirror/ </pre>
   5.197 +	New mirrors should be announced on the 
   5.198 +	<a href="http://www.slitaz.org/en/mailing-list.html">mailing list</a>.
   5.199 +<ul>
   5.200 +<?php
   5.201 +$output_url_file="";
   5.202 +$output_url_handler;
   5.203 +$mirrors_url_file="/tmp/mirrors";
   5.204 +
   5.205 +function test_url($link, $proto)
   5.206 +{
   5.207 +	global $output_url_file;
   5.208 +	global $mirrors_url_file;
   5.209 +	global $output_url_handler;
   5.210 +	
   5.211 +	if ($output_url_file != "") {
   5.212 +		switch($proto) {
   5.213 +		case "http" :
   5.214 +		case "ftp" :
   5.215 +			$cmd = "busybox wget -s $link/README" ;
   5.216 +			break;
   5.217 +		case "rsync" :
   5.218 +			$cmd = "rsync $link > /dev/null 2>&1" ;
   5.219 +			break;
   5.220 +		default :
   5.221 +			return FALSE;
   5.222 +		}
   5.223 +		if (shell_exec("$cmd && echo -n OK") == "OK") {
   5.224 +			fwrite($output_url_handler,$link."\n");
   5.225 +			return TRUE;
   5.226 +		} 
   5.227 +		return FALSE;
   5.228 +	}
   5.229 +	return shell_exec("grep -qs ^$link$ $mirrors_url_file && echo -n OK") == "OK"; 
   5.230 +}
   5.231 +
   5.232 +if (! file_exists($mirrors_url_file)) {
   5.233 +	$output_url_file = tempnam('/tmp','mkmirrors');
   5.234 +	$output_url_handler = fopen($output_url_file, "w");
   5.235 +	fwrite($output_url_handler,"http://mirror.slitaz.org/\n");
   5.236 +	fwrite($output_url_handler,"rsync://mirror.slitaz.org/\n");
   5.237 +}
   5.238 +
   5.239 +# Flags icons from http://www.famfamfam.com/lab/icons/flags/famfamfam_flag_icons.zip
   5.240 +foreach (array(
   5.241 +	array(	"flag"  => "ch",
   5.242 +		"http"  => "http://mirror.switch.ch/ftp/mirror/slitaz/",
   5.243 +		"ftp"   => "ftp://mirror.switch.ch/mirror/slitaz/"),
   5.244 +	array(	"flag"  => "us",
   5.245 +		"http"  => "http://www.gtlib.gatech.edu/pub/slitaz/",
   5.246 +		"ftp"   => "ftp://ftp.gtlib.gatech.edu/pub/slitaz/",
   5.247 +		"rsync" => "rsync://www.gtlib.gatech.edu/slitaz/"),
   5.248 +	array(	"flag"  => "fr",
   5.249 +		"http"  => "http://download.tuxfamily.org/slitaz/",
   5.250 +		"ftp"   => "ftp://download.tuxfamily.org/slitaz/",
   5.251 +		"rsync" => "rsync://download.tuxfamily.org/pub/slitaz/"),
   5.252 +	array(	"flag"  => "fr",
   5.253 +		"http"  => "http://www.linuxembarque.com/slitaz/mirror/"),
   5.254 +	array(	"flag"  => "cn",
   5.255 +		"http"  => "http://mirror.lupaworld.com/slitaz/"),
   5.256 +	array(	"flag"  => "cn",
   5.257 +		"http"  => "http://ks.lupaworld.com/slitaz/"),
   5.258 +	array(	"flag"  => "br",
   5.259 +		"http"  => "http://slitaz.c3sl.ufpr.br/",
   5.260 +		"ftp"   => "ftp://slitaz.c3sl.ufpr.br/slitaz/",
   5.261 +		"rsync" => "rsync://slitaz.c3sl.ufpr.br/slitaz/"),
   5.262 +	array(	"flag"  => "it",
   5.263 +		"http"  => "http://slitaz.mirror.garr.it/mirrors/slitaz/",
   5.264 +		"ftp"   => "ftp://slitaz.mirror.garr.it/mirrors/slitaz/",
   5.265 +		"rsync" => "rsync://slitaz.mirror.garr.it/mirrors/slitaz/"),
   5.266 +	array(	"flag"  => "si",
   5.267 +		"http"  => "http://mirror.drustvo-dns.si/slitaz/"),
   5.268 +	array(	"flag"  => "si",
   5.269 +		"ftp"   => "ftp://ftp.pina.si/slitaz/"),
   5.270 +	array(	"flag"  => "us",
   5.271 +		"http"  => "http://distro.ibiblio.org/pub/linux/distributions/slitaz/",
   5.272 +		"ftp"   => "ftp://distro.ibiblio.org/pub/linux/distributions/slitaz/"),
   5.273 +	array(	"flag"  => "nl",
   5.274 +		"http"  => "http://ftp.vim.org/ftp/os/Linux/distr/slitaz/",
   5.275 +		"ftp"   => "ftp://ftp.vim.org/mirror/os/Linux/distr/slitaz/"),
   5.276 +	array(	"flag"  => "nl",
   5.277 +		"http"  => "http://ftp.nedit.org/ftp/ftp/pub/os/Linux/distr/slitaz/",
   5.278 +		"ftp"   => "ftp://ftp.nedit.org/ftp/ftp/pub/os/Linux/distr/slitaz/"),
   5.279 +	array(	"flag"  => "ch",
   5.280 +		"http"  => "http://ftp.ch.xemacs.org/ftp/pool/2/mirror/slitaz/",
   5.281 +		"ftp"   => "ftp://ftp.ch.xemacs.org//pool/2/mirror/slitaz/"),
   5.282 +	array(	"flag"  => "de",
   5.283 +		"http"  => "http://ftp.uni-stuttgart.de/slitaz/",
   5.284 +		"ftp"   => "ftp://ftp.uni-stuttgart.de/slitaz/"),
   5.285 +	array(	"flag"  => "au",
   5.286 +		"http"  => "http://mirror.iprimus.com/slitaz/"),
   5.287 +	array(	"flag"  => "au",
   5.288 +		"http"  => "http://mirror01.ipgn.com.au/slitaz/"),
   5.289 +	array(	"flag"  => "us",
   5.290 +		"http"  => "http://mirror.clarkson.edu/slitaz/",
   5.291 +		"rsync" => "rsync://mirror.clarkson.edu/slitaz/")) as $mirror) {
   5.292 +	$flag = "pics/website/".$mirror["flag"].".png";
   5.293 +	$head = TRUE;
   5.294 +	foreach(array("http", "ftp", "rsync") as $proto) {
   5.295 +		if (!isset($mirror[$proto])) continue;
   5.296 +		$link = $mirror[$proto];
   5.297 +		if (!test_url($link, $proto)) continue;
   5.298 +		$serveur = parse_url($link, PHP_URL_HOST);
   5.299 +		if ($head) echo <<<EOT
   5.300 +	<li><a href="http://en.utrace.de/?query=$serveur">
   5.301 +		<img title="map" src="$flag" alt="map" /></a>
   5.302 +		<a href="$link">$link</a>
   5.303 +EOT;
   5.304 +		else echo <<<EOT
   5.305 +		or <a href="$link">$proto</a>
   5.306 +EOT;
   5.307 +		$head = FALSE;
   5.308 +	}
   5.309 +	if ($head) continue;
   5.310 +	echo "	</li>\n";
   5.311 +}
   5.312 +
   5.313 +if ($output_url_file != "") {
   5.314 +	fclose($output_url_handler);
   5.315 +	rename($output_url_file, $mirrors_url_file);
   5.316 +	chmod($mirrors_url_file, 0644);
   5.317 +}
   5.318 +
   5.319 +?>
   5.320 +</ul>
   5.321 +
   5.322 +<a name="builds"></a>
   5.323 +<h3><img title="Daily builds" src="pics/website/cdrom.png" alt="builds" 
   5.324 +     width="25" height="25" />
   5.325 +    Daily builds</h3>
   5.326 +
   5.327 +<?php
   5.328 +function display_log($file,$anchor,$url)
   5.329 +{
   5.330 +echo '<a name="'.$anchor.'"></a>';
   5.331 +echo "<h4><a href=\"$url\">";
   5.332 +system("stat -c '%y %n' ".$file." | sed 's/.000000000//;s|/var/log/\(.*\).log|\\1.iso|'");
   5.333 +echo "</a></h4>";
   5.334 +echo "<pre>";
   5.335 +$sed_script="s/.\[[0-9][^mG]*.//g";
   5.336 +$sed_script.=";:a;s/^\(.\{1,68\}\)\(\[ [A-Za-z]* \]\)/\\1 \\2/;ta";
   5.337 +$sed_script.=";s#\[ OK \]#[ <span style=\"color:green\">OK</span> ]#";
   5.338 +$sed_script.=";s#\[ Failed \]#[ <span style=\"color:red\">Failed</span> ]#";
   5.339 +system("sed '".$sed_script."' < $file");
   5.340 +echo "</pre>";
   5.341 +}
   5.342 +
   5.343 +display_log("/var/log/packages-stable.log", "buildstable", "/iso/stable/packages-3.0.iso");
   5.344 +display_log("/var/log/packages-cooking.log","buildcooking","/iso/cooking/packages-cooking.iso");
   5.345 +?>
   5.346 +
   5.347 +<!-- End of content -->
   5.348 +</div>
   5.349 +
   5.350 +<div id="content_bottom">
   5.351 +<div class="bottom_left"></div>
   5.352 +<div class="bottom_right"></div>
   5.353 +</div>
   5.354 +
   5.355 +<!-- Start of footer and copy notice -->
   5.356 +<div id="copy">
   5.357 +<p>                                                                          
   5.358 +Last update : <?php echo date('r'); ?>
   5.359 +</p> 
   5.360 +<p>
   5.361 +Copyright &copy; <?php echo date('Y'); ?> <a href="http://www.slitaz.org/">SliTaz</a> -
   5.362 +<a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
   5.363 +</p>
   5.364 +<!-- End of copy -->
   5.365 +</div>
   5.366 +
   5.367 +<!-- Bottom and logo's -->
   5.368 +<div id="bottom">
   5.369 +<p>
   5.370 +<a href="http://validator.w3.org/check?uri=referer"><img
   5.371 +   src="/css/pics/website/xhtml10.png" alt="Valid XHTML 1.0"
   5.372 +   title="Code validé XHTML 1.0"
   5.373 +   style="width: 80px; height: 15px;" /></a>
   5.374 +</p>
   5.375 +</div>
   5.376 +
   5.377 +</body>
   5.378 +</html>