slitaz-dev-tools rev 4
Starting to add mirror-tools. Add etc. home. and usr so far.
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mirror-tools/etc/lighttpd/vhosts.conf Thu Feb 24 01:03:48 2011 +0000 1.3 @@ -0,0 +1,184 @@ 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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/mirror-tools/etc/rsyncd.conf Thu Feb 24 01:03:48 2011 +0000 2.3 @@ -0,0 +1,25 @@ 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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/mirror-tools/etc/rsyncd.motd Thu Feb 24 01:03:48 2011 +0000 3.3 @@ -0,0 +1,12 @@ 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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/mirror-tools/etc/tazwok.conf.mirror Thu Feb 24 01:03:48 2011 +0000 4.3 @@ -0,0 +1,45 @@ 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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/mirror-tools/home/backups/mirror/backup.sh Thu Feb 24 01:03:48 2011 +0000 5.3 @@ -0,0 +1,83 @@ 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/usr/bin/mkpkgiso Thu Feb 24 01:03:48 2011 +0000 6.3 @@ -0,0 +1,431 @@ 6.4 +#!/bin/sh 6.5 +# mkpkgiso, build packages ISO image. 6.6 +# (C) 2007-TODAY SliTaz - GNU General Public License v3. 6.7 +# 6.8 +# Authors : Eric Joseph-Alexandre <erjo@slitaz.org> 6.9 +# Pascal Bellard <pascal.bellard@slitaz.org> 6.10 + 6.11 +VERSION=0.9 6.12 + 6.13 +PKG_VER=$1 6.14 +ROOT=/home/slitaz/iso 6.15 +REPOS=/var/www/slitaz/mirror/packages/$PKG_VER 6.16 +SOURCES=/var/www/slitaz/mirror/sources/packages 6.17 +IFMEM_C32=/var/www/slitaz/mirror/pxe/ifmem.c32 6.18 +ISO_DIR=/var/www/slitaz/mirror/iso/$PKG_VER 6.19 + 6.20 +[ -s /etc/slitaz/mkpkgiso.conf ] && . /etc/slitaz/mkpkgiso.conf 6.21 +[ -s ./mkpkgiso.conf ] && . ./mkpkgiso.conf 6.22 + 6.23 +SORT_DIR=${ROOT}/_iso.$$ 6.24 +TEMP_DIR=${ROOT}/_iso.$$ 6.25 +SORT_FILE=${ROOT}/_sort.$$ 6.26 +shift 6.27 +OPTIONS=$@ 6.28 +PKG_DIR=$TEMP_DIR/packages/$PKG_VER 6.29 +SRC_DIR=$TEMP_DIR/src 6.30 +LOG=$PWD/$(basename $0).log 6.31 + 6.32 +# 6.33 +VOLUME_ID="packages-${PKG_VER}" 6.34 +PUBLISHER="SliTaz http://www.slitaz.org/" 6.35 +IMAGE="packages-${PKG_VER}.iso" 6.36 +case " $@ " in 6.37 +*\ --sources\ *) 6.38 + IMAGE="sources-${PKG_VER}.iso" ;; 6.39 +esac 6.40 +OUTPUT="$ROOT/$IMAGE" 6.41 + 6.42 +# Check command line option. 6.43 +if [ -z $PKG_VER ]; then 6.44 + cat <<EOT 6.45 +Usage: $(basename $0) <Version> 6.46 + [--boot [--auto-install] [--loram-detect]]|--webboot] [--filter] 6.47 + [--wok] [--wok-stable] [--website] [--sources] [--dry-run] 6.48 + $(basename $0) update-hg <dir> 6.49 +Example: 6.50 +$(basename $0) cooking --boot --auto-install --loram-detect --filter --wok --website --sources 6.51 +EOT 6.52 + exit 1 6.53 +fi 6.54 + 6.55 +# Update hg repos 6.56 +if [ "$PKG_VER" == "update-hg" ]; then 6.57 + for i in $1/* ; do 6.58 + grep -qs '\[paths]' $i/.hg/hgrc || continue 6.59 + cd $i 6.60 + hg pull 6.61 + hg update 6.62 + cd - > /dev/null 6.63 + done 6.64 + exit 1 6.65 +fi 6.66 + 6.67 +# Check if we provide a valide version 6.68 +if [ ! -d $REPOS ]; then 6.69 + echo "Boooh! $PKG_VER is not a valid version." 6.70 + exit 1 6.71 +fi 6.72 + 6.73 +# Status function. 6.74 +status() 6.75 +{ 6.76 + local CHECK=$? 6.77 + echo -en "\\033[70G[ " 6.78 + if [ $CHECK = 0 ]; then 6.79 + echo -en "\\033[1;33mOK" 6.80 + else 6.81 + echo -en "\\033[1;31mFailed" 6.82 + fi 6.83 + echo -e "\\033[0;39m ]" 6.84 +} 6.85 + 6.86 +need() 6.87 +{ 6.88 + found=1 6.89 + for i in $@ ; do 6.90 + [ -s $i ] && continue 6.91 + echo "Missing: $i " 6.92 + found=0 6.93 + done 6.94 + [ $found -ne 0 ] && return 6.95 + status 6.96 + rm -rf $TEMP_DIR $SORT_FILE 6.97 + exit 1 6.98 +} 6.99 + 6.100 +# Create temp directory 6.101 +mkdir -p $TEMP_DIR/packages/$PKG_VER 6.102 +which genisoimage > /dev/null || need /usr/bin/genisoimage 6.103 + 6.104 +# Prepare evrything for ISO 6.105 + 6.106 +echo "" 6.107 +echo "Building ISO for packages $PKG_VER" 6.108 +echo "===============================================================================" 6.109 +echo -n "Creating working dir $(basename $TEMP_DIR)" 6.110 +status 6.111 +echo -n "Creating symlink" 6.112 +status 6.113 + 6.114 +# Link every packages to temp dir 6.115 +cd $PKG_DIR 6.116 +for i in $REPOS/* 6.117 +do 6.118 + ln -s $i >> $LOG 2>&1 6.119 +done 6.120 + 6.121 +echo -n "Creating install script" 6.122 +# Create install script as suggested by Pascal. 6.123 +cat >$TEMP_DIR/install.sh<<EOF 6.124 +#!/bin/sh 6.125 +# 6.126 + 6.127 +DIR=\$(cd \$(busybox dirname \$0); pwd) 6.128 + 6.129 +# Handle --auto-install case 6.130 +if [ "\$DIR" == "/etc/init.d" ]; then 6.131 + DIR=/cdrom 6.132 + if [ ! -f /cdrom/install.sh ]; then 6.133 + mkdir /cdrom 2> /dev/null 6.134 + mount --bind /mnt /cdrom 6.135 + fi 6.136 + # Handle loram on hybrid hard disk / usb key case 6.137 + if [ ! -d /usr/bin ]; then 6.138 + echo "" 6.139 + if [ -d /.usr.rw ]; then 6.140 + echo -n "Mounting /usr read-write... " 6.141 + usr=.usr.ro 6.142 + else 6.143 + echo -n "Mounting /usr read-only... " 6.144 + usr=usr 6.145 + fi 6.146 + FS=\$DIR/usr.cromfs 6.147 + if [ -f \$FS ]; then 6.148 + /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other 6.149 + elif [ -f \$DIR/usr.sqfs ]; then 6.150 + FS=\$DIR/usr.sqfs 6.151 + mount -o loop,ro -t squashfs \$FS /\$usr 6.152 + elif [ -L /\$usr ]; then 6.153 + FS=\$DIR/usr 6.154 + fi 6.155 + status 6.156 + if [ -d /.usr.rw ]; then 6.157 + if [ -x /bin/funionfs ]; then 6.158 + /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr 6.159 + else 6.160 + /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr 6.161 + fi 6.162 + fi 6.163 + fi 6.164 +fi 6.165 + 6.166 +[ -d /var/cache/tazpkg ] || mkdir -p /var/cache/tazpkg 6.167 +ls -d \$DIR/packages/* > /var/lib/tazpkg/mirror 6.168 +ln -fs \$DIR/packages/*/*.tazpkg /var/cache/tazpkg/ 6.169 +ln -fs \$DIR/packages/*/packages.* /var/lib/tazpkg 6.170 +echo "" 6.171 +echo "=> all $PKG_VER packages are available for tazpkg/tazpkgbox" 6.172 +EOF 6.173 +[ -e files.list.lzma ] && cat >>$TEMP_DIR/install.sh<<EOF 6.174 +ln -fs \$DIR/packages/*/files.list.lzma /var/lib/tazpkg 6.175 +EOF 6.176 + 6.177 +status 6.178 +cat > $SORT_FILE <<EOT 6.179 +$SORT_DIR/install.sh -4000 6.180 +$SORT_DIR/README -4000 6.181 +$SORT_DIR/index.html -4000 6.182 +$SORT_DIR/md5sum -4000 6.183 +$SORT_DIR/style.css -4000 6.184 +$SORT_DIR/images/header.png -4000 6.185 +$SORT_DIR/boot/bzImage 2 6.186 +$SORT_DIR/boot/rootfs.gz 1 6.187 +$SORT_DIR/packages -9000 6.188 +EOT 6.189 +( cd $ROOT; ls $SORT_DIR/packages/*/packages* $SORT_DIR/packages/*/files.list.lzma ) | \ 6.190 + awk '{ printf "%s -7000\n",$0 }' >> $SORT_FILE 6.191 +chmod 755 $TEMP_DIR/install.sh 6.192 + 6.193 +case " $OPTIONS " in 6.194 +*\ --filter\ *) 6.195 + SIZE=0 6.196 + for i in *.tazpkg; do 6.197 + while read f; do 6.198 + case "$i" in 6.199 + $f*) continue 2;; 6.200 + esac 6.201 + done < packages.list 6.202 + echo -n "Filter out $i ($(du -hs $(readlink $i) | awk '{ print $1 }'))..." 6.203 + SIZE=$(( $SIZE + $(stat -c %s $(readlink $i)) )) 6.204 + rm $i 6.205 + status 6.206 + done 6.207 + UNIT=" bytes" 6.208 + if [ $SIZE -gt 10240 ]; then 6.209 + SIZE=$(( $SIZE / 1024 )) 6.210 + UNIT="K" 6.211 + fi 6.212 + if [ $SIZE -gt 10240 ]; then 6.213 + SIZE=$(( $SIZE / 1024 )) 6.214 + UNIT="M" 6.215 + fi 6.216 + echo "$SIZE$UNIT removed.";; 6.217 +esac 6.218 + 6.219 +# Copy hg subtree 6.220 +get_from_hg() 6.221 +{ 6.222 +echo -n "Adding $2" 6.223 +if [ -s /home/slitaz/$1/.hg/hgrc ]; then 6.224 + cp -a /home/slitaz/$1 $TEMP_DIR 6.225 +else 6.226 + wget -q -O - http://hg.slitaz.org/$1/archive/tip.tar.bz2 | tar xjf - -C $TEMP_DIR 6.227 + mv $TEMP_DIR/$1-* $TEMP_DIR/$1 6.228 +fi 6.229 +status 6.230 +echo "$(du -hs $TEMP_DIR/$1 | awk '{ print $1 }') used by $2." 6.231 +} 6.232 + 6.233 +for i in $OPTIONS ; do 6.234 +case "$i" in 6.235 +--wok) 6.236 + cat >>$TEMP_DIR/install.sh<<EOF 6.237 +mkdir -p /home/slitaz 6.238 +ln -s \$DIR/wok /home/slitaz 6.239 +echo "=> Wok (cooking) is in /home/slitaz/wok" 6.240 +EOF 6.241 + if get_from_hg wok "wok (cooking)"; then 6.242 + echo "$SORT_DIR/wok -8000" >> $SORT_FILE 6.243 + fi;; 6.244 +--wok-stable) 6.245 + cat >>$TEMP_DIR/install.sh<<EOF 6.246 +mkdir -p /home/slitaz 6.247 +ln -s \$DIR/wok /home/slitaz 6.248 +echo "=> Wok (stable) is in /home/slitaz/wok" 6.249 +EOF 6.250 + if get_from_hg wok-stable "wok (stable)"; then 6.251 + mv $TEMP_DIR/wok-stable $TEMP_DIR/wok 6.252 + echo "$SORT_DIR/wok -8000" >> $SORT_FILE 6.253 + fi;; 6.254 +--website) 6.255 + if get_from_hg website "web site"; then 6.256 + echo "$SORT_DIR/website -6000" >> $SORT_FILE 6.257 + cat >>$TEMP_DIR/install.sh<<EOF 6.258 +echo "=> slitaz web site installed in file://\$DIR/website/index.html" 6.259 +EOF 6.260 + fi;; 6.261 +--sources) 6.262 + echo -n "Removing previous ISO..." 6.263 + rm -f $OUTPUT 6.264 + status 6.265 + cat >>$TEMP_DIR/install.sh<<EOF 6.266 +mkdir -p /home/slitaz 6.267 +ln -s \$DIR/src /home/slitaz 6.268 +echo "=> sources are in /home/slitaz/src" 6.269 +EOF 6.270 + mkdir -p $SRC_DIR 6.271 + cd $SRC_DIR 6.272 + for i in $SOURCES/*/* 6.273 + do 6.274 + case "$i" in 6.275 + */md5sum) continue;; 6.276 + esac 6.277 + ln -s $i >> $LOG 2>&1 6.278 + done 6.279 + find * -not -type d | grep -v md5sum | xargs md5sum > md5sum 6.280 + echo "$(du -hs $SOURCES | awk '{ print $1 }') used by sources." ;; 6.281 +esac 6.282 +done 6.283 + 6.284 +# Extract boot package function 6.285 +extract_boot() 6.286 +{ 6.287 +f=$(ls $REPOS/$1-[0-9]*.tazpkg 2> /dev/null) 6.288 +[ -f "$f" ] || return 1 6.289 +[ -d $TEMP_DIR/boot ] || mkdir $TEMP_DIR/boot 6.290 +( cd $TEMP_DIR/boot ; cpio -i fs.cpio.gz < $f 2> /dev/null ) 6.291 +( cd $TEMP_DIR/boot ; zcat fs.cpio.gz | cpio -id 2> /dev/null ) 6.292 +mv $TEMP_DIR/boot/fs/boot/* $TEMP_DIR/boot 6.293 +rm -rf $TEMP_DIR/boot/fs.cpio.gz $TEMP_DIR/boot/fs 6.294 +return 0 6.295 +} 6.296 + 6.297 +# Gen boot part 6.298 +BOOT_OPT="" 6.299 +iso=$ISO_DIR/slitaz-$PKG_VER.iso 6.300 +for i in slitaz-loram-cdrom-sqfs slitaz-$PKG_VER-loram-cdrom ; do 6.301 + isoloram=$ISO_DIR/flavors/$i.iso 6.302 + [ -s $isoloram ] && break 6.303 +done 6.304 +case " $OPTIONS " in 6.305 +*\ --boot\ *) 6.306 + echo -n "Creating boot tree" 6.307 + need $iso 6.308 + which isoinfo > /dev/null || need /usr/bin/isoinfo 6.309 + isoinfo -R -l -i $iso | awk '/^Directory/ { path=$4 } /^-/ { print path$12 }' | while read file; do 6.310 + [ "$(basename $file)" == ".." ] && continue 6.311 + [ "$file" = "/boot/isolinux/boot.cat" ] && continue 6.312 + [ -d "$(dirname $TEMP_DIR/$file)" ] || 6.313 + mkdir -p "$(dirname $TEMP_DIR/$file)" 6.314 + isoinfo -R -x "$file" -i $iso > "$TEMP_DIR/$file" 6.315 + done 6.316 + if [ -f "$(echo $TEMP_DIR/boot/vmlinuz*)" ]; then 6.317 + rm -f $TEMP_DIR/boot/bzImage 6.318 + ln $TEMP_DIR/boot/vmlinuz* $TEMP_DIR/boot/bzImage 6.319 + fi 6.320 + status 6.321 + BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \ 6.322 +-c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table" 6.323 + case " $OPTIONS " in 6.324 + *\ --auto-install\ *) 6.325 + echo -n "Enable auto install" 6.326 + sed -i "s/rw root/rw config=LABEL=packages-$PKG_VER,install.sh root/" \ 6.327 + $TEMP_DIR/boot/isolinux/*.cfg 6.328 + status 6.329 + ;; 6.330 + esac 6.331 + case " $OPTIONS " in 6.332 + *\ --loram-detect\ *) 6.333 + echo -n "Enable loram autodetection" 6.334 + need $IFMEM_C32 $isoloram 6.335 + which isoinfo > /dev/null || need /usr/bin/isoinfo 6.336 + cp $IFMEM_C32 "$TEMP_DIR/boot/isolinux" 6.337 + isoinfo -R -x "/usr.sqfs" -i $isoloram \ 6.338 + > "$TEMP_DIR/usr.sqfs" 2> /dev/null 6.339 + if [ -s "$TEMP_DIR/usr.sqfs" ]; then 6.340 + echo "$SORT_DIR/usr.sqfs -5000" >> $SORT_FILE 6.341 + else 6.342 + rm -f "$TEMP_DIR/usr.sqfs" 6.343 + isoinfo -R -x "/rootfs.gz" -i $isoloram \ 6.344 + > "$TEMP_DIR/rootfs.gz" 2> /dev/null 6.345 + echo "$SORT_DIR/rootfs.gz -5000" >> $SORT_FILE 6.346 + fi 6.347 + isoinfo -R -x "/boot/rootfs.gz" -i $isoloram > \ 6.348 + "$TEMP_DIR/boot/loram.gz" 6.349 + cat >> $TEMP_DIR/boot/isolinux/common.cfg <<EOT 6.350 +label noram 6.351 + config noram.cfg 6.352 +EOT 6.353 + cat >> $TEMP_DIR/boot/isolinux/noram.cfg <<EOT 6.354 +display isolinux.msg 6.355 +say Not enough RAM to boot slitaz. 6.356 +default reboot 6.357 +label reboot 6.358 + com32 reboot.c32 6.359 + 6.360 +implicit 0 6.361 +prompt 1 6.362 +timeout 80 6.363 +F1 help.txt 6.364 +F2 options.txt 6.365 +F3 isolinux.msg 6.366 +F4 display.txt 6.367 +F5 enhelp.txt 6.368 +F6 enopts.txt 6.369 +EOT 6.370 + sed -i -e 's|kernel /boot/bzImage|kernel /boot/isolinux/ifmem.c32\n\tappend 160768 core 29696 loram noram\n|' \ 6.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,|" \ 6.372 + $TEMP_DIR/boot/isolinux/*.cfg 6.373 + status 6.374 + ;; 6.375 + esac 6.376 + echo "$SORT_DIR/boot 0" >> $SORT_FILE 6.377 + ;; 6.378 +*\ --webboot\ *) 6.379 + if extract_boot gpxe; then 6.380 + echo -n "Creating web boot tree" 6.381 + which isoinfo > /dev/null || need /usr/bin/isoinfo 6.382 + mkdir $TEMP_DIR/boot/isolinux/ 6.383 + isoinfo -R -x "/boot/isolinux/isolinux.bin" -i $iso > \ 6.384 + $TEMP_DIR/boot/isolinux/isolinux.bin 6.385 + mv $TEMP_DIR/boot/gpxe $TEMP_DIR/boot/isolinux 6.386 + echo "$SORT_DIR/boot 0" >> $SORT_FILE 6.387 + cat > $TEMP_DIR/boot/isolinux/isolinux.cfg <<EOT 6.388 +default gpxe 6.389 +append http://mirror.slitaz.org/pxe/pxelinux.0 6.390 +EOT 6.391 + status 6.392 + BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \ 6.393 +-c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table" 6.394 + fi 6.395 + ;; 6.396 +esac 6.397 + 6.398 +if [ -n "$BOOT_OPT" ]; then 6.399 + echo "$(du -chs $TEMP_DIR/boot $TEMP_DIR/usr.sqfs 2> /dev/null | \ 6.400 + awk 'END { print $1 }') used by boot." 6.401 +fi 6.402 + 6.403 +case " $OPTIONS " in 6.404 +*\ --dry-run\ *) 6.405 + echo "Please check and remove $TEMP_DIR and $SORT_FILE" 6.406 + exit 6.407 + ;; 6.408 +esac 6.409 +# Gen ISO 6.410 +echo -n "Generating iso image" 6.411 +genisoimage -R -J -f -V $VOLUME_ID \ 6.412 + -P "$PUBLISHER" -md5-list $REPOS/packages.md5 \ 6.413 + -quiet -o $OUTPUT $BOOT_OPT $TEMP_DIR 6.414 +status 6.415 + 6.416 +echo "$(du -hs $OUTPUT | awk '{ print $1 }') used by iso image." 6.417 + 6.418 +cd ${ROOT} 6.419 +echo -n "Create hybrid DVD/CDROM" 6.420 +which isohybrid > /dev/null && isohybrid $IMAGE 2> /dev/null 6.421 +status 6.422 + 6.423 +echo -n "Calculate md5sum" 6.424 +md5sum $IMAGE > $(basename $IMAGE .iso).md5 6.425 +status 6.426 + 6.427 +echo -n "Moving file to mirror" 6.428 +mv $IMAGE $ISO_DIR 6.429 +mv $(basename $IMAGE .iso).md5 $ISO_DIR 6.430 +status 6.431 + 6.432 +# Cleaning temp files 6.433 +rm -rf $TEMP_DIR $SORT_FILE 6.434 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/mirror-tools/usr/share/mirror-host/boot/lguest-disk Thu Feb 24 01:03:48 2011 +0000 7.3 @@ -0,0 +1,58 @@ 7.4 +#!/bin/sh 7.5 + 7.6 +usage() 7.7 +{ 7.8 + cat << EOT 7.9 +resize2fs 7.10 +usage: 7.11 +$0 grow <guest> <size>[MG] 7.12 +$0 fixmbr <guest> 7.13 +EOT 7.14 + exit 1 7.15 +} 7.16 + 7.17 +grow() 7.18 +{ 7.19 + case "$2" in 7.20 + *M) dd if=/dev/zero bs=1M count=${2%M} >> /boot/guests/$1 ;; 7.21 + *G) dd if=/dev/zero bs=1G count=${2%G} >> /boot/guests/$1 ;; 7.22 + esac 7.23 +} 7.24 + 7.25 +# write a 32 bits data 7.26 +# usage: storelong offset data32 file 7.27 +storelong() 7.28 +{ 7.29 + echo $2 | awk '{ printf "%c%c%c%c", 7.30 + $1%256,($1/256)%256,($1/256/256)%256,($1/256/256/256)%256 }' | \ 7.31 + dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null 7.32 +} 7.33 + 7.34 +# read a 32 bits data 7.35 +# usage: getlong offset file 7.36 +getlong() 7.37 +{ 7.38 + dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \ 7.39 + hexdump -e '"" 1/4 "%d" "\n"' 7.40 +} 7.41 + 7.42 +fixmbr() 7.43 +{ 7.44 + if [ $(getlong 0x1ea $1) -ne 0 -a $(getlong 0x1fa $1) -ne 0 ]; then 7.45 + echo "Parttion 3 & 4 non empty. Abort" 7.46 + exit 1 7.47 + fi 7.48 + if [ $(getlong 0x1da $1) -eq 0 ]; then 7.49 + echo "Parttion 2 empty. Abort" 7.50 + exit 1 7.51 + fi 7.52 + size=$(stat -c %s $1) 7.53 + new=$(( $size/512 - 32 - $(getlong 0x1ca $1) )) 7.54 + storelong 0x1da $new $1 7.55 +} 7.56 + 7.57 +case "$1" in 7.58 +grow) shift; grow $@ ; fixmbr $1 ;; 7.59 +fixmbr) shift; fixmbr $1 ;; 7.60 +*) usage ;; 7.61 +esac
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/mirror-tools/usr/share/mirror-host/boot/lguest-slitaz Thu Feb 24 01:03:48 2011 +0000 8.3 @@ -0,0 +1,21 @@ 8.4 +#!/bin/sh 8.5 + 8.6 +tty=tty; [ -n "$1" ] && tty=$1 8.7 +export TERM=$tty 8.8 +shift 8.9 + 8.10 +rootfs="--initrd=/boot/rootfs-lguest.gz" 8.11 +[ -n "$1" ] && rootfs="--block=$1 root=/dev/vda2" 8.12 +shift 8.13 + 8.14 +net="--tunnet=192.168.0.1" 8.15 +case "$1" in 8.16 +192*) net="--tunnet=$1"; shift;; 8.17 +esac 8.18 + 8.19 +args="screen=text lang=fr_FR kmap=fr-latin1 sound=noconf" 8.20 +[ -n "$1" ] && args=$@ 8.21 + 8.22 +/sbin/modprobe lg 8.23 +/usr/bin/lguest 512 /boot/vmlinuz-2.6.25.5-lguest \ 8.24 + $net $rootfs $args > /dev/$tty < /dev/$tty 2>&1
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/mirror-tools/usr/share/mirror-host/boot/shellinabox.sh Thu Feb 24 01:03:48 2011 +0000 9.3 @@ -0,0 +1,107 @@ 9.4 +#!/bin/sh 9.5 + 9.6 +services="/ /reset /reboot /ssh" 9.7 + 9.8 +mkexe() 9.9 +{ 9.10 +exe=$0 9.11 +while true; do 9.12 + cd $(dirname $exe) 9.13 + exe=$(basename $exe) 9.14 + [ -L $exe ] || break 9.15 + exe=$(readlink $exe) 9.16 +done 9.17 +echo $(pwd)/$exe 9.18 +} 9.19 +exe=$(mkexe) 9.20 + 9.21 +services_arg() 9.22 +{ 9.23 +for i in $services ; do 9.24 + echo -n "-s '$i:root:root:/tmp:LINES=25 /bin/sh -c \"$exe service $i " 9.25 + echo -n "\${peer} \${url} \${columns} \${lines}\"' " 9.26 +done 9.27 +} 9.28 + 9.29 +launch_ssh() 9.30 +{ 9.31 + # Get SSH server 9.32 + server="" 9.33 + echo -n "SSH server: " 9.34 + read -t 300 server || exit 1 9.35 + [ -n "$server" ] || exit 1 9.36 + 9.37 + # Allow non default SSH port with format server:port 9.38 + sshport="" 9.39 + case "$server" in 9.40 + *:*) sshport="-p ${server#*:}" 9.41 + server=${server%:*};; 9.42 + esac 9.43 + 9.44 + # heading ! in server name means open remote ssh port with a knock sequence 9.45 + if [ -x /usr/bin/knock ]; then 9.46 + case "$server" in 9.47 + !*) server=${server#*!} 9.48 + echo -n "Knock sequence (port[:proto]...): " 9.49 + read -t 30 sequence && knock ${server#*@} $sequence 9.50 + esac 9.51 + fi 9.52 + 9.53 + # Get SSH user if missing 9.54 + case "$server" in 9.55 + *@*) ;; 9.56 + *) echo -n "$server login: " 9.57 + read -t 30 user || exit 1 9.58 + server="$user@$server";; 9.59 + esac 9.60 + 9.61 + # Launch OpenSSH or Dropbear 9.62 + sshargs="-oPreferredAuthentications=keyboard-interactive,password -oNoHostAuthenticationForLocalhost=yes -oLogLevel=FATAL -F/dev/null"; 9.63 + [ -L /usr/bin/ssh ] && sshargs="" 9.64 + exec ssh $sshport $sshargs $server 9.65 +} 9.66 + 9.67 +auth() 9.68 +{ 9.69 + while read host md5 ; do 9.70 + [ "${host#*.}" == "${1#*.}" ] && break 9.71 + done < $(dirname $exe)/shellinabox.secrets 9.72 + echo -n "$host password: " 9.73 + read -s -t 30 password || exit 1 9.74 + [ "$(echo $password | md5sum)" == "$md5 -" ] || exit 1 9.75 + echo "" 9.76 +} 9.77 + 9.78 +pidfile=/var/run/shellinaboxd.pid 9.79 +case "$1" in 9.80 +service) 9.81 + host=$(echo $4 | sed 's/.*\/\/\(.*\):.*/\1/') 9.82 + tty=$(awk "/$host/ { print \$2 }" /etc/inittab) 9.83 + vm=$(awk "/$host/ { print \$3 }" /etc/inittab) 9.84 + [ -n "$vm" ] || exit 1 9.85 + case "$2" in 9.86 + /) 9.87 + auth $host 9.88 + exec /usr/bin/conspy ${tty#tty} ;; 9.89 + /reboot) 9.90 + auth $host 9.91 + echo -n "Sure to reboot $host now (YES or NO) ?" 9.92 + read -t 30 answer || exit 1 9.93 + case "$answer" in 9.94 + YES*) ;; 9.95 + *) exit 1;; 9.96 + esac 9.97 + exec /bin/kill $(ps ww | grep $vm | awk '/lguest/ { printf "%s ",$1 }') ;; 9.98 + /ssh) 9.99 + auth $host 9.100 + launch_ssh ;; 9.101 + esac 9.102 + ;; 9.103 +start) 9.104 + dir=$(dirname $exe) 9.105 + eval shellinaboxd --background=$pidfile --cert=/boot/cert $(services_arg) 9.106 + ;; 9.107 +stop) 9.108 + [ -s $pidfile ] && kill $(cat $pidfile) 9.109 + ;; 9.110 +esac
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz Thu Feb 24 01:03:48 2011 +0000 10.3 @@ -0,0 +1,16 @@ 10.4 +<VirtualHost *:80> 10.5 + ServerName mirror.slitaz.org 10.6 + ServerAlias *.slitaz.org 10.7 + <IfModule mod_proxy.c> 10.8 + ProxyPreserveHost On 10.9 + ProxyRequests Off 10.10 + ProxyTimeout 600 10.11 + <Proxy *> 10.12 + Order deny,allow 10.13 + Allow from all 10.14 + </Proxy> 10.15 + ProxyPass / http://192.168.0.6/ 10.16 + ProxyPassReverse / http://192.168.0.6/ 10.17 + </IfModule> 10.18 +</VirtualHost> 10.19 +
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl Thu Feb 24 01:03:48 2011 +0000 11.3 @@ -0,0 +1,20 @@ 11.4 +<VirtualHost *:443> 11.5 + SSLProxyEngine On 11.6 + SSLEngine On 11.7 + ServerName mirror.slitaz.org:443 11.8 + ServerAlias *.slitaz.org 11.9 + SSLCertificateFile /etc/ssl/apache/slitaz.org.pem 11.10 + SSLCertificateKeyFile /etc/ssl/apache/slitaz.org.pem 11.11 + <IfModule mod_proxy.c> 11.12 + ProxyPreserveHost On 11.13 + ProxyRequests Off 11.14 + ProxyTimeout 600 11.15 + <Proxy *> 11.16 + Order deny,allow 11.17 + Allow from all 11.18 + </Proxy> 11.19 + ProxyPass / http://192.168.0.6/ 11.20 + ProxyPassReverse / http://192.168.0.6/ 11.21 + </IfModule> 11.22 +</VirtualHost> 11.23 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/mirror-tools/usr/share/mirror-host/etc/init.d/shellinabox Thu Feb 24 01:03:48 2011 +0000 12.3 @@ -0,0 +1,1 @@ 12.4 +/boot/shellinabox.sh/pics/rrd/cpu-year.pnggngg 12.5 \ No newline at end of file
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/mirror-tools/usr/share/mirror-host/install Thu Feb 24 01:03:48 2011 +0000 13.3 @@ -0,0 +1,25 @@ 13.4 +#!/bin/sh 13.5 + 13.6 +grep -qs lguest-slitaz /etc/inittab || { 13.7 +sed -i 's|^tty1::|tty16::respawn:/boot/lguest-slitaz tty16 /boot/guests/mirror.slitaz.org 192.168.0.1\n&|' /etc/inittab 13.8 +cat >> /etc/init.d/local.sh <<EOT 13.9 +. /etc/network.conf 13.10 +iptables -t nat -A POSTROUTING -o $INTERFACE -j MASQUERADE 13.11 +for port in 22 873 ; do 13.12 + iptables -t nat -A PREROUTING -i $INTERFACE --dport $port \ 13.13 + -j DNAT --to-destination 192.168.0.6:$port 13.14 +done 13.15 +for port in 80 443 ; do 13.16 + iptables -A INPUT -p tcp -m tcp --dport $port -j ACCEPT 13.17 +done 13.18 +for iface in tap+ ; do 13.19 + iptables -A INPUT -i $iface -j ACCEPT 13.20 + iptables -A OUTPUT -o $iface -j ACCEPT 13.21 + iptables -A FORWARD -i $iface -m state \ 13.22 + --state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT 13.23 + iptables -A FORWARD -o $iface -m state \ 13.24 + --state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT 13.25 +done 13.26 +echo "1" > /proc/sys/net/ipv4/ip_forward 13.27 +EOT 13.28 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/mirror-tools/usr/share/rrd/makegraphs Thu Feb 24 01:03:48 2011 +0000 14.3 @@ -0,0 +1,299 @@ 14.4 +#!/bin/sh 14.5 +#*/5 * * * * /usr/share/rrd/makegraphs >/dev/null 14.6 + 14.7 +# RRD database directory 14.8 +rrdlog="/var/spool/rrd" 14.9 + 14.10 +# Images directory 14.11 +rrdgraph="/var/spool/rrd" 14.12 + 14.13 +# Colors 14.14 +#rrdcolors="--color SHADEA#EAE9EE --color SHADEB#EAE9EE --color BACK#EAE9EE" 14.15 +rrdcolors="--color SHADEA#FFFFFF --color SHADEB#FFFFFF --color BACK#FFFFFF" 14.16 +rrdgraphargs="-aPNG -i -z --alt-y-grid -w 600 -h 100 -r $rrdcolors" 14.17 + 14.18 +[ -d $rrdlog ] || mkdir -p $rrdlog 14.19 +[ -d $rrdgraph ] || mkdir -p $rrdgraph 14.20 + 14.21 +updatecpudata() { 14.22 + [ -e "$rrdlog/cpu.rrd" ] || rrdtool create $rrdlog/cpu.rrd --step=300 \ 14.23 + DS:user:COUNTER:600:0:500000000 \ 14.24 + DS:system:COUNTER:600:0:500000000 \ 14.25 + DS:idle:COUNTER:600:0:500000000 \ 14.26 + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ 14.27 + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 14.28 + grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do 14.29 + rrdtool update $rrdlog/cpu.rrd -t user:system:idle \ 14.30 + N:$(( $user + $nice )):$system:$idle 14.31 + break 14.32 + done 14.33 + 14.34 + [ -e "$rrdlog/cpu2.rrd" ] && 14.35 + grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do 14.36 + rrdtool update $rrdlog/cpu2.rrd -t nice:user:system:idle \ 14.37 + N:$nice:$user:$system:$idle 14.38 + break 14.39 + done 14.40 +} 14.41 + 14.42 +updatecpugraph() { 14.43 + period=$1 14.44 + info="$(grep '^model name' /proc/cpuinfo | cut -d: -f2 | head -1)" 14.45 + rrdtool graph "$rrdgraph/cpu-$period.png" --start -1$period \ 14.46 + $rrdgraphargs -l 0 -u 100 -t "cpu usage per $period [$info ]" \ 14.47 + DEF:user=$rrdlog/cpu.rrd:user:AVERAGE \ 14.48 + DEF:system=$rrdlog/cpu.rrd:system:AVERAGE \ 14.49 + DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE \ 14.50 + 'CDEF:total=user,system,idle,+,+' \ 14.51 + 'CDEF:userpct=100,user,total,/,*' \ 14.52 + 'CDEF:systempct=100,system,total,/,*' \ 14.53 + 'CDEF:idlepct=100,idle,total,/,*' \ 14.54 + 'AREA:userpct#0000FF:user cpu usage' \ 14.55 + 'STACK:systempct#FF0000:system cpu usage' \ 14.56 + 'STACK:idlepct#00FF00:idle cpu usage\j' 14.57 +} 14.58 + 14.59 + 14.60 +updatememgraph() { 14.61 + period=$1 14.62 + info="$(free | awk '\ 14.63 +{ \ 14.64 + if (/Mem:/) { \ 14.65 + if ($2 < 10000) printf "%d KB",$2; \ 14.66 + else if ($2 < 10000000) printf "%d MB",$2/1024; \ 14.67 + else printf "%d GB",$2/1024/1024; \ 14.68 + } \ 14.69 +}')" 14.70 + info2="$(free | awk '\ 14.71 +{ \ 14.72 + if (/Swap:/) { \ 14.73 + if ($2 < 10000) printf "%d KB",$2; \ 14.74 + else if ($2 < 10000000) printf "%d MB",$2/1024; \ 14.75 + else printf "%d GB",$2/1024/1024; \ 14.76 + } \ 14.77 +}')" 14.78 + rrdtool graph "$rrdgraph/memory-$period.png" --start -1$period \ 14.79 + $rrdgraphargs -l 0 -u 100 \ 14.80 + -t "memory usage per $period [ $info + $info2 swap ]" \ 14.81 + DEF:used=$rrdlog/mem.rrd:memused:AVERAGE \ 14.82 + DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE \ 14.83 + DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE \ 14.84 + DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE \ 14.85 + DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE \ 14.86 + DEF:swused=$rrdlog/mem.rrd:swapused:AVERAGE \ 14.87 + DEF:swfree=$rrdlog/mem.rrd:swapfree:AVERAGE \ 14.88 + 'CDEF:total=used,free,+' \ 14.89 + 'CDEF:used2=used,buffer,cache,shared,+,+,-' \ 14.90 + 'CDEF:usedpct=100,used2,total,/,*' \ 14.91 + 'CDEF:sharedpct=100,shared,total,/,*' \ 14.92 + 'CDEF:bufferpct=100,buffer,total,/,*' \ 14.93 + 'CDEF:cachepct=100,cache,total,/,*' \ 14.94 + 'CDEF:freepct=100,free,total,/,*' \ 14.95 + 'CDEF:swtotal=swused,swfree,+' \ 14.96 + 'CDEF:swusedpct=100,swused,swtotal,/,*' \ 14.97 + 'AREA:usedpct#0000FF:used memory' \ 14.98 + 'STACK:sharedpct#FF7F00:shared memory' \ 14.99 + 'STACK:bufferpct#FF00FF:buffered memory' \ 14.100 + 'STACK:cachepct#FFFF00:cached memory' \ 14.101 + 'STACK:freepct#00FF00:free memory' \ 14.102 + 'LINE2:swusedpct#FF0000:used swap\j' 14.103 +} 14.104 + 14.105 +updatememdata () { 14.106 + [ -e "$rrdlog/mem.rrd" ] || 14.107 + rrdtool create "$rrdlog/mem.rrd" --step=300 \ 14.108 + DS:memused:ABSOLUTE:600:0:5000000000 \ 14.109 + DS:memfree:ABSOLUTE:600:0:5000000000 \ 14.110 + DS:memshared:ABSOLUTE:600:0:5000000000 \ 14.111 + DS:membuffers:ABSOLUTE:600:0:5000000000 \ 14.112 + DS:memcache:ABSOLUTE:600:0:5000000000 \ 14.113 + DS:swapused:ABSOLUTE:600:0:5000000000 \ 14.114 + DS:swapfree:ABSOLUTE:600:0:5000000000 \ 14.115 + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ 14.116 + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 14.117 + 14.118 + while read tag count unit; do 14.119 + case "$tag" in 14.120 + MemTotal:) memtotal=$(($count * 1024));; 14.121 + MemFree:) memfree=$(($count * 1024)) 14.122 + memused=$(($memtotal - $memfree)) 14.123 + memshared=0;; 14.124 + MemShared:) memshared=$(($count * 1024));; 14.125 + Buffers:) membuffers=$(($count * 1024));; 14.126 + Cached:) memcache=$(($count * 1024));; 14.127 + SwapTotal:) swaptotal=$(($count * 1024));; 14.128 + SwapFree:) swapfree=$(($count * 1024)) 14.129 + swapused=$(( $swaptotal - $swapfree));; 14.130 + esac 14.131 + done < /proc/meminfo 14.132 + 14.133 + rrdtool update "$rrdlog/mem.rrd" \ 14.134 + -t memused:memfree:memshared:membuffers:memcache:swapused:swapfree \ 14.135 + "N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree" 14.136 +} 14.137 + 14.138 +getmax() { 14.139 + rrdtool fetch $rrdlog/$1.rrd AVERAGE | awk '\ 14.140 +BEGIN {max=0} \ 14.141 +/^[0-9]/ { \ 14.142 + if ($2 != "nan" && $2 > max) max=$2; \ 14.143 + if ($3 != "nan" && $3 > max) max=$3; \ 14.144 +} \ 14.145 +END { print max }' | sed 's/,/./' 14.146 +} 14.147 + 14.148 +updatediskgraph() { 14.149 + period=$1 14.150 + [ "$period" == "day" ] && maxdisk="$(getmax disk)" 14.151 + info="" 14.152 + [ -r $2 ] && 14.153 + info="[ $(fdisk -l | grep "^Disk $2:" | \ 14.154 + sed "s|Disk $2: \(.*\), .*|\1|") ]" 14.155 + rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \ 14.156 + $rrdgraphargs -t "disk access per $period $info" \ 14.157 + --logarithmic --lower-limit 1 -v "Sectors/second" --units=si \ 14.158 + DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \ 14.159 + DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \ 14.160 + DEF:req=$rrdlog/iodisk.rrd:req:AVERAGE \ 14.161 + DEF:done=$rrdlog/iodisk.rrd:done:AVERAGE \ 14.162 + DEF:err=$rrdlog/iodisk.rrd:err:AVERAGE \ 14.163 + "CDEF:readpct=100,read,$maxdisk,/,*" \ 14.164 + "CDEF:writepct=100,write,$maxdisk,/,*" \ 14.165 + "CDEF:errpct=100,err,req,/,*" \ 14.166 + "CDEF:donepct=100,done,req,/,*" \ 14.167 + 'AREA:readpct#0000FF:sectors read from disk' \ 14.168 + 'STACK:writepct#00FF00:sectors written to disk' \ 14.169 + 'LINE2:donepct#FFFF00:I/O complete' \ 14.170 + 'LINE2:errpct#FF0000:I/O error\j' 14.171 +} 14.172 + 14.173 +updatediskdata() { 14.174 + dev=$1 14.175 + [ -e "$rrdlog/disk.rrd" ] || 14.176 + rrdtool create "$rrdlog/disk.rrd" --step=300 \ 14.177 + DS:readsect:COUNTER:600:0:5000000000 \ 14.178 + DS:writesect:COUNTER:600:0:5000000000 \ 14.179 + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ 14.180 + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 14.181 + [ -e "$rrdlog/iodisk.rrd" ] || 14.182 + rrdtool create "$rrdlog/iodisk.rrd" --step=300 \ 14.183 + DS:done:GAUGE:600:0:U DS:err:GAUGE:600:0:U \ 14.184 + DS:req:GAUGE:600:0:U \ 14.185 + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ 14.186 + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 14.187 + 14.188 + while read major minor name readreq readsect writereq writesect misc; do 14.189 + [ $major = $(( 0x$(stat -c %t $dev) )) ] || continue 14.190 + [ $minor = $(( 0x$(stat -c %T $dev) )) ] || continue 14.191 + rrdtool update "$rrdlog/disk.rrd" -t readsect:writesect \ 14.192 + N:$readsect:$writesect 14.193 + done < /proc/diskstats 14.194 + dir=/sys/block/${dev#/dev/}/device 14.195 + done=$(printf "%d\n" $(cat $dir/iodone_cnt 2> /dev/null) ) 14.196 + err=$(printf "%d\n" $(cat $dir/ioerr_cnt 2> /dev/null) ) 14.197 + req=$(printf "%d\n" $(cat $dir/iorequest_cnt 2> /dev/null) ) 14.198 + rrdtool update "$rrdlog/iodisk.rrd" -t done:err:req N:$done:$err:$req 14.199 +} 14.200 + 14.201 +updateifgraph() { 14.202 + interface=$1 14.203 + period=$2 14.204 + [ "$period" == "day" ] && maxif="$(getmax $interface)" 14.205 + rrdtool graph "$rrdgraph/$interface-$period.png" --start -1$period \ 14.206 + $rrdgraphargs -t "traffic on $interface graph per $period" \ 14.207 + --logarithmic -A -v "Bytes/second" --units=si \ 14.208 + DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE \ 14.209 + DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE \ 14.210 + "CDEF:inpct=100,incoming,$maxif,/,*" \ 14.211 + "CDEF:outpct=100,outgoing,$maxif,/,*" \ 14.212 + 'AREA:inpct#00FF00:incoming traffic' \ 14.213 + 'LINE1:outpct#0000FF:outgoing traffic\j' 14.214 +} 14.215 + 14.216 +netframes() { 14.217 +ifconfig $1 | grep "$2 packets" | sed -re "s/.*$3:([0-9]+).*/\1/g" 14.218 +} 14.219 + 14.220 +netstats() { 14.221 +ifconfig $1 | grep bytes | sed -re "s/.*$2 bytes:([0-9]+).*/\1/g" 14.222 +} 14.223 + 14.224 +updateifdata() { 14.225 + interface=$1 14.226 + [ -e "$rrdlog/$interface.rrd" ] || 14.227 + rrdtool create "$rrdlog/$interface.rrd" --step=300 \ 14.228 + DS:incoming:COUNTER:600:0:U \ 14.229 + DS:outgoing:COUNTER:600:0:U \ 14.230 + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ 14.231 + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 14.232 + [ -e "$rrdlog/packets-$interface.rrd" ] || 14.233 + rrdtool create "$rrdlog/packets-$interface.rrd" --step=300 \ 14.234 + DS:in:COUNTER:600:0:U DS:out:COUNTER:600:0:U \ 14.235 + DS:inerr:COUNTER:600:0:U DS:outerr:COUNTER:600:0:U \ 14.236 + DS:indrop:COUNTER:600:0:U DS:outdrop:COUNTER:600:0:U \ 14.237 + DS:inov:COUNTER:600:0:U DS:outov:COUNTER:600:0:U \ 14.238 + DS:frame:COUNTER:600:0:U DS:carrier:COUNTER:600:0:U \ 14.239 + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ 14.240 + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 14.241 + rx=$(netstats $interface RX) 14.242 + tx=$(netstats $interface TX) 14.243 + rrdtool update "$rrdlog/$interface.rrd" -t incoming:outgoing \ 14.244 + N:${rx:-U}:${tx:-U} 14.245 + rx=$(netframes $interface RX packets) 14.246 + tx=$(netframes $interface TX packets) 14.247 + rxerr=$(netframes $interface RX errors) 14.248 + txerr=$(netframes $interface TX errors) 14.249 + rxdrop=$(netframes $interface RX dropped) 14.250 + txdrop=$(netframes $interface TX dropped) 14.251 + rxov=$(netframes $interface RX overruns) 14.252 + txov=$(netframes $interface TX overruns) 14.253 + frame=$(netframes $interface RX frame) 14.254 + carrier=$(netframes $interface TX carrier) 14.255 + rrdtool update "$rrdlog/packets-$interface.rrd" \ 14.256 + -t in:out:inerr:outerr:indrop:outdrop:inov:outov:frame:carrier \ 14.257 + N:${rx:-U}:${tx:-U}:${rxerr:-U}:${txerr:-U}:${rxdrop:-U}:${txdrop:-U}:${rxov:-U}:${txov:-U}:${frame:-U}:${carrier:-U} 14.258 +} 14.259 + 14.260 +getdisk() 14.261 +{ 14.262 + local d 14.263 + local i 14.264 + d=$(stat -c %D $1) 14.265 + for i in /dev/* ; do 14.266 + [ $(stat -c "%02t%02T" $i) == $d ] || continue 14.267 + echo $i 14.268 + break 14.269 + done 14.270 +} 14.271 + 14.272 +### 14.273 +### System graphs 14.274 +### 14.275 + 14.276 +updatecpudata 14.277 +updatecpugraph day 14.278 +updatecpugraph week 14.279 +updatecpugraph month 14.280 +updatecpugraph year 14.281 + 14.282 +updatememdata 14.283 +updatememgraph day 14.284 +updatememgraph week 14.285 +updatememgraph month 14.286 +updatememgraph year 14.287 + 14.288 +if [ -e /proc/diskstats ]; then 14.289 + disk=$(getdisk $0) 14.290 + updatediskdata $disk 14.291 + updatediskgraph day ${disk:0:8} 14.292 + updatediskgraph week ${disk:0:8} 14.293 + updatediskgraph month ${disk:0:8} 14.294 + updatediskgraph year ${disk:0:8} 14.295 +fi 14.296 + 14.297 +iface=$(/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }') 14.298 +updateifdata $iface 14.299 +updateifgraph $iface day 14.300 +updateifgraph $iface week 14.301 +updateifgraph $iface month 14.302 +updateifgraph $iface year
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/mirror-tools/usr/share/slitaz-live/INSTALL Thu Feb 24 01:03:48 2011 +0000 15.3 @@ -0,0 +1,14 @@ 15.4 +#!/bin/sh 15.5 +DIR=$(dirname $0) 15.6 +MOUNTS="/proc /sys /dev/pts /dev/shm" 15.7 +cp /etc/resolv.conf etc 15.8 +for i in $MOUNTS; do 15.9 + [ -d $i ] && mount --bind $i $DIR/$i 15.10 +done 15.11 +#mount --bind /var/tmp tmp 15.12 +mount --bind /tmp tmp || mount -t tmpfs tmpfs tmp 15.13 +SHELL=/bin/ash chroot $DIR /bin/ash - 15.14 +umount tmp 15.15 +for i in $MOUNTS; do 15.16 + umount $DIR/$i 15.17 +done