sfsnapshot 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. OUT="~/test"
  50. CF="usf-cf-x86-linux-2"
  51. DS=`date -u +%Y%m%d%H%M`
  52. # Make dists for HEAD and any others in command parameters
  53. make_dist
  54. for i in $* ; do
  55. make_dist $i
  56. done
  57. # Check for *.gz files locally (expect NFS between cf shell server and $CF)
  58. set -x
  59. files=$(ls $IN/*/$PROJECT/*.gz 2>/dev/null)
  60. [[ -z $files ]] && die "No files created"
  61. ssh $OUT_SERVER "rm -f $OUT/*.gz"
  62. scp $files $OUT_SERVER:$OUT
  63. # Create MD5 sum
  64. ssh $OUT_SERVER << EOF
  65. cd $OUT
  66. md5sum *.gz > MD5SUM
  67. EOF
  68. rm -f $files