sfsnapshot 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #! /bin/bash
  2. # Butchered version of snapshot
  3. # Can only run on the shell compile farm server
  4. # Will always create a snapshot of HEAD
  5. # If want multiple snapshots, just run with "sfsnapshot {branch} [branch2 ...]"
  6. # Assumes:
  7. # ssh setup to send to shell.sf.net and $CF without password prompt
  8. # autconf and automake installed on shell cf at v 2.57 & 1.72 and in PATH
  9. function die { echo $1; exit 1; }
  10. # This makes the distribution. Expects $1 as CVS tag, otherwise uses HEAD
  11. function make_dist {
  12. if [[ -n $1 ]] ; then
  13. cvs_rel=$1
  14. v="$1-"
  15. else
  16. cvs_rel="HEAD"
  17. v=""
  18. fi
  19. # Get compile server to do the work
  20. # Variables will be expanded locally before being run on $CF
  21. ssh $CF <<-EOF
  22. set -x
  23. PATH=$PATH
  24. [[ ! -d $IN/$cvs_rel ]] && mkdir -p $IN/$cvs_rel
  25. cd $IN/$cvs_rel
  26. if [[ -d $PROJECT ]] ; then
  27. cd $PROJECT
  28. cvs update -r $cvs_rel
  29. else
  30. cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nagiosplug co -r $cvs_rel nagiosplug
  31. cd $PROJECT
  32. aclocal
  33. autoheader
  34. autoconf
  35. automake
  36. autoreconf
  37. ./configure
  38. fi
  39. # Make the Nagiosplug dist tarball
  40. VER=$v$DS VERSION=$v$DS REL=snapshot make -e dist
  41. # End ssh
  42. EOF
  43. }
  44. # Set working variables
  45. PROJECT=nagiosplug
  46. IN=${HOME}/tmp_snapshot
  47. OUT_SERVER="shell.sf.net"
  48. OUT="/home/groups/n/na/nagiosplug/htdocs/snapshot"
  49. CF="usf-cf-x86-linux-2"
  50. DS=`date -u +%Y%m%d%H%M`
  51. # Make dists for HEAD and any others in command parameters
  52. make_dist
  53. for i in $* ; do
  54. make_dist $i
  55. done
  56. # Check for *.gz files locally (expect NFS between cf shell server and $CF)
  57. set -x
  58. files=$(ls $IN/*/$PROJECT/*.gz 2>/dev/null)
  59. [[ -z $files ]] && die "No files created"
  60. ssh $OUT_SERVER "rm -f $OUT/*.gz"
  61. scp $files $OUT_SERVER:$OUT
  62. # Create MD5 sum
  63. ssh $OUT_SERVER << EOF
  64. cd $OUT
  65. md5sum *.gz > MD5SUM
  66. EOF
  67. rm -f $files