website diff scripts/get-latest.sh @ rev 678

Improve home page with last commit and pkgs + use PHP
author Christophe Lincoln <pankso@slitaz.org>
date Sun Nov 07 14:42:03 2010 +0100 (2010-11-07)
parents
children c55af5fe90ab
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/get-latest.sh	Sun Nov 07 14:42:03 2010 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +#!/bin/sh
     1.5 +# 
     1.6 +# Get latest commits and packages to display on the website main page.
     1.7 +# On Tank, this script is executed by cron each hour.
     1.8 +#
     1.9 +
    1.10 +REPO="/home/slitaz/repos/wok"
    1.11 +URL="http://hg.slitaz.org/wok"
    1.12 +PKGS="/home/slitaz/cooking/packages"
    1.13 +OUTPUT="/var/cache/slitaz/website/latest.html"
    1.14 +
    1.15 +mkdir -p /var/cache/slitaz/website
    1.16 +
    1.17 +# Latest Hg commits
    1.18 +echo -n "Getting latest commits... "
    1.19 +echo '<h2><font color="#DF8F06">Latest commits</font></h2>' > $OUTPUT
    1.20 +echo "<ul>" >> $OUTPUT
    1.21 +hg log --repository $REPO --limit 5 --no-merges \
    1.22 +	--template "	<li><strong>{date|shortdate}</strong> \
    1.23 +- <a href=\"$URL/rev/{rev}\">{desc}</a></li>\n" >> $OUTPUT 2> /dev/null
    1.24 +echo "</ul>" >> $OUTPUT
    1.25 +echo "Done"
    1.26 +
    1.27 +# Latest cooked packages by the build bot.
    1.28 +echo -n "Getting latest cooked packages... "
    1.29 +echo '<h2><font color="#DF8F06">Latest cooked packages</font></h2>' >> $OUTPUT
    1.30 +echo "<ul>" >> $OUTPUT
    1.31 +cd $PKGS && ls -1t *.tazpkg | head -5 | \
    1.32 +while read file
    1.33 +do
    1.34 +	echo -n '	<li>'$(stat -c '%y' $PKGS/$file | \
    1.35 +	cut -d ' ' -f 1); echo " - $file</li>"
    1.36 +done >> $OUTPUT
    1.37 +echo "</ul>" >> $OUTPUT
    1.38 +echo "Done"