summaryrefslogtreecommitdiffstats
authorMario Izquierdo (mariodebian) <mariodebian@gmail.com>2009-02-10 19:24:07 (CET)
committer Mario Izquierdo (mariodebian) <mariodebian@gmail.com>2009-02-10 19:24:07 (CET)
commite8bc6a0ed6604d23a10c8bc9a9396ec17383a662 (patch) (side-by-side diff)
tree12ae1f14b6ecabf780fc14545e1b31f00efc6a2f
parent3a8615333841835cfa38b0459f28ca76fdf1917d (diff)
downloadtcos-e8bc6a0ed6604d23a10c8bc9a9396ec17383a662.tar.gz
Add tcosproject.org stats supportbigbrother
Signed-off-by: Mario Izquierdo (mariodebian) <mariodebian@gmail.com>
-rw-r--r--README.Stats49
-rwxr-xr-xbin/gentcos44
-rw-r--r--conf/tcos.conf2
-rw-r--r--debian/initramfs-tools-tcos.docs1
4 files changed, 96 insertions, 0 deletions
diff --git a/README.Stats b/README.Stats
new file mode 100644
index 0000000..20df077
--- a/dev/null
+++ b/README.Stats
@@ -0,0 +1,49 @@
+ #####################################################
+
+ TcosProject.org installation Stats
+
+ #####################################################
+
+
+ Many open source projects (examples: [1], [2]) use some server-side
+ statistics software to know and count number of users using his software.
+
+ TCOS don't have a real users database (perhaps web-server access.log statistics)
+ but nothing complete. Many times I need to say, we have 2.000 servers installed.
+
+ I made some hacks to call TcosProject server and save some data:
+
+ * id=[sha256sum identify macchine unique]
+ * distro=[ debian | ubuntu ]
+ * version=[ unstable | testing | etch | jaunty | intrepid | hardy | gusty ]
+ * tcos=[ TCOS version ]
+ * arch=[ i386 | amd64 ]
+
+
+ ID is generated first time is needed (from gentcos script) from some /dev/urandom
+ data and current date of server. This is hashed with SHA265 and saved in:
+
+ /etc/tcos/tcos.hash
+
+===========================================================================
+
+ Server side script (what I'm saving)
+
+
+ You can see PHP script at:
+
+ http://tcosproject.org/cgit/cgit.cgi/tcosproject.org.git/tree/stats.php
+
+===========================================================================
+
+ DISABLE send of data to TcosProject.org server
+
+ Create empty file:
+
+ $ sudo touch /etc/tcos/disable.hash
+
+
+===========================================================================
+
+ [1] DRDB: http://usage.drbd.org/
+ [2] Debian: http://popcon.debian.org/
diff --git a/bin/gentcos b/bin/gentcos
index 0a7288c..68e3be6 100755
--- a/bin/gentcos
+++ b/bin/gentcos
@@ -119,6 +119,7 @@ _exit () {
cp ${TCOS_CONF}/tcos.conf.orig ${TCOS_CONF}/tcos.conf > /dev/null 2>&1
# exit wrapper
#echo "DONE"
+ call_tcosproject_stats
exit $1
}
@@ -669,6 +670,49 @@ fix_nvidia_ati() {
[ ! -z $1 ] || _exit 0
}
+call_tcosproject_stats() {
+ # user don't want to set stats to TCOS project
+ [ -e /etc/tcos/disable.hash ] && return
+
+ #cat /etc/tcos/version.conf
+ # some package vars
+ #
+ #TCOS_VERSION="0.89.28.1"
+ #TCOS_DISTRO="unstable"
+ #TCOS_ARCH="i386"
+ #DISTRIBUTION="debian"
+
+ [ -e /etc/tcos/version.conf ] && . /etc/tcos/version.conf
+ if [ ! -e /etc/tcos/tcos.hash ]; then
+ # create unique HASH
+ TMPFILE=$(mktemp /tmp/tcos.hash.XXXXXXXXXX)
+
+ # generate 2Kb of random data
+ dd if=/dev/urandom of=$TMPFILE count=2048 bs=1 2>/dev/null
+
+ # add date to this file (more unique)
+ date >> $TMPFILE
+
+ # get sha256 HASH
+ TCOS_ID_HASH=$(sha256sum $TMPFILE | awk '{print $1}')
+ echo "TCOS_ID_HASH=$TCOS_ID_HASH" > /etc/tcos/tcos.hash
+
+ # clean tmpfile and set read-only file to root
+ rm -f $TMPFILE
+ chmod 400 /etc/tcos/tcos.hash
+ _echo " * Created new TCOS_ID_HASH"
+ else
+ . /etc/tcos/tcos.hash
+ fi
+
+ # LOAD with wget TCOS_STATS_URL
+ _echo " * Updating TCOS stats..."
+ _echo " * See README.Stats doc to know more or disable it."
+ wget -q "${TCOS_STATS_URL}?id=$TCOS_ID_HASH&distro=${DISTRIBUTION}&version=$TCOS_DISTRO&tcos=$TCOS_VERSION&arch=$TCOS_ARCH" -O- >/dev/null 2>&1 &
+}
+
+
+
for opt in $@ ; do
case ${opt} in
-h) _help
diff --git a/conf/tcos.conf b/conf/tcos.conf
index b85357a..5b19c19 100644
--- a/conf/tcos.conf
+++ b/conf/tcos.conf
@@ -15,6 +15,8 @@ TCOS_PXECFG=pxelinux.cfg.tpl
TCOS_PXECFG_MENU=pxelinux.menu.cfg.tpl
TCOS_TEMPLATES_DIR=/usr/share/initramfs-tools-tcos/templates
TCOS_TEMPLATES_ETC=/etc/tcos/templates
+TCOS_STATS_URL=http://tcosproject.org/stats.php
+
ISOS="/var/lib/tcos/isos"
VOLUMENAME="TCOS boot cd"
diff --git a/debian/initramfs-tools-tcos.docs b/debian/initramfs-tools-tcos.docs
index ea882eb..3a52f1f 100644
--- a/debian/initramfs-tools-tcos.docs
+++ b/debian/initramfs-tools-tcos.docs
@@ -5,3 +5,4 @@ README.wireless
UPGRADE.debian
README.cache
README.freenx
+README.Stats