| 1 | #!/bin/sh |
|---|
| 2 | # Bash script to create Parsix watch page html |
|---|
| 3 | # Coyright 2007 Alan Baghumian / GNU/GPL |
|---|
| 4 | # |
|---|
| 5 | # Requires: lynx |
|---|
| 6 | |
|---|
| 7 | BASE_PATH="/home/parsix/public_html/watch" |
|---|
| 8 | BASE_URL="http://watch.parsix.org" |
|---|
| 9 | LOCAL_REPO="/home/parsix/public_html/packages/pool" |
|---|
| 10 | SVN_REPO="/svn/pkg-parsix/" |
|---|
| 11 | |
|---|
| 12 | if [ -f $BASE_PATH/index.html ]; then |
|---|
| 13 | rm $BASE_PATH/index.html |
|---|
| 14 | fi |
|---|
| 15 | |
|---|
| 16 | HEADER="<html lang='en-us'><head><title>Parsix GNU/Linux :: Package Watch System</title><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><link rel='icon' href='http://www.parsix.org/html/themes/parsix/images/icon.png' type='image/png'><link rel='shortcut icon' href='http://www.parsix.org/html/themes/parsix/images/favicon.ico'><link rel='stylesheet' href='http://www.parsix.org/html/modules/Admin/pnstyle/admin.css' type='text/css'><link rel='stylesheet' href='http://www.parsix.org/html/themes/parsix/style/styleNN.css' type='text/css'><style type='text/css'>@import url('http://www.parsix.org/html/themes/parsix/style/style.css');</style></head><body bgcolor='#deba73' text='#000000' link='#363636' vlink='#363636' alink='#d5ae83'><CENTER><H2>Parsix GNU/Linux Package Watch System</H2></CENTER><table border=1 align=center width=80% bgcolor=#f7f0e0><tr><td><b>Package Name</b></td><td><b>Upstream Version</b></td><td><b>Parsix Version</b></td><td><b>Supported Archs</b></td><td><b>Status</b></td><tr>" |
|---|
| 17 | |
|---|
| 18 | FOOTER="</body></html>" |
|---|
| 19 | |
|---|
| 20 | echo $HEADER > $BASE_PATH/index.html |
|---|
| 21 | |
|---|
| 22 | LIST=`/usr/bin/find $SVN_REPO -name watch | /bin/grep debian | /bin/grep trunk | sort -u` |
|---|
| 23 | |
|---|
| 24 | for x in $LIST |
|---|
| 25 | do |
|---|
| 26 | |
|---|
| 27 | # ARCH Checks |
|---|
| 28 | PKG=`/usr/bin/basename ${x/%trunk\/debian\/watch/}` |
|---|
| 29 | PATH=`/usr/bin/find $LOCAL_REPO -type d | /bin/grep $PKG` |
|---|
| 30 | COUNT=`/usr/bin/find $PATH | /bin/grep -c amd64.deb` |
|---|
| 31 | if [ $COUNT -ne 0 ]; then |
|---|
| 32 | AMD64="amd64" |
|---|
| 33 | else |
|---|
| 34 | AMD64="" |
|---|
| 35 | fi |
|---|
| 36 | |
|---|
| 37 | COUNT=`/usr/bin/find $PATH | /bin/grep -c i386.deb` |
|---|
| 38 | if [ $COUNT -ne 0 ]; then |
|---|
| 39 | I386="i386" |
|---|
| 40 | else |
|---|
| 41 | I386="" |
|---|
| 42 | fi |
|---|
| 43 | |
|---|
| 44 | COUNT=`/usr/bin/find $PATH | /bin/grep -c all.deb` |
|---|
| 45 | if [ $COUNT -ne 0 ]; then |
|---|
| 46 | ALLARCH="all" |
|---|
| 47 | else |
|---|
| 48 | ALLARCH="" |
|---|
| 49 | fi |
|---|
| 50 | |
|---|
| 51 | ARCHS="$ALLARCH-$I386-$AMD64" |
|---|
| 52 | FAKEARCHS="$ALLARCH$I386$AMD64" |
|---|
| 53 | |
|---|
| 54 | # work around the plus bug |
|---|
| 55 | x=`echo $x | /bin/sed s/+/KKK/g` |
|---|
| 56 | |
|---|
| 57 | if [ ! -z "$FAKEARCHS" ]; then |
|---|
| 58 | /usr/bin/lynx -source $BASE_URL/watch.php?vars=${x/%debian\/watch/}*$ARCHS*$PKG | /bin/sed s/Debian/Parsix/g >> $BASE_PATH/index.html |
|---|
| 59 | fi |
|---|
| 60 | |
|---|
| 61 | done |
|---|
| 62 | |
|---|
| 63 | echo "<p align=center>Last Update: `/bin/date`</p>" >> $BASE_PATH/index.html |
|---|
| 64 | |
|---|
| 65 | echo $FOOTER >> $BASE_PATH/index.html |
|---|
| 66 | |
|---|
| 67 | # replace KKK! |
|---|
| 68 | sed -i s/KKK/+/g $BASE_PATH/index.html |
|---|
| 69 | |
|---|
| 70 | |
|---|