sfsnapshot 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. rm configure.in
  29. cvs update -r $cvs_rel
  30. else
  31. cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nagiosplug co -r $cvs_rel nagiosplug
  32. cd $PROJECT
  33. fi
  34. sed 's/^VER=.*/VER=$v$DS/;s/^REL=.*/REL=snapshot/' configure.in > configure.tmp
  35. mv configure.tmp configure.in
  36. aclocal -I lib
  37. autoheader
  38. autoconf
  39. automake --add-missing --copy
  40. autoreconf
  41. ./configure
  42. # Make the Nagiosplug dist tarball
  43. make dist
  44. # End ssh
  45. EOF
  46. }
  47. # Set working variables
  48. PROJECT=nagiosplug
  49. IN=${HOME}/tmp_snapshot
  50. OUT_SERVER="shell.sf.net"
  51. OUT="/home/groups/n/na/nagiosplug/htdocs/snapshot"
  52. CF="usf-cf-x86-linux-2"
  53. DS=`date -u +%Y%m%d%H%M`
  54. # Make dists for HEAD and any others in command parameters
  55. make_dist
  56. for i in $* ; do
  57. make_dist $i
  58. done
  59. # Check for *.gz files locally (expect NFS between cf shell server and $CF)
  60. set -x
  61. files=$(ls $IN/*/$PROJECT/*.gz 2>/dev/null)
  62. [[ -z $files ]] && die "No files created"
  63. ssh $OUT_SERVER "rm -f $OUT/*.gz"
  64. scp $files $OUT_SERVER:$OUT
  65. # Create MD5 sum
  66. ssh $OUT_SERVER << EOF
  67. cd $OUT
  68. md5sum *.gz > MD5SUM
  69. EOF
  70. rm -f $files