You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BuildAll.sh 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/sh
  2. # cron doesn't seem to like doing this iself...
  3. . /etc/profile
  4. # Used for nightly.log to help diagnosing problems
  5. env
  6. # Path to WWW Directory
  7. WWWDIR="/home/dmdirc/www"
  8. # Path to trunk
  9. MYDIR="/home/dmdirc/google"
  10. # Path to scripts
  11. SCRIPTDIR="/home/dmdirc/scripts"
  12. # Path to ant binary
  13. ANT="/usr/bin/ant"
  14. # Path to git binary
  15. GIT="/usr/bin/git"
  16. # Path to jar binary
  17. JAR="/usr/bin/jar"
  18. cd ${MYDIR}
  19. if [ -d .git ]; then
  20. $GIT reset --hard
  21. $GIT checkout master
  22. $GIT pull
  23. GITREV=`$GIT describe`
  24. else
  25. echo "GIT Directory not found."
  26. exit 1;
  27. fi;
  28. export DMDIRC_GIT=${GITREV}
  29. # Archive old nightlies
  30. if [ `date +%d` = "01" ]; then
  31. echo "Archiving Last Months Nightlies"
  32. OLDDIR=${WWWDIR}/nightly/old/`date -d yesterday +%B%y | tr "[:upper:]" "[:lower:]"`
  33. mkdir -p ${OLDDIR}
  34. mv -fv ${WWWDIR}/nightly/*_`date -d yesterday +%Y%m`??_* ${OLDDIR}
  35. mv -fv ${WWWDIR}/nightly/*-`date -d yesterday +%Y%m`??_* ${OLDDIR}
  36. rm -Rf ${WWWDIR}/nightly/*_latest*
  37. fi
  38. # The date/git rev to add to the end of the file names of stuff
  39. FILEDATA=`date +%Y%m%d`_${GITREV}
  40. # Build plugins/jar
  41. $ANT -Dchannel=NIGHTLY -k clean jar
  42. PHP=`which php`
  43. # Check if build failed
  44. if [ ! -e "$MYDIR/dist/DMDirc.jar" ]; then
  45. # Report failure
  46. echo "Build Failure."
  47. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  48. $PHP -q $SCRIPTDIR/nightly-failure.php
  49. fi
  50. else
  51. # Build installers
  52. # Delete all automatically added plugins from the jar to allow the installer
  53. # to add its own on a per-os basis
  54. unzip -l ${MYDIR}/dist/DMDirc.jar | grep " plugins/" | tr -s ' ' | cut -d ' ' -f 5- | xargs zip ${MYDIR}/dist/DMDirc.jar -d
  55. cd "${MYDIR}/installer"
  56. ./release.sh --jar "${MYDIR}/dist/DMDirc.jar" --opt "--extra ${FILEDATA}" trunk
  57. cd "${MYDIR}"
  58. if [ ! -e "${MYDIR}/installer/output/DMDirc-Setup-${FILEDATA}.exe" -o ! -e "${MYDIR}/installer/output/DMDirc-Setup-${FILEDATA}.run" -o ! -e "${MYDIR}/installer/output/DMDirc-${FILEDATA}.dmg" -o ! -e "${MYDIR}/installer/output/DMDirc-${FILEDATA}.jar" ]; then
  59. # Report failure
  60. echo "Installer Build Failure."
  61. if [ -e "$SCRIPTDIR/nightly-failure.php" -a "${PHP}" != "" ]; then
  62. export DMDIRC_INSTALLERFAILURE=true;
  63. export BAMBOO_BUILD;
  64. $PHP -q $SCRIPTDIR/nightly-failure.php
  65. fi
  66. fi;
  67. # Re-Add all plugins to the jar so that the nightly .jar has everything.
  68. $JAR -uvf "dist/DMDirc.jar" plugins
  69. # Submit plugins to addons site
  70. if [ -e "${HOME}/www/addons/submitplugin.php" ]; then
  71. for plugin in `ls plugins/*.jar`; do
  72. $PHP ${HOME}/www/addons/submitplugin.php $plugin
  73. done;
  74. fi;
  75. # Move installers/jar to nightlies site
  76. FILENAME=DMDirc_${FILEDATA}.jar
  77. mv "installer/output/DMDirc-Setup-${FILEDATA}.exe" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe"
  78. mv "installer/output/DMDirc-Setup-${FILEDATA}.run" "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run"
  79. mv "installer/output/DMDirc-${FILEDATA}.dmg" "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg"
  80. rm -Rf "installer/output/DMDirc-${FILEDATA}.jar"
  81. cp dist/DMDirc.jar /home/dmdirc/www/nightly/$FILENAME
  82. if [ -e "${WWWDIR}/nightly/${FILENAME}" ]; then
  83. ln -sf ${WWWDIR}/nightly/${FILENAME} $WWWDIR/nightly/DMDirc_latest.jar
  84. fi;
  85. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" ]; then
  86. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.run" $WWWDIR/nightly/DMDirc-Setup_latest.run
  87. fi;
  88. if [ -e "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" ]; then
  89. ln -sf "${WWWDIR}/nightly/DMDirc-Setup-${FILEDATA}.exe" $WWWDIR/nightly/DMDirc-Setup_latest.exe
  90. fi;
  91. if [ -e "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" ]; then
  92. ln -sf "${WWWDIR}/nightly/DMDirc-${FILEDATA}.dmg" $WWWDIR/nightly/DMDirc_latest.dmg
  93. fi;
  94. # Do normal reports
  95. if [ "${IS_BAMBOO}" == "" ]; then
  96. /bin/sh $MYDIR/DoReports.sh
  97. fi;
  98. fi