# HG changeset patch # User Christopher Rogers # Date 1298512761 0 # Node ID e0a09d90b2cb4380f8cf8bea557f88fe749c2341 # Parent b788a1c8e19d83864574f3423ae5faab6c800093 Moved everthing that should be in root (/) into rootfs folder in mirror-tools. diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/etc/lighttpd/vhosts.conf --- a/mirror-tools/etc/lighttpd/vhosts.conf Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -# /etc/lighttpd/vhosts.conf : Virtual hosts configuration file. -# - -# Example.org -# -#$HTTP["host"] =~ "(^|\.)example\.org$" { - #server.document-root = "/var/www/vhost/exemple.com/html" - #server.errorlog = "/var/log/lighttpd/example.org-error.log" - #accesslog.filename = "/var/log/lighttpd/example.org-access.log" -#} - -# mirror.slitaz.org (Server canonical hostname) -# -$HTTP["host"] =~ "^mirror([0-9]*)\.slitaz\.org$" { - server.document-root = "/var/www/slitaz/mirror" - server.errorlog = "/var/log/lighttpd/mirror.slitaz.org-error.log" - accesslog.filename = "/var/log/lighttpd/mirror.slitaz.org-access.log" - - include "awstats.conf" - - alias.url += ( "/info" => "/var/www/mirror-info/" ) - - alias.url += ( "/pizza" => "/var/www/pizza/" ) - - alias.url += ( "/doc" => "/var/www/doc/" ) - var.dokudir = "/doc" - # Rewrites for dokuwiki - url.rewrite = ( - "^" + var.dokudir + "/lib/.*$" => "$0", - "^" + var.dokudir + "/_media/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1&$2", - "^" + var.dokudir + "/_media/(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1", - "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2", - "^" + var.dokudir + "/_detail/(.*)?$" => var.dokudir + "/lib/exe/detail.php?media=$1", - "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3", - "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2", - "^" + var.dokudir + "/doku.php.*" => "$0", - "^" + var.dokudir + "/feed.php.*" => "$0", - "^" + var.dokudir + "/(.*)\?(.*)" => var.dokudir + "/doku.php?id=$1&$2", - "^" + var.dokudir + "/(.*)" => var.dokudir + "/doku.php?id=$1" - ) - - alias.url += ( "/webboot" => "/var/www/boot/" ) - - alias.url += ( "/pkgs" => "/var/www/pkgs/" ) - index-file.names += ( "search.sh" ) - cgi.assign += ( - ".sh" => "/bin/sh" - ) - - alias.url += ( "/hg" => "/var/www/hg/" ) -### url.rewrite-once = ( "/hg(.*)" => "/hg/hgwebdir.py$1" ) - index-file.names += ( "hgwebdir.py" ) - cgi.assign += ( - ".py" => "/usr/bin/python" - ) - - alias.url += ( "/www" => "/home/slitaz/website" ) - -# alias.url += ( "/tiny" => "/var/www/pizza/tiny/demos/192.168.0.6/var/www" ) -# index-file.names += ( "index.sh" ) - - index-file.names += ( "index.html" ) - index-file.names += ( "index.php" ) - # Last but not least... - index-file.names += ( "/dir-generator.php" ) -} - -## info.mirror.slitaz.org -## -#$HTTP["host"] =~ "^info\.mirror\.slitaz\.org$" { -# server.document-root = "/var/www/mirror-info/" -# server.errorlog = "/var/log/lighttpd/info.mirror.slitaz.org-error.log" -# accesslog.filename = "/var/log/lighttpd/info.mirror.slitaz.org-access.log" -# include "awstats.conf" -#} - -$HTTP["host"] =~ "ajaxterm\.slitaz\.org$" { - proxy.server = ( "/" => - ( ( "host" => "127.0.0.1", "port" => 8022 ) ) - ) -} - -# pizza.slitaz.org (Server canonical hostname) -# -$HTTP["host"] =~ "^pizza\.slitaz\.org$" { - server.document-root = "/var/www/pizza" - server.errorlog = "/var/log/lighttpd/pizza.slitaz.org-error.log" - accesslog.filename = "/var/log/lighttpd/pizza.slitaz.org-access.log" - include "awstats.conf" - index-file.names += ( "index.php" ) -} - -# slitaz.org -# -#$HTTP["host"] =~ "(^|www\.)slitaz\.org$" { -$HTTP["host"] =~ "www\.slitaz\.org$" { - server.document-root = "/home/slitaz/website" - server.errorlog = "/var/log/lighttpd/slitaz.org-error.log" - accesslog.filename = "/var/log/lighttpd/slitaz.org-access.log" - include "awstats.conf" - -### index-file.names = ( "index.html" ) - index-file.names += ( "start.html" ) - - -### url.rewrite-once = ( -### "^/about" => "/fr/about", -### "^/artwork" => "/fr/artwork", -### "^/devel" => "/fr/devel", -### "^/doc" => "/fr/doc", -### "^/get" => "/fr/get", -### "^/packages" => "/fr/packages" -### ) - -} - -# doc.slitaz.org -# -$HTTP["host"] =~ "doc\.slitaz\.org$" { - server.document-root = "/var/www/doc" - server.errorlog = "/var/log/lighttpd/doc.slitaz.org-error.log" - accesslog.filename = "/var/log/lighttpd/doc.slitaz.org-access.log" - index-file.names = ("doku.php") - var.dokudir = "" - # Rewrites for dokuwiki - url.rewrite = ( - "^" + var.dokudir + "/lib/.*$" => "$0", - "^" + var.dokudir + "/_media/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1&$2", - "^" + var.dokudir + "/_media/(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1", - "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2", - "^" + var.dokudir + "/_detail/(.*)?$" => var.dokudir + "/lib/exe/detail.php?media=$1", - "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3", - "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2", - "^" + var.dokudir + "/doku.php.*" => "$0", - "^" + var.dokudir + "/feed.php.*" => "$0", - "^" + var.dokudir + "/(.*)\?(.*)" => var.dokudir + "/doku.php?id=$1&$2", - "^" + var.dokudir + "/(.*)" => var.dokudir + "/doku.php?id=$1" - ) -} - -# boot.slitaz.org -# -$HTTP["host"] =~ "boot\.slitaz\.org$" { - server.document-root = "/var/www/boot" - server.errorlog = "/var/log/lighttpd/boot.slitaz.org-error.log" - accesslog.filename = "/var/log/lighttpd/boot.slitaz.org-access.log" -} - -# pkgs.slitaz.org -# -$HTTP["host"] =~ "pkgs\.slitaz\.org$" { - server.document-root = "/var/www/pkgs" - server.errorlog = "/var/log/lighttpd/pkgs.slitaz.org-error.log" - accesslog.filename = "/var/log/lighttpd/pkgs.slitaz.org-access.log" - index-file.names += ( "search.sh" ) - cgi.assign = ( - ".sh" => "/bin/sh" - ) -} - -# hg.slitaz.org (Mercurial repos) -# -$HTTP["host"] =~ "hg\.slitaz\.org" { - cgi.assign = ( - ".py" => "/usr/bin/python" - ) - server.document-root = "/var/www/hg" -# url.rewrite-once = ( "(.*)" => "/hgwebdir.py$1" ) - index-file.names += ( "hgwebdir.py" ) -} - -# scn.slitaz.org (SliTaz Community Network) -# -$HTTP["host"] =~ "scn\.slitaz\.org$" { - server.document-root = "/var/www/scn" - server.errorlog = "/var/log/lighttpd/scn.slitaz.org-error.log" - accesslog.filename = "/var/log/lighttpd/scn.slitaz.org-access.log" - url.rewrite-final = ( - "^/system/test/(.*)$" => "/index.php?q=system/test/$1", - "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2", - "^/([^.?]*)$" => "/index.php?q=$1", - "^/rss.xml" => "/index.php?q=rss.xml" - ) -} diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/etc/rsyncd.conf --- a/mirror-tools/etc/rsyncd.conf Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -# rsynd configuration for SliTaz mirror -# -motd file=/etc/rsyncd.motd -log file=/var/log/rsyncd -pid file=/var/run/rsyncd.pid - - -[slitaz] - - comment = SliTaz GNU/Linux mirror - path = /var/www/slitaz/mirror - use chroot = yes - max connections = 5 - lock file = /var/lock/rsyncd - read only = yes - list = yes - uid = nobody - gid = nogroup - strict modes = yes - ignore errors = no - ignore nonreadable = yes - transfer logging = no - timeout = 600 - refuse options = checksum dry-run - dont compress = *.gz *.tgz *.zip *.iso *.bz2 *.tazpkg diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/etc/rsyncd.motd --- a/mirror-tools/etc/rsyncd.motd Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -=============================================================================== - - SliTaz GNU/Linux mirror - http://www.slitaz.org/ - -=============================================================================== - -modules: - - * slitaz --> ISO, packages, boot... all stuff - -=============================================================================== - diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/etc/tazwok.conf.mirror --- a/mirror-tools/etc/tazwok.conf.mirror Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -# tazwok.conf: Tazwok configuration file. -# - -# Wok directory/tree to find receipts and build packages. -# By default on SliTaz the directory is /home/slitaz/wok. -WOK="/slitaz/home/slitaz/wok" - -# The path to the sources tarballs of the binaries packages. -SOURCES_REPOSITORY="/slitaz/home/slitaz/src" - -# This path set the binaries packages repository. It's where all -# the gen *.tazpkg will be stored when using gen-repository command. -PACKAGES_REPOSITORY="/var/www/slitaz/mirror/packages/cooking" - -# Default build host -BUILD_HOST=i486-pc-linux-gnu - -# Default tool prefix -TOOLPREFIX="${BUILD_HOST}-" - -# Default arguments for GNU configure. -CONFIGURE_ARGS="--build=$BUILD_HOST --host=$BUILD_HOST" - -# Translation files to include in packages, note that you can specifiy -# several locale. -LOCALE="fr" - -# Mirrors URLs. To downloads source next from your location. -# GNU mirror : -# -GNU_MIRROR="http://ftpmirror.gnu.org" - -# SourceForge mirror : -# -SF_MIRROR="http://prdownloads.sourceforge.net/sourceforge" - -# Xorg mirror : -# -XORG_MIRROR="ftp://ftp.solnet.ch/mirror/x.org/pub/individual" - -# FSH standards directories with init. Package generation will abort if -# a file is installed in a non-specified path. Note /vz is for OpenVZ. -FSH="bin boot dev etc home init lib media mnt proc root sbin share sys \ -tmp usr var vz usr/bin usr/games usr/include usr/lib usr/local usr/sbin \ -usr/share usr/src" diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/home/backups/mirror/backup.sh --- a/mirror-tools/home/backups/mirror/backup.sh Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -#!/bin/sh - -KEEP=1 -EXTRA="monthly:30:2" -BACKUP_USER=bellard -REMOTE_USER=bellard - -backup_data() -{ -GZIP=rgzip -which $GZIP > /dev/null || GZIP=gzip -echo "Sync doc.slitaz.org ..." -rsync -aH -e "$SSH" --bwlimit=50 \ - $REMOTE_USER@tank.slitaz.org:/home/slitaz/www/doc/data/. /var/www/doc/data/. -while read file dirs; do - echo "Create $file.cpio.gz ..." - ( cd / ; find $dirs | cpio -o -H newc ) | \ - $GZIP -9 > $file.cpio.gz 2> /dev/null -done < "/var/www/mirror-info/" ) + + alias.url += ( "/pizza" => "/var/www/pizza/" ) + + alias.url += ( "/doc" => "/var/www/doc/" ) + var.dokudir = "/doc" + # Rewrites for dokuwiki + url.rewrite = ( + "^" + var.dokudir + "/lib/.*$" => "$0", + "^" + var.dokudir + "/_media/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1&$2", + "^" + var.dokudir + "/_media/(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1", + "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2", + "^" + var.dokudir + "/_detail/(.*)?$" => var.dokudir + "/lib/exe/detail.php?media=$1", + "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3", + "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2", + "^" + var.dokudir + "/doku.php.*" => "$0", + "^" + var.dokudir + "/feed.php.*" => "$0", + "^" + var.dokudir + "/(.*)\?(.*)" => var.dokudir + "/doku.php?id=$1&$2", + "^" + var.dokudir + "/(.*)" => var.dokudir + "/doku.php?id=$1" + ) + + alias.url += ( "/webboot" => "/var/www/boot/" ) + + alias.url += ( "/pkgs" => "/var/www/pkgs/" ) + index-file.names += ( "search.sh" ) + cgi.assign += ( + ".sh" => "/bin/sh" + ) + + alias.url += ( "/hg" => "/var/www/hg/" ) +### url.rewrite-once = ( "/hg(.*)" => "/hg/hgwebdir.py$1" ) + index-file.names += ( "hgwebdir.py" ) + cgi.assign += ( + ".py" => "/usr/bin/python" + ) + + alias.url += ( "/www" => "/home/slitaz/website" ) + +# alias.url += ( "/tiny" => "/var/www/pizza/tiny/demos/192.168.0.6/var/www" ) +# index-file.names += ( "index.sh" ) + + index-file.names += ( "index.html" ) + index-file.names += ( "index.php" ) + # Last but not least... + index-file.names += ( "/dir-generator.php" ) +} + +## info.mirror.slitaz.org +## +#$HTTP["host"] =~ "^info\.mirror\.slitaz\.org$" { +# server.document-root = "/var/www/mirror-info/" +# server.errorlog = "/var/log/lighttpd/info.mirror.slitaz.org-error.log" +# accesslog.filename = "/var/log/lighttpd/info.mirror.slitaz.org-access.log" +# include "awstats.conf" +#} + +$HTTP["host"] =~ "ajaxterm\.slitaz\.org$" { + proxy.server = ( "/" => + ( ( "host" => "127.0.0.1", "port" => 8022 ) ) + ) +} + +# pizza.slitaz.org (Server canonical hostname) +# +$HTTP["host"] =~ "^pizza\.slitaz\.org$" { + server.document-root = "/var/www/pizza" + server.errorlog = "/var/log/lighttpd/pizza.slitaz.org-error.log" + accesslog.filename = "/var/log/lighttpd/pizza.slitaz.org-access.log" + include "awstats.conf" + index-file.names += ( "index.php" ) +} + +# slitaz.org +# +#$HTTP["host"] =~ "(^|www\.)slitaz\.org$" { +$HTTP["host"] =~ "www\.slitaz\.org$" { + server.document-root = "/home/slitaz/website" + server.errorlog = "/var/log/lighttpd/slitaz.org-error.log" + accesslog.filename = "/var/log/lighttpd/slitaz.org-access.log" + include "awstats.conf" + +### index-file.names = ( "index.html" ) + index-file.names += ( "start.html" ) + + +### url.rewrite-once = ( +### "^/about" => "/fr/about", +### "^/artwork" => "/fr/artwork", +### "^/devel" => "/fr/devel", +### "^/doc" => "/fr/doc", +### "^/get" => "/fr/get", +### "^/packages" => "/fr/packages" +### ) + +} + +# doc.slitaz.org +# +$HTTP["host"] =~ "doc\.slitaz\.org$" { + server.document-root = "/var/www/doc" + server.errorlog = "/var/log/lighttpd/doc.slitaz.org-error.log" + accesslog.filename = "/var/log/lighttpd/doc.slitaz.org-access.log" + index-file.names = ("doku.php") + var.dokudir = "" + # Rewrites for dokuwiki + url.rewrite = ( + "^" + var.dokudir + "/lib/.*$" => "$0", + "^" + var.dokudir + "/_media/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1&$2", + "^" + var.dokudir + "/_media/(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1", + "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2", + "^" + var.dokudir + "/_detail/(.*)?$" => var.dokudir + "/lib/exe/detail.php?media=$1", + "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3", + "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2", + "^" + var.dokudir + "/doku.php.*" => "$0", + "^" + var.dokudir + "/feed.php.*" => "$0", + "^" + var.dokudir + "/(.*)\?(.*)" => var.dokudir + "/doku.php?id=$1&$2", + "^" + var.dokudir + "/(.*)" => var.dokudir + "/doku.php?id=$1" + ) +} + +# boot.slitaz.org +# +$HTTP["host"] =~ "boot\.slitaz\.org$" { + server.document-root = "/var/www/boot" + server.errorlog = "/var/log/lighttpd/boot.slitaz.org-error.log" + accesslog.filename = "/var/log/lighttpd/boot.slitaz.org-access.log" +} + +# pkgs.slitaz.org +# +$HTTP["host"] =~ "pkgs\.slitaz\.org$" { + server.document-root = "/var/www/pkgs" + server.errorlog = "/var/log/lighttpd/pkgs.slitaz.org-error.log" + accesslog.filename = "/var/log/lighttpd/pkgs.slitaz.org-access.log" + index-file.names += ( "search.sh" ) + cgi.assign = ( + ".sh" => "/bin/sh" + ) +} + +# hg.slitaz.org (Mercurial repos) +# +$HTTP["host"] =~ "hg\.slitaz\.org" { + cgi.assign = ( + ".py" => "/usr/bin/python" + ) + server.document-root = "/var/www/hg" +# url.rewrite-once = ( "(.*)" => "/hgwebdir.py$1" ) + index-file.names += ( "hgwebdir.py" ) +} + +# scn.slitaz.org (SliTaz Community Network) +# +$HTTP["host"] =~ "scn\.slitaz\.org$" { + server.document-root = "/var/www/scn" + server.errorlog = "/var/log/lighttpd/scn.slitaz.org-error.log" + accesslog.filename = "/var/log/lighttpd/scn.slitaz.org-access.log" + url.rewrite-final = ( + "^/system/test/(.*)$" => "/index.php?q=system/test/$1", + "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2", + "^/([^.?]*)$" => "/index.php?q=$1", + "^/rss.xml" => "/index.php?q=rss.xml" + ) +} diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/etc/rsyncd.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/etc/rsyncd.conf Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,25 @@ +# rsynd configuration for SliTaz mirror +# +motd file=/etc/rsyncd.motd +log file=/var/log/rsyncd +pid file=/var/run/rsyncd.pid + + +[slitaz] + + comment = SliTaz GNU/Linux mirror + path = /var/www/slitaz/mirror + use chroot = yes + max connections = 5 + lock file = /var/lock/rsyncd + read only = yes + list = yes + uid = nobody + gid = nogroup + strict modes = yes + ignore errors = no + ignore nonreadable = yes + transfer logging = no + timeout = 600 + refuse options = checksum dry-run + dont compress = *.gz *.tgz *.zip *.iso *.bz2 *.tazpkg diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/etc/rsyncd.motd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/etc/rsyncd.motd Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,12 @@ +=============================================================================== + + SliTaz GNU/Linux mirror - http://www.slitaz.org/ + +=============================================================================== + +modules: + + * slitaz --> ISO, packages, boot... all stuff + +=============================================================================== + diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/etc/tazwok.conf.mirror --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/etc/tazwok.conf.mirror Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,45 @@ +# tazwok.conf: Tazwok configuration file. +# + +# Wok directory/tree to find receipts and build packages. +# By default on SliTaz the directory is /home/slitaz/wok. +WOK="/slitaz/home/slitaz/wok" + +# The path to the sources tarballs of the binaries packages. +SOURCES_REPOSITORY="/slitaz/home/slitaz/src" + +# This path set the binaries packages repository. It's where all +# the gen *.tazpkg will be stored when using gen-repository command. +PACKAGES_REPOSITORY="/var/www/slitaz/mirror/packages/cooking" + +# Default build host +BUILD_HOST=i486-pc-linux-gnu + +# Default tool prefix +TOOLPREFIX="${BUILD_HOST}-" + +# Default arguments for GNU configure. +CONFIGURE_ARGS="--build=$BUILD_HOST --host=$BUILD_HOST" + +# Translation files to include in packages, note that you can specifiy +# several locale. +LOCALE="fr" + +# Mirrors URLs. To downloads source next from your location. +# GNU mirror : +# +GNU_MIRROR="http://ftpmirror.gnu.org" + +# SourceForge mirror : +# +SF_MIRROR="http://prdownloads.sourceforge.net/sourceforge" + +# Xorg mirror : +# +XORG_MIRROR="ftp://ftp.solnet.ch/mirror/x.org/pub/individual" + +# FSH standards directories with init. Package generation will abort if +# a file is installed in a non-specified path. Note /vz is for OpenVZ. +FSH="bin boot dev etc home init lib media mnt proc root sbin share sys \ +tmp usr var vz usr/bin usr/games usr/include usr/lib usr/local usr/sbin \ +usr/share usr/src" diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/home/backups/mirror/backup.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/home/backups/mirror/backup.sh Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,83 @@ +#!/bin/sh + +KEEP=1 +EXTRA="monthly:30:2" +BACKUP_USER=bellard +REMOTE_USER=bellard + +backup_data() +{ +GZIP=rgzip +which $GZIP > /dev/null || GZIP=gzip +echo "Sync doc.slitaz.org ..." +rsync -aH -e "$SSH" --bwlimit=50 \ + $REMOTE_USER@tank.slitaz.org:/home/slitaz/www/doc/data/. /var/www/doc/data/. +while read file dirs; do + echo "Create $file.cpio.gz ..." + ( cd / ; find $dirs | cpio -o -H newc ) | \ + $GZIP -9 > $file.cpio.gz 2> /dev/null +done < +# Pascal Bellard + +VERSION=0.9 + +PKG_VER=$1 +ROOT=/home/slitaz/iso +REPOS=/var/www/slitaz/mirror/packages/$PKG_VER +SOURCES=/var/www/slitaz/mirror/sources/packages +IFMEM_C32=/var/www/slitaz/mirror/pxe/ifmem.c32 +ISO_DIR=/var/www/slitaz/mirror/iso/$PKG_VER + +[ -s /etc/slitaz/mkpkgiso.conf ] && . /etc/slitaz/mkpkgiso.conf +[ -s ./mkpkgiso.conf ] && . ./mkpkgiso.conf + +SORT_DIR=${ROOT}/_iso.$$ +TEMP_DIR=${ROOT}/_iso.$$ +SORT_FILE=${ROOT}/_sort.$$ +shift +OPTIONS=$@ +PKG_DIR=$TEMP_DIR/packages/$PKG_VER +SRC_DIR=$TEMP_DIR/src +LOG=$PWD/$(basename $0).log + +# +VOLUME_ID="packages-${PKG_VER}" +PUBLISHER="SliTaz http://www.slitaz.org/" +IMAGE="packages-${PKG_VER}.iso" +case " $@ " in +*\ --sources\ *) + IMAGE="sources-${PKG_VER}.iso" ;; +esac +OUTPUT="$ROOT/$IMAGE" + +# Check command line option. +if [ -z $PKG_VER ]; then + cat < + [--boot [--auto-install] [--loram-detect]]|--webboot] [--filter] + [--wok] [--wok-stable] [--website] [--sources] [--dry-run] + $(basename $0) update-hg +Example: +$(basename $0) cooking --boot --auto-install --loram-detect --filter --wok --website --sources +EOT + exit 1 +fi + +# Update hg repos +if [ "$PKG_VER" == "update-hg" ]; then + for i in $1/* ; do + grep -qs '\[paths]' $i/.hg/hgrc || continue + cd $i + hg pull + hg update + cd - > /dev/null + done + exit 1 +fi + +# Check if we provide a valide version +if [ ! -d $REPOS ]; then + echo "Boooh! $PKG_VER is not a valid version." + exit 1 +fi + +# Status function. +status() +{ + local CHECK=$? + echo -en "\\033[70G[ " + if [ $CHECK = 0 ]; then + echo -en "\\033[1;33mOK" + else + echo -en "\\033[1;31mFailed" + fi + echo -e "\\033[0;39m ]" +} + +need() +{ + found=1 + for i in $@ ; do + [ -s $i ] && continue + echo "Missing: $i " + found=0 + done + [ $found -ne 0 ] && return + status + rm -rf $TEMP_DIR $SORT_FILE + exit 1 +} + +# Create temp directory +mkdir -p $TEMP_DIR/packages/$PKG_VER +which genisoimage > /dev/null || need /usr/bin/genisoimage + +# Prepare evrything for ISO + +echo "" +echo "Building ISO for packages $PKG_VER" +echo "===============================================================================" +echo -n "Creating working dir $(basename $TEMP_DIR)" +status +echo -n "Creating symlink" +status + +# Link every packages to temp dir +cd $PKG_DIR +for i in $REPOS/* +do + ln -s $i >> $LOG 2>&1 +done + +echo -n "Creating install script" +# Create install script as suggested by Pascal. +cat >$TEMP_DIR/install.sh< /dev/null + mount --bind /mnt /cdrom + fi + # Handle loram on hybrid hard disk / usb key case + if [ ! -d /usr/bin ]; then + echo "" + if [ -d /.usr.rw ]; then + echo -n "Mounting /usr read-write... " + usr=.usr.ro + else + echo -n "Mounting /usr read-only... " + usr=usr + fi + FS=\$DIR/usr.cromfs + if [ -f \$FS ]; then + /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other + elif [ -f \$DIR/usr.sqfs ]; then + FS=\$DIR/usr.sqfs + mount -o loop,ro -t squashfs \$FS /\$usr + elif [ -L /\$usr ]; then + FS=\$DIR/usr + fi + status + if [ -d /.usr.rw ]; then + if [ -x /bin/funionfs ]; then + /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr + else + /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr + fi + fi + fi +fi + +[ -d /var/cache/tazpkg ] || mkdir -p /var/cache/tazpkg +ls -d \$DIR/packages/* > /var/lib/tazpkg/mirror +ln -fs \$DIR/packages/*/*.tazpkg /var/cache/tazpkg/ +ln -fs \$DIR/packages/*/packages.* /var/lib/tazpkg +echo "" +echo "=> all $PKG_VER packages are available for tazpkg/tazpkgbox" +EOF +[ -e files.list.lzma ] && cat >>$TEMP_DIR/install.sh< $SORT_FILE <> $SORT_FILE +chmod 755 $TEMP_DIR/install.sh + +case " $OPTIONS " in +*\ --filter\ *) + SIZE=0 + for i in *.tazpkg; do + while read f; do + case "$i" in + $f*) continue 2;; + esac + done < packages.list + echo -n "Filter out $i ($(du -hs $(readlink $i) | awk '{ print $1 }'))..." + SIZE=$(( $SIZE + $(stat -c %s $(readlink $i)) )) + rm $i + status + done + UNIT=" bytes" + if [ $SIZE -gt 10240 ]; then + SIZE=$(( $SIZE / 1024 )) + UNIT="K" + fi + if [ $SIZE -gt 10240 ]; then + SIZE=$(( $SIZE / 1024 )) + UNIT="M" + fi + echo "$SIZE$UNIT removed.";; +esac + +# Copy hg subtree +get_from_hg() +{ +echo -n "Adding $2" +if [ -s /home/slitaz/$1/.hg/hgrc ]; then + cp -a /home/slitaz/$1 $TEMP_DIR +else + wget -q -O - http://hg.slitaz.org/$1/archive/tip.tar.bz2 | tar xjf - -C $TEMP_DIR + mv $TEMP_DIR/$1-* $TEMP_DIR/$1 +fi +status +echo "$(du -hs $TEMP_DIR/$1 | awk '{ print $1 }') used by $2." +} + +for i in $OPTIONS ; do +case "$i" in +--wok) + cat >>$TEMP_DIR/install.sh< Wok (cooking) is in /home/slitaz/wok" +EOF + if get_from_hg wok "wok (cooking)"; then + echo "$SORT_DIR/wok -8000" >> $SORT_FILE + fi;; +--wok-stable) + cat >>$TEMP_DIR/install.sh< Wok (stable) is in /home/slitaz/wok" +EOF + if get_from_hg wok-stable "wok (stable)"; then + mv $TEMP_DIR/wok-stable $TEMP_DIR/wok + echo "$SORT_DIR/wok -8000" >> $SORT_FILE + fi;; +--website) + if get_from_hg website "web site"; then + echo "$SORT_DIR/website -6000" >> $SORT_FILE + cat >>$TEMP_DIR/install.sh< slitaz web site installed in file://\$DIR/website/index.html" +EOF + fi;; +--sources) + echo -n "Removing previous ISO..." + rm -f $OUTPUT + status + cat >>$TEMP_DIR/install.sh< sources are in /home/slitaz/src" +EOF + mkdir -p $SRC_DIR + cd $SRC_DIR + for i in $SOURCES/*/* + do + case "$i" in + */md5sum) continue;; + esac + ln -s $i >> $LOG 2>&1 + done + find * -not -type d | grep -v md5sum | xargs md5sum > md5sum + echo "$(du -hs $SOURCES | awk '{ print $1 }') used by sources." ;; +esac +done + +# Extract boot package function +extract_boot() +{ +f=$(ls $REPOS/$1-[0-9]*.tazpkg 2> /dev/null) +[ -f "$f" ] || return 1 +[ -d $TEMP_DIR/boot ] || mkdir $TEMP_DIR/boot +( cd $TEMP_DIR/boot ; cpio -i fs.cpio.gz < $f 2> /dev/null ) +( cd $TEMP_DIR/boot ; zcat fs.cpio.gz | cpio -id 2> /dev/null ) +mv $TEMP_DIR/boot/fs/boot/* $TEMP_DIR/boot +rm -rf $TEMP_DIR/boot/fs.cpio.gz $TEMP_DIR/boot/fs +return 0 +} + +# Gen boot part +BOOT_OPT="" +iso=$ISO_DIR/slitaz-$PKG_VER.iso +for i in slitaz-loram-cdrom-sqfs slitaz-$PKG_VER-loram-cdrom ; do + isoloram=$ISO_DIR/flavors/$i.iso + [ -s $isoloram ] && break +done +case " $OPTIONS " in +*\ --boot\ *) + echo -n "Creating boot tree" + need $iso + which isoinfo > /dev/null || need /usr/bin/isoinfo + isoinfo -R -l -i $iso | awk '/^Directory/ { path=$4 } /^-/ { print path$12 }' | while read file; do + [ "$(basename $file)" == ".." ] && continue + [ "$file" = "/boot/isolinux/boot.cat" ] && continue + [ -d "$(dirname $TEMP_DIR/$file)" ] || + mkdir -p "$(dirname $TEMP_DIR/$file)" + isoinfo -R -x "$file" -i $iso > "$TEMP_DIR/$file" + done + if [ -f "$(echo $TEMP_DIR/boot/vmlinuz*)" ]; then + rm -f $TEMP_DIR/boot/bzImage + ln $TEMP_DIR/boot/vmlinuz* $TEMP_DIR/boot/bzImage + fi + status + BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \ +-c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table" + case " $OPTIONS " in + *\ --auto-install\ *) + echo -n "Enable auto install" + sed -i "s/rw root/rw config=LABEL=packages-$PKG_VER,install.sh root/" \ + $TEMP_DIR/boot/isolinux/*.cfg + status + ;; + esac + case " $OPTIONS " in + *\ --loram-detect\ *) + echo -n "Enable loram autodetection" + need $IFMEM_C32 $isoloram + which isoinfo > /dev/null || need /usr/bin/isoinfo + cp $IFMEM_C32 "$TEMP_DIR/boot/isolinux" + isoinfo -R -x "/usr.sqfs" -i $isoloram \ + > "$TEMP_DIR/usr.sqfs" 2> /dev/null + if [ -s "$TEMP_DIR/usr.sqfs" ]; then + echo "$SORT_DIR/usr.sqfs -5000" >> $SORT_FILE + else + rm -f "$TEMP_DIR/usr.sqfs" + isoinfo -R -x "/rootfs.gz" -i $isoloram \ + > "$TEMP_DIR/rootfs.gz" 2> /dev/null + echo "$SORT_DIR/rootfs.gz -5000" >> $SORT_FILE + fi + isoinfo -R -x "/boot/rootfs.gz" -i $isoloram > \ + "$TEMP_DIR/boot/loram.gz" + cat >> $TEMP_DIR/boot/isolinux/common.cfg <> $TEMP_DIR/boot/isolinux/noram.cfg <> $SORT_FILE + ;; +*\ --webboot\ *) + if extract_boot gpxe; then + echo -n "Creating web boot tree" + which isoinfo > /dev/null || need /usr/bin/isoinfo + mkdir $TEMP_DIR/boot/isolinux/ + isoinfo -R -x "/boot/isolinux/isolinux.bin" -i $iso > \ + $TEMP_DIR/boot/isolinux/isolinux.bin + mv $TEMP_DIR/boot/gpxe $TEMP_DIR/boot/isolinux + echo "$SORT_DIR/boot 0" >> $SORT_FILE + cat > $TEMP_DIR/boot/isolinux/isolinux.cfg < /dev/null | \ + awk 'END { print $1 }') used by boot." +fi + +case " $OPTIONS " in +*\ --dry-run\ *) + echo "Please check and remove $TEMP_DIR and $SORT_FILE" + exit + ;; +esac +# Gen ISO +echo -n "Generating iso image" +genisoimage -R -J -f -V $VOLUME_ID \ + -P "$PUBLISHER" -md5-list $REPOS/packages.md5 \ + -quiet -o $OUTPUT $BOOT_OPT $TEMP_DIR +status + +echo "$(du -hs $OUTPUT | awk '{ print $1 }') used by iso image." + +cd ${ROOT} +echo -n "Create hybrid DVD/CDROM" +which isohybrid > /dev/null && isohybrid $IMAGE 2> /dev/null +status + +echo -n "Calculate md5sum" +md5sum $IMAGE > $(basename $IMAGE .iso).md5 +status + +echo -n "Moving file to mirror" +mv $IMAGE $ISO_DIR +mv $(basename $IMAGE .iso).md5 $ISO_DIR +status + +# Cleaning temp files +rm -rf $TEMP_DIR $SORT_FILE + diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/usr/share/mirror-host/boot/lguest-disk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/usr/share/mirror-host/boot/lguest-disk Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,58 @@ +#!/bin/sh + +usage() +{ + cat << EOT +resize2fs +usage: +$0 grow [MG] +$0 fixmbr +EOT + exit 1 +} + +grow() +{ + case "$2" in + *M) dd if=/dev/zero bs=1M count=${2%M} >> /boot/guests/$1 ;; + *G) dd if=/dev/zero bs=1G count=${2%G} >> /boot/guests/$1 ;; + esac +} + +# write a 32 bits data +# usage: storelong offset data32 file +storelong() +{ + echo $2 | awk '{ printf "%c%c%c%c", + $1%256,($1/256)%256,($1/256/256)%256,($1/256/256/256)%256 }' | \ + dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null +} + +# read a 32 bits data +# usage: getlong offset file +getlong() +{ + dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \ + hexdump -e '"" 1/4 "%d" "\n"' +} + +fixmbr() +{ + if [ $(getlong 0x1ea $1) -ne 0 -a $(getlong 0x1fa $1) -ne 0 ]; then + echo "Parttion 3 & 4 non empty. Abort" + exit 1 + fi + if [ $(getlong 0x1da $1) -eq 0 ]; then + echo "Parttion 2 empty. Abort" + exit 1 + fi + size=$(stat -c %s $1) + new=$(( $size/512 - 32 - $(getlong 0x1ca $1) )) + storelong 0x1da $new $1 +} + +case "$1" in +grow) shift; grow $@ ; fixmbr $1 ;; +fixmbr) shift; fixmbr $1 ;; +*) usage ;; +esac diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/usr/share/mirror-host/boot/lguest-slitaz --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/usr/share/mirror-host/boot/lguest-slitaz Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,21 @@ +#!/bin/sh + +tty=tty; [ -n "$1" ] && tty=$1 +export TERM=$tty +shift + +rootfs="--initrd=/boot/rootfs-lguest.gz" +[ -n "$1" ] && rootfs="--block=$1 root=/dev/vda2" +shift + +net="--tunnet=192.168.0.1" +case "$1" in +192*) net="--tunnet=$1"; shift;; +esac + +args="screen=text lang=fr_FR kmap=fr-latin1 sound=noconf" +[ -n "$1" ] && args=$@ + +/sbin/modprobe lg +/usr/bin/lguest 512 /boot/vmlinuz-2.6.25.5-lguest \ + $net $rootfs $args > /dev/$tty < /dev/$tty 2>&1 diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/usr/share/mirror-host/boot/shellinabox.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/usr/share/mirror-host/boot/shellinabox.sh Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,107 @@ +#!/bin/sh + +services="/ /reset /reboot /ssh" + +mkexe() +{ +exe=$0 +while true; do + cd $(dirname $exe) + exe=$(basename $exe) + [ -L $exe ] || break + exe=$(readlink $exe) +done +echo $(pwd)/$exe +} +exe=$(mkexe) + +services_arg() +{ +for i in $services ; do + echo -n "-s '$i:root:root:/tmp:LINES=25 /bin/sh -c \"$exe service $i " + echo -n "\${peer} \${url} \${columns} \${lines}\"' " +done +} + +launch_ssh() +{ + # Get SSH server + server="" + echo -n "SSH server: " + read -t 300 server || exit 1 + [ -n "$server" ] || exit 1 + + # Allow non default SSH port with format server:port + sshport="" + case "$server" in + *:*) sshport="-p ${server#*:}" + server=${server%:*};; + esac + + # heading ! in server name means open remote ssh port with a knock sequence + if [ -x /usr/bin/knock ]; then + case "$server" in + !*) server=${server#*!} + echo -n "Knock sequence (port[:proto]...): " + read -t 30 sequence && knock ${server#*@} $sequence + esac + fi + + # Get SSH user if missing + case "$server" in + *@*) ;; + *) echo -n "$server login: " + read -t 30 user || exit 1 + server="$user@$server";; + esac + + # Launch OpenSSH or Dropbear + sshargs="-oPreferredAuthentications=keyboard-interactive,password -oNoHostAuthenticationForLocalhost=yes -oLogLevel=FATAL -F/dev/null"; + [ -L /usr/bin/ssh ] && sshargs="" + exec ssh $sshport $sshargs $server +} + +auth() +{ + while read host md5 ; do + [ "${host#*.}" == "${1#*.}" ] && break + done < $(dirname $exe)/shellinabox.secrets + echo -n "$host password: " + read -s -t 30 password || exit 1 + [ "$(echo $password | md5sum)" == "$md5 -" ] || exit 1 + echo "" +} + +pidfile=/var/run/shellinaboxd.pid +case "$1" in +service) + host=$(echo $4 | sed 's/.*\/\/\(.*\):.*/\1/') + tty=$(awk "/$host/ { print \$2 }" /etc/inittab) + vm=$(awk "/$host/ { print \$3 }" /etc/inittab) + [ -n "$vm" ] || exit 1 + case "$2" in + /) + auth $host + exec /usr/bin/conspy ${tty#tty} ;; + /reboot) + auth $host + echo -n "Sure to reboot $host now (YES or NO) ?" + read -t 30 answer || exit 1 + case "$answer" in + YES*) ;; + *) exit 1;; + esac + exec /bin/kill $(ps ww | grep $vm | awk '/lguest/ { printf "%s ",$1 }') ;; + /ssh) + auth $host + launch_ssh ;; + esac + ;; +start) + dir=$(dirname $exe) + eval shellinaboxd --background=$pidfile --cert=/boot/cert $(services_arg) + ;; +stop) + [ -s $pidfile ] && kill $(cat $pidfile) + ;; +esac diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/usr/share/mirror-host/etc/apache/conf.d/slitaz --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/usr/share/mirror-host/etc/apache/conf.d/slitaz Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,16 @@ + + ServerName mirror.slitaz.org + ServerAlias *.slitaz.org + + ProxyPreserveHost On + ProxyRequests Off + ProxyTimeout 600 + + Order deny,allow + Allow from all + + ProxyPass / http://192.168.0.6/ + ProxyPassReverse / http://192.168.0.6/ + + + diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,20 @@ + + SSLProxyEngine On + SSLEngine On + ServerName mirror.slitaz.org:443 + ServerAlias *.slitaz.org + SSLCertificateFile /etc/ssl/apache/slitaz.org.pem + SSLCertificateKeyFile /etc/ssl/apache/slitaz.org.pem + + ProxyPreserveHost On + ProxyRequests Off + ProxyTimeout 600 + + Order deny,allow + Allow from all + + ProxyPass / http://192.168.0.6/ + ProxyPassReverse / http://192.168.0.6/ + + + diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/usr/share/mirror-host/etc/init.d/shellinabox --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/usr/share/mirror-host/etc/init.d/shellinabox Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,1 @@ +/boot/shellinabox.sh/pics/rrd/cpu-year.pnggngg \ No newline at end of file diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/usr/share/mirror-host/install --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/usr/share/mirror-host/install Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,25 @@ +#!/bin/sh + +grep -qs lguest-slitaz /etc/inittab || { +sed -i 's|^tty1::|tty16::respawn:/boot/lguest-slitaz tty16 /boot/guests/mirror.slitaz.org 192.168.0.1\n&|' /etc/inittab +cat >> /etc/init.d/local.sh < /proc/sys/net/ipv4/ip_forward +EOT +} diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/usr/share/rrd/makegraphs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/usr/share/rrd/makegraphs Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,299 @@ +#!/bin/sh +#*/5 * * * * /usr/share/rrd/makegraphs >/dev/null + +# RRD database directory +rrdlog="/var/spool/rrd" + +# Images directory +rrdgraph="/var/spool/rrd" + +# Colors +#rrdcolors="--color SHADEA#EAE9EE --color SHADEB#EAE9EE --color BACK#EAE9EE" +rrdcolors="--color SHADEA#FFFFFF --color SHADEB#FFFFFF --color BACK#FFFFFF" +rrdgraphargs="-aPNG -i -z --alt-y-grid -w 600 -h 100 -r $rrdcolors" + +[ -d $rrdlog ] || mkdir -p $rrdlog +[ -d $rrdgraph ] || mkdir -p $rrdgraph + +updatecpudata() { + [ -e "$rrdlog/cpu.rrd" ] || rrdtool create $rrdlog/cpu.rrd --step=300 \ + DS:user:COUNTER:600:0:500000000 \ + DS:system:COUNTER:600:0:500000000 \ + DS:idle:COUNTER:600:0:500000000 \ + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 + grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do + rrdtool update $rrdlog/cpu.rrd -t user:system:idle \ + N:$(( $user + $nice )):$system:$idle + break + done + + [ -e "$rrdlog/cpu2.rrd" ] && + grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do + rrdtool update $rrdlog/cpu2.rrd -t nice:user:system:idle \ + N:$nice:$user:$system:$idle + break + done +} + +updatecpugraph() { + period=$1 + info="$(grep '^model name' /proc/cpuinfo | cut -d: -f2 | head -1)" + rrdtool graph "$rrdgraph/cpu-$period.png" --start -1$period \ + $rrdgraphargs -l 0 -u 100 -t "cpu usage per $period [$info ]" \ + DEF:user=$rrdlog/cpu.rrd:user:AVERAGE \ + DEF:system=$rrdlog/cpu.rrd:system:AVERAGE \ + DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE \ + 'CDEF:total=user,system,idle,+,+' \ + 'CDEF:userpct=100,user,total,/,*' \ + 'CDEF:systempct=100,system,total,/,*' \ + 'CDEF:idlepct=100,idle,total,/,*' \ + 'AREA:userpct#0000FF:user cpu usage' \ + 'STACK:systempct#FF0000:system cpu usage' \ + 'STACK:idlepct#00FF00:idle cpu usage\j' +} + + +updatememgraph() { + period=$1 + info="$(free | awk '\ +{ \ + if (/Mem:/) { \ + if ($2 < 10000) printf "%d KB",$2; \ + else if ($2 < 10000000) printf "%d MB",$2/1024; \ + else printf "%d GB",$2/1024/1024; \ + } \ +}')" + info2="$(free | awk '\ +{ \ + if (/Swap:/) { \ + if ($2 < 10000) printf "%d KB",$2; \ + else if ($2 < 10000000) printf "%d MB",$2/1024; \ + else printf "%d GB",$2/1024/1024; \ + } \ +}')" + rrdtool graph "$rrdgraph/memory-$period.png" --start -1$period \ + $rrdgraphargs -l 0 -u 100 \ + -t "memory usage per $period [ $info + $info2 swap ]" \ + DEF:used=$rrdlog/mem.rrd:memused:AVERAGE \ + DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE \ + DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE \ + DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE \ + DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE \ + DEF:swused=$rrdlog/mem.rrd:swapused:AVERAGE \ + DEF:swfree=$rrdlog/mem.rrd:swapfree:AVERAGE \ + 'CDEF:total=used,free,+' \ + 'CDEF:used2=used,buffer,cache,shared,+,+,-' \ + 'CDEF:usedpct=100,used2,total,/,*' \ + 'CDEF:sharedpct=100,shared,total,/,*' \ + 'CDEF:bufferpct=100,buffer,total,/,*' \ + 'CDEF:cachepct=100,cache,total,/,*' \ + 'CDEF:freepct=100,free,total,/,*' \ + 'CDEF:swtotal=swused,swfree,+' \ + 'CDEF:swusedpct=100,swused,swtotal,/,*' \ + 'AREA:usedpct#0000FF:used memory' \ + 'STACK:sharedpct#FF7F00:shared memory' \ + 'STACK:bufferpct#FF00FF:buffered memory' \ + 'STACK:cachepct#FFFF00:cached memory' \ + 'STACK:freepct#00FF00:free memory' \ + 'LINE2:swusedpct#FF0000:used swap\j' +} + +updatememdata () { + [ -e "$rrdlog/mem.rrd" ] || + rrdtool create "$rrdlog/mem.rrd" --step=300 \ + DS:memused:ABSOLUTE:600:0:5000000000 \ + DS:memfree:ABSOLUTE:600:0:5000000000 \ + DS:memshared:ABSOLUTE:600:0:5000000000 \ + DS:membuffers:ABSOLUTE:600:0:5000000000 \ + DS:memcache:ABSOLUTE:600:0:5000000000 \ + DS:swapused:ABSOLUTE:600:0:5000000000 \ + DS:swapfree:ABSOLUTE:600:0:5000000000 \ + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 + + while read tag count unit; do + case "$tag" in + MemTotal:) memtotal=$(($count * 1024));; + MemFree:) memfree=$(($count * 1024)) + memused=$(($memtotal - $memfree)) + memshared=0;; + MemShared:) memshared=$(($count * 1024));; + Buffers:) membuffers=$(($count * 1024));; + Cached:) memcache=$(($count * 1024));; + SwapTotal:) swaptotal=$(($count * 1024));; + SwapFree:) swapfree=$(($count * 1024)) + swapused=$(( $swaptotal - $swapfree));; + esac + done < /proc/meminfo + + rrdtool update "$rrdlog/mem.rrd" \ + -t memused:memfree:memshared:membuffers:memcache:swapused:swapfree \ + "N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree" +} + +getmax() { + rrdtool fetch $rrdlog/$1.rrd AVERAGE | awk '\ +BEGIN {max=0} \ +/^[0-9]/ { \ + if ($2 != "nan" && $2 > max) max=$2; \ + if ($3 != "nan" && $3 > max) max=$3; \ +} \ +END { print max }' | sed 's/,/./' +} + +updatediskgraph() { + period=$1 + [ "$period" == "day" ] && maxdisk="$(getmax disk)" + info="" + [ -r $2 ] && + info="[ $(fdisk -l | grep "^Disk $2:" | \ + sed "s|Disk $2: \(.*\), .*|\1|") ]" + rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \ + $rrdgraphargs -t "disk access per $period $info" \ + --logarithmic --lower-limit 1 -v "Sectors/second" --units=si \ + DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \ + DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \ + DEF:req=$rrdlog/iodisk.rrd:req:AVERAGE \ + DEF:done=$rrdlog/iodisk.rrd:done:AVERAGE \ + DEF:err=$rrdlog/iodisk.rrd:err:AVERAGE \ + "CDEF:readpct=100,read,$maxdisk,/,*" \ + "CDEF:writepct=100,write,$maxdisk,/,*" \ + "CDEF:errpct=100,err,req,/,*" \ + "CDEF:donepct=100,done,req,/,*" \ + 'AREA:readpct#0000FF:sectors read from disk' \ + 'STACK:writepct#00FF00:sectors written to disk' \ + 'LINE2:donepct#FFFF00:I/O complete' \ + 'LINE2:errpct#FF0000:I/O error\j' +} + +updatediskdata() { + dev=$1 + [ -e "$rrdlog/disk.rrd" ] || + rrdtool create "$rrdlog/disk.rrd" --step=300 \ + DS:readsect:COUNTER:600:0:5000000000 \ + DS:writesect:COUNTER:600:0:5000000000 \ + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 + [ -e "$rrdlog/iodisk.rrd" ] || + rrdtool create "$rrdlog/iodisk.rrd" --step=300 \ + DS:done:GAUGE:600:0:U DS:err:GAUGE:600:0:U \ + DS:req:GAUGE:600:0:U \ + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 + + while read major minor name readreq readsect writereq writesect misc; do + [ $major = $(( 0x$(stat -c %t $dev) )) ] || continue + [ $minor = $(( 0x$(stat -c %T $dev) )) ] || continue + rrdtool update "$rrdlog/disk.rrd" -t readsect:writesect \ + N:$readsect:$writesect + done < /proc/diskstats + dir=/sys/block/${dev#/dev/}/device + done=$(printf "%d\n" $(cat $dir/iodone_cnt 2> /dev/null) ) + err=$(printf "%d\n" $(cat $dir/ioerr_cnt 2> /dev/null) ) + req=$(printf "%d\n" $(cat $dir/iorequest_cnt 2> /dev/null) ) + rrdtool update "$rrdlog/iodisk.rrd" -t done:err:req N:$done:$err:$req +} + +updateifgraph() { + interface=$1 + period=$2 + [ "$period" == "day" ] && maxif="$(getmax $interface)" + rrdtool graph "$rrdgraph/$interface-$period.png" --start -1$period \ + $rrdgraphargs -t "traffic on $interface graph per $period" \ + --logarithmic -A -v "Bytes/second" --units=si \ + DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE \ + DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE \ + "CDEF:inpct=100,incoming,$maxif,/,*" \ + "CDEF:outpct=100,outgoing,$maxif,/,*" \ + 'AREA:inpct#00FF00:incoming traffic' \ + 'LINE1:outpct#0000FF:outgoing traffic\j' +} + +netframes() { +ifconfig $1 | grep "$2 packets" | sed -re "s/.*$3:([0-9]+).*/\1/g" +} + +netstats() { +ifconfig $1 | grep bytes | sed -re "s/.*$2 bytes:([0-9]+).*/\1/g" +} + +updateifdata() { + interface=$1 + [ -e "$rrdlog/$interface.rrd" ] || + rrdtool create "$rrdlog/$interface.rrd" --step=300 \ + DS:incoming:COUNTER:600:0:U \ + DS:outgoing:COUNTER:600:0:U \ + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 + [ -e "$rrdlog/packets-$interface.rrd" ] || + rrdtool create "$rrdlog/packets-$interface.rrd" --step=300 \ + DS:in:COUNTER:600:0:U DS:out:COUNTER:600:0:U \ + DS:inerr:COUNTER:600:0:U DS:outerr:COUNTER:600:0:U \ + DS:indrop:COUNTER:600:0:U DS:outdrop:COUNTER:600:0:U \ + DS:inov:COUNTER:600:0:U DS:outov:COUNTER:600:0:U \ + DS:frame:COUNTER:600:0:U DS:carrier:COUNTER:600:0:U \ + RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ + RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 + rx=$(netstats $interface RX) + tx=$(netstats $interface TX) + rrdtool update "$rrdlog/$interface.rrd" -t incoming:outgoing \ + N:${rx:-U}:${tx:-U} + rx=$(netframes $interface RX packets) + tx=$(netframes $interface TX packets) + rxerr=$(netframes $interface RX errors) + txerr=$(netframes $interface TX errors) + rxdrop=$(netframes $interface RX dropped) + txdrop=$(netframes $interface TX dropped) + rxov=$(netframes $interface RX overruns) + txov=$(netframes $interface TX overruns) + frame=$(netframes $interface RX frame) + carrier=$(netframes $interface TX carrier) + rrdtool update "$rrdlog/packets-$interface.rrd" \ + -t in:out:inerr:outerr:indrop:outdrop:inov:outov:frame:carrier \ + N:${rx:-U}:${tx:-U}:${rxerr:-U}:${txerr:-U}:${rxdrop:-U}:${txdrop:-U}:${rxov:-U}:${txov:-U}:${frame:-U}:${carrier:-U} +} + +getdisk() +{ + local d + local i + d=$(stat -c %D $1) + for i in /dev/* ; do + [ $(stat -c "%02t%02T" $i) == $d ] || continue + echo $i + break + done +} + +### +### System graphs +### + +updatecpudata +updatecpugraph day +updatecpugraph week +updatecpugraph month +updatecpugraph year + +updatememdata +updatememgraph day +updatememgraph week +updatememgraph month +updatememgraph year + +if [ -e /proc/diskstats ]; then + disk=$(getdisk $0) + updatediskdata $disk + updatediskgraph day ${disk:0:8} + updatediskgraph week ${disk:0:8} + updatediskgraph month ${disk:0:8} + updatediskgraph year ${disk:0:8} +fi + +iface=$(/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }') +updateifdata $iface +updateifgraph $iface day +updateifgraph $iface week +updateifgraph $iface month +updateifgraph $iface year diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/rootfs/usr/share/slitaz-live/INSTALL --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/rootfs/usr/share/slitaz-live/INSTALL Thu Feb 24 01:59:21 2011 +0000 @@ -0,0 +1,14 @@ +#!/bin/sh +DIR=$(dirname $0) +MOUNTS="/proc /sys /dev/pts /dev/shm" +cp /etc/resolv.conf etc +for i in $MOUNTS; do + [ -d $i ] && mount --bind $i $DIR/$i +done +#mount --bind /var/tmp tmp +mount --bind /tmp tmp || mount -t tmpfs tmpfs tmp +SHELL=/bin/ash chroot $DIR /bin/ash - +umount tmp +for i in $MOUNTS; do + umount $DIR/$i +done diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/bin/mkpkgiso --- a/mirror-tools/usr/bin/mkpkgiso Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,431 +0,0 @@ -#!/bin/sh -# mkpkgiso, build packages ISO image. -# (C) 2007-TODAY SliTaz - GNU General Public License v3. -# -# Authors : Eric Joseph-Alexandre -# Pascal Bellard - -VERSION=0.9 - -PKG_VER=$1 -ROOT=/home/slitaz/iso -REPOS=/var/www/slitaz/mirror/packages/$PKG_VER -SOURCES=/var/www/slitaz/mirror/sources/packages -IFMEM_C32=/var/www/slitaz/mirror/pxe/ifmem.c32 -ISO_DIR=/var/www/slitaz/mirror/iso/$PKG_VER - -[ -s /etc/slitaz/mkpkgiso.conf ] && . /etc/slitaz/mkpkgiso.conf -[ -s ./mkpkgiso.conf ] && . ./mkpkgiso.conf - -SORT_DIR=${ROOT}/_iso.$$ -TEMP_DIR=${ROOT}/_iso.$$ -SORT_FILE=${ROOT}/_sort.$$ -shift -OPTIONS=$@ -PKG_DIR=$TEMP_DIR/packages/$PKG_VER -SRC_DIR=$TEMP_DIR/src -LOG=$PWD/$(basename $0).log - -# -VOLUME_ID="packages-${PKG_VER}" -PUBLISHER="SliTaz http://www.slitaz.org/" -IMAGE="packages-${PKG_VER}.iso" -case " $@ " in -*\ --sources\ *) - IMAGE="sources-${PKG_VER}.iso" ;; -esac -OUTPUT="$ROOT/$IMAGE" - -# Check command line option. -if [ -z $PKG_VER ]; then - cat < - [--boot [--auto-install] [--loram-detect]]|--webboot] [--filter] - [--wok] [--wok-stable] [--website] [--sources] [--dry-run] - $(basename $0) update-hg -Example: -$(basename $0) cooking --boot --auto-install --loram-detect --filter --wok --website --sources -EOT - exit 1 -fi - -# Update hg repos -if [ "$PKG_VER" == "update-hg" ]; then - for i in $1/* ; do - grep -qs '\[paths]' $i/.hg/hgrc || continue - cd $i - hg pull - hg update - cd - > /dev/null - done - exit 1 -fi - -# Check if we provide a valide version -if [ ! -d $REPOS ]; then - echo "Boooh! $PKG_VER is not a valid version." - exit 1 -fi - -# Status function. -status() -{ - local CHECK=$? - echo -en "\\033[70G[ " - if [ $CHECK = 0 ]; then - echo -en "\\033[1;33mOK" - else - echo -en "\\033[1;31mFailed" - fi - echo -e "\\033[0;39m ]" -} - -need() -{ - found=1 - for i in $@ ; do - [ -s $i ] && continue - echo "Missing: $i " - found=0 - done - [ $found -ne 0 ] && return - status - rm -rf $TEMP_DIR $SORT_FILE - exit 1 -} - -# Create temp directory -mkdir -p $TEMP_DIR/packages/$PKG_VER -which genisoimage > /dev/null || need /usr/bin/genisoimage - -# Prepare evrything for ISO - -echo "" -echo "Building ISO for packages $PKG_VER" -echo "===============================================================================" -echo -n "Creating working dir $(basename $TEMP_DIR)" -status -echo -n "Creating symlink" -status - -# Link every packages to temp dir -cd $PKG_DIR -for i in $REPOS/* -do - ln -s $i >> $LOG 2>&1 -done - -echo -n "Creating install script" -# Create install script as suggested by Pascal. -cat >$TEMP_DIR/install.sh< /dev/null - mount --bind /mnt /cdrom - fi - # Handle loram on hybrid hard disk / usb key case - if [ ! -d /usr/bin ]; then - echo "" - if [ -d /.usr.rw ]; then - echo -n "Mounting /usr read-write... " - usr=.usr.ro - else - echo -n "Mounting /usr read-only... " - usr=usr - fi - FS=\$DIR/usr.cromfs - if [ -f \$FS ]; then - /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other - elif [ -f \$DIR/usr.sqfs ]; then - FS=\$DIR/usr.sqfs - mount -o loop,ro -t squashfs \$FS /\$usr - elif [ -L /\$usr ]; then - FS=\$DIR/usr - fi - status - if [ -d /.usr.rw ]; then - if [ -x /bin/funionfs ]; then - /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr - else - /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr - fi - fi - fi -fi - -[ -d /var/cache/tazpkg ] || mkdir -p /var/cache/tazpkg -ls -d \$DIR/packages/* > /var/lib/tazpkg/mirror -ln -fs \$DIR/packages/*/*.tazpkg /var/cache/tazpkg/ -ln -fs \$DIR/packages/*/packages.* /var/lib/tazpkg -echo "" -echo "=> all $PKG_VER packages are available for tazpkg/tazpkgbox" -EOF -[ -e files.list.lzma ] && cat >>$TEMP_DIR/install.sh< $SORT_FILE <> $SORT_FILE -chmod 755 $TEMP_DIR/install.sh - -case " $OPTIONS " in -*\ --filter\ *) - SIZE=0 - for i in *.tazpkg; do - while read f; do - case "$i" in - $f*) continue 2;; - esac - done < packages.list - echo -n "Filter out $i ($(du -hs $(readlink $i) | awk '{ print $1 }'))..." - SIZE=$(( $SIZE + $(stat -c %s $(readlink $i)) )) - rm $i - status - done - UNIT=" bytes" - if [ $SIZE -gt 10240 ]; then - SIZE=$(( $SIZE / 1024 )) - UNIT="K" - fi - if [ $SIZE -gt 10240 ]; then - SIZE=$(( $SIZE / 1024 )) - UNIT="M" - fi - echo "$SIZE$UNIT removed.";; -esac - -# Copy hg subtree -get_from_hg() -{ -echo -n "Adding $2" -if [ -s /home/slitaz/$1/.hg/hgrc ]; then - cp -a /home/slitaz/$1 $TEMP_DIR -else - wget -q -O - http://hg.slitaz.org/$1/archive/tip.tar.bz2 | tar xjf - -C $TEMP_DIR - mv $TEMP_DIR/$1-* $TEMP_DIR/$1 -fi -status -echo "$(du -hs $TEMP_DIR/$1 | awk '{ print $1 }') used by $2." -} - -for i in $OPTIONS ; do -case "$i" in ---wok) - cat >>$TEMP_DIR/install.sh< Wok (cooking) is in /home/slitaz/wok" -EOF - if get_from_hg wok "wok (cooking)"; then - echo "$SORT_DIR/wok -8000" >> $SORT_FILE - fi;; ---wok-stable) - cat >>$TEMP_DIR/install.sh< Wok (stable) is in /home/slitaz/wok" -EOF - if get_from_hg wok-stable "wok (stable)"; then - mv $TEMP_DIR/wok-stable $TEMP_DIR/wok - echo "$SORT_DIR/wok -8000" >> $SORT_FILE - fi;; ---website) - if get_from_hg website "web site"; then - echo "$SORT_DIR/website -6000" >> $SORT_FILE - cat >>$TEMP_DIR/install.sh< slitaz web site installed in file://\$DIR/website/index.html" -EOF - fi;; ---sources) - echo -n "Removing previous ISO..." - rm -f $OUTPUT - status - cat >>$TEMP_DIR/install.sh< sources are in /home/slitaz/src" -EOF - mkdir -p $SRC_DIR - cd $SRC_DIR - for i in $SOURCES/*/* - do - case "$i" in - */md5sum) continue;; - esac - ln -s $i >> $LOG 2>&1 - done - find * -not -type d | grep -v md5sum | xargs md5sum > md5sum - echo "$(du -hs $SOURCES | awk '{ print $1 }') used by sources." ;; -esac -done - -# Extract boot package function -extract_boot() -{ -f=$(ls $REPOS/$1-[0-9]*.tazpkg 2> /dev/null) -[ -f "$f" ] || return 1 -[ -d $TEMP_DIR/boot ] || mkdir $TEMP_DIR/boot -( cd $TEMP_DIR/boot ; cpio -i fs.cpio.gz < $f 2> /dev/null ) -( cd $TEMP_DIR/boot ; zcat fs.cpio.gz | cpio -id 2> /dev/null ) -mv $TEMP_DIR/boot/fs/boot/* $TEMP_DIR/boot -rm -rf $TEMP_DIR/boot/fs.cpio.gz $TEMP_DIR/boot/fs -return 0 -} - -# Gen boot part -BOOT_OPT="" -iso=$ISO_DIR/slitaz-$PKG_VER.iso -for i in slitaz-loram-cdrom-sqfs slitaz-$PKG_VER-loram-cdrom ; do - isoloram=$ISO_DIR/flavors/$i.iso - [ -s $isoloram ] && break -done -case " $OPTIONS " in -*\ --boot\ *) - echo -n "Creating boot tree" - need $iso - which isoinfo > /dev/null || need /usr/bin/isoinfo - isoinfo -R -l -i $iso | awk '/^Directory/ { path=$4 } /^-/ { print path$12 }' | while read file; do - [ "$(basename $file)" == ".." ] && continue - [ "$file" = "/boot/isolinux/boot.cat" ] && continue - [ -d "$(dirname $TEMP_DIR/$file)" ] || - mkdir -p "$(dirname $TEMP_DIR/$file)" - isoinfo -R -x "$file" -i $iso > "$TEMP_DIR/$file" - done - if [ -f "$(echo $TEMP_DIR/boot/vmlinuz*)" ]; then - rm -f $TEMP_DIR/boot/bzImage - ln $TEMP_DIR/boot/vmlinuz* $TEMP_DIR/boot/bzImage - fi - status - BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \ --c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table" - case " $OPTIONS " in - *\ --auto-install\ *) - echo -n "Enable auto install" - sed -i "s/rw root/rw config=LABEL=packages-$PKG_VER,install.sh root/" \ - $TEMP_DIR/boot/isolinux/*.cfg - status - ;; - esac - case " $OPTIONS " in - *\ --loram-detect\ *) - echo -n "Enable loram autodetection" - need $IFMEM_C32 $isoloram - which isoinfo > /dev/null || need /usr/bin/isoinfo - cp $IFMEM_C32 "$TEMP_DIR/boot/isolinux" - isoinfo -R -x "/usr.sqfs" -i $isoloram \ - > "$TEMP_DIR/usr.sqfs" 2> /dev/null - if [ -s "$TEMP_DIR/usr.sqfs" ]; then - echo "$SORT_DIR/usr.sqfs -5000" >> $SORT_FILE - else - rm -f "$TEMP_DIR/usr.sqfs" - isoinfo -R -x "/rootfs.gz" -i $isoloram \ - > "$TEMP_DIR/rootfs.gz" 2> /dev/null - echo "$SORT_DIR/rootfs.gz -5000" >> $SORT_FILE - fi - isoinfo -R -x "/boot/rootfs.gz" -i $isoloram > \ - "$TEMP_DIR/boot/loram.gz" - cat >> $TEMP_DIR/boot/isolinux/common.cfg <> $TEMP_DIR/boot/isolinux/noram.cfg <> $SORT_FILE - ;; -*\ --webboot\ *) - if extract_boot gpxe; then - echo -n "Creating web boot tree" - which isoinfo > /dev/null || need /usr/bin/isoinfo - mkdir $TEMP_DIR/boot/isolinux/ - isoinfo -R -x "/boot/isolinux/isolinux.bin" -i $iso > \ - $TEMP_DIR/boot/isolinux/isolinux.bin - mv $TEMP_DIR/boot/gpxe $TEMP_DIR/boot/isolinux - echo "$SORT_DIR/boot 0" >> $SORT_FILE - cat > $TEMP_DIR/boot/isolinux/isolinux.cfg < /dev/null | \ - awk 'END { print $1 }') used by boot." -fi - -case " $OPTIONS " in -*\ --dry-run\ *) - echo "Please check and remove $TEMP_DIR and $SORT_FILE" - exit - ;; -esac -# Gen ISO -echo -n "Generating iso image" -genisoimage -R -J -f -V $VOLUME_ID \ - -P "$PUBLISHER" -md5-list $REPOS/packages.md5 \ - -quiet -o $OUTPUT $BOOT_OPT $TEMP_DIR -status - -echo "$(du -hs $OUTPUT | awk '{ print $1 }') used by iso image." - -cd ${ROOT} -echo -n "Create hybrid DVD/CDROM" -which isohybrid > /dev/null && isohybrid $IMAGE 2> /dev/null -status - -echo -n "Calculate md5sum" -md5sum $IMAGE > $(basename $IMAGE .iso).md5 -status - -echo -n "Moving file to mirror" -mv $IMAGE $ISO_DIR -mv $(basename $IMAGE .iso).md5 $ISO_DIR -status - -# Cleaning temp files -rm -rf $TEMP_DIR $SORT_FILE - diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/share/mirror-host/boot/lguest-disk --- a/mirror-tools/usr/share/mirror-host/boot/lguest-disk Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -#!/bin/sh - -usage() -{ - cat << EOT -resize2fs -usage: -$0 grow [MG] -$0 fixmbr -EOT - exit 1 -} - -grow() -{ - case "$2" in - *M) dd if=/dev/zero bs=1M count=${2%M} >> /boot/guests/$1 ;; - *G) dd if=/dev/zero bs=1G count=${2%G} >> /boot/guests/$1 ;; - esac -} - -# write a 32 bits data -# usage: storelong offset data32 file -storelong() -{ - echo $2 | awk '{ printf "%c%c%c%c", - $1%256,($1/256)%256,($1/256/256)%256,($1/256/256/256)%256 }' | \ - dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null -} - -# read a 32 bits data -# usage: getlong offset file -getlong() -{ - dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \ - hexdump -e '"" 1/4 "%d" "\n"' -} - -fixmbr() -{ - if [ $(getlong 0x1ea $1) -ne 0 -a $(getlong 0x1fa $1) -ne 0 ]; then - echo "Parttion 3 & 4 non empty. Abort" - exit 1 - fi - if [ $(getlong 0x1da $1) -eq 0 ]; then - echo "Parttion 2 empty. Abort" - exit 1 - fi - size=$(stat -c %s $1) - new=$(( $size/512 - 32 - $(getlong 0x1ca $1) )) - storelong 0x1da $new $1 -} - -case "$1" in -grow) shift; grow $@ ; fixmbr $1 ;; -fixmbr) shift; fixmbr $1 ;; -*) usage ;; -esac diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/share/mirror-host/boot/lguest-slitaz --- a/mirror-tools/usr/share/mirror-host/boot/lguest-slitaz Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#!/bin/sh - -tty=tty; [ -n "$1" ] && tty=$1 -export TERM=$tty -shift - -rootfs="--initrd=/boot/rootfs-lguest.gz" -[ -n "$1" ] && rootfs="--block=$1 root=/dev/vda2" -shift - -net="--tunnet=192.168.0.1" -case "$1" in -192*) net="--tunnet=$1"; shift;; -esac - -args="screen=text lang=fr_FR kmap=fr-latin1 sound=noconf" -[ -n "$1" ] && args=$@ - -/sbin/modprobe lg -/usr/bin/lguest 512 /boot/vmlinuz-2.6.25.5-lguest \ - $net $rootfs $args > /dev/$tty < /dev/$tty 2>&1 diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/share/mirror-host/boot/shellinabox.sh --- a/mirror-tools/usr/share/mirror-host/boot/shellinabox.sh Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -#!/bin/sh - -services="/ /reset /reboot /ssh" - -mkexe() -{ -exe=$0 -while true; do - cd $(dirname $exe) - exe=$(basename $exe) - [ -L $exe ] || break - exe=$(readlink $exe) -done -echo $(pwd)/$exe -} -exe=$(mkexe) - -services_arg() -{ -for i in $services ; do - echo -n "-s '$i:root:root:/tmp:LINES=25 /bin/sh -c \"$exe service $i " - echo -n "\${peer} \${url} \${columns} \${lines}\"' " -done -} - -launch_ssh() -{ - # Get SSH server - server="" - echo -n "SSH server: " - read -t 300 server || exit 1 - [ -n "$server" ] || exit 1 - - # Allow non default SSH port with format server:port - sshport="" - case "$server" in - *:*) sshport="-p ${server#*:}" - server=${server%:*};; - esac - - # heading ! in server name means open remote ssh port with a knock sequence - if [ -x /usr/bin/knock ]; then - case "$server" in - !*) server=${server#*!} - echo -n "Knock sequence (port[:proto]...): " - read -t 30 sequence && knock ${server#*@} $sequence - esac - fi - - # Get SSH user if missing - case "$server" in - *@*) ;; - *) echo -n "$server login: " - read -t 30 user || exit 1 - server="$user@$server";; - esac - - # Launch OpenSSH or Dropbear - sshargs="-oPreferredAuthentications=keyboard-interactive,password -oNoHostAuthenticationForLocalhost=yes -oLogLevel=FATAL -F/dev/null"; - [ -L /usr/bin/ssh ] && sshargs="" - exec ssh $sshport $sshargs $server -} - -auth() -{ - while read host md5 ; do - [ "${host#*.}" == "${1#*.}" ] && break - done < $(dirname $exe)/shellinabox.secrets - echo -n "$host password: " - read -s -t 30 password || exit 1 - [ "$(echo $password | md5sum)" == "$md5 -" ] || exit 1 - echo "" -} - -pidfile=/var/run/shellinaboxd.pid -case "$1" in -service) - host=$(echo $4 | sed 's/.*\/\/\(.*\):.*/\1/') - tty=$(awk "/$host/ { print \$2 }" /etc/inittab) - vm=$(awk "/$host/ { print \$3 }" /etc/inittab) - [ -n "$vm" ] || exit 1 - case "$2" in - /) - auth $host - exec /usr/bin/conspy ${tty#tty} ;; - /reboot) - auth $host - echo -n "Sure to reboot $host now (YES or NO) ?" - read -t 30 answer || exit 1 - case "$answer" in - YES*) ;; - *) exit 1;; - esac - exec /bin/kill $(ps ww | grep $vm | awk '/lguest/ { printf "%s ",$1 }') ;; - /ssh) - auth $host - launch_ssh ;; - esac - ;; -start) - dir=$(dirname $exe) - eval shellinaboxd --background=$pidfile --cert=/boot/cert $(services_arg) - ;; -stop) - [ -s $pidfile ] && kill $(cat $pidfile) - ;; -esac diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz --- a/mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - ServerName mirror.slitaz.org - ServerAlias *.slitaz.org - - ProxyPreserveHost On - ProxyRequests Off - ProxyTimeout 600 - - Order deny,allow - Allow from all - - ProxyPass / http://192.168.0.6/ - ProxyPassReverse / http://192.168.0.6/ - - - diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl --- a/mirror-tools/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - - SSLProxyEngine On - SSLEngine On - ServerName mirror.slitaz.org:443 - ServerAlias *.slitaz.org - SSLCertificateFile /etc/ssl/apache/slitaz.org.pem - SSLCertificateKeyFile /etc/ssl/apache/slitaz.org.pem - - ProxyPreserveHost On - ProxyRequests Off - ProxyTimeout 600 - - Order deny,allow - Allow from all - - ProxyPass / http://192.168.0.6/ - ProxyPassReverse / http://192.168.0.6/ - - - diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/share/mirror-host/etc/init.d/shellinabox --- a/mirror-tools/usr/share/mirror-host/etc/init.d/shellinabox Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -/boot/shellinabox.sh/pics/rrd/cpu-year.pnggngg \ No newline at end of file diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/share/mirror-host/install --- a/mirror-tools/usr/share/mirror-host/install Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#!/bin/sh - -grep -qs lguest-slitaz /etc/inittab || { -sed -i 's|^tty1::|tty16::respawn:/boot/lguest-slitaz tty16 /boot/guests/mirror.slitaz.org 192.168.0.1\n&|' /etc/inittab -cat >> /etc/init.d/local.sh < /proc/sys/net/ipv4/ip_forward -EOT -} diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/share/rrd/makegraphs --- a/mirror-tools/usr/share/rrd/makegraphs Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,299 +0,0 @@ -#!/bin/sh -#*/5 * * * * /usr/share/rrd/makegraphs >/dev/null - -# RRD database directory -rrdlog="/var/spool/rrd" - -# Images directory -rrdgraph="/var/spool/rrd" - -# Colors -#rrdcolors="--color SHADEA#EAE9EE --color SHADEB#EAE9EE --color BACK#EAE9EE" -rrdcolors="--color SHADEA#FFFFFF --color SHADEB#FFFFFF --color BACK#FFFFFF" -rrdgraphargs="-aPNG -i -z --alt-y-grid -w 600 -h 100 -r $rrdcolors" - -[ -d $rrdlog ] || mkdir -p $rrdlog -[ -d $rrdgraph ] || mkdir -p $rrdgraph - -updatecpudata() { - [ -e "$rrdlog/cpu.rrd" ] || rrdtool create $rrdlog/cpu.rrd --step=300 \ - DS:user:COUNTER:600:0:500000000 \ - DS:system:COUNTER:600:0:500000000 \ - DS:idle:COUNTER:600:0:500000000 \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do - rrdtool update $rrdlog/cpu.rrd -t user:system:idle \ - N:$(( $user + $nice )):$system:$idle - break - done - - [ -e "$rrdlog/cpu2.rrd" ] && - grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do - rrdtool update $rrdlog/cpu2.rrd -t nice:user:system:idle \ - N:$nice:$user:$system:$idle - break - done -} - -updatecpugraph() { - period=$1 - info="$(grep '^model name' /proc/cpuinfo | cut -d: -f2 | head -1)" - rrdtool graph "$rrdgraph/cpu-$period.png" --start -1$period \ - $rrdgraphargs -l 0 -u 100 -t "cpu usage per $period [$info ]" \ - DEF:user=$rrdlog/cpu.rrd:user:AVERAGE \ - DEF:system=$rrdlog/cpu.rrd:system:AVERAGE \ - DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE \ - 'CDEF:total=user,system,idle,+,+' \ - 'CDEF:userpct=100,user,total,/,*' \ - 'CDEF:systempct=100,system,total,/,*' \ - 'CDEF:idlepct=100,idle,total,/,*' \ - 'AREA:userpct#0000FF:user cpu usage' \ - 'STACK:systempct#FF0000:system cpu usage' \ - 'STACK:idlepct#00FF00:idle cpu usage\j' -} - - -updatememgraph() { - period=$1 - info="$(free | awk '\ -{ \ - if (/Mem:/) { \ - if ($2 < 10000) printf "%d KB",$2; \ - else if ($2 < 10000000) printf "%d MB",$2/1024; \ - else printf "%d GB",$2/1024/1024; \ - } \ -}')" - info2="$(free | awk '\ -{ \ - if (/Swap:/) { \ - if ($2 < 10000) printf "%d KB",$2; \ - else if ($2 < 10000000) printf "%d MB",$2/1024; \ - else printf "%d GB",$2/1024/1024; \ - } \ -}')" - rrdtool graph "$rrdgraph/memory-$period.png" --start -1$period \ - $rrdgraphargs -l 0 -u 100 \ - -t "memory usage per $period [ $info + $info2 swap ]" \ - DEF:used=$rrdlog/mem.rrd:memused:AVERAGE \ - DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE \ - DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE \ - DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE \ - DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE \ - DEF:swused=$rrdlog/mem.rrd:swapused:AVERAGE \ - DEF:swfree=$rrdlog/mem.rrd:swapfree:AVERAGE \ - 'CDEF:total=used,free,+' \ - 'CDEF:used2=used,buffer,cache,shared,+,+,-' \ - 'CDEF:usedpct=100,used2,total,/,*' \ - 'CDEF:sharedpct=100,shared,total,/,*' \ - 'CDEF:bufferpct=100,buffer,total,/,*' \ - 'CDEF:cachepct=100,cache,total,/,*' \ - 'CDEF:freepct=100,free,total,/,*' \ - 'CDEF:swtotal=swused,swfree,+' \ - 'CDEF:swusedpct=100,swused,swtotal,/,*' \ - 'AREA:usedpct#0000FF:used memory' \ - 'STACK:sharedpct#FF7F00:shared memory' \ - 'STACK:bufferpct#FF00FF:buffered memory' \ - 'STACK:cachepct#FFFF00:cached memory' \ - 'STACK:freepct#00FF00:free memory' \ - 'LINE2:swusedpct#FF0000:used swap\j' -} - -updatememdata () { - [ -e "$rrdlog/mem.rrd" ] || - rrdtool create "$rrdlog/mem.rrd" --step=300 \ - DS:memused:ABSOLUTE:600:0:5000000000 \ - DS:memfree:ABSOLUTE:600:0:5000000000 \ - DS:memshared:ABSOLUTE:600:0:5000000000 \ - DS:membuffers:ABSOLUTE:600:0:5000000000 \ - DS:memcache:ABSOLUTE:600:0:5000000000 \ - DS:swapused:ABSOLUTE:600:0:5000000000 \ - DS:swapfree:ABSOLUTE:600:0:5000000000 \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - - while read tag count unit; do - case "$tag" in - MemTotal:) memtotal=$(($count * 1024));; - MemFree:) memfree=$(($count * 1024)) - memused=$(($memtotal - $memfree)) - memshared=0;; - MemShared:) memshared=$(($count * 1024));; - Buffers:) membuffers=$(($count * 1024));; - Cached:) memcache=$(($count * 1024));; - SwapTotal:) swaptotal=$(($count * 1024));; - SwapFree:) swapfree=$(($count * 1024)) - swapused=$(( $swaptotal - $swapfree));; - esac - done < /proc/meminfo - - rrdtool update "$rrdlog/mem.rrd" \ - -t memused:memfree:memshared:membuffers:memcache:swapused:swapfree \ - "N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree" -} - -getmax() { - rrdtool fetch $rrdlog/$1.rrd AVERAGE | awk '\ -BEGIN {max=0} \ -/^[0-9]/ { \ - if ($2 != "nan" && $2 > max) max=$2; \ - if ($3 != "nan" && $3 > max) max=$3; \ -} \ -END { print max }' | sed 's/,/./' -} - -updatediskgraph() { - period=$1 - [ "$period" == "day" ] && maxdisk="$(getmax disk)" - info="" - [ -r $2 ] && - info="[ $(fdisk -l | grep "^Disk $2:" | \ - sed "s|Disk $2: \(.*\), .*|\1|") ]" - rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \ - $rrdgraphargs -t "disk access per $period $info" \ - --logarithmic --lower-limit 1 -v "Sectors/second" --units=si \ - DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \ - DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \ - DEF:req=$rrdlog/iodisk.rrd:req:AVERAGE \ - DEF:done=$rrdlog/iodisk.rrd:done:AVERAGE \ - DEF:err=$rrdlog/iodisk.rrd:err:AVERAGE \ - "CDEF:readpct=100,read,$maxdisk,/,*" \ - "CDEF:writepct=100,write,$maxdisk,/,*" \ - "CDEF:errpct=100,err,req,/,*" \ - "CDEF:donepct=100,done,req,/,*" \ - 'AREA:readpct#0000FF:sectors read from disk' \ - 'STACK:writepct#00FF00:sectors written to disk' \ - 'LINE2:donepct#FFFF00:I/O complete' \ - 'LINE2:errpct#FF0000:I/O error\j' -} - -updatediskdata() { - dev=$1 - [ -e "$rrdlog/disk.rrd" ] || - rrdtool create "$rrdlog/disk.rrd" --step=300 \ - DS:readsect:COUNTER:600:0:5000000000 \ - DS:writesect:COUNTER:600:0:5000000000 \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - [ -e "$rrdlog/iodisk.rrd" ] || - rrdtool create "$rrdlog/iodisk.rrd" --step=300 \ - DS:done:GAUGE:600:0:U DS:err:GAUGE:600:0:U \ - DS:req:GAUGE:600:0:U \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - - while read major minor name readreq readsect writereq writesect misc; do - [ $major = $(( 0x$(stat -c %t $dev) )) ] || continue - [ $minor = $(( 0x$(stat -c %T $dev) )) ] || continue - rrdtool update "$rrdlog/disk.rrd" -t readsect:writesect \ - N:$readsect:$writesect - done < /proc/diskstats - dir=/sys/block/${dev#/dev/}/device - done=$(printf "%d\n" $(cat $dir/iodone_cnt 2> /dev/null) ) - err=$(printf "%d\n" $(cat $dir/ioerr_cnt 2> /dev/null) ) - req=$(printf "%d\n" $(cat $dir/iorequest_cnt 2> /dev/null) ) - rrdtool update "$rrdlog/iodisk.rrd" -t done:err:req N:$done:$err:$req -} - -updateifgraph() { - interface=$1 - period=$2 - [ "$period" == "day" ] && maxif="$(getmax $interface)" - rrdtool graph "$rrdgraph/$interface-$period.png" --start -1$period \ - $rrdgraphargs -t "traffic on $interface graph per $period" \ - --logarithmic -A -v "Bytes/second" --units=si \ - DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE \ - DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE \ - "CDEF:inpct=100,incoming,$maxif,/,*" \ - "CDEF:outpct=100,outgoing,$maxif,/,*" \ - 'AREA:inpct#00FF00:incoming traffic' \ - 'LINE1:outpct#0000FF:outgoing traffic\j' -} - -netframes() { -ifconfig $1 | grep "$2 packets" | sed -re "s/.*$3:([0-9]+).*/\1/g" -} - -netstats() { -ifconfig $1 | grep bytes | sed -re "s/.*$2 bytes:([0-9]+).*/\1/g" -} - -updateifdata() { - interface=$1 - [ -e "$rrdlog/$interface.rrd" ] || - rrdtool create "$rrdlog/$interface.rrd" --step=300 \ - DS:incoming:COUNTER:600:0:U \ - DS:outgoing:COUNTER:600:0:U \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - [ -e "$rrdlog/packets-$interface.rrd" ] || - rrdtool create "$rrdlog/packets-$interface.rrd" --step=300 \ - DS:in:COUNTER:600:0:U DS:out:COUNTER:600:0:U \ - DS:inerr:COUNTER:600:0:U DS:outerr:COUNTER:600:0:U \ - DS:indrop:COUNTER:600:0:U DS:outdrop:COUNTER:600:0:U \ - DS:inov:COUNTER:600:0:U DS:outov:COUNTER:600:0:U \ - DS:frame:COUNTER:600:0:U DS:carrier:COUNTER:600:0:U \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - rx=$(netstats $interface RX) - tx=$(netstats $interface TX) - rrdtool update "$rrdlog/$interface.rrd" -t incoming:outgoing \ - N:${rx:-U}:${tx:-U} - rx=$(netframes $interface RX packets) - tx=$(netframes $interface TX packets) - rxerr=$(netframes $interface RX errors) - txerr=$(netframes $interface TX errors) - rxdrop=$(netframes $interface RX dropped) - txdrop=$(netframes $interface TX dropped) - rxov=$(netframes $interface RX overruns) - txov=$(netframes $interface TX overruns) - frame=$(netframes $interface RX frame) - carrier=$(netframes $interface TX carrier) - rrdtool update "$rrdlog/packets-$interface.rrd" \ - -t in:out:inerr:outerr:indrop:outdrop:inov:outov:frame:carrier \ - N:${rx:-U}:${tx:-U}:${rxerr:-U}:${txerr:-U}:${rxdrop:-U}:${txdrop:-U}:${rxov:-U}:${txov:-U}:${frame:-U}:${carrier:-U} -} - -getdisk() -{ - local d - local i - d=$(stat -c %D $1) - for i in /dev/* ; do - [ $(stat -c "%02t%02T" $i) == $d ] || continue - echo $i - break - done -} - -### -### System graphs -### - -updatecpudata -updatecpugraph day -updatecpugraph week -updatecpugraph month -updatecpugraph year - -updatememdata -updatememgraph day -updatememgraph week -updatememgraph month -updatememgraph year - -if [ -e /proc/diskstats ]; then - disk=$(getdisk $0) - updatediskdata $disk - updatediskgraph day ${disk:0:8} - updatediskgraph week ${disk:0:8} - updatediskgraph month ${disk:0:8} - updatediskgraph year ${disk:0:8} -fi - -iface=$(/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }') -updateifdata $iface -updateifgraph $iface day -updateifgraph $iface week -updateifgraph $iface month -updateifgraph $iface year diff -r b788a1c8e19d -r e0a09d90b2cb mirror-tools/usr/share/slitaz-live/INSTALL --- a/mirror-tools/usr/share/slitaz-live/INSTALL Thu Feb 24 01:29:50 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#!/bin/sh -DIR=$(dirname $0) -MOUNTS="/proc /sys /dev/pts /dev/shm" -cp /etc/resolv.conf etc -for i in $MOUNTS; do - [ -d $i ] && mount --bind $i $DIR/$i -done -#mount --bind /var/tmp tmp -mount --bind /tmp tmp || mount -t tmpfs tmpfs tmp -SHELL=/bin/ash chroot $DIR /bin/ash - -umount tmp -for i in $MOUNTS; do - umount $DIR/$i -done