#!/bin/sh # # /home/herrold/bin/ORC_notify # # handle caos build notifications # # Run this daily as non-root # PATH="/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin" MYNAME=`basename $0` VER="0.01-040317" # WORKDIR="/home/herrold/bin/" EPOCH="$WORKDIR${MYNAME}-mark " # EPOCH="/etc/vsftpd.conf~ " RESULTS="/var/www/html " ADOPTERS="/home/herrold/bin/maintainers.txt " ADOPTLINK=" -- elided -- "; # # build a hash of results [ ! -e $WORKDIR/work ] && mkdir $WORKDIR/work touch $WORKDIR/work/dummy rm -f $WORKDIR/work/* # # figure out the current adopters [ -e $ADOPTERS ] && rm $ADOPTERS wget -O $ADOPTERS $ADOPTLINK > /dev/null 2>&1 [ ! -s $ADOPTERS ] && { echo "ERROR: Cannot see: $ADOPTERS from $ADOPTLINK" 2>&1 exit 1 } # # find pachages rebuilt since last pass [ -e $EPOCH ] && { for j in `cat $ADOPTERS | sort | awk '{print $1}' | grep -v ^$`; do TOWHO=`grep ^$j $ADOPTERS | tr '\012' ' ' | awk '{print $2}' ` [ "x$TOWHO" = "x" ] && { TOWHO="herrold+orphan@owlriver.com" } # echo "$j ${TOWHO}" DIRTY="" for i in ` find $RESULTS -newer $EPOCH -follow -a -print | \ grep src.rpm$ | grep [/]$j[-] | grep -v 'cAos-1.0' `; do echo "$i" >> $WORKDIR/work/${TOWHO} # echo " -- $i success" DIRTY="y" export DIRTY done [ "x$DIRTY" = "x" ] && { for i in ` find $RESULTS -newer $EPOCH -follow -a -print | \ grep error.txt$ | grep [/]$j[-] | grep -v 'cAos-1.0' `; do echo "$i" >> $WORKDIR/work/${TOWHO} # echo " -- $i error" DIRTY="y" export DIRTY done } [ "x$DIRTY" != "x" ] && { echo "" >> $WORKDIR/work/${TOWHO} } done } # # and update the last pass indicator touch $EPOCH # # walk the hash, sending bundles of joy # [ 6 = 9 ] && { for i in `find $WORKDIR/work/ -name '*' -a -print `; do ADDRESSEE=`basename $i` ( echo "Caos Build report" ; echo " " ; \ echo " " ; \ date ; \ echo "This reports successes (ends with .src.rpm) or possible problems" ; \ echo " " ; \ cat $i | sed -e 's$/var/www/html$http://mirror.caosity.org$' ) | \ mail -s "Temple Builder report" $ADDRESSEE echo " $i" rm $i sleep 1 done # } # # EOJ #