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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. /home/dmdirc/scripts/oblong.sh "LAUNCHER" "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. cp ${SRCFILE} ${DESTFILE}
  31. else
  32. FUNCTIONSLINE=$((${FUNCTIONSLINE%%:*} + 0))
  33. head -n ${FUNCTIONSLINE} ${SRCFILE} > ${DESTFILE}
  34. cat functions.sh >> ${DESTFILE}
  35. echo "" >> ${DESTFILE}
  36. tail ${TAILOPTS}$((${FUNCTIONSLINE%%:*} + 1)) ${SRCFILE} >> ${DESTFILE}
  37. fi;
  38. else
  39. /home/dmdirc/scripts/oblong.sh "LAUNCHER" "Unable to create unix launcher update, no functions.sh found."
  40. fi;
  41. fi;
  42. if [ ! -e "${LAUNCHERUPDATEDIR}/windows-${WINDOWSVERSION}.zip" ]; then
  43. /home/dmdirc/scripts/oblong.sh "LAUNCHER" "Creating Launcher Update: windows-${WINDOWSVERSION}";
  44. OLDDIR=${PWD}
  45. cd ${LAUNCHERDIR}/windows
  46. sh compile.sh
  47. # Create symlinks
  48. for exe in `ls *.exe`; do
  49. ln -s ${exe} .${exe}
  50. done;
  51. # Create Zip File
  52. zip -9 ${LAUNCHERUPDATEDIR}/windows-${WINDOWSVERSION}.zip .*.exe
  53. # Remove temp exes
  54. for exe in `ls .*.exe`; do
  55. rm -Rf ${exe}
  56. done;
  57. cd ${OLDDIR}
  58. fi;