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