#! /bin/bash # Butchered version of snapshot # Can only run on the shell compile farm server # Will always create a snapshot of HEAD # If want multiple snapshots, just run with "sfsnapshot [branch ...]" # Assumes: # ssh setup to send to shell.sf.net and $CF without password prompt # the compile server has all the prerequisites stated at http://nagiosplug.sourceforge.net/developer-guidelines.html # Install in cron with something like: # 47 * * * * $HOME/bin/mail_error -o $HOME/sfsnapshot.out -m tonvoon@users.sf.net sfsnapshot r1_3_0 function die { echo $1; exit 1; } # This makes the distribution. Expects $1 as CVS tag, otherwise uses HEAD function make_dist { if [[ -n $1 ]] ; then cvs_rel=$1 v="$1-" else cvs_rel="HEAD" v="HEAD-" fi # Get compile server to do the work # Variables will be expanded locally before being run on $CF ssh $CF </dev/null) [[ -z $files ]] && die "No files created" head_file=$(cd $IN && ls *HEAD*.gz 2>/dev/null) ssh -2 $OUT_SERVER "rm -f $OUT/*.gz" scp -2 $files $OUT_SERVER:$OUT if [[ -n $head_file ]] ; then ssh -2 $OUT_SERVER "cd $OUT && ln -s $head_file nagios-plugins-HEAD.tar.gz" fi # Create MD5 sum ssh -2 $OUT_SERVER << EOF cd $OUT cat <<-END_README > README This is the daily CVS snapshot of nagiosplug, consisting of the CVS HEAD and any other branches. The nagios-plugins-HEAD.tar.gz link will always go to the latest HEAD snapshot. The MD5SUM is: END_README md5sum *.gz | tee -a README > MD5SUM EOF rm -f $files # Work out success or failure expected=$(($# + 1)) set -- $files [[ $# -ne $expected ]] && die "Expected $expected, got $#" exit 0