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.

createUpdate.sh 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. # This script generates the launcher updates
  3. LAUNCHERDIR=`dirname $0`
  4. LAUNCHERUPDATEDIR="/home/dmdirc/www/updates/launchers/"
  5. UNIXVERSION=`cat ${LAUNCHERDIR}/unix/DMDirc.sh | grep LAUNCHERVERSION= | awk -F\" '{print $2}'`
  6. WINDOWSVERSION=`cat ${LAUNCHERDIR}/windows/DMDirc.dpr | grep "launcherVersion: String =" | awk -F\' '{print $2}'`
  7. # Find out what params we should pass to things.
  8. # Solaris has a nice and ancient version of grep in /usr/bin
  9. grep -na "" /dev/null >/dev/null 2>&1
  10. if [ $? -eq 2 ]; then
  11. GREPOPTS="-n"
  12. else
  13. GREPOPTS="-na"
  14. fi;
  15. # Solaris also has a crappy version of tail!
  16. tail -n +1 /dev/null >/dev/null 2>&1
  17. if [ $? -eq 2 ]; then
  18. TAILOPTS="+"
  19. else
  20. TAILOPTS="-n +"
  21. fi;
  22. if [ ! -e "${LAUNCHERUPDATEDIR}/unix-${UNIXVERSION}.sh" ]; then
  23. echo "Creating Launcher Update: unix-${UNIXVERSION}";
  24. FUNCTIONSFILE="${LAUNCHERDIR}/../installer/linux/functions.sh"
  25. SRCFILE=${LAUNCHERDIR}/unix/DMDirc.sh
  26. DESTFILE=${LAUNCHERUPDATEDIR}/unix-${UNIXVERSION}.sh
  27. if [ -e "${FUNCTIONSFILE}" ]; then
  28. FUNCTIONSLINE=`grep ${GREPOPTS} "^###FUNCTIONS_FILE###$" ${SRCFILE}`
  29. if [ "${FUNCTIONSLINE}" == "" ]; then
  30. echo " Functions already built into launcher."
  31. cp ${SRCFILE} ${DESTFILE}
  32. else
  33. echo " Including functions.sh into launcher."
  34. FUNCTIONSLINE=$((${FUNCTIONSLINE%%:*} + 0))
  35. head -n ${FUNCTIONSLINE} ${SRCFILE} > ${DESTFILE}
  36. cat functions.sh >> ${DESTFILE}
  37. echo "" >> ${DESTFILE}
  38. tail ${TAILOPTS}$((${FUNCTIONSLINE%%:*} + 1)) ${SRCFILE} >> ${DESTFILE}
  39. fi;
  40. else
  41. echo " Unable to create unix launcher update, no functions.sh found."
  42. fi;
  43. fi;
  44. if [ ! -e "${LAUNCHERUPDATEDIR}/windows-${WINDOWSVERSION}.zip" ]; then
  45. echo "Creating Launcher Update: windows-${WINDOWSVERSION}";
  46. OLDDIR=${PWD}
  47. cd ${LAUNCHERDIR}/windows
  48. sh compile.sh
  49. # Create symlinks
  50. for exe in `ls *.exe`; do
  51. ln -s ${exe} .${exe}
  52. done;
  53. # Create Zip File
  54. zip -9 ${LAUNCHERUPDATEDIR}/windows-${WINDOWSVERSION}.zip .*.exe
  55. # Remove temp exes
  56. for exe in `ls .*.exe`; do
  57. rm -Rf ${exe}
  58. done;
  59. cd ${OLDDIR}
  60. fi;