slitaz-dev-tools rev 6

Moved everthing that should be in root (/) into rootfs folder in mirror-tools.
author Christopher Rogers <slaxemulator@gmail.com>
date Thu Feb 24 01:59:21 2011 +0000 (2011-02-24)
parents b788a1c8e19d
children 6a89e7f58612
files mirror-tools/etc/lighttpd/vhosts.conf mirror-tools/etc/rsyncd.conf mirror-tools/etc/rsyncd.motd mirror-tools/etc/tazwok.conf.mirror mirror-tools/home/backups/mirror/backup.sh mirror-tools/rootfs/etc/lighttpd/vhosts.conf mirror-tools/rootfs/etc/rsyncd.conf mirror-tools/rootfs/etc/rsyncd.motd mirror-tools/rootfs/etc/tazwok.conf.mirror mirror-tools/rootfs/home/backups/mirror/backup.sh mirror-tools/rootfs/usr/bin/mkpkgiso mirror-tools/rootfs/usr/share/mirror-host/boot/lguest-disk mirror-tools/rootfs/usr/share/mirror-host/boot/lguest-slitaz mirror-tools/rootfs/usr/share/mirror-host/boot/shellinabox.sh mirror-tools/rootfs/usr/share/mirror-host/etc/apache/conf.d/slitaz mirror-tools/rootfs/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl mirror-tools/rootfs/usr/share/mirror-host/etc/init.d/shellinabox mirror-tools/rootfs/usr/share/mirror-host/install mirror-tools/rootfs/usr/share/rrd/makegraphs mirror-tools/rootfs/usr/share/slitaz-live/INSTALL mirror-tools/usr/bin/mkpkgiso mirror-tools/usr/share/mirror-host/boot/lguest-disk mirror-tools/usr/share/mirror-host/boot/lguest-slitaz mirror-tools/usr/share/mirror-host/boot/shellinabox.sh mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl mirror-tools/usr/share/mirror-host/etc/init.d/shellinabox mirror-tools/usr/share/mirror-host/install mirror-tools/usr/share/rrd/makegraphs mirror-tools/usr/share/slitaz-live/INSTALL
line diff
     1.1 --- a/mirror-tools/etc/lighttpd/vhosts.conf	Thu Feb 24 01:29:50 2011 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,184 +0,0 @@
     1.4 -# /etc/lighttpd/vhosts.conf : Virtual hosts configuration file.
     1.5 -#
     1.6 -
     1.7 -# Example.org
     1.8 -#
     1.9 -#$HTTP["host"] =~ "(^|\.)example\.org$" {
    1.10 -  #server.document-root = "/var/www/vhost/exemple.com/html"
    1.11 -  #server.errorlog = "/var/log/lighttpd/example.org-error.log"
    1.12 -  #accesslog.filename = "/var/log/lighttpd/example.org-access.log"
    1.13 -#}
    1.14 -
    1.15 -# mirror.slitaz.org (Server canonical hostname)
    1.16 -#
    1.17 -$HTTP["host"] =~ "^mirror([0-9]*)\.slitaz\.org$" {
    1.18 -  server.document-root = "/var/www/slitaz/mirror"
    1.19 -  server.errorlog = "/var/log/lighttpd/mirror.slitaz.org-error.log"
    1.20 -  accesslog.filename = "/var/log/lighttpd/mirror.slitaz.org-access.log"
    1.21 -  
    1.22 -  include "awstats.conf"
    1.23 -  
    1.24 -  alias.url += ( "/info" => "/var/www/mirror-info/" )
    1.25 -  
    1.26 -  alias.url += ( "/pizza" => "/var/www/pizza/" )
    1.27 -  
    1.28 -  alias.url += ( "/doc" => "/var/www/doc/" )
    1.29 -  var.dokudir = "/doc"
    1.30 -  # Rewrites for dokuwiki
    1.31 -  url.rewrite = (
    1.32 -    "^" + var.dokudir + "/lib/.*$"              => "$0",
    1.33 -     "^" + var.dokudir + "/_media/(.*)?\?(.*)$"  => var.dokudir + "/lib/exe/fetch.php?media=$1&$2",
    1.34 -     "^" + var.dokudir + "/_media/(.*)$"         => var.dokudir + "/lib/exe/fetch.php?media=$1",
    1.35 -     "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2",
    1.36 -     "^" + var.dokudir + "/_detail/(.*)?$"       => var.dokudir + "/lib/exe/detail.php?media=$1",
    1.37 -     "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3",
    1.38 -     "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2",
    1.39 -     "^" + var.dokudir + "/doku.php.*"           => "$0",
    1.40 -     "^" + var.dokudir + "/feed.php.*"           => "$0",
    1.41 -     "^" + var.dokudir + "/(.*)\?(.*)"           => var.dokudir + "/doku.php?id=$1&$2",
    1.42 -     "^" + var.dokudir + "/(.*)"                 => var.dokudir + "/doku.php?id=$1"
    1.43 -  )
    1.44 -
    1.45 -  alias.url += ( "/webboot" => "/var/www/boot/" )
    1.46 -
    1.47 -  alias.url += ( "/pkgs" => "/var/www/pkgs/" )
    1.48 -  index-file.names += ( "search.sh" )
    1.49 -  cgi.assign += (
    1.50 -    ".sh" => "/bin/sh"
    1.51 -  )
    1.52 -
    1.53 -  alias.url += ( "/hg" => "/var/www/hg/" )
    1.54 -###  url.rewrite-once = ( "/hg(.*)" => "/hg/hgwebdir.py$1" )
    1.55 -  index-file.names += ( "hgwebdir.py" )
    1.56 -  cgi.assign += (
    1.57 -    ".py" => "/usr/bin/python"
    1.58 -  )
    1.59 -
    1.60 -  alias.url += ( "/www" => "/home/slitaz/website" )
    1.61 -  
    1.62 -#  alias.url += ( "/tiny" => "/var/www/pizza/tiny/demos/192.168.0.6/var/www" )
    1.63 -#  index-file.names += ( "index.sh" )
    1.64 -  
    1.65 -  index-file.names += ( "index.html" )
    1.66 -  index-file.names += ( "index.php" )
    1.67 -  # Last but not least...
    1.68 -  index-file.names += ( "/dir-generator.php" )
    1.69 -}
    1.70 -
    1.71 -## info.mirror.slitaz.org
    1.72 -##
    1.73 -#$HTTP["host"] =~ "^info\.mirror\.slitaz\.org$" {
    1.74 -#  server.document-root = "/var/www/mirror-info/"
    1.75 -#  server.errorlog = "/var/log/lighttpd/info.mirror.slitaz.org-error.log"
    1.76 -#  accesslog.filename = "/var/log/lighttpd/info.mirror.slitaz.org-access.log"
    1.77 -#  include "awstats.conf"
    1.78 -#}
    1.79 -
    1.80 -$HTTP["host"] =~ "ajaxterm\.slitaz\.org$" {
    1.81 -  proxy.server = ( "/" => 
    1.82 -  	( ( "host" => "127.0.0.1", "port" => 8022 ) )
    1.83 -  )
    1.84 -}
    1.85 -
    1.86 -# pizza.slitaz.org (Server canonical hostname)
    1.87 -#
    1.88 -$HTTP["host"] =~ "^pizza\.slitaz\.org$" {
    1.89 -  server.document-root = "/var/www/pizza"
    1.90 -  server.errorlog = "/var/log/lighttpd/pizza.slitaz.org-error.log"
    1.91 -  accesslog.filename = "/var/log/lighttpd/pizza.slitaz.org-access.log"
    1.92 -  include "awstats.conf"
    1.93 -  index-file.names += ( "index.php" )
    1.94 -}
    1.95 -
    1.96 -# slitaz.org
    1.97 -#
    1.98 -#$HTTP["host"] =~ "(^|www\.)slitaz\.org$" {
    1.99 -$HTTP["host"] =~ "www\.slitaz\.org$" {
   1.100 -  server.document-root = "/home/slitaz/website"
   1.101 -  server.errorlog = "/var/log/lighttpd/slitaz.org-error.log"
   1.102 -  accesslog.filename = "/var/log/lighttpd/slitaz.org-access.log"
   1.103 -  include "awstats.conf"
   1.104 -  
   1.105 -###  index-file.names = ( "index.html" )
   1.106 -  index-file.names += ( "start.html" )
   1.107 -  
   1.108 -  
   1.109 -###  url.rewrite-once = (
   1.110 -###    "^/about" => "/fr/about",
   1.111 -###	"^/artwork" => "/fr/artwork",
   1.112 -###	"^/devel" => "/fr/devel",
   1.113 -###    "^/doc" => "/fr/doc",
   1.114 -###	"^/get" => "/fr/get",
   1.115 -###	"^/packages" => "/fr/packages"
   1.116 -###  )
   1.117 - 
   1.118 -}
   1.119 -
   1.120 -# doc.slitaz.org
   1.121 -#
   1.122 -$HTTP["host"] =~ "doc\.slitaz\.org$" {
   1.123 -  server.document-root = "/var/www/doc"
   1.124 -  server.errorlog = "/var/log/lighttpd/doc.slitaz.org-error.log"
   1.125 -  accesslog.filename = "/var/log/lighttpd/doc.slitaz.org-access.log"
   1.126 -  index-file.names = ("doku.php")
   1.127 -  var.dokudir = ""
   1.128 -  # Rewrites for dokuwiki
   1.129 -  url.rewrite = (
   1.130 -    "^" + var.dokudir + "/lib/.*$"              => "$0",
   1.131 -     "^" + var.dokudir + "/_media/(.*)?\?(.*)$"  => var.dokudir + "/lib/exe/fetch.php?media=$1&$2",
   1.132 -     "^" + var.dokudir + "/_media/(.*)$"         => var.dokudir + "/lib/exe/fetch.php?media=$1",
   1.133 -     "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2",
   1.134 -     "^" + var.dokudir + "/_detail/(.*)?$"       => var.dokudir + "/lib/exe/detail.php?media=$1",
   1.135 -     "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3",
   1.136 -     "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2",
   1.137 -     "^" + var.dokudir + "/doku.php.*"           => "$0",
   1.138 -     "^" + var.dokudir + "/feed.php.*"           => "$0",
   1.139 -     "^" + var.dokudir + "/(.*)\?(.*)"           => var.dokudir + "/doku.php?id=$1&$2",
   1.140 -     "^" + var.dokudir + "/(.*)"                 => var.dokudir + "/doku.php?id=$1"
   1.141 -  )
   1.142 -}
   1.143 -
   1.144 -# boot.slitaz.org
   1.145 -#
   1.146 -$HTTP["host"] =~ "boot\.slitaz\.org$" {
   1.147 -  server.document-root = "/var/www/boot"
   1.148 -  server.errorlog = "/var/log/lighttpd/boot.slitaz.org-error.log"
   1.149 -  accesslog.filename = "/var/log/lighttpd/boot.slitaz.org-access.log"
   1.150 -}
   1.151 -
   1.152 -# pkgs.slitaz.org
   1.153 -#
   1.154 -$HTTP["host"] =~ "pkgs\.slitaz\.org$" {
   1.155 -  server.document-root = "/var/www/pkgs"
   1.156 -  server.errorlog = "/var/log/lighttpd/pkgs.slitaz.org-error.log"
   1.157 -  accesslog.filename = "/var/log/lighttpd/pkgs.slitaz.org-access.log"
   1.158 -  index-file.names += ( "search.sh" )
   1.159 -  cgi.assign = (
   1.160 -    ".sh" => "/bin/sh"
   1.161 -  )
   1.162 -}
   1.163 -
   1.164 -# hg.slitaz.org (Mercurial repos)
   1.165 -#
   1.166 -$HTTP["host"] =~ "hg\.slitaz\.org" {
   1.167 -  cgi.assign = (
   1.168 -    ".py" => "/usr/bin/python"
   1.169 -  )
   1.170 -  server.document-root = "/var/www/hg"
   1.171 -#  url.rewrite-once = ( "(.*)" => "/hgwebdir.py$1" )
   1.172 -  index-file.names += ( "hgwebdir.py" )
   1.173 -}
   1.174 -
   1.175 -# scn.slitaz.org (SliTaz Community Network)
   1.176 -#
   1.177 -$HTTP["host"] =~ "scn\.slitaz\.org$" {
   1.178 -  server.document-root = "/var/www/scn"
   1.179 -  server.errorlog = "/var/log/lighttpd/scn.slitaz.org-error.log"
   1.180 -  accesslog.filename = "/var/log/lighttpd/scn.slitaz.org-access.log"
   1.181 -  url.rewrite-final = (
   1.182 -    "^/system/test/(.*)$" => "/index.php?q=system/test/$1",
   1.183 -    "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
   1.184 -    "^/([^.?]*)$" => "/index.php?q=$1",
   1.185 -    "^/rss.xml" => "/index.php?q=rss.xml"
   1.186 -  )
   1.187 -}
     2.1 --- a/mirror-tools/etc/rsyncd.conf	Thu Feb 24 01:29:50 2011 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,25 +0,0 @@
     2.4 -# rsynd configuration for SliTaz mirror
     2.5 -#
     2.6 -motd file=/etc/rsyncd.motd
     2.7 -log file=/var/log/rsyncd
     2.8 -pid file=/var/run/rsyncd.pid
     2.9 -
    2.10 -
    2.11 -[slitaz]
    2.12 -
    2.13 -	comment = SliTaz GNU/Linux mirror
    2.14 -	path = /var/www/slitaz/mirror
    2.15 -	use chroot = yes
    2.16 -	max connections = 5
    2.17 -	lock file = /var/lock/rsyncd
    2.18 -	read only = yes
    2.19 -	list = yes
    2.20 -	uid = nobody
    2.21 -	gid = nogroup
    2.22 -	strict modes = yes
    2.23 -	ignore errors = no
    2.24 -	ignore nonreadable = yes
    2.25 -	transfer logging = no
    2.26 -	timeout = 600
    2.27 -	refuse options = checksum dry-run
    2.28 -	dont compress = *.gz *.tgz *.zip *.iso *.bz2 *.tazpkg
     3.1 --- a/mirror-tools/etc/rsyncd.motd	Thu Feb 24 01:29:50 2011 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,12 +0,0 @@
     3.4 -===============================================================================
     3.5 -
     3.6 -	SliTaz GNU/Linux mirror - http://www.slitaz.org/
     3.7 -
     3.8 -===============================================================================
     3.9 -
    3.10 -modules: 
    3.11 -
    3.12 - * slitaz      		--> ISO, packages, boot... all stuff 
    3.13 -
    3.14 -===============================================================================
    3.15 -
     4.1 --- a/mirror-tools/etc/tazwok.conf.mirror	Thu Feb 24 01:29:50 2011 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,45 +0,0 @@
     4.4 -# tazwok.conf: Tazwok configuration file.
     4.5 -#
     4.6 -
     4.7 -# Wok directory/tree to find receipts and build packages.
     4.8 -# By default on SliTaz the directory is /home/slitaz/wok.
     4.9 -WOK="/slitaz/home/slitaz/wok"
    4.10 -
    4.11 -# The path to the sources tarballs of the binaries packages.
    4.12 -SOURCES_REPOSITORY="/slitaz/home/slitaz/src"
    4.13 -
    4.14 -# This path set the binaries packages repository. It's where all
    4.15 -# the gen *.tazpkg will be stored when using gen-repository command.
    4.16 -PACKAGES_REPOSITORY="/var/www/slitaz/mirror/packages/cooking"
    4.17 -
    4.18 -# Default build host
    4.19 -BUILD_HOST=i486-pc-linux-gnu
    4.20 -
    4.21 -# Default tool prefix
    4.22 -TOOLPREFIX="${BUILD_HOST}-"
    4.23 -
    4.24 -# Default arguments for GNU configure.
    4.25 -CONFIGURE_ARGS="--build=$BUILD_HOST --host=$BUILD_HOST"
    4.26 -
    4.27 -# Translation files to include in packages, note that you can specifiy
    4.28 -# several locale.
    4.29 -LOCALE="fr"
    4.30 -
    4.31 -# Mirrors URLs. To downloads source next from your location.
    4.32 -# GNU mirror :
    4.33 -#
    4.34 -GNU_MIRROR="http://ftpmirror.gnu.org" 
    4.35 -
    4.36 -# SourceForge mirror :
    4.37 -#
    4.38 -SF_MIRROR="http://prdownloads.sourceforge.net/sourceforge" 
    4.39 -
    4.40 -# Xorg mirror :
    4.41 -#
    4.42 -XORG_MIRROR="ftp://ftp.solnet.ch/mirror/x.org/pub/individual"
    4.43 -
    4.44 -# FSH standards directories with init. Package generation will abort if
    4.45 -# a file is installed in a non-specified path. Note /vz is for OpenVZ.
    4.46 -FSH="bin boot dev etc home init lib media mnt proc root sbin share sys \
    4.47 -tmp usr var vz usr/bin usr/games usr/include usr/lib usr/local usr/sbin \
    4.48 -usr/share usr/src"
     5.1 --- a/mirror-tools/home/backups/mirror/backup.sh	Thu Feb 24 01:29:50 2011 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,83 +0,0 @@
     5.4 -#!/bin/sh
     5.5 -
     5.6 -KEEP=1
     5.7 -EXTRA="monthly:30:2"
     5.8 -BACKUP_USER=bellard
     5.9 -REMOTE_USER=bellard
    5.10 -
    5.11 -backup_data()
    5.12 -{
    5.13 -GZIP=rgzip
    5.14 -which $GZIP > /dev/null || GZIP=gzip
    5.15 -echo "Sync doc.slitaz.org ..."
    5.16 -rsync -aH -e "$SSH" --bwlimit=50 \
    5.17 -  $REMOTE_USER@tank.slitaz.org:/home/slitaz/www/doc/data/. /var/www/doc/data/.
    5.18 -while read file dirs; do
    5.19 -	echo "Create $file.cpio.gz ..."
    5.20 -	( cd / ; find $dirs  | cpio -o -H newc ) | \
    5.21 -		$GZIP -9 > $file.cpio.gz 2> /dev/null
    5.22 -done <<EOT
    5.23 -etc		etc home/$BACKUP_USER/.ssh
    5.24 -www		var/www/mirror-info var/www/pizza
    5.25 -www2		var/www/boot /var/www/hg /var/www/pkgs /var/www/doc
    5.26 -packages	var/lib/tazpkg/installed
    5.27 -rrd		var/spool/rrd
    5.28 -crontabs	var/spool/cron/crontabs
    5.29 -awstats		var/lib/awstats
    5.30 -EOT
    5.31 -}
    5.32 -
    5.33 -#
    5.34 -# The following should be kept untouched.
    5.35 -#
    5.36 -
    5.37 -SSH="ssh -i /home/$BACKUP_USER/.ssh/id_rsa -o PasswordAuthentication=no"
    5.38 -
    5.39 -cd $(dirname $0)
    5.40 -[ $(id -u) == 0 ] || exit 1
    5.41 -[ $(hostname) == $(basename $PWD) -o \
    5.42 -  $(hostname) == $(basename $PWD).slitaz.org ] || exit 1
    5.43 -
    5.44 -rotate()
    5.45 -{
    5.46 -	local i
    5.47 -	local j
    5.48 -	for j in $(seq $(($1 - 1)) -1 1); do
    5.49 -		for i in *.$2.$(($j - 1)) ; do
    5.50 -			[ -e $i ] && mv -f $i ${i%.$2.*}.$2.$j
    5.51 -		done
    5.52 -	done
    5.53 -}
    5.54 -
    5.55 -[ -n "$EXTRA" ] && for x in $EXTRA ; do
    5.56 -	IFS=':' ; set -- $x ; unset IFS
    5.57 -	suffix=$1
    5.58 -	days=$2
    5.59 -	keep=$3
    5.60 -	for i in *.gz ; do
    5.61 -		[ -e $i ] || continue
    5.62 -		mtime=$(( $(stat -c %Y $i) - ($days * 24 * 3600) ))
    5.63 -		j=$i.$suffix.0
    5.64 -		[ -e $j ] && [ $(stat -c %Y $j) -gt $mtime ] && continue
    5.65 -		rotate $keep gz.$suffix
    5.66 -		ln $i $j
    5.67 -	done
    5.68 -done
    5.69 -if [ 0$KEEP -gt 0 ]; then
    5.70 -	[ $KEEP -gt 1 ] && rotate $KEEP gz
    5.71 -	for i in *.gz ; do
    5.72 -		[ -e $i ] && mv -f $i $i.0
    5.73 -	done
    5.74 -fi
    5.75 -
    5.76 -echo "Local backup for $(hostname) ..."
    5.77 -backup_data
    5.78 -
    5.79 -chown $BACKUP_USER *
    5.80 -chmod 700 *
    5.81 -
    5.82 -[ -n "$REMOTE_USER" ] && for i in $(cd .. ; ls); do
    5.83 -	[ $i == $(hostname) -o $i.slitaz.org == $(hostname) ] && continue
    5.84 -	echo "Get backups from $i ..."
    5.85 -	rsync -aH -e "$SSH" --bwlimit=50 $REMOTE_USER@$i.slitaz.org:/home/backups/$i/. ../$i/.
    5.86 -done
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/mirror-tools/rootfs/etc/lighttpd/vhosts.conf	Thu Feb 24 01:59:21 2011 +0000
     6.3 @@ -0,0 +1,184 @@
     6.4 +# /etc/lighttpd/vhosts.conf : Virtual hosts configuration file.
     6.5 +#
     6.6 +
     6.7 +# Example.org
     6.8 +#
     6.9 +#$HTTP["host"] =~ "(^|\.)example\.org$" {
    6.10 +  #server.document-root = "/var/www/vhost/exemple.com/html"
    6.11 +  #server.errorlog = "/var/log/lighttpd/example.org-error.log"
    6.12 +  #accesslog.filename = "/var/log/lighttpd/example.org-access.log"
    6.13 +#}
    6.14 +
    6.15 +# mirror.slitaz.org (Server canonical hostname)
    6.16 +#
    6.17 +$HTTP["host"] =~ "^mirror([0-9]*)\.slitaz\.org$" {
    6.18 +  server.document-root = "/var/www/slitaz/mirror"
    6.19 +  server.errorlog = "/var/log/lighttpd/mirror.slitaz.org-error.log"
    6.20 +  accesslog.filename = "/var/log/lighttpd/mirror.slitaz.org-access.log"
    6.21 +  
    6.22 +  include "awstats.conf"
    6.23 +  
    6.24 +  alias.url += ( "/info" => "/var/www/mirror-info/" )
    6.25 +  
    6.26 +  alias.url += ( "/pizza" => "/var/www/pizza/" )
    6.27 +  
    6.28 +  alias.url += ( "/doc" => "/var/www/doc/" )
    6.29 +  var.dokudir = "/doc"
    6.30 +  # Rewrites for dokuwiki
    6.31 +  url.rewrite = (
    6.32 +    "^" + var.dokudir + "/lib/.*$"              => "$0",
    6.33 +     "^" + var.dokudir + "/_media/(.*)?\?(.*)$"  => var.dokudir + "/lib/exe/fetch.php?media=$1&$2",
    6.34 +     "^" + var.dokudir + "/_media/(.*)$"         => var.dokudir + "/lib/exe/fetch.php?media=$1",
    6.35 +     "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2",
    6.36 +     "^" + var.dokudir + "/_detail/(.*)?$"       => var.dokudir + "/lib/exe/detail.php?media=$1",
    6.37 +     "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3",
    6.38 +     "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2",
    6.39 +     "^" + var.dokudir + "/doku.php.*"           => "$0",
    6.40 +     "^" + var.dokudir + "/feed.php.*"           => "$0",
    6.41 +     "^" + var.dokudir + "/(.*)\?(.*)"           => var.dokudir + "/doku.php?id=$1&$2",
    6.42 +     "^" + var.dokudir + "/(.*)"                 => var.dokudir + "/doku.php?id=$1"
    6.43 +  )
    6.44 +
    6.45 +  alias.url += ( "/webboot" => "/var/www/boot/" )
    6.46 +
    6.47 +  alias.url += ( "/pkgs" => "/var/www/pkgs/" )
    6.48 +  index-file.names += ( "search.sh" )
    6.49 +  cgi.assign += (
    6.50 +    ".sh" => "/bin/sh"
    6.51 +  )
    6.52 +
    6.53 +  alias.url += ( "/hg" => "/var/www/hg/" )
    6.54 +###  url.rewrite-once = ( "/hg(.*)" => "/hg/hgwebdir.py$1" )
    6.55 +  index-file.names += ( "hgwebdir.py" )
    6.56 +  cgi.assign += (
    6.57 +    ".py" => "/usr/bin/python"
    6.58 +  )
    6.59 +
    6.60 +  alias.url += ( "/www" => "/home/slitaz/website" )
    6.61 +  
    6.62 +#  alias.url += ( "/tiny" => "/var/www/pizza/tiny/demos/192.168.0.6/var/www" )
    6.63 +#  index-file.names += ( "index.sh" )
    6.64 +  
    6.65 +  index-file.names += ( "index.html" )
    6.66 +  index-file.names += ( "index.php" )
    6.67 +  # Last but not least...
    6.68 +  index-file.names += ( "/dir-generator.php" )
    6.69 +}
    6.70 +
    6.71 +## info.mirror.slitaz.org
    6.72 +##
    6.73 +#$HTTP["host"] =~ "^info\.mirror\.slitaz\.org$" {
    6.74 +#  server.document-root = "/var/www/mirror-info/"
    6.75 +#  server.errorlog = "/var/log/lighttpd/info.mirror.slitaz.org-error.log"
    6.76 +#  accesslog.filename = "/var/log/lighttpd/info.mirror.slitaz.org-access.log"
    6.77 +#  include "awstats.conf"
    6.78 +#}
    6.79 +
    6.80 +$HTTP["host"] =~ "ajaxterm\.slitaz\.org$" {
    6.81 +  proxy.server = ( "/" => 
    6.82 +  	( ( "host" => "127.0.0.1", "port" => 8022 ) )
    6.83 +  )
    6.84 +}
    6.85 +
    6.86 +# pizza.slitaz.org (Server canonical hostname)
    6.87 +#
    6.88 +$HTTP["host"] =~ "^pizza\.slitaz\.org$" {
    6.89 +  server.document-root = "/var/www/pizza"
    6.90 +  server.errorlog = "/var/log/lighttpd/pizza.slitaz.org-error.log"
    6.91 +  accesslog.filename = "/var/log/lighttpd/pizza.slitaz.org-access.log"
    6.92 +  include "awstats.conf"
    6.93 +  index-file.names += ( "index.php" )
    6.94 +}
    6.95 +
    6.96 +# slitaz.org
    6.97 +#
    6.98 +#$HTTP["host"] =~ "(^|www\.)slitaz\.org$" {
    6.99 +$HTTP["host"] =~ "www\.slitaz\.org$" {
   6.100 +  server.document-root = "/home/slitaz/website"
   6.101 +  server.errorlog = "/var/log/lighttpd/slitaz.org-error.log"
   6.102 +  accesslog.filename = "/var/log/lighttpd/slitaz.org-access.log"
   6.103 +  include "awstats.conf"
   6.104 +  
   6.105 +###  index-file.names = ( "index.html" )
   6.106 +  index-file.names += ( "start.html" )
   6.107 +  
   6.108 +  
   6.109 +###  url.rewrite-once = (
   6.110 +###    "^/about" => "/fr/about",
   6.111 +###	"^/artwork" => "/fr/artwork",
   6.112 +###	"^/devel" => "/fr/devel",
   6.113 +###    "^/doc" => "/fr/doc",
   6.114 +###	"^/get" => "/fr/get",
   6.115 +###	"^/packages" => "/fr/packages"
   6.116 +###  )
   6.117 + 
   6.118 +}
   6.119 +
   6.120 +# doc.slitaz.org
   6.121 +#
   6.122 +$HTTP["host"] =~ "doc\.slitaz\.org$" {
   6.123 +  server.document-root = "/var/www/doc"
   6.124 +  server.errorlog = "/var/log/lighttpd/doc.slitaz.org-error.log"
   6.125 +  accesslog.filename = "/var/log/lighttpd/doc.slitaz.org-access.log"
   6.126 +  index-file.names = ("doku.php")
   6.127 +  var.dokudir = ""
   6.128 +  # Rewrites for dokuwiki
   6.129 +  url.rewrite = (
   6.130 +    "^" + var.dokudir + "/lib/.*$"              => "$0",
   6.131 +     "^" + var.dokudir + "/_media/(.*)?\?(.*)$"  => var.dokudir + "/lib/exe/fetch.php?media=$1&$2",
   6.132 +     "^" + var.dokudir + "/_media/(.*)$"         => var.dokudir + "/lib/exe/fetch.php?media=$1",
   6.133 +     "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2",
   6.134 +     "^" + var.dokudir + "/_detail/(.*)?$"       => var.dokudir + "/lib/exe/detail.php?media=$1",
   6.135 +     "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3",
   6.136 +     "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2",
   6.137 +     "^" + var.dokudir + "/doku.php.*"           => "$0",
   6.138 +     "^" + var.dokudir + "/feed.php.*"           => "$0",
   6.139 +     "^" + var.dokudir + "/(.*)\?(.*)"           => var.dokudir + "/doku.php?id=$1&$2",
   6.140 +     "^" + var.dokudir + "/(.*)"                 => var.dokudir + "/doku.php?id=$1"
   6.141 +  )
   6.142 +}
   6.143 +
   6.144 +# boot.slitaz.org
   6.145 +#
   6.146 +$HTTP["host"] =~ "boot\.slitaz\.org$" {
   6.147 +  server.document-root = "/var/www/boot"
   6.148 +  server.errorlog = "/var/log/lighttpd/boot.slitaz.org-error.log"
   6.149 +  accesslog.filename = "/var/log/lighttpd/boot.slitaz.org-access.log"
   6.150 +}
   6.151 +
   6.152 +# pkgs.slitaz.org
   6.153 +#
   6.154 +$HTTP["host"] =~ "pkgs\.slitaz\.org$" {
   6.155 +  server.document-root = "/var/www/pkgs"
   6.156 +  server.errorlog = "/var/log/lighttpd/pkgs.slitaz.org-error.log"
   6.157 +  accesslog.filename = "/var/log/lighttpd/pkgs.slitaz.org-access.log"
   6.158 +  index-file.names += ( "search.sh" )
   6.159 +  cgi.assign = (
   6.160 +    ".sh" => "/bin/sh"
   6.161 +  )
   6.162 +}
   6.163 +
   6.164 +# hg.slitaz.org (Mercurial repos)
   6.165 +#
   6.166 +$HTTP["host"] =~ "hg\.slitaz\.org" {
   6.167 +  cgi.assign = (
   6.168 +    ".py" => "/usr/bin/python"
   6.169 +  )
   6.170 +  server.document-root = "/var/www/hg"
   6.171 +#  url.rewrite-once = ( "(.*)" => "/hgwebdir.py$1" )
   6.172 +  index-file.names += ( "hgwebdir.py" )
   6.173 +}
   6.174 +
   6.175 +# scn.slitaz.org (SliTaz Community Network)
   6.176 +#
   6.177 +$HTTP["host"] =~ "scn\.slitaz\.org$" {
   6.178 +  server.document-root = "/var/www/scn"
   6.179 +  server.errorlog = "/var/log/lighttpd/scn.slitaz.org-error.log"
   6.180 +  accesslog.filename = "/var/log/lighttpd/scn.slitaz.org-access.log"
   6.181 +  url.rewrite-final = (
   6.182 +    "^/system/test/(.*)$" => "/index.php?q=system/test/$1",
   6.183 +    "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
   6.184 +    "^/([^.?]*)$" => "/index.php?q=$1",
   6.185 +    "^/rss.xml" => "/index.php?q=rss.xml"
   6.186 +  )
   6.187 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/mirror-tools/rootfs/etc/rsyncd.conf	Thu Feb 24 01:59:21 2011 +0000
     7.3 @@ -0,0 +1,25 @@
     7.4 +# rsynd configuration for SliTaz mirror
     7.5 +#
     7.6 +motd file=/etc/rsyncd.motd
     7.7 +log file=/var/log/rsyncd
     7.8 +pid file=/var/run/rsyncd.pid
     7.9 +
    7.10 +
    7.11 +[slitaz]
    7.12 +
    7.13 +	comment = SliTaz GNU/Linux mirror
    7.14 +	path = /var/www/slitaz/mirror
    7.15 +	use chroot = yes
    7.16 +	max connections = 5
    7.17 +	lock file = /var/lock/rsyncd
    7.18 +	read only = yes
    7.19 +	list = yes
    7.20 +	uid = nobody
    7.21 +	gid = nogroup
    7.22 +	strict modes = yes
    7.23 +	ignore errors = no
    7.24 +	ignore nonreadable = yes
    7.25 +	transfer logging = no
    7.26 +	timeout = 600
    7.27 +	refuse options = checksum dry-run
    7.28 +	dont compress = *.gz *.tgz *.zip *.iso *.bz2 *.tazpkg
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/mirror-tools/rootfs/etc/rsyncd.motd	Thu Feb 24 01:59:21 2011 +0000
     8.3 @@ -0,0 +1,12 @@
     8.4 +===============================================================================
     8.5 +
     8.6 +	SliTaz GNU/Linux mirror - http://www.slitaz.org/
     8.7 +
     8.8 +===============================================================================
     8.9 +
    8.10 +modules: 
    8.11 +
    8.12 + * slitaz      		--> ISO, packages, boot... all stuff 
    8.13 +
    8.14 +===============================================================================
    8.15 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/mirror-tools/rootfs/etc/tazwok.conf.mirror	Thu Feb 24 01:59:21 2011 +0000
     9.3 @@ -0,0 +1,45 @@
     9.4 +# tazwok.conf: Tazwok configuration file.
     9.5 +#
     9.6 +
     9.7 +# Wok directory/tree to find receipts and build packages.
     9.8 +# By default on SliTaz the directory is /home/slitaz/wok.
     9.9 +WOK="/slitaz/home/slitaz/wok"
    9.10 +
    9.11 +# The path to the sources tarballs of the binaries packages.
    9.12 +SOURCES_REPOSITORY="/slitaz/home/slitaz/src"
    9.13 +
    9.14 +# This path set the binaries packages repository. It's where all
    9.15 +# the gen *.tazpkg will be stored when using gen-repository command.
    9.16 +PACKAGES_REPOSITORY="/var/www/slitaz/mirror/packages/cooking"
    9.17 +
    9.18 +# Default build host
    9.19 +BUILD_HOST=i486-pc-linux-gnu
    9.20 +
    9.21 +# Default tool prefix
    9.22 +TOOLPREFIX="${BUILD_HOST}-"
    9.23 +
    9.24 +# Default arguments for GNU configure.
    9.25 +CONFIGURE_ARGS="--build=$BUILD_HOST --host=$BUILD_HOST"
    9.26 +
    9.27 +# Translation files to include in packages, note that you can specifiy
    9.28 +# several locale.
    9.29 +LOCALE="fr"
    9.30 +
    9.31 +# Mirrors URLs. To downloads source next from your location.
    9.32 +# GNU mirror :
    9.33 +#
    9.34 +GNU_MIRROR="http://ftpmirror.gnu.org" 
    9.35 +
    9.36 +# SourceForge mirror :
    9.37 +#
    9.38 +SF_MIRROR="http://prdownloads.sourceforge.net/sourceforge" 
    9.39 +
    9.40 +# Xorg mirror :
    9.41 +#
    9.42 +XORG_MIRROR="ftp://ftp.solnet.ch/mirror/x.org/pub/individual"
    9.43 +
    9.44 +# FSH standards directories with init. Package generation will abort if
    9.45 +# a file is installed in a non-specified path. Note /vz is for OpenVZ.
    9.46 +FSH="bin boot dev etc home init lib media mnt proc root sbin share sys \
    9.47 +tmp usr var vz usr/bin usr/games usr/include usr/lib usr/local usr/sbin \
    9.48 +usr/share usr/src"
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/mirror-tools/rootfs/home/backups/mirror/backup.sh	Thu Feb 24 01:59:21 2011 +0000
    10.3 @@ -0,0 +1,83 @@
    10.4 +#!/bin/sh
    10.5 +
    10.6 +KEEP=1
    10.7 +EXTRA="monthly:30:2"
    10.8 +BACKUP_USER=bellard
    10.9 +REMOTE_USER=bellard
   10.10 +
   10.11 +backup_data()
   10.12 +{
   10.13 +GZIP=rgzip
   10.14 +which $GZIP > /dev/null || GZIP=gzip
   10.15 +echo "Sync doc.slitaz.org ..."
   10.16 +rsync -aH -e "$SSH" --bwlimit=50 \
   10.17 +  $REMOTE_USER@tank.slitaz.org:/home/slitaz/www/doc/data/. /var/www/doc/data/.
   10.18 +while read file dirs; do
   10.19 +	echo "Create $file.cpio.gz ..."
   10.20 +	( cd / ; find $dirs  | cpio -o -H newc ) | \
   10.21 +		$GZIP -9 > $file.cpio.gz 2> /dev/null
   10.22 +done <<EOT
   10.23 +etc		etc home/$BACKUP_USER/.ssh
   10.24 +www		var/www/mirror-info var/www/pizza
   10.25 +www2		var/www/boot /var/www/hg /var/www/pkgs /var/www/doc
   10.26 +packages	var/lib/tazpkg/installed
   10.27 +rrd		var/spool/rrd
   10.28 +crontabs	var/spool/cron/crontabs
   10.29 +awstats		var/lib/awstats
   10.30 +EOT
   10.31 +}
   10.32 +
   10.33 +#
   10.34 +# The following should be kept untouched.
   10.35 +#
   10.36 +
   10.37 +SSH="ssh -i /home/$BACKUP_USER/.ssh/id_rsa -o PasswordAuthentication=no"
   10.38 +
   10.39 +cd $(dirname $0)
   10.40 +[ $(id -u) == 0 ] || exit 1
   10.41 +[ $(hostname) == $(basename $PWD) -o \
   10.42 +  $(hostname) == $(basename $PWD).slitaz.org ] || exit 1
   10.43 +
   10.44 +rotate()
   10.45 +{
   10.46 +	local i
   10.47 +	local j
   10.48 +	for j in $(seq $(($1 - 1)) -1 1); do
   10.49 +		for i in *.$2.$(($j - 1)) ; do
   10.50 +			[ -e $i ] && mv -f $i ${i%.$2.*}.$2.$j
   10.51 +		done
   10.52 +	done
   10.53 +}
   10.54 +
   10.55 +[ -n "$EXTRA" ] && for x in $EXTRA ; do
   10.56 +	IFS=':' ; set -- $x ; unset IFS
   10.57 +	suffix=$1
   10.58 +	days=$2
   10.59 +	keep=$3
   10.60 +	for i in *.gz ; do
   10.61 +		[ -e $i ] || continue
   10.62 +		mtime=$(( $(stat -c %Y $i) - ($days * 24 * 3600) ))
   10.63 +		j=$i.$suffix.0
   10.64 +		[ -e $j ] && [ $(stat -c %Y $j) -gt $mtime ] && continue
   10.65 +		rotate $keep gz.$suffix
   10.66 +		ln $i $j
   10.67 +	done
   10.68 +done
   10.69 +if [ 0$KEEP -gt 0 ]; then
   10.70 +	[ $KEEP -gt 1 ] && rotate $KEEP gz
   10.71 +	for i in *.gz ; do
   10.72 +		[ -e $i ] && mv -f $i $i.0
   10.73 +	done
   10.74 +fi
   10.75 +
   10.76 +echo "Local backup for $(hostname) ..."
   10.77 +backup_data
   10.78 +
   10.79 +chown $BACKUP_USER *
   10.80 +chmod 700 *
   10.81 +
   10.82 +[ -n "$REMOTE_USER" ] && for i in $(cd .. ; ls); do
   10.83 +	[ $i == $(hostname) -o $i.slitaz.org == $(hostname) ] && continue
   10.84 +	echo "Get backups from $i ..."
   10.85 +	rsync -aH -e "$SSH" --bwlimit=50 $REMOTE_USER@$i.slitaz.org:/home/backups/$i/. ../$i/.
   10.86 +done
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/mirror-tools/rootfs/usr/bin/mkpkgiso	Thu Feb 24 01:59:21 2011 +0000
    11.3 @@ -0,0 +1,431 @@
    11.4 +#!/bin/sh
    11.5 +# mkpkgiso, build packages ISO image.
    11.6 +# (C) 2007-TODAY SliTaz - GNU General Public License v3.
    11.7 +#
    11.8 +# Authors : Eric Joseph-Alexandre <erjo@slitaz.org>
    11.9 +#	    Pascal Bellard <pascal.bellard@slitaz.org>
   11.10 +
   11.11 +VERSION=0.9
   11.12 +
   11.13 +PKG_VER=$1
   11.14 +ROOT=/home/slitaz/iso
   11.15 +REPOS=/var/www/slitaz/mirror/packages/$PKG_VER
   11.16 +SOURCES=/var/www/slitaz/mirror/sources/packages
   11.17 +IFMEM_C32=/var/www/slitaz/mirror/pxe/ifmem.c32
   11.18 +ISO_DIR=/var/www/slitaz/mirror/iso/$PKG_VER
   11.19 +
   11.20 +[ -s /etc/slitaz/mkpkgiso.conf ] && . /etc/slitaz/mkpkgiso.conf
   11.21 +[ -s ./mkpkgiso.conf ] && . ./mkpkgiso.conf
   11.22 +
   11.23 +SORT_DIR=${ROOT}/_iso.$$
   11.24 +TEMP_DIR=${ROOT}/_iso.$$
   11.25 +SORT_FILE=${ROOT}/_sort.$$
   11.26 +shift
   11.27 +OPTIONS=$@
   11.28 +PKG_DIR=$TEMP_DIR/packages/$PKG_VER
   11.29 +SRC_DIR=$TEMP_DIR/src
   11.30 +LOG=$PWD/$(basename $0).log
   11.31 +
   11.32 +#
   11.33 +VOLUME_ID="packages-${PKG_VER}"
   11.34 +PUBLISHER="SliTaz http://www.slitaz.org/"
   11.35 +IMAGE="packages-${PKG_VER}.iso"
   11.36 +case " $@ " in
   11.37 +*\ --sources\ *)
   11.38 +	IMAGE="sources-${PKG_VER}.iso" ;;
   11.39 +esac
   11.40 +OUTPUT="$ROOT/$IMAGE"
   11.41 +
   11.42 +# Check command line option.
   11.43 +if [ -z $PKG_VER ]; then
   11.44 +	cat <<EOT
   11.45 +Usage: $(basename $0) <Version> 
   11.46 +	[--boot [--auto-install] [--loram-detect]]|--webboot] [--filter]
   11.47 +	[--wok] [--wok-stable] [--website] [--sources] [--dry-run]
   11.48 +       $(basename $0) update-hg <dir>
   11.49 +Example:
   11.50 +$(basename $0) cooking --boot --auto-install --loram-detect --filter --wok --website --sources
   11.51 +EOT
   11.52 +	exit 1
   11.53 +fi
   11.54 +
   11.55 +# Update hg repos
   11.56 +if [ "$PKG_VER" == "update-hg" ]; then
   11.57 +	for i in $1/* ; do
   11.58 +		grep -qs '\[paths]' $i/.hg/hgrc || continue
   11.59 +		cd $i
   11.60 +		hg pull
   11.61 +		hg update
   11.62 +		cd - > /dev/null
   11.63 +	done
   11.64 +	exit 1
   11.65 +fi
   11.66 +
   11.67 +# Check if we provide a valide version
   11.68 +if [ ! -d $REPOS ]; then
   11.69 +	echo "Boooh! $PKG_VER is not a valid version."
   11.70 +	exit 1
   11.71 +fi
   11.72 +
   11.73 +# Status function.
   11.74 +status()
   11.75 +{
   11.76 +	local CHECK=$?
   11.77 +	echo -en "\\033[70G[ "
   11.78 +	if [ $CHECK = 0 ]; then
   11.79 +		echo -en "\\033[1;33mOK"
   11.80 +	else
   11.81 +		echo -en "\\033[1;31mFailed"
   11.82 +	fi
   11.83 +	echo -e "\\033[0;39m ]"
   11.84 +}
   11.85 +
   11.86 +need()
   11.87 +{
   11.88 +	found=1
   11.89 +	for i in $@ ; do
   11.90 +		[ -s $i ] && continue
   11.91 +		echo "Missing: $i "
   11.92 +		found=0
   11.93 +	done
   11.94 +	[ $found -ne 0 ] && return
   11.95 +	status
   11.96 +	rm -rf $TEMP_DIR $SORT_FILE
   11.97 +	exit 1
   11.98 +}
   11.99 +
  11.100 +# Create temp directory
  11.101 +mkdir -p $TEMP_DIR/packages/$PKG_VER
  11.102 +which genisoimage > /dev/null || need /usr/bin/genisoimage
  11.103 +
  11.104 +# Prepare evrything for ISO
  11.105 +
  11.106 +echo ""
  11.107 +echo "Building ISO for packages  $PKG_VER"
  11.108 +echo "==============================================================================="
  11.109 +echo -n "Creating working dir $(basename $TEMP_DIR)"
  11.110 +status 
  11.111 +echo -n "Creating symlink"
  11.112 +status
  11.113 +
  11.114 +# Link every packages to temp dir
  11.115 +cd $PKG_DIR
  11.116 +for i in $REPOS/*
  11.117 +do
  11.118 +	ln -s $i >> $LOG 2>&1
  11.119 +done
  11.120 +
  11.121 +echo -n "Creating install script"
  11.122 +# Create install script as suggested by Pascal.
  11.123 +cat >$TEMP_DIR/install.sh<<EOF
  11.124 +#!/bin/sh
  11.125 +#
  11.126 +
  11.127 +DIR=\$(cd \$(busybox dirname \$0); pwd)
  11.128 +
  11.129 +# Handle --auto-install case
  11.130 +if [ "\$DIR" == "/etc/init.d" ]; then
  11.131 +  DIR=/cdrom
  11.132 +  if [ ! -f /cdrom/install.sh ]; then
  11.133 +    mkdir /cdrom 2> /dev/null
  11.134 +    mount --bind /mnt /cdrom
  11.135 +  fi
  11.136 +  # Handle loram on hybrid hard disk / usb key case
  11.137 +  if [ ! -d /usr/bin ]; then
  11.138 +    echo ""
  11.139 +    if [ -d /.usr.rw ]; then
  11.140 +      echo -n "Mounting /usr read-write... "
  11.141 +      usr=.usr.ro
  11.142 +    else
  11.143 +      echo -n "Mounting /usr read-only... "
  11.144 +      usr=usr
  11.145 +    fi
  11.146 +    FS=\$DIR/usr.cromfs
  11.147 +    if [ -f \$FS ]; then
  11.148 +      /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
  11.149 +    elif [ -f \$DIR/usr.sqfs ]; then
  11.150 +      FS=\$DIR/usr.sqfs
  11.151 +      mount -o loop,ro -t squashfs \$FS /\$usr
  11.152 +    elif [ -L /\$usr ]; then
  11.153 +      FS=\$DIR/usr
  11.154 +    fi
  11.155 +    status
  11.156 +    if [ -d /.usr.rw ]; then
  11.157 +      if [ -x /bin/funionfs ]; then
  11.158 +        /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
  11.159 +      else
  11.160 +        /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
  11.161 +      fi
  11.162 +    fi
  11.163 +  fi
  11.164 +fi
  11.165 +
  11.166 +[ -d /var/cache/tazpkg ] || mkdir -p /var/cache/tazpkg
  11.167 +ls -d \$DIR/packages/* > /var/lib/tazpkg/mirror
  11.168 +ln -fs \$DIR/packages/*/*.tazpkg /var/cache/tazpkg/
  11.169 +ln -fs \$DIR/packages/*/packages.* /var/lib/tazpkg
  11.170 +echo ""
  11.171 +echo "=> all $PKG_VER packages are available for tazpkg/tazpkgbox"
  11.172 +EOF
  11.173 +[ -e files.list.lzma ] && cat >>$TEMP_DIR/install.sh<<EOF
  11.174 +ln -fs \$DIR/packages/*/files.list.lzma /var/lib/tazpkg
  11.175 +EOF
  11.176 +
  11.177 +status
  11.178 +cat > $SORT_FILE <<EOT
  11.179 +$SORT_DIR/install.sh -4000
  11.180 +$SORT_DIR/README -4000
  11.181 +$SORT_DIR/index.html -4000
  11.182 +$SORT_DIR/md5sum -4000
  11.183 +$SORT_DIR/style.css -4000
  11.184 +$SORT_DIR/images/header.png -4000
  11.185 +$SORT_DIR/boot/bzImage 2
  11.186 +$SORT_DIR/boot/rootfs.gz 1
  11.187 +$SORT_DIR/packages -9000
  11.188 +EOT
  11.189 +( cd $ROOT; ls $SORT_DIR/packages/*/packages* $SORT_DIR/packages/*/files.list.lzma ) | \
  11.190 +		awk '{ printf "%s -7000\n",$0 }' >> $SORT_FILE
  11.191 +chmod 755  $TEMP_DIR/install.sh
  11.192 +
  11.193 +case " $OPTIONS " in
  11.194 +*\ --filter\ *)
  11.195 +	SIZE=0
  11.196 +	for i in *.tazpkg; do
  11.197 +		while read f; do
  11.198 +			case "$i" in
  11.199 +			$f*) continue 2;;
  11.200 +			esac
  11.201 +		done < packages.list
  11.202 +		echo -n "Filter out $i ($(du -hs $(readlink $i) | awk '{ print $1 }'))..."
  11.203 +		SIZE=$(( $SIZE + $(stat -c %s $(readlink $i)) ))
  11.204 +		rm $i
  11.205 +		status
  11.206 +	done
  11.207 +	UNIT=" bytes"
  11.208 +	if [ $SIZE -gt 10240 ]; then
  11.209 +		SIZE=$(( $SIZE / 1024 ))
  11.210 +		UNIT="K"
  11.211 +	fi
  11.212 +	if [ $SIZE -gt 10240 ]; then
  11.213 +		SIZE=$(( $SIZE / 1024 ))
  11.214 +		UNIT="M"
  11.215 +	fi
  11.216 +	echo "$SIZE$UNIT removed.";;
  11.217 +esac
  11.218 +
  11.219 +# Copy hg subtree
  11.220 +get_from_hg()
  11.221 +{
  11.222 +echo -n "Adding $2"
  11.223 +if [ -s /home/slitaz/$1/.hg/hgrc ]; then
  11.224 +	cp -a /home/slitaz/$1 $TEMP_DIR
  11.225 +else
  11.226 +	wget -q -O - http://hg.slitaz.org/$1/archive/tip.tar.bz2 | tar xjf - -C $TEMP_DIR
  11.227 +	mv $TEMP_DIR/$1-* $TEMP_DIR/$1
  11.228 +fi
  11.229 +status
  11.230 +echo "$(du -hs $TEMP_DIR/$1 | awk '{ print $1 }') used by $2."
  11.231 +}
  11.232 +
  11.233 +for i in $OPTIONS ; do
  11.234 +case "$i" in
  11.235 +--wok)
  11.236 +	cat >>$TEMP_DIR/install.sh<<EOF
  11.237 +mkdir -p /home/slitaz
  11.238 +ln -s \$DIR/wok /home/slitaz
  11.239 +echo "=> Wok (cooking) is in /home/slitaz/wok"
  11.240 +EOF
  11.241 +	if get_from_hg wok "wok (cooking)"; then
  11.242 +		echo "$SORT_DIR/wok -8000" >> $SORT_FILE
  11.243 +	fi;;
  11.244 +--wok-stable)
  11.245 +	cat >>$TEMP_DIR/install.sh<<EOF
  11.246 +mkdir -p /home/slitaz
  11.247 +ln -s \$DIR/wok /home/slitaz
  11.248 +echo "=> Wok (stable) is in /home/slitaz/wok"
  11.249 +EOF
  11.250 +	if get_from_hg wok-stable "wok (stable)"; then
  11.251 +		mv $TEMP_DIR/wok-stable $TEMP_DIR/wok
  11.252 +		echo "$SORT_DIR/wok -8000" >> $SORT_FILE
  11.253 +	fi;;
  11.254 +--website)
  11.255 +	if get_from_hg website "web site"; then
  11.256 +		echo "$SORT_DIR/website -6000" >> $SORT_FILE
  11.257 +		cat >>$TEMP_DIR/install.sh<<EOF
  11.258 +echo "=> slitaz web site installed in file://\$DIR/website/index.html"
  11.259 +EOF
  11.260 +	fi;;
  11.261 +--sources)
  11.262 +	echo -n "Removing previous ISO..."
  11.263 +	rm -f $OUTPUT
  11.264 +	status
  11.265 +	cat >>$TEMP_DIR/install.sh<<EOF
  11.266 +mkdir -p /home/slitaz
  11.267 +ln -s \$DIR/src /home/slitaz
  11.268 +echo "=> sources are in /home/slitaz/src"
  11.269 +EOF
  11.270 +	mkdir -p $SRC_DIR
  11.271 +	cd $SRC_DIR
  11.272 +	for i in $SOURCES/*/*
  11.273 +	do
  11.274 +		case "$i" in
  11.275 +		*/md5sum) continue;;
  11.276 +		esac
  11.277 +		ln -s $i >> $LOG 2>&1
  11.278 +	done
  11.279 +	find * -not -type d | grep -v md5sum | xargs md5sum > md5sum
  11.280 +	echo "$(du -hs $SOURCES | awk '{ print $1 }') used by sources." ;;
  11.281 +esac
  11.282 +done
  11.283 +
  11.284 +# Extract boot package function
  11.285 +extract_boot()
  11.286 +{
  11.287 +f=$(ls $REPOS/$1-[0-9]*.tazpkg 2> /dev/null)
  11.288 +[ -f "$f" ] || return 1
  11.289 +[ -d $TEMP_DIR/boot ] || mkdir $TEMP_DIR/boot
  11.290 +( cd $TEMP_DIR/boot ; cpio -i fs.cpio.gz < $f 2> /dev/null ) 
  11.291 +( cd $TEMP_DIR/boot ; zcat fs.cpio.gz | cpio -id 2> /dev/null )
  11.292 +mv $TEMP_DIR/boot/fs/boot/* $TEMP_DIR/boot
  11.293 +rm -rf $TEMP_DIR/boot/fs.cpio.gz $TEMP_DIR/boot/fs
  11.294 +return 0
  11.295 +}
  11.296 +
  11.297 +# Gen boot part
  11.298 +BOOT_OPT=""
  11.299 +iso=$ISO_DIR/slitaz-$PKG_VER.iso
  11.300 +for i in slitaz-loram-cdrom-sqfs slitaz-$PKG_VER-loram-cdrom ; do
  11.301 +	isoloram=$ISO_DIR/flavors/$i.iso
  11.302 +	[ -s $isoloram ] && break
  11.303 +done
  11.304 +case " $OPTIONS " in
  11.305 +*\ --boot\ *)
  11.306 +	echo -n "Creating boot tree"
  11.307 +	need $iso
  11.308 +	which isoinfo > /dev/null || need /usr/bin/isoinfo
  11.309 +	isoinfo -R -l -i $iso | awk '/^Directory/ { path=$4 } /^-/ { print path$12  }' | while read file; do
  11.310 +		[ "$(basename $file)" == ".." ] && continue
  11.311 +		[ "$file" = "/boot/isolinux/boot.cat" ] && continue
  11.312 +		[ -d "$(dirname $TEMP_DIR/$file)" ] ||
  11.313 +			mkdir -p "$(dirname $TEMP_DIR/$file)"
  11.314 +		isoinfo -R -x "$file" -i $iso > "$TEMP_DIR/$file"
  11.315 +	done
  11.316 +	if [ -f "$(echo $TEMP_DIR/boot/vmlinuz*)" ]; then
  11.317 +		rm -f $TEMP_DIR/boot/bzImage
  11.318 +		ln $TEMP_DIR/boot/vmlinuz* $TEMP_DIR/boot/bzImage
  11.319 +	fi
  11.320 +	status
  11.321 +	BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \
  11.322 +-c boot/isolinux/boot.cat  -no-emul-boot -boot-load-size 4 -boot-info-table"
  11.323 +	case " $OPTIONS " in
  11.324 +	*\ --auto-install\ *)
  11.325 +		echo -n "Enable auto install"
  11.326 +		sed -i "s/rw root/rw config=LABEL=packages-$PKG_VER,install.sh root/" \
  11.327 +			$TEMP_DIR/boot/isolinux/*.cfg
  11.328 +		status
  11.329 +		;;
  11.330 +	esac
  11.331 +	case " $OPTIONS " in
  11.332 +	*\ --loram-detect\ *)
  11.333 +		echo -n "Enable loram autodetection"
  11.334 +		need $IFMEM_C32 $isoloram
  11.335 +		which isoinfo > /dev/null || need /usr/bin/isoinfo
  11.336 +		cp $IFMEM_C32 "$TEMP_DIR/boot/isolinux"
  11.337 +		isoinfo -R -x "/usr.sqfs" -i $isoloram \
  11.338 +			> "$TEMP_DIR/usr.sqfs" 2> /dev/null
  11.339 +		if [ -s "$TEMP_DIR/usr.sqfs" ]; then
  11.340 +			echo "$SORT_DIR/usr.sqfs -5000" >> $SORT_FILE
  11.341 +		else
  11.342 +			rm -f "$TEMP_DIR/usr.sqfs"
  11.343 +			isoinfo -R -x "/rootfs.gz" -i $isoloram \
  11.344 +				> "$TEMP_DIR/rootfs.gz" 2> /dev/null
  11.345 +			echo "$SORT_DIR/rootfs.gz -5000" >> $SORT_FILE
  11.346 +		fi
  11.347 +		isoinfo -R -x "/boot/rootfs.gz" -i $isoloram > \
  11.348 +			"$TEMP_DIR/boot/loram.gz"
  11.349 +		cat >> $TEMP_DIR/boot/isolinux/common.cfg <<EOT
  11.350 +label noram
  11.351 +        config noram.cfg
  11.352 +EOT
  11.353 +		cat >> $TEMP_DIR/boot/isolinux/noram.cfg <<EOT
  11.354 +display isolinux.msg
  11.355 +say Not enough RAM to boot slitaz.
  11.356 +default reboot
  11.357 +label reboot
  11.358 +        com32 reboot.c32
  11.359 +
  11.360 +implicit 0
  11.361 +prompt 1
  11.362 +timeout 80
  11.363 +F1 help.txt
  11.364 +F2 options.txt
  11.365 +F3 isolinux.msg
  11.366 +F4 display.txt
  11.367 +F5 enhelp.txt
  11.368 +F6 enopts.txt
  11.369 +EOT
  11.370 +		sed -i -e 's|kernel /boot/bzImage|kernel /boot/isolinux/ifmem.c32\n\tappend 160768 core 29696 loram noram\n|' \
  11.371 +			-e "s|\\(.*/\\)rootfs\\(.gz .*\\)\$|label core\\n\\tkernel /boot/bzImage\\n\\1rootfs\\2\\n\\nlabel loram\\n\\tkernel /boot/bzImage\\n\\1loram\\2 loram=LABEL=packages-$PKG_VER,|" \
  11.372 +			$TEMP_DIR/boot/isolinux/*.cfg
  11.373 +		status
  11.374 +		;;
  11.375 +	esac
  11.376 +	echo "$SORT_DIR/boot 0" >> $SORT_FILE
  11.377 +	;;
  11.378 +*\ --webboot\ *)
  11.379 +	if extract_boot gpxe; then
  11.380 +	echo -n "Creating web boot tree"
  11.381 +	which isoinfo > /dev/null || need /usr/bin/isoinfo
  11.382 +	mkdir $TEMP_DIR/boot/isolinux/
  11.383 +	isoinfo -R -x "/boot/isolinux/isolinux.bin" -i $iso > \
  11.384 +		$TEMP_DIR/boot/isolinux/isolinux.bin
  11.385 +	mv $TEMP_DIR/boot/gpxe $TEMP_DIR/boot/isolinux
  11.386 +	echo "$SORT_DIR/boot 0" >> $SORT_FILE
  11.387 +	cat > $TEMP_DIR/boot/isolinux/isolinux.cfg <<EOT
  11.388 +default gpxe
  11.389 +append http://mirror.slitaz.org/pxe/pxelinux.0
  11.390 +EOT
  11.391 +	status
  11.392 +	BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \
  11.393 +-c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
  11.394 +	fi
  11.395 +	;;
  11.396 +esac
  11.397 +
  11.398 +if [ -n "$BOOT_OPT" ]; then
  11.399 +	echo "$(du -chs $TEMP_DIR/boot $TEMP_DIR/usr.sqfs 2> /dev/null | \
  11.400 +		    awk 'END { print $1 }') used by boot."
  11.401 +fi
  11.402 +
  11.403 +case " $OPTIONS " in
  11.404 +*\ --dry-run\ *)
  11.405 +	echo "Please check and remove $TEMP_DIR and $SORT_FILE"
  11.406 +	exit
  11.407 +	;;
  11.408 +esac
  11.409 +# Gen ISO
  11.410 +echo -n "Generating iso image"
  11.411 +genisoimage -R -J -f -V $VOLUME_ID \
  11.412 + -P "$PUBLISHER" -md5-list $REPOS/packages.md5 \
  11.413 + -quiet -o $OUTPUT $BOOT_OPT $TEMP_DIR
  11.414 +status 
  11.415 +
  11.416 +echo "$(du -hs $OUTPUT | awk '{ print $1 }') used by iso image."
  11.417 +
  11.418 +cd ${ROOT}
  11.419 +echo -n "Create hybrid DVD/CDROM"
  11.420 +which isohybrid > /dev/null && isohybrid $IMAGE 2> /dev/null
  11.421 +status
  11.422 +
  11.423 +echo -n "Calculate md5sum"
  11.424 +md5sum $IMAGE > $(basename $IMAGE .iso).md5
  11.425 +status
  11.426 +
  11.427 +echo -n "Moving file to mirror"
  11.428 +mv $IMAGE $ISO_DIR
  11.429 +mv $(basename $IMAGE .iso).md5 $ISO_DIR
  11.430 +status
  11.431 +
  11.432 +# Cleaning temp files
  11.433 +rm -rf $TEMP_DIR $SORT_FILE
  11.434 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/mirror-tools/rootfs/usr/share/mirror-host/boot/lguest-disk	Thu Feb 24 01:59:21 2011 +0000
    12.3 @@ -0,0 +1,58 @@
    12.4 +#!/bin/sh
    12.5 +
    12.6 +usage()
    12.7 +{
    12.8 +	cat << EOT
    12.9 +resize2fs
   12.10 +usage: 
   12.11 +$0 grow <guest> <size>[MG]
   12.12 +$0 fixmbr <guest>
   12.13 +EOT
   12.14 +	exit 1
   12.15 +}
   12.16 +
   12.17 +grow()
   12.18 +{
   12.19 +	case "$2" in
   12.20 +	*M)	dd if=/dev/zero bs=1M count=${2%M} >> /boot/guests/$1 ;;
   12.21 +	*G)	dd if=/dev/zero bs=1G count=${2%G} >> /boot/guests/$1 ;;
   12.22 +	esac
   12.23 +}
   12.24 +
   12.25 +# write a 32 bits data
   12.26 +# usage: storelong offset data32 file
   12.27 +storelong()
   12.28 +{
   12.29 +	echo $2 | awk '{ printf "%c%c%c%c",
   12.30 +	  $1%256,($1/256)%256,($1/256/256)%256,($1/256/256/256)%256 }' | \
   12.31 +	dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null
   12.32 +}
   12.33 +
   12.34 +# read a 32 bits data
   12.35 +# usage: getlong offset file
   12.36 +getlong()
   12.37 +{
   12.38 +	dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
   12.39 +		hexdump -e '"" 1/4 "%d" "\n"'
   12.40 +}
   12.41 +
   12.42 +fixmbr()
   12.43 +{
   12.44 +	if [ $(getlong 0x1ea $1) -ne 0 -a $(getlong 0x1fa $1) -ne 0 ]; then
   12.45 +		echo "Parttion 3 & 4 non empty. Abort"
   12.46 +		exit 1
   12.47 +	fi
   12.48 +	if [ $(getlong 0x1da $1) -eq 0 ]; then
   12.49 +		echo "Parttion 2 empty. Abort"
   12.50 +		exit 1
   12.51 +	fi
   12.52 +	size=$(stat -c %s $1)
   12.53 +	new=$(( $size/512 - 32 - $(getlong 0x1ca $1) ))
   12.54 +	storelong 0x1da $new $1
   12.55 +}
   12.56 +
   12.57 +case "$1" in
   12.58 +grow)	shift; grow $@ ; fixmbr $1 ;;
   12.59 +fixmbr) shift; fixmbr $1 ;;
   12.60 +*)	usage ;;
   12.61 +esac
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/mirror-tools/rootfs/usr/share/mirror-host/boot/lguest-slitaz	Thu Feb 24 01:59:21 2011 +0000
    13.3 @@ -0,0 +1,21 @@
    13.4 +#!/bin/sh
    13.5 +
    13.6 +tty=tty; [ -n "$1" ] && tty=$1
    13.7 +export TERM=$tty
    13.8 +shift
    13.9 +
   13.10 +rootfs="--initrd=/boot/rootfs-lguest.gz"
   13.11 +[ -n "$1" ] && rootfs="--block=$1 root=/dev/vda2"
   13.12 +shift
   13.13 +
   13.14 +net="--tunnet=192.168.0.1"
   13.15 +case "$1" in
   13.16 +192*) net="--tunnet=$1"; shift;;
   13.17 +esac
   13.18 +
   13.19 +args="screen=text lang=fr_FR kmap=fr-latin1 sound=noconf"
   13.20 +[ -n "$1" ] && args=$@
   13.21 +
   13.22 +/sbin/modprobe lg
   13.23 +/usr/bin/lguest 512 /boot/vmlinuz-2.6.25.5-lguest \
   13.24 +	$net $rootfs $args > /dev/$tty < /dev/$tty 2>&1
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/mirror-tools/rootfs/usr/share/mirror-host/boot/shellinabox.sh	Thu Feb 24 01:59:21 2011 +0000
    14.3 @@ -0,0 +1,107 @@
    14.4 +#!/bin/sh
    14.5 +
    14.6 +services="/ /reset /reboot /ssh"
    14.7 +
    14.8 +mkexe()
    14.9 +{
   14.10 +exe=$0
   14.11 +while true; do
   14.12 +	cd $(dirname $exe)
   14.13 +	exe=$(basename $exe)
   14.14 +	[ -L $exe ] || break
   14.15 +	exe=$(readlink $exe)
   14.16 +done
   14.17 +echo $(pwd)/$exe
   14.18 +}
   14.19 +exe=$(mkexe)
   14.20 +
   14.21 +services_arg()
   14.22 +{
   14.23 +for i in $services ; do
   14.24 +	echo -n "-s '$i:root:root:/tmp:LINES=25 /bin/sh -c \"$exe service $i "
   14.25 +	echo -n "\${peer} \${url} \${columns} \${lines}\"' "
   14.26 +done
   14.27 +}
   14.28 +
   14.29 +launch_ssh()
   14.30 +{
   14.31 +	# Get SSH server
   14.32 +	server=""
   14.33 +	echo -n "SSH server: "
   14.34 +	read -t 300 server || exit 1
   14.35 +	[ -n "$server" ] || exit 1
   14.36 +
   14.37 +	# Allow non default SSH port with format server:port
   14.38 +	sshport=""
   14.39 +	case "$server" in
   14.40 +	*:*)	sshport="-p ${server#*:}"
   14.41 +		server=${server%:*};;
   14.42 +	esac
   14.43 +
   14.44 +	# heading ! in server name means open remote ssh port with a knock sequence
   14.45 +	if [ -x /usr/bin/knock ]; then
   14.46 +		case "$server" in
   14.47 +		!*)	server=${server#*!}
   14.48 +			echo -n "Knock sequence (port[:proto]...): "
   14.49 +			read -t 30 sequence && knock ${server#*@} $sequence
   14.50 +		esac
   14.51 +	fi
   14.52 +
   14.53 +	# Get SSH user if missing
   14.54 +	case "$server" in
   14.55 +	*@*)	;;
   14.56 +	*)	echo -n "$server login: "
   14.57 +		read -t 30 user || exit 1
   14.58 +		server="$user@$server";;
   14.59 +	esac
   14.60 +
   14.61 +	# Launch OpenSSH or Dropbear
   14.62 +	sshargs="-oPreferredAuthentications=keyboard-interactive,password -oNoHostAuthenticationForLocalhost=yes -oLogLevel=FATAL -F/dev/null";
   14.63 +	[ -L /usr/bin/ssh ] && sshargs=""
   14.64 +	exec ssh $sshport $sshargs $server
   14.65 +}
   14.66 +
   14.67 +auth()
   14.68 +{
   14.69 +	while read host md5 ; do
   14.70 +		[ "${host#*.}" == "${1#*.}" ] && break
   14.71 +	done < $(dirname $exe)/shellinabox.secrets
   14.72 +	echo -n "$host password: "
   14.73 +	read -s -t 30 password || exit 1
   14.74 +	[ "$(echo $password | md5sum)" == "$md5  -" ] || exit 1
   14.75 +	echo ""
   14.76 +}
   14.77 +
   14.78 +pidfile=/var/run/shellinaboxd.pid
   14.79 +case "$1" in
   14.80 +service)
   14.81 +	host=$(echo $4 | sed 's/.*\/\/\(.*\):.*/\1/')
   14.82 +	tty=$(awk "/$host/ { print \$2 }" /etc/inittab)
   14.83 +	vm=$(awk "/$host/ { print \$3 }" /etc/inittab)
   14.84 +	[ -n "$vm" ] || exit 1
   14.85 +	case "$2" in
   14.86 +	/)
   14.87 +		auth $host
   14.88 +		exec /usr/bin/conspy ${tty#tty} ;;
   14.89 +	/reboot)
   14.90 +		auth $host
   14.91 +		echo -n "Sure to reboot $host now (YES or NO) ?"
   14.92 +		read -t 30 answer || exit 1
   14.93 +		case "$answer" in
   14.94 +		YES*) ;;
   14.95 +		*) exit 1;;
   14.96 +		esac
   14.97 +		exec /bin/kill $(ps ww | grep $vm | awk '/lguest/ { printf "%s ",$1 }') ;;
   14.98 +	/ssh)
   14.99 +		auth $host
  14.100 +		launch_ssh ;;
  14.101 +	esac
  14.102 +	;;
  14.103 +start)
  14.104 +	dir=$(dirname $exe)
  14.105 +	eval shellinaboxd --background=$pidfile --cert=/boot/cert $(services_arg)
  14.106 +	;;
  14.107 +stop)
  14.108 +	[ -s $pidfile ] && kill $(cat $pidfile)
  14.109 +	;;
  14.110 +esac
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/mirror-tools/rootfs/usr/share/mirror-host/etc/apache/conf.d/slitaz	Thu Feb 24 01:59:21 2011 +0000
    15.3 @@ -0,0 +1,16 @@
    15.4 +<VirtualHost *:80>
    15.5 +	ServerName      mirror.slitaz.org
    15.6 +	ServerAlias	*.slitaz.org
    15.7 +	<IfModule mod_proxy.c>
    15.8 +		ProxyPreserveHost On
    15.9 +		ProxyRequests Off
   15.10 +		ProxyTimeout 600
   15.11 +		<Proxy *>
   15.12 +			Order deny,allow
   15.13 +			Allow from all
   15.14 +		</Proxy>
   15.15 +		ProxyPass / http://192.168.0.6/
   15.16 +		ProxyPassReverse / http://192.168.0.6/
   15.17 +	</IfModule>
   15.18 +</VirtualHost>
   15.19 +
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/mirror-tools/rootfs/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl	Thu Feb 24 01:59:21 2011 +0000
    16.3 @@ -0,0 +1,20 @@
    16.4 +<VirtualHost *:443>
    16.5 +	SSLProxyEngine On
    16.6 +	SSLEngine On
    16.7 +	ServerName      mirror.slitaz.org:443
    16.8 +	ServerAlias	*.slitaz.org
    16.9 +	SSLCertificateFile /etc/ssl/apache/slitaz.org.pem
   16.10 +	SSLCertificateKeyFile /etc/ssl/apache/slitaz.org.pem
   16.11 +	<IfModule mod_proxy.c>
   16.12 +		ProxyPreserveHost On
   16.13 +		ProxyRequests Off
   16.14 +		ProxyTimeout 600
   16.15 +		<Proxy *>
   16.16 +			Order deny,allow
   16.17 +			Allow from all
   16.18 +		</Proxy>
   16.19 +		ProxyPass / http://192.168.0.6/
   16.20 +		ProxyPassReverse / http://192.168.0.6/
   16.21 +	</IfModule>
   16.22 +</VirtualHost>
   16.23 +
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/mirror-tools/rootfs/usr/share/mirror-host/etc/init.d/shellinabox	Thu Feb 24 01:59:21 2011 +0000
    17.3 @@ -0,0 +1,1 @@
    17.4 +/boot/shellinabox.sh/pics/rrd/cpu-year.pnggngg
    17.5 \ No newline at end of file
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/mirror-tools/rootfs/usr/share/mirror-host/install	Thu Feb 24 01:59:21 2011 +0000
    18.3 @@ -0,0 +1,25 @@
    18.4 +#!/bin/sh
    18.5 +
    18.6 +grep -qs lguest-slitaz /etc/inittab || {
    18.7 +sed -i 's|^tty1::|tty16::respawn:/boot/lguest-slitaz tty16 /boot/guests/mirror.slitaz.org 192.168.0.1\n&|' /etc/inittab
    18.8 +cat >> /etc/init.d/local.sh <<EOT
    18.9 +. /etc/network.conf
   18.10 +iptables -t nat -A POSTROUTING -o $INTERFACE -j MASQUERADE
   18.11 +for port in 22 873 ; do
   18.12 +	iptables -t nat -A PREROUTING -i $INTERFACE --dport $port \
   18.13 +			-j DNAT --to-destination 192.168.0.6:$port
   18.14 +done
   18.15 +for port in 80 443 ; do
   18.16 +	iptables -A INPUT -p tcp -m tcp --dport $port -j ACCEPT
   18.17 +done
   18.18 +for iface in tap+ ; do
   18.19 +	iptables -A INPUT  -i $iface -j ACCEPT
   18.20 +	iptables -A OUTPUT -o $iface -j ACCEPT
   18.21 +	iptables -A FORWARD -i $iface -m state \
   18.22 +			--state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT
   18.23 +	iptables -A FORWARD -o $iface -m state \
   18.24 +			--state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT
   18.25 +done
   18.26 +echo "1" > /proc/sys/net/ipv4/ip_forward
   18.27 +EOT
   18.28 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/mirror-tools/rootfs/usr/share/rrd/makegraphs	Thu Feb 24 01:59:21 2011 +0000
    19.3 @@ -0,0 +1,299 @@
    19.4 +#!/bin/sh
    19.5 +#*/5  * * * * /usr/share/rrd/makegraphs >/dev/null
    19.6 +
    19.7 +# RRD database directory
    19.8 +rrdlog="/var/spool/rrd"
    19.9 +
   19.10 +# Images directory
   19.11 +rrdgraph="/var/spool/rrd"
   19.12 +
   19.13 +# Colors
   19.14 +#rrdcolors="--color SHADEA#EAE9EE --color SHADEB#EAE9EE --color BACK#EAE9EE" 
   19.15 +rrdcolors="--color SHADEA#FFFFFF --color SHADEB#FFFFFF --color BACK#FFFFFF" 
   19.16 +rrdgraphargs="-aPNG -i -z --alt-y-grid -w 600 -h 100 -r $rrdcolors"
   19.17 +
   19.18 +[ -d $rrdlog ] || mkdir -p $rrdlog
   19.19 +[ -d $rrdgraph ] || mkdir -p $rrdgraph
   19.20 +
   19.21 +updatecpudata() {
   19.22 +	[ -e "$rrdlog/cpu.rrd" ] || rrdtool create $rrdlog/cpu.rrd --step=300 \
   19.23 +			DS:user:COUNTER:600:0:500000000 \
   19.24 +			DS:system:COUNTER:600:0:500000000 \
   19.25 +			DS:idle:COUNTER:600:0:500000000 \
   19.26 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
   19.27 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
   19.28 +	grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do
   19.29 +		rrdtool update $rrdlog/cpu.rrd -t user:system:idle \
   19.30 +			N:$(( $user + $nice )):$system:$idle
   19.31 +		break
   19.32 +	done
   19.33 +
   19.34 +	[ -e "$rrdlog/cpu2.rrd" ] &&
   19.35 +	grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do
   19.36 +		rrdtool update $rrdlog/cpu2.rrd -t nice:user:system:idle \
   19.37 +			N:$nice:$user:$system:$idle
   19.38 +		break
   19.39 +	done
   19.40 +}
   19.41 +
   19.42 +updatecpugraph() {
   19.43 +	period=$1
   19.44 +	info="$(grep '^model name' /proc/cpuinfo | cut -d: -f2 | head -1)"
   19.45 +	rrdtool graph "$rrdgraph/cpu-$period.png" --start -1$period \
   19.46 +		$rrdgraphargs -l 0 -u 100 -t "cpu usage per $period [$info ]" \
   19.47 +		DEF:user=$rrdlog/cpu.rrd:user:AVERAGE \
   19.48 +		DEF:system=$rrdlog/cpu.rrd:system:AVERAGE \
   19.49 +		DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE \
   19.50 +		'CDEF:total=user,system,idle,+,+' \
   19.51 +		'CDEF:userpct=100,user,total,/,*' \
   19.52 +		'CDEF:systempct=100,system,total,/,*' \
   19.53 +		'CDEF:idlepct=100,idle,total,/,*' \
   19.54 +		'AREA:userpct#0000FF:user cpu usage' \
   19.55 +		'STACK:systempct#FF0000:system cpu usage' \
   19.56 +		'STACK:idlepct#00FF00:idle cpu usage\j'
   19.57 +}
   19.58 +
   19.59 +
   19.60 +updatememgraph() {
   19.61 +	period=$1
   19.62 +	info="$(free | awk '\
   19.63 +{ \
   19.64 +  if (/Mem:/) { \
   19.65 +	if ($2 < 10000) printf "%d KB",$2; \
   19.66 +	else if ($2 < 10000000) printf "%d MB",$2/1024; \
   19.67 +	else printf "%d GB",$2/1024/1024; \
   19.68 +  } \
   19.69 +}')"
   19.70 +	info2="$(free | awk '\
   19.71 +{ \
   19.72 +  if (/Swap:/) { \
   19.73 +	if ($2 < 10000) printf "%d KB",$2; \
   19.74 +	else if ($2 < 10000000) printf "%d MB",$2/1024; \
   19.75 +	else printf "%d GB",$2/1024/1024; \
   19.76 +  } \
   19.77 +}')"
   19.78 +	rrdtool graph "$rrdgraph/memory-$period.png" --start -1$period \
   19.79 +		$rrdgraphargs -l 0 -u 100 \
   19.80 +		-t "memory usage per $period [ $info + $info2 swap ]" \
   19.81 +		DEF:used=$rrdlog/mem.rrd:memused:AVERAGE \
   19.82 +		DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE \
   19.83 +		DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE \
   19.84 +		DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE \
   19.85 +		DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE \
   19.86 +		DEF:swused=$rrdlog/mem.rrd:swapused:AVERAGE \
   19.87 +		DEF:swfree=$rrdlog/mem.rrd:swapfree:AVERAGE \
   19.88 +		'CDEF:total=used,free,+' \
   19.89 +		'CDEF:used2=used,buffer,cache,shared,+,+,-' \
   19.90 +		'CDEF:usedpct=100,used2,total,/,*' \
   19.91 +		'CDEF:sharedpct=100,shared,total,/,*' \
   19.92 +		'CDEF:bufferpct=100,buffer,total,/,*' \
   19.93 +		'CDEF:cachepct=100,cache,total,/,*' \
   19.94 +		'CDEF:freepct=100,free,total,/,*' \
   19.95 +		'CDEF:swtotal=swused,swfree,+' \
   19.96 +		'CDEF:swusedpct=100,swused,swtotal,/,*' \
   19.97 +		'AREA:usedpct#0000FF:used memory' \
   19.98 +		'STACK:sharedpct#FF7F00:shared memory' \
   19.99 +		'STACK:bufferpct#FF00FF:buffered memory' \
  19.100 +		'STACK:cachepct#FFFF00:cached memory' \
  19.101 +		'STACK:freepct#00FF00:free memory' \
  19.102 +		'LINE2:swusedpct#FF0000:used swap\j'
  19.103 +}
  19.104 +
  19.105 +updatememdata () {
  19.106 +	[ -e "$rrdlog/mem.rrd" ] ||
  19.107 +		rrdtool create "$rrdlog/mem.rrd" --step=300 \
  19.108 +			DS:memused:ABSOLUTE:600:0:5000000000 \
  19.109 +			DS:memfree:ABSOLUTE:600:0:5000000000 \
  19.110 +			DS:memshared:ABSOLUTE:600:0:5000000000 \
  19.111 +			DS:membuffers:ABSOLUTE:600:0:5000000000 \
  19.112 +			DS:memcache:ABSOLUTE:600:0:5000000000 \
  19.113 +			DS:swapused:ABSOLUTE:600:0:5000000000 \
  19.114 +			DS:swapfree:ABSOLUTE:600:0:5000000000 \
  19.115 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  19.116 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  19.117 +
  19.118 +	while read tag count unit; do
  19.119 +		case "$tag" in
  19.120 +		MemTotal:)  memtotal=$(($count * 1024));;
  19.121 +		MemFree:)   memfree=$(($count * 1024))
  19.122 +			    memused=$(($memtotal - $memfree))
  19.123 +			    memshared=0;;
  19.124 +		MemShared:) memshared=$(($count * 1024));;
  19.125 +		Buffers:)   membuffers=$(($count * 1024));;
  19.126 +		Cached:)    memcache=$(($count * 1024));;
  19.127 +		SwapTotal:) swaptotal=$(($count * 1024));;
  19.128 +		SwapFree:)  swapfree=$(($count * 1024))
  19.129 +			    swapused=$(( $swaptotal - $swapfree));;
  19.130 +		esac
  19.131 +	done < /proc/meminfo
  19.132 +
  19.133 +	rrdtool update "$rrdlog/mem.rrd" \
  19.134 +		-t memused:memfree:memshared:membuffers:memcache:swapused:swapfree \
  19.135 +		"N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree"
  19.136 +}
  19.137 +
  19.138 +getmax() {
  19.139 +	rrdtool fetch $rrdlog/$1.rrd AVERAGE | awk '\
  19.140 +BEGIN {max=0} \
  19.141 +/^[0-9]/ { \
  19.142 +   if ($2 != "nan" && $2 > max) max=$2; \
  19.143 +   if ($3 != "nan" && $3 > max) max=$3; \
  19.144 +} \
  19.145 +END { print max }' | sed 's/,/./'
  19.146 +}
  19.147 +
  19.148 +updatediskgraph() {
  19.149 +	period=$1
  19.150 +	[ "$period" == "day" ] && maxdisk="$(getmax disk)"
  19.151 +	info=""
  19.152 +	[ -r $2 ] &&
  19.153 +	info="[ $(fdisk -l | grep "^Disk $2:" | \
  19.154 +		  sed "s|Disk $2: \(.*\), .*|\1|") ]"
  19.155 +	rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \
  19.156 +		$rrdgraphargs -t "disk access per $period $info" \
  19.157 +		--logarithmic --lower-limit 1 -v "Sectors/second" --units=si \
  19.158 +		DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \
  19.159 +		DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \
  19.160 +		DEF:req=$rrdlog/iodisk.rrd:req:AVERAGE \
  19.161 +		DEF:done=$rrdlog/iodisk.rrd:done:AVERAGE \
  19.162 +		DEF:err=$rrdlog/iodisk.rrd:err:AVERAGE \
  19.163 +		"CDEF:readpct=100,read,$maxdisk,/,*" \
  19.164 +		"CDEF:writepct=100,write,$maxdisk,/,*" \
  19.165 +		"CDEF:errpct=100,err,req,/,*" \
  19.166 +		"CDEF:donepct=100,done,req,/,*" \
  19.167 +		'AREA:readpct#0000FF:sectors read from disk' \
  19.168 +		'STACK:writepct#00FF00:sectors written to disk' \
  19.169 +		'LINE2:donepct#FFFF00:I/O complete' \
  19.170 +		'LINE2:errpct#FF0000:I/O error\j'
  19.171 +}
  19.172 +
  19.173 +updatediskdata() {
  19.174 +	dev=$1
  19.175 +	[ -e "$rrdlog/disk.rrd" ] ||
  19.176 +		rrdtool create "$rrdlog/disk.rrd" --step=300 \
  19.177 +			DS:readsect:COUNTER:600:0:5000000000 \
  19.178 +			DS:writesect:COUNTER:600:0:5000000000 \
  19.179 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  19.180 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  19.181 +	[ -e "$rrdlog/iodisk.rrd" ] ||
  19.182 +		rrdtool create "$rrdlog/iodisk.rrd" --step=300 \
  19.183 +			DS:done:GAUGE:600:0:U  DS:err:GAUGE:600:0:U \
  19.184 +			DS:req:GAUGE:600:0:U \
  19.185 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  19.186 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  19.187 +
  19.188 +	while read major minor name readreq readsect writereq writesect misc; do
  19.189 +		[ $major = $(( 0x$(stat -c %t $dev) )) ] || continue
  19.190 +		[ $minor = $(( 0x$(stat -c %T $dev) )) ] || continue
  19.191 +		rrdtool update "$rrdlog/disk.rrd" -t readsect:writesect \
  19.192 +			N:$readsect:$writesect
  19.193 +	done < /proc/diskstats
  19.194 +	dir=/sys/block/${dev#/dev/}/device
  19.195 +	done=$(printf "%d\n" $(cat $dir/iodone_cnt 2> /dev/null) )
  19.196 +	err=$(printf "%d\n" $(cat $dir/ioerr_cnt 2> /dev/null) )
  19.197 +	req=$(printf "%d\n" $(cat $dir/iorequest_cnt 2> /dev/null) )
  19.198 +	rrdtool update "$rrdlog/iodisk.rrd" -t done:err:req N:$done:$err:$req
  19.199 +}
  19.200 +
  19.201 +updateifgraph() {
  19.202 +	interface=$1
  19.203 +	period=$2
  19.204 +	[ "$period" == "day" ] && maxif="$(getmax $interface)"
  19.205 +	rrdtool graph "$rrdgraph/$interface-$period.png" --start -1$period \
  19.206 +		$rrdgraphargs -t "traffic on $interface graph per $period" \
  19.207 +		--logarithmic -A -v "Bytes/second" --units=si \
  19.208 +		DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE \
  19.209 +		DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE \
  19.210 +		"CDEF:inpct=100,incoming,$maxif,/,*" \
  19.211 +		"CDEF:outpct=100,outgoing,$maxif,/,*" \
  19.212 +		'AREA:inpct#00FF00:incoming traffic' \
  19.213 +		'LINE1:outpct#0000FF:outgoing traffic\j'
  19.214 +}
  19.215 +
  19.216 +netframes() {
  19.217 +ifconfig $1 | grep "$2 packets" | sed -re "s/.*$3:([0-9]+).*/\1/g"
  19.218 +}
  19.219 +
  19.220 +netstats() {
  19.221 +ifconfig $1 | grep bytes | sed -re "s/.*$2 bytes:([0-9]+).*/\1/g"
  19.222 +}
  19.223 +
  19.224 +updateifdata() {
  19.225 +	interface=$1
  19.226 +	[ -e "$rrdlog/$interface.rrd" ] ||
  19.227 +		rrdtool create "$rrdlog/$interface.rrd" --step=300 \
  19.228 +			DS:incoming:COUNTER:600:0:U \
  19.229 +			DS:outgoing:COUNTER:600:0:U \
  19.230 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  19.231 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  19.232 +	[ -e "$rrdlog/packets-$interface.rrd" ] ||
  19.233 +		rrdtool create "$rrdlog/packets-$interface.rrd" --step=300 \
  19.234 +			DS:in:COUNTER:600:0:U      DS:out:COUNTER:600:0:U \
  19.235 +			DS:inerr:COUNTER:600:0:U   DS:outerr:COUNTER:600:0:U \
  19.236 +			DS:indrop:COUNTER:600:0:U  DS:outdrop:COUNTER:600:0:U \
  19.237 +			DS:inov:COUNTER:600:0:U    DS:outov:COUNTER:600:0:U \
  19.238 +			DS:frame:COUNTER:600:0:U   DS:carrier:COUNTER:600:0:U \
  19.239 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  19.240 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  19.241 +	rx=$(netstats $interface RX)
  19.242 +	tx=$(netstats $interface TX)
  19.243 +	rrdtool update "$rrdlog/$interface.rrd" -t incoming:outgoing \
  19.244 +		N:${rx:-U}:${tx:-U}
  19.245 +	rx=$(netframes $interface RX packets)
  19.246 +	tx=$(netframes $interface TX packets)
  19.247 +	rxerr=$(netframes $interface RX errors)
  19.248 +	txerr=$(netframes $interface TX errors)
  19.249 +	rxdrop=$(netframes $interface RX dropped)
  19.250 +	txdrop=$(netframes $interface TX dropped)
  19.251 +	rxov=$(netframes $interface RX overruns)
  19.252 +	txov=$(netframes $interface TX overruns)
  19.253 +	frame=$(netframes $interface RX frame)
  19.254 +	carrier=$(netframes $interface TX carrier)
  19.255 +	rrdtool update "$rrdlog/packets-$interface.rrd" \
  19.256 +		-t in:out:inerr:outerr:indrop:outdrop:inov:outov:frame:carrier \
  19.257 +		N:${rx:-U}:${tx:-U}:${rxerr:-U}:${txerr:-U}:${rxdrop:-U}:${txdrop:-U}:${rxov:-U}:${txov:-U}:${frame:-U}:${carrier:-U}
  19.258 +}
  19.259 +
  19.260 +getdisk()
  19.261 +{
  19.262 +	local d
  19.263 +	local i
  19.264 +	d=$(stat -c %D $1)
  19.265 +	for i in /dev/* ; do 
  19.266 +		[ $(stat -c "%02t%02T" $i) == $d ] || continue
  19.267 +		echo $i
  19.268 +		break
  19.269 +	done
  19.270 +}
  19.271 +
  19.272 +###
  19.273 +### System graphs
  19.274 +###
  19.275 +
  19.276 +updatecpudata
  19.277 +updatecpugraph day
  19.278 +updatecpugraph week
  19.279 +updatecpugraph month
  19.280 +updatecpugraph year
  19.281 +
  19.282 +updatememdata
  19.283 +updatememgraph day
  19.284 +updatememgraph week
  19.285 +updatememgraph month
  19.286 +updatememgraph year
  19.287 +
  19.288 +if [ -e /proc/diskstats ]; then
  19.289 +	disk=$(getdisk $0)
  19.290 +	updatediskdata $disk
  19.291 +	updatediskgraph day ${disk:0:8}
  19.292 +	updatediskgraph week ${disk:0:8}
  19.293 +	updatediskgraph month ${disk:0:8}
  19.294 +	updatediskgraph year ${disk:0:8}
  19.295 +fi
  19.296 +
  19.297 +iface=$(/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }')
  19.298 +updateifdata $iface
  19.299 +updateifgraph $iface day
  19.300 +updateifgraph $iface week
  19.301 +updateifgraph $iface month
  19.302 +updateifgraph $iface year
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/mirror-tools/rootfs/usr/share/slitaz-live/INSTALL	Thu Feb 24 01:59:21 2011 +0000
    20.3 @@ -0,0 +1,14 @@
    20.4 +#!/bin/sh
    20.5 +DIR=$(dirname $0)
    20.6 +MOUNTS="/proc /sys /dev/pts /dev/shm"
    20.7 +cp /etc/resolv.conf etc
    20.8 +for i in $MOUNTS; do
    20.9 +  [ -d $i ] && mount --bind $i $DIR/$i
   20.10 +done
   20.11 +#mount --bind /var/tmp tmp
   20.12 +mount --bind /tmp tmp || mount -t tmpfs tmpfs tmp
   20.13 +SHELL=/bin/ash chroot $DIR /bin/ash -
   20.14 +umount tmp
   20.15 +for i in $MOUNTS; do
   20.16 +  umount $DIR/$i
   20.17 +done
    21.1 --- a/mirror-tools/usr/bin/mkpkgiso	Thu Feb 24 01:29:50 2011 +0000
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,431 +0,0 @@
    21.4 -#!/bin/sh
    21.5 -# mkpkgiso, build packages ISO image.
    21.6 -# (C) 2007-TODAY SliTaz - GNU General Public License v3.
    21.7 -#
    21.8 -# Authors : Eric Joseph-Alexandre <erjo@slitaz.org>
    21.9 -#	    Pascal Bellard <pascal.bellard@slitaz.org>
   21.10 -
   21.11 -VERSION=0.9
   21.12 -
   21.13 -PKG_VER=$1
   21.14 -ROOT=/home/slitaz/iso
   21.15 -REPOS=/var/www/slitaz/mirror/packages/$PKG_VER
   21.16 -SOURCES=/var/www/slitaz/mirror/sources/packages
   21.17 -IFMEM_C32=/var/www/slitaz/mirror/pxe/ifmem.c32
   21.18 -ISO_DIR=/var/www/slitaz/mirror/iso/$PKG_VER
   21.19 -
   21.20 -[ -s /etc/slitaz/mkpkgiso.conf ] && . /etc/slitaz/mkpkgiso.conf
   21.21 -[ -s ./mkpkgiso.conf ] && . ./mkpkgiso.conf
   21.22 -
   21.23 -SORT_DIR=${ROOT}/_iso.$$
   21.24 -TEMP_DIR=${ROOT}/_iso.$$
   21.25 -SORT_FILE=${ROOT}/_sort.$$
   21.26 -shift
   21.27 -OPTIONS=$@
   21.28 -PKG_DIR=$TEMP_DIR/packages/$PKG_VER
   21.29 -SRC_DIR=$TEMP_DIR/src
   21.30 -LOG=$PWD/$(basename $0).log
   21.31 -
   21.32 -#
   21.33 -VOLUME_ID="packages-${PKG_VER}"
   21.34 -PUBLISHER="SliTaz http://www.slitaz.org/"
   21.35 -IMAGE="packages-${PKG_VER}.iso"
   21.36 -case " $@ " in
   21.37 -*\ --sources\ *)
   21.38 -	IMAGE="sources-${PKG_VER}.iso" ;;
   21.39 -esac
   21.40 -OUTPUT="$ROOT/$IMAGE"
   21.41 -
   21.42 -# Check command line option.
   21.43 -if [ -z $PKG_VER ]; then
   21.44 -	cat <<EOT
   21.45 -Usage: $(basename $0) <Version> 
   21.46 -	[--boot [--auto-install] [--loram-detect]]|--webboot] [--filter]
   21.47 -	[--wok] [--wok-stable] [--website] [--sources] [--dry-run]
   21.48 -       $(basename $0) update-hg <dir>
   21.49 -Example:
   21.50 -$(basename $0) cooking --boot --auto-install --loram-detect --filter --wok --website --sources
   21.51 -EOT
   21.52 -	exit 1
   21.53 -fi
   21.54 -
   21.55 -# Update hg repos
   21.56 -if [ "$PKG_VER" == "update-hg" ]; then
   21.57 -	for i in $1/* ; do
   21.58 -		grep -qs '\[paths]' $i/.hg/hgrc || continue
   21.59 -		cd $i
   21.60 -		hg pull
   21.61 -		hg update
   21.62 -		cd - > /dev/null
   21.63 -	done
   21.64 -	exit 1
   21.65 -fi
   21.66 -
   21.67 -# Check if we provide a valide version
   21.68 -if [ ! -d $REPOS ]; then
   21.69 -	echo "Boooh! $PKG_VER is not a valid version."
   21.70 -	exit 1
   21.71 -fi
   21.72 -
   21.73 -# Status function.
   21.74 -status()
   21.75 -{
   21.76 -	local CHECK=$?
   21.77 -	echo -en "\\033[70G[ "
   21.78 -	if [ $CHECK = 0 ]; then
   21.79 -		echo -en "\\033[1;33mOK"
   21.80 -	else
   21.81 -		echo -en "\\033[1;31mFailed"
   21.82 -	fi
   21.83 -	echo -e "\\033[0;39m ]"
   21.84 -}
   21.85 -
   21.86 -need()
   21.87 -{
   21.88 -	found=1
   21.89 -	for i in $@ ; do
   21.90 -		[ -s $i ] && continue
   21.91 -		echo "Missing: $i "
   21.92 -		found=0
   21.93 -	done
   21.94 -	[ $found -ne 0 ] && return
   21.95 -	status
   21.96 -	rm -rf $TEMP_DIR $SORT_FILE
   21.97 -	exit 1
   21.98 -}
   21.99 -
  21.100 -# Create temp directory
  21.101 -mkdir -p $TEMP_DIR/packages/$PKG_VER
  21.102 -which genisoimage > /dev/null || need /usr/bin/genisoimage
  21.103 -
  21.104 -# Prepare evrything for ISO
  21.105 -
  21.106 -echo ""
  21.107 -echo "Building ISO for packages  $PKG_VER"
  21.108 -echo "==============================================================================="
  21.109 -echo -n "Creating working dir $(basename $TEMP_DIR)"
  21.110 -status 
  21.111 -echo -n "Creating symlink"
  21.112 -status
  21.113 -
  21.114 -# Link every packages to temp dir
  21.115 -cd $PKG_DIR
  21.116 -for i in $REPOS/*
  21.117 -do
  21.118 -	ln -s $i >> $LOG 2>&1
  21.119 -done
  21.120 -
  21.121 -echo -n "Creating install script"
  21.122 -# Create install script as suggested by Pascal.
  21.123 -cat >$TEMP_DIR/install.sh<<EOF
  21.124 -#!/bin/sh
  21.125 -#
  21.126 -
  21.127 -DIR=\$(cd \$(busybox dirname \$0); pwd)
  21.128 -
  21.129 -# Handle --auto-install case
  21.130 -if [ "\$DIR" == "/etc/init.d" ]; then
  21.131 -  DIR=/cdrom
  21.132 -  if [ ! -f /cdrom/install.sh ]; then
  21.133 -    mkdir /cdrom 2> /dev/null
  21.134 -    mount --bind /mnt /cdrom
  21.135 -  fi
  21.136 -  # Handle loram on hybrid hard disk / usb key case
  21.137 -  if [ ! -d /usr/bin ]; then
  21.138 -    echo ""
  21.139 -    if [ -d /.usr.rw ]; then
  21.140 -      echo -n "Mounting /usr read-write... "
  21.141 -      usr=.usr.ro
  21.142 -    else
  21.143 -      echo -n "Mounting /usr read-only... "
  21.144 -      usr=usr
  21.145 -    fi
  21.146 -    FS=\$DIR/usr.cromfs
  21.147 -    if [ -f \$FS ]; then
  21.148 -      /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
  21.149 -    elif [ -f \$DIR/usr.sqfs ]; then
  21.150 -      FS=\$DIR/usr.sqfs
  21.151 -      mount -o loop,ro -t squashfs \$FS /\$usr
  21.152 -    elif [ -L /\$usr ]; then
  21.153 -      FS=\$DIR/usr
  21.154 -    fi
  21.155 -    status
  21.156 -    if [ -d /.usr.rw ]; then
  21.157 -      if [ -x /bin/funionfs ]; then
  21.158 -        /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
  21.159 -      else
  21.160 -        /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
  21.161 -      fi
  21.162 -    fi
  21.163 -  fi
  21.164 -fi
  21.165 -
  21.166 -[ -d /var/cache/tazpkg ] || mkdir -p /var/cache/tazpkg
  21.167 -ls -d \$DIR/packages/* > /var/lib/tazpkg/mirror
  21.168 -ln -fs \$DIR/packages/*/*.tazpkg /var/cache/tazpkg/
  21.169 -ln -fs \$DIR/packages/*/packages.* /var/lib/tazpkg
  21.170 -echo ""
  21.171 -echo "=> all $PKG_VER packages are available for tazpkg/tazpkgbox"
  21.172 -EOF
  21.173 -[ -e files.list.lzma ] && cat >>$TEMP_DIR/install.sh<<EOF
  21.174 -ln -fs \$DIR/packages/*/files.list.lzma /var/lib/tazpkg
  21.175 -EOF
  21.176 -
  21.177 -status
  21.178 -cat > $SORT_FILE <<EOT
  21.179 -$SORT_DIR/install.sh -4000
  21.180 -$SORT_DIR/README -4000
  21.181 -$SORT_DIR/index.html -4000
  21.182 -$SORT_DIR/md5sum -4000
  21.183 -$SORT_DIR/style.css -4000
  21.184 -$SORT_DIR/images/header.png -4000
  21.185 -$SORT_DIR/boot/bzImage 2
  21.186 -$SORT_DIR/boot/rootfs.gz 1
  21.187 -$SORT_DIR/packages -9000
  21.188 -EOT
  21.189 -( cd $ROOT; ls $SORT_DIR/packages/*/packages* $SORT_DIR/packages/*/files.list.lzma ) | \
  21.190 -		awk '{ printf "%s -7000\n",$0 }' >> $SORT_FILE
  21.191 -chmod 755  $TEMP_DIR/install.sh
  21.192 -
  21.193 -case " $OPTIONS " in
  21.194 -*\ --filter\ *)
  21.195 -	SIZE=0
  21.196 -	for i in *.tazpkg; do
  21.197 -		while read f; do
  21.198 -			case "$i" in
  21.199 -			$f*) continue 2;;
  21.200 -			esac
  21.201 -		done < packages.list
  21.202 -		echo -n "Filter out $i ($(du -hs $(readlink $i) | awk '{ print $1 }'))..."
  21.203 -		SIZE=$(( $SIZE + $(stat -c %s $(readlink $i)) ))
  21.204 -		rm $i
  21.205 -		status
  21.206 -	done
  21.207 -	UNIT=" bytes"
  21.208 -	if [ $SIZE -gt 10240 ]; then
  21.209 -		SIZE=$(( $SIZE / 1024 ))
  21.210 -		UNIT="K"
  21.211 -	fi
  21.212 -	if [ $SIZE -gt 10240 ]; then
  21.213 -		SIZE=$(( $SIZE / 1024 ))
  21.214 -		UNIT="M"
  21.215 -	fi
  21.216 -	echo "$SIZE$UNIT removed.";;
  21.217 -esac
  21.218 -
  21.219 -# Copy hg subtree
  21.220 -get_from_hg()
  21.221 -{
  21.222 -echo -n "Adding $2"
  21.223 -if [ -s /home/slitaz/$1/.hg/hgrc ]; then
  21.224 -	cp -a /home/slitaz/$1 $TEMP_DIR
  21.225 -else
  21.226 -	wget -q -O - http://hg.slitaz.org/$1/archive/tip.tar.bz2 | tar xjf - -C $TEMP_DIR
  21.227 -	mv $TEMP_DIR/$1-* $TEMP_DIR/$1
  21.228 -fi
  21.229 -status
  21.230 -echo "$(du -hs $TEMP_DIR/$1 | awk '{ print $1 }') used by $2."
  21.231 -}
  21.232 -
  21.233 -for i in $OPTIONS ; do
  21.234 -case "$i" in
  21.235 ---wok)
  21.236 -	cat >>$TEMP_DIR/install.sh<<EOF
  21.237 -mkdir -p /home/slitaz
  21.238 -ln -s \$DIR/wok /home/slitaz
  21.239 -echo "=> Wok (cooking) is in /home/slitaz/wok"
  21.240 -EOF
  21.241 -	if get_from_hg wok "wok (cooking)"; then
  21.242 -		echo "$SORT_DIR/wok -8000" >> $SORT_FILE
  21.243 -	fi;;
  21.244 ---wok-stable)
  21.245 -	cat >>$TEMP_DIR/install.sh<<EOF
  21.246 -mkdir -p /home/slitaz
  21.247 -ln -s \$DIR/wok /home/slitaz
  21.248 -echo "=> Wok (stable) is in /home/slitaz/wok"
  21.249 -EOF
  21.250 -	if get_from_hg wok-stable "wok (stable)"; then
  21.251 -		mv $TEMP_DIR/wok-stable $TEMP_DIR/wok
  21.252 -		echo "$SORT_DIR/wok -8000" >> $SORT_FILE
  21.253 -	fi;;
  21.254 ---website)
  21.255 -	if get_from_hg website "web site"; then
  21.256 -		echo "$SORT_DIR/website -6000" >> $SORT_FILE
  21.257 -		cat >>$TEMP_DIR/install.sh<<EOF
  21.258 -echo "=> slitaz web site installed in file://\$DIR/website/index.html"
  21.259 -EOF
  21.260 -	fi;;
  21.261 ---sources)
  21.262 -	echo -n "Removing previous ISO..."
  21.263 -	rm -f $OUTPUT
  21.264 -	status
  21.265 -	cat >>$TEMP_DIR/install.sh<<EOF
  21.266 -mkdir -p /home/slitaz
  21.267 -ln -s \$DIR/src /home/slitaz
  21.268 -echo "=> sources are in /home/slitaz/src"
  21.269 -EOF
  21.270 -	mkdir -p $SRC_DIR
  21.271 -	cd $SRC_DIR
  21.272 -	for i in $SOURCES/*/*
  21.273 -	do
  21.274 -		case "$i" in
  21.275 -		*/md5sum) continue;;
  21.276 -		esac
  21.277 -		ln -s $i >> $LOG 2>&1
  21.278 -	done
  21.279 -	find * -not -type d | grep -v md5sum | xargs md5sum > md5sum
  21.280 -	echo "$(du -hs $SOURCES | awk '{ print $1 }') used by sources." ;;
  21.281 -esac
  21.282 -done
  21.283 -
  21.284 -# Extract boot package function
  21.285 -extract_boot()
  21.286 -{
  21.287 -f=$(ls $REPOS/$1-[0-9]*.tazpkg 2> /dev/null)
  21.288 -[ -f "$f" ] || return 1
  21.289 -[ -d $TEMP_DIR/boot ] || mkdir $TEMP_DIR/boot
  21.290 -( cd $TEMP_DIR/boot ; cpio -i fs.cpio.gz < $f 2> /dev/null ) 
  21.291 -( cd $TEMP_DIR/boot ; zcat fs.cpio.gz | cpio -id 2> /dev/null )
  21.292 -mv $TEMP_DIR/boot/fs/boot/* $TEMP_DIR/boot
  21.293 -rm -rf $TEMP_DIR/boot/fs.cpio.gz $TEMP_DIR/boot/fs
  21.294 -return 0
  21.295 -}
  21.296 -
  21.297 -# Gen boot part
  21.298 -BOOT_OPT=""
  21.299 -iso=$ISO_DIR/slitaz-$PKG_VER.iso
  21.300 -for i in slitaz-loram-cdrom-sqfs slitaz-$PKG_VER-loram-cdrom ; do
  21.301 -	isoloram=$ISO_DIR/flavors/$i.iso
  21.302 -	[ -s $isoloram ] && break
  21.303 -done
  21.304 -case " $OPTIONS " in
  21.305 -*\ --boot\ *)
  21.306 -	echo -n "Creating boot tree"
  21.307 -	need $iso
  21.308 -	which isoinfo > /dev/null || need /usr/bin/isoinfo
  21.309 -	isoinfo -R -l -i $iso | awk '/^Directory/ { path=$4 } /^-/ { print path$12  }' | while read file; do
  21.310 -		[ "$(basename $file)" == ".." ] && continue
  21.311 -		[ "$file" = "/boot/isolinux/boot.cat" ] && continue
  21.312 -		[ -d "$(dirname $TEMP_DIR/$file)" ] ||
  21.313 -			mkdir -p "$(dirname $TEMP_DIR/$file)"
  21.314 -		isoinfo -R -x "$file" -i $iso > "$TEMP_DIR/$file"
  21.315 -	done
  21.316 -	if [ -f "$(echo $TEMP_DIR/boot/vmlinuz*)" ]; then
  21.317 -		rm -f $TEMP_DIR/boot/bzImage
  21.318 -		ln $TEMP_DIR/boot/vmlinuz* $TEMP_DIR/boot/bzImage
  21.319 -	fi
  21.320 -	status
  21.321 -	BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \
  21.322 --c boot/isolinux/boot.cat  -no-emul-boot -boot-load-size 4 -boot-info-table"
  21.323 -	case " $OPTIONS " in
  21.324 -	*\ --auto-install\ *)
  21.325 -		echo -n "Enable auto install"
  21.326 -		sed -i "s/rw root/rw config=LABEL=packages-$PKG_VER,install.sh root/" \
  21.327 -			$TEMP_DIR/boot/isolinux/*.cfg
  21.328 -		status
  21.329 -		;;
  21.330 -	esac
  21.331 -	case " $OPTIONS " in
  21.332 -	*\ --loram-detect\ *)
  21.333 -		echo -n "Enable loram autodetection"
  21.334 -		need $IFMEM_C32 $isoloram
  21.335 -		which isoinfo > /dev/null || need /usr/bin/isoinfo
  21.336 -		cp $IFMEM_C32 "$TEMP_DIR/boot/isolinux"
  21.337 -		isoinfo -R -x "/usr.sqfs" -i $isoloram \
  21.338 -			> "$TEMP_DIR/usr.sqfs" 2> /dev/null
  21.339 -		if [ -s "$TEMP_DIR/usr.sqfs" ]; then
  21.340 -			echo "$SORT_DIR/usr.sqfs -5000" >> $SORT_FILE
  21.341 -		else
  21.342 -			rm -f "$TEMP_DIR/usr.sqfs"
  21.343 -			isoinfo -R -x "/rootfs.gz" -i $isoloram \
  21.344 -				> "$TEMP_DIR/rootfs.gz" 2> /dev/null
  21.345 -			echo "$SORT_DIR/rootfs.gz -5000" >> $SORT_FILE
  21.346 -		fi
  21.347 -		isoinfo -R -x "/boot/rootfs.gz" -i $isoloram > \
  21.348 -			"$TEMP_DIR/boot/loram.gz"
  21.349 -		cat >> $TEMP_DIR/boot/isolinux/common.cfg <<EOT
  21.350 -label noram
  21.351 -        config noram.cfg
  21.352 -EOT
  21.353 -		cat >> $TEMP_DIR/boot/isolinux/noram.cfg <<EOT
  21.354 -display isolinux.msg
  21.355 -say Not enough RAM to boot slitaz.
  21.356 -default reboot
  21.357 -label reboot
  21.358 -        com32 reboot.c32
  21.359 -
  21.360 -implicit 0
  21.361 -prompt 1
  21.362 -timeout 80
  21.363 -F1 help.txt
  21.364 -F2 options.txt
  21.365 -F3 isolinux.msg
  21.366 -F4 display.txt
  21.367 -F5 enhelp.txt
  21.368 -F6 enopts.txt
  21.369 -EOT
  21.370 -		sed -i -e 's|kernel /boot/bzImage|kernel /boot/isolinux/ifmem.c32\n\tappend 160768 core 29696 loram noram\n|' \
  21.371 -			-e "s|\\(.*/\\)rootfs\\(.gz .*\\)\$|label core\\n\\tkernel /boot/bzImage\\n\\1rootfs\\2\\n\\nlabel loram\\n\\tkernel /boot/bzImage\\n\\1loram\\2 loram=LABEL=packages-$PKG_VER,|" \
  21.372 -			$TEMP_DIR/boot/isolinux/*.cfg
  21.373 -		status
  21.374 -		;;
  21.375 -	esac
  21.376 -	echo "$SORT_DIR/boot 0" >> $SORT_FILE
  21.377 -	;;
  21.378 -*\ --webboot\ *)
  21.379 -	if extract_boot gpxe; then
  21.380 -	echo -n "Creating web boot tree"
  21.381 -	which isoinfo > /dev/null || need /usr/bin/isoinfo
  21.382 -	mkdir $TEMP_DIR/boot/isolinux/
  21.383 -	isoinfo -R -x "/boot/isolinux/isolinux.bin" -i $iso > \
  21.384 -		$TEMP_DIR/boot/isolinux/isolinux.bin
  21.385 -	mv $TEMP_DIR/boot/gpxe $TEMP_DIR/boot/isolinux
  21.386 -	echo "$SORT_DIR/boot 0" >> $SORT_FILE
  21.387 -	cat > $TEMP_DIR/boot/isolinux/isolinux.cfg <<EOT
  21.388 -default gpxe
  21.389 -append http://mirror.slitaz.org/pxe/pxelinux.0
  21.390 -EOT
  21.391 -	status
  21.392 -	BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \
  21.393 --c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
  21.394 -	fi
  21.395 -	;;
  21.396 -esac
  21.397 -
  21.398 -if [ -n "$BOOT_OPT" ]; then
  21.399 -	echo "$(du -chs $TEMP_DIR/boot $TEMP_DIR/usr.sqfs 2> /dev/null | \
  21.400 -		    awk 'END { print $1 }') used by boot."
  21.401 -fi
  21.402 -
  21.403 -case " $OPTIONS " in
  21.404 -*\ --dry-run\ *)
  21.405 -	echo "Please check and remove $TEMP_DIR and $SORT_FILE"
  21.406 -	exit
  21.407 -	;;
  21.408 -esac
  21.409 -# Gen ISO
  21.410 -echo -n "Generating iso image"
  21.411 -genisoimage -R -J -f -V $VOLUME_ID \
  21.412 - -P "$PUBLISHER" -md5-list $REPOS/packages.md5 \
  21.413 - -quiet -o $OUTPUT $BOOT_OPT $TEMP_DIR
  21.414 -status 
  21.415 -
  21.416 -echo "$(du -hs $OUTPUT | awk '{ print $1 }') used by iso image."
  21.417 -
  21.418 -cd ${ROOT}
  21.419 -echo -n "Create hybrid DVD/CDROM"
  21.420 -which isohybrid > /dev/null && isohybrid $IMAGE 2> /dev/null
  21.421 -status
  21.422 -
  21.423 -echo -n "Calculate md5sum"
  21.424 -md5sum $IMAGE > $(basename $IMAGE .iso).md5
  21.425 -status
  21.426 -
  21.427 -echo -n "Moving file to mirror"
  21.428 -mv $IMAGE $ISO_DIR
  21.429 -mv $(basename $IMAGE .iso).md5 $ISO_DIR
  21.430 -status
  21.431 -
  21.432 -# Cleaning temp files
  21.433 -rm -rf $TEMP_DIR $SORT_FILE
  21.434 -
    22.1 --- a/mirror-tools/usr/share/mirror-host/boot/lguest-disk	Thu Feb 24 01:29:50 2011 +0000
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,58 +0,0 @@
    22.4 -#!/bin/sh
    22.5 -
    22.6 -usage()
    22.7 -{
    22.8 -	cat << EOT
    22.9 -resize2fs
   22.10 -usage: 
   22.11 -$0 grow <guest> <size>[MG]
   22.12 -$0 fixmbr <guest>
   22.13 -EOT
   22.14 -	exit 1
   22.15 -}
   22.16 -
   22.17 -grow()
   22.18 -{
   22.19 -	case "$2" in
   22.20 -	*M)	dd if=/dev/zero bs=1M count=${2%M} >> /boot/guests/$1 ;;
   22.21 -	*G)	dd if=/dev/zero bs=1G count=${2%G} >> /boot/guests/$1 ;;
   22.22 -	esac
   22.23 -}
   22.24 -
   22.25 -# write a 32 bits data
   22.26 -# usage: storelong offset data32 file
   22.27 -storelong()
   22.28 -{
   22.29 -	echo $2 | awk '{ printf "%c%c%c%c",
   22.30 -	  $1%256,($1/256)%256,($1/256/256)%256,($1/256/256/256)%256 }' | \
   22.31 -	dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null
   22.32 -}
   22.33 -
   22.34 -# read a 32 bits data
   22.35 -# usage: getlong offset file
   22.36 -getlong()
   22.37 -{
   22.38 -	dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
   22.39 -		hexdump -e '"" 1/4 "%d" "\n"'
   22.40 -}
   22.41 -
   22.42 -fixmbr()
   22.43 -{
   22.44 -	if [ $(getlong 0x1ea $1) -ne 0 -a $(getlong 0x1fa $1) -ne 0 ]; then
   22.45 -		echo "Parttion 3 & 4 non empty. Abort"
   22.46 -		exit 1
   22.47 -	fi
   22.48 -	if [ $(getlong 0x1da $1) -eq 0 ]; then
   22.49 -		echo "Parttion 2 empty. Abort"
   22.50 -		exit 1
   22.51 -	fi
   22.52 -	size=$(stat -c %s $1)
   22.53 -	new=$(( $size/512 - 32 - $(getlong 0x1ca $1) ))
   22.54 -	storelong 0x1da $new $1
   22.55 -}
   22.56 -
   22.57 -case "$1" in
   22.58 -grow)	shift; grow $@ ; fixmbr $1 ;;
   22.59 -fixmbr) shift; fixmbr $1 ;;
   22.60 -*)	usage ;;
   22.61 -esac
    23.1 --- a/mirror-tools/usr/share/mirror-host/boot/lguest-slitaz	Thu Feb 24 01:29:50 2011 +0000
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,21 +0,0 @@
    23.4 -#!/bin/sh
    23.5 -
    23.6 -tty=tty; [ -n "$1" ] && tty=$1
    23.7 -export TERM=$tty
    23.8 -shift
    23.9 -
   23.10 -rootfs="--initrd=/boot/rootfs-lguest.gz"
   23.11 -[ -n "$1" ] && rootfs="--block=$1 root=/dev/vda2"
   23.12 -shift
   23.13 -
   23.14 -net="--tunnet=192.168.0.1"
   23.15 -case "$1" in
   23.16 -192*) net="--tunnet=$1"; shift;;
   23.17 -esac
   23.18 -
   23.19 -args="screen=text lang=fr_FR kmap=fr-latin1 sound=noconf"
   23.20 -[ -n "$1" ] && args=$@
   23.21 -
   23.22 -/sbin/modprobe lg
   23.23 -/usr/bin/lguest 512 /boot/vmlinuz-2.6.25.5-lguest \
   23.24 -	$net $rootfs $args > /dev/$tty < /dev/$tty 2>&1
    24.1 --- a/mirror-tools/usr/share/mirror-host/boot/shellinabox.sh	Thu Feb 24 01:29:50 2011 +0000
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,107 +0,0 @@
    24.4 -#!/bin/sh
    24.5 -
    24.6 -services="/ /reset /reboot /ssh"
    24.7 -
    24.8 -mkexe()
    24.9 -{
   24.10 -exe=$0
   24.11 -while true; do
   24.12 -	cd $(dirname $exe)
   24.13 -	exe=$(basename $exe)
   24.14 -	[ -L $exe ] || break
   24.15 -	exe=$(readlink $exe)
   24.16 -done
   24.17 -echo $(pwd)/$exe
   24.18 -}
   24.19 -exe=$(mkexe)
   24.20 -
   24.21 -services_arg()
   24.22 -{
   24.23 -for i in $services ; do
   24.24 -	echo -n "-s '$i:root:root:/tmp:LINES=25 /bin/sh -c \"$exe service $i "
   24.25 -	echo -n "\${peer} \${url} \${columns} \${lines}\"' "
   24.26 -done
   24.27 -}
   24.28 -
   24.29 -launch_ssh()
   24.30 -{
   24.31 -	# Get SSH server
   24.32 -	server=""
   24.33 -	echo -n "SSH server: "
   24.34 -	read -t 300 server || exit 1
   24.35 -	[ -n "$server" ] || exit 1
   24.36 -
   24.37 -	# Allow non default SSH port with format server:port
   24.38 -	sshport=""
   24.39 -	case "$server" in
   24.40 -	*:*)	sshport="-p ${server#*:}"
   24.41 -		server=${server%:*};;
   24.42 -	esac
   24.43 -
   24.44 -	# heading ! in server name means open remote ssh port with a knock sequence
   24.45 -	if [ -x /usr/bin/knock ]; then
   24.46 -		case "$server" in
   24.47 -		!*)	server=${server#*!}
   24.48 -			echo -n "Knock sequence (port[:proto]...): "
   24.49 -			read -t 30 sequence && knock ${server#*@} $sequence
   24.50 -		esac
   24.51 -	fi
   24.52 -
   24.53 -	# Get SSH user if missing
   24.54 -	case "$server" in
   24.55 -	*@*)	;;
   24.56 -	*)	echo -n "$server login: "
   24.57 -		read -t 30 user || exit 1
   24.58 -		server="$user@$server";;
   24.59 -	esac
   24.60 -
   24.61 -	# Launch OpenSSH or Dropbear
   24.62 -	sshargs="-oPreferredAuthentications=keyboard-interactive,password -oNoHostAuthenticationForLocalhost=yes -oLogLevel=FATAL -F/dev/null";
   24.63 -	[ -L /usr/bin/ssh ] && sshargs=""
   24.64 -	exec ssh $sshport $sshargs $server
   24.65 -}
   24.66 -
   24.67 -auth()
   24.68 -{
   24.69 -	while read host md5 ; do
   24.70 -		[ "${host#*.}" == "${1#*.}" ] && break
   24.71 -	done < $(dirname $exe)/shellinabox.secrets
   24.72 -	echo -n "$host password: "
   24.73 -	read -s -t 30 password || exit 1
   24.74 -	[ "$(echo $password | md5sum)" == "$md5  -" ] || exit 1
   24.75 -	echo ""
   24.76 -}
   24.77 -
   24.78 -pidfile=/var/run/shellinaboxd.pid
   24.79 -case "$1" in
   24.80 -service)
   24.81 -	host=$(echo $4 | sed 's/.*\/\/\(.*\):.*/\1/')
   24.82 -	tty=$(awk "/$host/ { print \$2 }" /etc/inittab)
   24.83 -	vm=$(awk "/$host/ { print \$3 }" /etc/inittab)
   24.84 -	[ -n "$vm" ] || exit 1
   24.85 -	case "$2" in
   24.86 -	/)
   24.87 -		auth $host
   24.88 -		exec /usr/bin/conspy ${tty#tty} ;;
   24.89 -	/reboot)
   24.90 -		auth $host
   24.91 -		echo -n "Sure to reboot $host now (YES or NO) ?"
   24.92 -		read -t 30 answer || exit 1
   24.93 -		case "$answer" in
   24.94 -		YES*) ;;
   24.95 -		*) exit 1;;
   24.96 -		esac
   24.97 -		exec /bin/kill $(ps ww | grep $vm | awk '/lguest/ { printf "%s ",$1 }') ;;
   24.98 -	/ssh)
   24.99 -		auth $host
  24.100 -		launch_ssh ;;
  24.101 -	esac
  24.102 -	;;
  24.103 -start)
  24.104 -	dir=$(dirname $exe)
  24.105 -	eval shellinaboxd --background=$pidfile --cert=/boot/cert $(services_arg)
  24.106 -	;;
  24.107 -stop)
  24.108 -	[ -s $pidfile ] && kill $(cat $pidfile)
  24.109 -	;;
  24.110 -esac
    25.1 --- a/mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz	Thu Feb 24 01:29:50 2011 +0000
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,16 +0,0 @@
    25.4 -<VirtualHost *:80>
    25.5 -	ServerName      mirror.slitaz.org
    25.6 -	ServerAlias	*.slitaz.org
    25.7 -	<IfModule mod_proxy.c>
    25.8 -		ProxyPreserveHost On
    25.9 -		ProxyRequests Off
   25.10 -		ProxyTimeout 600
   25.11 -		<Proxy *>
   25.12 -			Order deny,allow
   25.13 -			Allow from all
   25.14 -		</Proxy>
   25.15 -		ProxyPass / http://192.168.0.6/
   25.16 -		ProxyPassReverse / http://192.168.0.6/
   25.17 -	</IfModule>
   25.18 -</VirtualHost>
   25.19 -
    26.1 --- a/mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl	Thu Feb 24 01:29:50 2011 +0000
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,20 +0,0 @@
    26.4 -<VirtualHost *:443>
    26.5 -	SSLProxyEngine On
    26.6 -	SSLEngine On
    26.7 -	ServerName      mirror.slitaz.org:443
    26.8 -	ServerAlias	*.slitaz.org
    26.9 -	SSLCertificateFile /etc/ssl/apache/slitaz.org.pem
   26.10 -	SSLCertificateKeyFile /etc/ssl/apache/slitaz.org.pem
   26.11 -	<IfModule mod_proxy.c>
   26.12 -		ProxyPreserveHost On
   26.13 -		ProxyRequests Off
   26.14 -		ProxyTimeout 600
   26.15 -		<Proxy *>
   26.16 -			Order deny,allow
   26.17 -			Allow from all
   26.18 -		</Proxy>
   26.19 -		ProxyPass / http://192.168.0.6/
   26.20 -		ProxyPassReverse / http://192.168.0.6/
   26.21 -	</IfModule>
   26.22 -</VirtualHost>
   26.23 -
    27.1 --- a/mirror-tools/usr/share/mirror-host/etc/init.d/shellinabox	Thu Feb 24 01:29:50 2011 +0000
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,1 +0,0 @@
    27.4 -/boot/shellinabox.sh/pics/rrd/cpu-year.pnggngg
    27.5 \ No newline at end of file
    28.1 --- a/mirror-tools/usr/share/mirror-host/install	Thu Feb 24 01:29:50 2011 +0000
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,25 +0,0 @@
    28.4 -#!/bin/sh
    28.5 -
    28.6 -grep -qs lguest-slitaz /etc/inittab || {
    28.7 -sed -i 's|^tty1::|tty16::respawn:/boot/lguest-slitaz tty16 /boot/guests/mirror.slitaz.org 192.168.0.1\n&|' /etc/inittab
    28.8 -cat >> /etc/init.d/local.sh <<EOT
    28.9 -. /etc/network.conf
   28.10 -iptables -t nat -A POSTROUTING -o $INTERFACE -j MASQUERADE
   28.11 -for port in 22 873 ; do
   28.12 -	iptables -t nat -A PREROUTING -i $INTERFACE --dport $port \
   28.13 -			-j DNAT --to-destination 192.168.0.6:$port
   28.14 -done
   28.15 -for port in 80 443 ; do
   28.16 -	iptables -A INPUT -p tcp -m tcp --dport $port -j ACCEPT
   28.17 -done
   28.18 -for iface in tap+ ; do
   28.19 -	iptables -A INPUT  -i $iface -j ACCEPT
   28.20 -	iptables -A OUTPUT -o $iface -j ACCEPT
   28.21 -	iptables -A FORWARD -i $iface -m state \
   28.22 -			--state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT
   28.23 -	iptables -A FORWARD -o $iface -m state \
   28.24 -			--state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT
   28.25 -done
   28.26 -echo "1" > /proc/sys/net/ipv4/ip_forward
   28.27 -EOT
   28.28 -}
    29.1 --- a/mirror-tools/usr/share/rrd/makegraphs	Thu Feb 24 01:29:50 2011 +0000
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,299 +0,0 @@
    29.4 -#!/bin/sh
    29.5 -#*/5  * * * * /usr/share/rrd/makegraphs >/dev/null
    29.6 -
    29.7 -# RRD database directory
    29.8 -rrdlog="/var/spool/rrd"
    29.9 -
   29.10 -# Images directory
   29.11 -rrdgraph="/var/spool/rrd"
   29.12 -
   29.13 -# Colors
   29.14 -#rrdcolors="--color SHADEA#EAE9EE --color SHADEB#EAE9EE --color BACK#EAE9EE" 
   29.15 -rrdcolors="--color SHADEA#FFFFFF --color SHADEB#FFFFFF --color BACK#FFFFFF" 
   29.16 -rrdgraphargs="-aPNG -i -z --alt-y-grid -w 600 -h 100 -r $rrdcolors"
   29.17 -
   29.18 -[ -d $rrdlog ] || mkdir -p $rrdlog
   29.19 -[ -d $rrdgraph ] || mkdir -p $rrdgraph
   29.20 -
   29.21 -updatecpudata() {
   29.22 -	[ -e "$rrdlog/cpu.rrd" ] || rrdtool create $rrdlog/cpu.rrd --step=300 \
   29.23 -			DS:user:COUNTER:600:0:500000000 \
   29.24 -			DS:system:COUNTER:600:0:500000000 \
   29.25 -			DS:idle:COUNTER:600:0:500000000 \
   29.26 -			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
   29.27 -			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
   29.28 -	grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do
   29.29 -		rrdtool update $rrdlog/cpu.rrd -t user:system:idle \
   29.30 -			N:$(( $user + $nice )):$system:$idle
   29.31 -		break
   29.32 -	done
   29.33 -
   29.34 -	[ -e "$rrdlog/cpu2.rrd" ] &&
   29.35 -	grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do
   29.36 -		rrdtool update $rrdlog/cpu2.rrd -t nice:user:system:idle \
   29.37 -			N:$nice:$user:$system:$idle
   29.38 -		break
   29.39 -	done
   29.40 -}
   29.41 -
   29.42 -updatecpugraph() {
   29.43 -	period=$1
   29.44 -	info="$(grep '^model name' /proc/cpuinfo | cut -d: -f2 | head -1)"
   29.45 -	rrdtool graph "$rrdgraph/cpu-$period.png" --start -1$period \
   29.46 -		$rrdgraphargs -l 0 -u 100 -t "cpu usage per $period [$info ]" \
   29.47 -		DEF:user=$rrdlog/cpu.rrd:user:AVERAGE \
   29.48 -		DEF:system=$rrdlog/cpu.rrd:system:AVERAGE \
   29.49 -		DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE \
   29.50 -		'CDEF:total=user,system,idle,+,+' \
   29.51 -		'CDEF:userpct=100,user,total,/,*' \
   29.52 -		'CDEF:systempct=100,system,total,/,*' \
   29.53 -		'CDEF:idlepct=100,idle,total,/,*' \
   29.54 -		'AREA:userpct#0000FF:user cpu usage' \
   29.55 -		'STACK:systempct#FF0000:system cpu usage' \
   29.56 -		'STACK:idlepct#00FF00:idle cpu usage\j'
   29.57 -}
   29.58 -
   29.59 -
   29.60 -updatememgraph() {
   29.61 -	period=$1
   29.62 -	info="$(free | awk '\
   29.63 -{ \
   29.64 -  if (/Mem:/) { \
   29.65 -	if ($2 < 10000) printf "%d KB",$2; \
   29.66 -	else if ($2 < 10000000) printf "%d MB",$2/1024; \
   29.67 -	else printf "%d GB",$2/1024/1024; \
   29.68 -  } \
   29.69 -}')"
   29.70 -	info2="$(free | awk '\
   29.71 -{ \
   29.72 -  if (/Swap:/) { \
   29.73 -	if ($2 < 10000) printf "%d KB",$2; \
   29.74 -	else if ($2 < 10000000) printf "%d MB",$2/1024; \
   29.75 -	else printf "%d GB",$2/1024/1024; \
   29.76 -  } \
   29.77 -}')"
   29.78 -	rrdtool graph "$rrdgraph/memory-$period.png" --start -1$period \
   29.79 -		$rrdgraphargs -l 0 -u 100 \
   29.80 -		-t "memory usage per $period [ $info + $info2 swap ]" \
   29.81 -		DEF:used=$rrdlog/mem.rrd:memused:AVERAGE \
   29.82 -		DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE \
   29.83 -		DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE \
   29.84 -		DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE \
   29.85 -		DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE \
   29.86 -		DEF:swused=$rrdlog/mem.rrd:swapused:AVERAGE \
   29.87 -		DEF:swfree=$rrdlog/mem.rrd:swapfree:AVERAGE \
   29.88 -		'CDEF:total=used,free,+' \
   29.89 -		'CDEF:used2=used,buffer,cache,shared,+,+,-' \
   29.90 -		'CDEF:usedpct=100,used2,total,/,*' \
   29.91 -		'CDEF:sharedpct=100,shared,total,/,*' \
   29.92 -		'CDEF:bufferpct=100,buffer,total,/,*' \
   29.93 -		'CDEF:cachepct=100,cache,total,/,*' \
   29.94 -		'CDEF:freepct=100,free,total,/,*' \
   29.95 -		'CDEF:swtotal=swused,swfree,+' \
   29.96 -		'CDEF:swusedpct=100,swused,swtotal,/,*' \
   29.97 -		'AREA:usedpct#0000FF:used memory' \
   29.98 -		'STACK:sharedpct#FF7F00:shared memory' \
   29.99 -		'STACK:bufferpct#FF00FF:buffered memory' \
  29.100 -		'STACK:cachepct#FFFF00:cached memory' \
  29.101 -		'STACK:freepct#00FF00:free memory' \
  29.102 -		'LINE2:swusedpct#FF0000:used swap\j'
  29.103 -}
  29.104 -
  29.105 -updatememdata () {
  29.106 -	[ -e "$rrdlog/mem.rrd" ] ||
  29.107 -		rrdtool create "$rrdlog/mem.rrd" --step=300 \
  29.108 -			DS:memused:ABSOLUTE:600:0:5000000000 \
  29.109 -			DS:memfree:ABSOLUTE:600:0:5000000000 \
  29.110 -			DS:memshared:ABSOLUTE:600:0:5000000000 \
  29.111 -			DS:membuffers:ABSOLUTE:600:0:5000000000 \
  29.112 -			DS:memcache:ABSOLUTE:600:0:5000000000 \
  29.113 -			DS:swapused:ABSOLUTE:600:0:5000000000 \
  29.114 -			DS:swapfree:ABSOLUTE:600:0:5000000000 \
  29.115 -			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  29.116 -			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  29.117 -
  29.118 -	while read tag count unit; do
  29.119 -		case "$tag" in
  29.120 -		MemTotal:)  memtotal=$(($count * 1024));;
  29.121 -		MemFree:)   memfree=$(($count * 1024))
  29.122 -			    memused=$(($memtotal - $memfree))
  29.123 -			    memshared=0;;
  29.124 -		MemShared:) memshared=$(($count * 1024));;
  29.125 -		Buffers:)   membuffers=$(($count * 1024));;
  29.126 -		Cached:)    memcache=$(($count * 1024));;
  29.127 -		SwapTotal:) swaptotal=$(($count * 1024));;
  29.128 -		SwapFree:)  swapfree=$(($count * 1024))
  29.129 -			    swapused=$(( $swaptotal - $swapfree));;
  29.130 -		esac
  29.131 -	done < /proc/meminfo
  29.132 -
  29.133 -	rrdtool update "$rrdlog/mem.rrd" \
  29.134 -		-t memused:memfree:memshared:membuffers:memcache:swapused:swapfree \
  29.135 -		"N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree"
  29.136 -}
  29.137 -
  29.138 -getmax() {
  29.139 -	rrdtool fetch $rrdlog/$1.rrd AVERAGE | awk '\
  29.140 -BEGIN {max=0} \
  29.141 -/^[0-9]/ { \
  29.142 -   if ($2 != "nan" && $2 > max) max=$2; \
  29.143 -   if ($3 != "nan" && $3 > max) max=$3; \
  29.144 -} \
  29.145 -END { print max }' | sed 's/,/./'
  29.146 -}
  29.147 -
  29.148 -updatediskgraph() {
  29.149 -	period=$1
  29.150 -	[ "$period" == "day" ] && maxdisk="$(getmax disk)"
  29.151 -	info=""
  29.152 -	[ -r $2 ] &&
  29.153 -	info="[ $(fdisk -l | grep "^Disk $2:" | \
  29.154 -		  sed "s|Disk $2: \(.*\), .*|\1|") ]"
  29.155 -	rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \
  29.156 -		$rrdgraphargs -t "disk access per $period $info" \
  29.157 -		--logarithmic --lower-limit 1 -v "Sectors/second" --units=si \
  29.158 -		DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \
  29.159 -		DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \
  29.160 -		DEF:req=$rrdlog/iodisk.rrd:req:AVERAGE \
  29.161 -		DEF:done=$rrdlog/iodisk.rrd:done:AVERAGE \
  29.162 -		DEF:err=$rrdlog/iodisk.rrd:err:AVERAGE \
  29.163 -		"CDEF:readpct=100,read,$maxdisk,/,*" \
  29.164 -		"CDEF:writepct=100,write,$maxdisk,/,*" \
  29.165 -		"CDEF:errpct=100,err,req,/,*" \
  29.166 -		"CDEF:donepct=100,done,req,/,*" \
  29.167 -		'AREA:readpct#0000FF:sectors read from disk' \
  29.168 -		'STACK:writepct#00FF00:sectors written to disk' \
  29.169 -		'LINE2:donepct#FFFF00:I/O complete' \
  29.170 -		'LINE2:errpct#FF0000:I/O error\j'
  29.171 -}
  29.172 -
  29.173 -updatediskdata() {
  29.174 -	dev=$1
  29.175 -	[ -e "$rrdlog/disk.rrd" ] ||
  29.176 -		rrdtool create "$rrdlog/disk.rrd" --step=300 \
  29.177 -			DS:readsect:COUNTER:600:0:5000000000 \
  29.178 -			DS:writesect:COUNTER:600:0:5000000000 \
  29.179 -			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  29.180 -			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  29.181 -	[ -e "$rrdlog/iodisk.rrd" ] ||
  29.182 -		rrdtool create "$rrdlog/iodisk.rrd" --step=300 \
  29.183 -			DS:done:GAUGE:600:0:U  DS:err:GAUGE:600:0:U \
  29.184 -			DS:req:GAUGE:600:0:U \
  29.185 -			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  29.186 -			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  29.187 -
  29.188 -	while read major minor name readreq readsect writereq writesect misc; do
  29.189 -		[ $major = $(( 0x$(stat -c %t $dev) )) ] || continue
  29.190 -		[ $minor = $(( 0x$(stat -c %T $dev) )) ] || continue
  29.191 -		rrdtool update "$rrdlog/disk.rrd" -t readsect:writesect \
  29.192 -			N:$readsect:$writesect
  29.193 -	done < /proc/diskstats
  29.194 -	dir=/sys/block/${dev#/dev/}/device
  29.195 -	done=$(printf "%d\n" $(cat $dir/iodone_cnt 2> /dev/null) )
  29.196 -	err=$(printf "%d\n" $(cat $dir/ioerr_cnt 2> /dev/null) )
  29.197 -	req=$(printf "%d\n" $(cat $dir/iorequest_cnt 2> /dev/null) )
  29.198 -	rrdtool update "$rrdlog/iodisk.rrd" -t done:err:req N:$done:$err:$req
  29.199 -}
  29.200 -
  29.201 -updateifgraph() {
  29.202 -	interface=$1
  29.203 -	period=$2
  29.204 -	[ "$period" == "day" ] && maxif="$(getmax $interface)"
  29.205 -	rrdtool graph "$rrdgraph/$interface-$period.png" --start -1$period \
  29.206 -		$rrdgraphargs -t "traffic on $interface graph per $period" \
  29.207 -		--logarithmic -A -v "Bytes/second" --units=si \
  29.208 -		DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE \
  29.209 -		DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE \
  29.210 -		"CDEF:inpct=100,incoming,$maxif,/,*" \
  29.211 -		"CDEF:outpct=100,outgoing,$maxif,/,*" \
  29.212 -		'AREA:inpct#00FF00:incoming traffic' \
  29.213 -		'LINE1:outpct#0000FF:outgoing traffic\j'
  29.214 -}
  29.215 -
  29.216 -netframes() {
  29.217 -ifconfig $1 | grep "$2 packets" | sed -re "s/.*$3:([0-9]+).*/\1/g"
  29.218 -}
  29.219 -
  29.220 -netstats() {
  29.221 -ifconfig $1 | grep bytes | sed -re "s/.*$2 bytes:([0-9]+).*/\1/g"
  29.222 -}
  29.223 -
  29.224 -updateifdata() {
  29.225 -	interface=$1
  29.226 -	[ -e "$rrdlog/$interface.rrd" ] ||
  29.227 -		rrdtool create "$rrdlog/$interface.rrd" --step=300 \
  29.228 -			DS:incoming:COUNTER:600:0:U \
  29.229 -			DS:outgoing:COUNTER:600:0:U \
  29.230 -			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  29.231 -			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  29.232 -	[ -e "$rrdlog/packets-$interface.rrd" ] ||
  29.233 -		rrdtool create "$rrdlog/packets-$interface.rrd" --step=300 \
  29.234 -			DS:in:COUNTER:600:0:U      DS:out:COUNTER:600:0:U \
  29.235 -			DS:inerr:COUNTER:600:0:U   DS:outerr:COUNTER:600:0:U \
  29.236 -			DS:indrop:COUNTER:600:0:U  DS:outdrop:COUNTER:600:0:U \
  29.237 -			DS:inov:COUNTER:600:0:U    DS:outov:COUNTER:600:0:U \
  29.238 -			DS:frame:COUNTER:600:0:U   DS:carrier:COUNTER:600:0:U \
  29.239 -			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
  29.240 -			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
  29.241 -	rx=$(netstats $interface RX)
  29.242 -	tx=$(netstats $interface TX)
  29.243 -	rrdtool update "$rrdlog/$interface.rrd" -t incoming:outgoing \
  29.244 -		N:${rx:-U}:${tx:-U}
  29.245 -	rx=$(netframes $interface RX packets)
  29.246 -	tx=$(netframes $interface TX packets)
  29.247 -	rxerr=$(netframes $interface RX errors)
  29.248 -	txerr=$(netframes $interface TX errors)
  29.249 -	rxdrop=$(netframes $interface RX dropped)
  29.250 -	txdrop=$(netframes $interface TX dropped)
  29.251 -	rxov=$(netframes $interface RX overruns)
  29.252 -	txov=$(netframes $interface TX overruns)
  29.253 -	frame=$(netframes $interface RX frame)
  29.254 -	carrier=$(netframes $interface TX carrier)
  29.255 -	rrdtool update "$rrdlog/packets-$interface.rrd" \
  29.256 -		-t in:out:inerr:outerr:indrop:outdrop:inov:outov:frame:carrier \
  29.257 -		N:${rx:-U}:${tx:-U}:${rxerr:-U}:${txerr:-U}:${rxdrop:-U}:${txdrop:-U}:${rxov:-U}:${txov:-U}:${frame:-U}:${carrier:-U}
  29.258 -}
  29.259 -
  29.260 -getdisk()
  29.261 -{
  29.262 -	local d
  29.263 -	local i
  29.264 -	d=$(stat -c %D $1)
  29.265 -	for i in /dev/* ; do 
  29.266 -		[ $(stat -c "%02t%02T" $i) == $d ] || continue
  29.267 -		echo $i
  29.268 -		break
  29.269 -	done
  29.270 -}
  29.271 -
  29.272 -###
  29.273 -### System graphs
  29.274 -###
  29.275 -
  29.276 -updatecpudata
  29.277 -updatecpugraph day
  29.278 -updatecpugraph week
  29.279 -updatecpugraph month
  29.280 -updatecpugraph year
  29.281 -
  29.282 -updatememdata
  29.283 -updatememgraph day
  29.284 -updatememgraph week
  29.285 -updatememgraph month
  29.286 -updatememgraph year
  29.287 -
  29.288 -if [ -e /proc/diskstats ]; then
  29.289 -	disk=$(getdisk $0)
  29.290 -	updatediskdata $disk
  29.291 -	updatediskgraph day ${disk:0:8}
  29.292 -	updatediskgraph week ${disk:0:8}
  29.293 -	updatediskgraph month ${disk:0:8}
  29.294 -	updatediskgraph year ${disk:0:8}
  29.295 -fi
  29.296 -
  29.297 -iface=$(/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }')
  29.298 -updateifdata $iface
  29.299 -updateifgraph $iface day
  29.300 -updateifgraph $iface week
  29.301 -updateifgraph $iface month
  29.302 -updateifgraph $iface year
    30.1 --- a/mirror-tools/usr/share/slitaz-live/INSTALL	Thu Feb 24 01:29:50 2011 +0000
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,14 +0,0 @@
    30.4 -#!/bin/sh
    30.5 -DIR=$(dirname $0)
    30.6 -MOUNTS="/proc /sys /dev/pts /dev/shm"
    30.7 -cp /etc/resolv.conf etc
    30.8 -for i in $MOUNTS; do
    30.9 -  [ -d $i ] && mount --bind $i $DIR/$i
   30.10 -done
   30.11 -#mount --bind /var/tmp tmp
   30.12 -mount --bind /tmp tmp || mount -t tmpfs tmpfs tmp
   30.13 -SHELL=/bin/ash chroot $DIR /bin/ash -
   30.14 -umount tmp
   30.15 -for i in $MOUNTS; do
   30.16 -  umount $DIR/$i
   30.17 -done