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.

DMDirc.sh 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. #!/bin/sh
  2. #
  3. # This script launches dmdirc and attempts to update the jar file if needed.
  4. #
  5. # DMDirc - Open Source IRC Client
  6. # Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
  7. #
  8. # Permission is hereby granted, free of charge, to any person obtaining a copy
  9. # of this software and associated documentation files (the "Software"), to deal
  10. # in the Software without restriction, including without limitation the rights
  11. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. # copies of the Software, and to permit persons to whom the Software is
  13. # furnished to do so, subject to the following conditions:
  14. #
  15. # The above copyright notice and this permission notice shall be included in
  16. # all copies or substantial portions of the Software.
  17. #
  18. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  24. # SOFTWARE.
  25. LAUNCHERVERSION="17"
  26. LAUNCHERINFO="unix-${LAUNCHERVERSION}"
  27. params=""
  28. # Check the which command exists, and if so make sure it behaves how we want
  29. # it to...
  30. WHICH=`which which 2>/dev/null`
  31. if [ "" = "${WHICH}" ]; then
  32. echo "which command not found. Aborting.";
  33. exit 0;
  34. else
  35. # Solaris sucks
  36. BADWHICH=`which /`
  37. if [ "${BADWHICH}" != "" ]; then
  38. echo "Replacing bad which command.";
  39. # "Which" on solaris gives non-empty results for commands that don't exist
  40. which() {
  41. OUT=`${WHICH} ${1}`
  42. if [ $? -eq 0 ]; then
  43. echo ${OUT}
  44. else
  45. echo ""
  46. fi;
  47. }
  48. fi;
  49. fi
  50. # Find out where we are
  51. BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
  52. # Store params so that we can pass them back to the client
  53. for param in "$@"; do
  54. if [ "${param}" = "--noprofile" -o "${param}" = "--updateonly" ]; then
  55. continue;
  56. fi;
  57. PSN=`echo "${param}" | grep "^-psn_"`
  58. if [ "" = "${PSN}" ]; then
  59. SPACE=`echo "${param}" | grep " "`
  60. if [ "${SPACE}" != "" ]; then
  61. niceParam=`echo "${param}" | sed 's/"/\\\\"/g'`
  62. params=${params}" \"${niceParam}\""
  63. else
  64. params=${params}" ${param}"
  65. fi;
  66. fi;
  67. done;
  68. if [ -e "${BASEDIR}/functions.sh" ]; then
  69. . ${BASEDIR}/functions.sh
  70. else
  71. echo "Unable to find functions.sh, using built in functions"
  72. ###FUNCTIONS_FILE###
  73. fi;
  74. # Check to see if we can bspatch things
  75. BSPATCH="./bspatch"
  76. if [ ! -e "${BSPATCH}" ]; then
  77. BSPATCH=`which bspatch`
  78. fi;
  79. # This launcher supports zip files.
  80. LAUNCHERINFO=${LAUNCHERINFO}",zip"
  81. if [ "${BSPATCH}" != "" ]; then
  82. # TODO: Website should (if available) send bsdiff patches
  83. # to clients with bsdiff compatible launchers
  84. LAUNCHERINFO=${LAUNCHERINFO}",bsdiff";
  85. fi;
  86. # Check for some CLI params
  87. if [ "${ISOSX}" = "1" ]; then
  88. profiledir="${HOME}/Library/Preferences/DMDirc/"
  89. else
  90. profiledir="${HOME}/.DMDirc/"
  91. if [ ! -d "${profiledir}" ]; then
  92. profiledir="${XDG_CONFIG_HOME}"
  93. if [ "${profiledir}" = "" ]; then
  94. profiledir="${HOME}/.config"
  95. fi;
  96. profiledir="${profiledir}/DMDirc/"
  97. fi;
  98. fi;
  99. USEPROFILE=1;
  100. UPDATEONLY=0;
  101. while test -n "$1"; do
  102. case "$1" in
  103. --directory|-d)
  104. shift
  105. profiledir=${1}
  106. ;;
  107. --noprofile)
  108. USEPROFILE=0;
  109. ;;
  110. --updateonly)
  111. UPDATEONLY=1;
  112. ;;
  113. -p|--portable)
  114. profiledir=${PWD};
  115. ;;
  116. esac
  117. shift
  118. done
  119. getConfigOption() {
  120. FILE="${profiledir}/dmdirc.config"
  121. WANTED_DOMAIN="${1}"
  122. WANTED_KEY="${2}"
  123. CURRENT_SECTION=""
  124. if [ "${WANTED_KEY}" != "" -a "${WANTED_DOMAIN}" = "" ]; then
  125. if [ -e "${FILE}" ]; then
  126. cat ${FILE} | sed 's/\\/\\\\/g' | while IFS='' read -r LINE; do
  127. IS_SECTION=`echo ${LINE} | egrep "^.*:$"`
  128. IS_KEYVALUE=`echo ${LINE} | egrep "^[[:space:]]+.*=.*$"`
  129. if [ "" != "${IS_SECTION}" ]; then
  130. CURRENT_SECTION=${LINE%%:*}
  131. elif [ "" != "${IS_KEYVALUE}" ]; then
  132. KEY=`echo ${LINE%%=*} | sed 's/^\s*//g'`
  133. VALUE=${LINE##*=}
  134. if [ "${WANTED_DOMAIN}" = "${CURRENT_SECTION}" -a "${WANTED_KEY}" = "${KEY}" ]; then
  135. echo ${VALUE};
  136. fi;
  137. fi;
  138. done;
  139. fi;
  140. fi;
  141. }
  142. if [ "${ISOSX}" = "1" ]; then
  143. jarDir=${BASEDIR}/../Resources/Java/
  144. jar=${jarDir}DMDirc.jar
  145. else
  146. jar=${BASEDIR}/DMDirc.jar
  147. fi
  148. launcherUpdater=${profiledir}/updateLauncher.sh
  149. BSDJava1="/usr/local/jdk1.6.0/jre/bin/java"
  150. BSDJava2="/usr/local/diablo-jdk1.6.0/jre/bin/java"
  151. echo "---------------------"
  152. echo "DMDirc - Open Source IRC Client"
  153. echo "Launcher Version: ${LAUNCHERVERSION}"
  154. echo "Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes"
  155. echo "---------------------"
  156. if [ "${ISOSX}" = "1" ]; then
  157. echo "Running on OS X."
  158. elif [ "${KERNEL}" = "Linux" ]; then
  159. echo "Running on Linux."
  160. elif [ "`echo ${KERNEL} | grep -i BSD`" != "" ]; then
  161. echo "Running on BSD."
  162. elif [ "`echo ${KERNEL} | grep -i SunOS`" != "" ]; then
  163. echo "Running on Solaris."
  164. else
  165. echo "Running on unknown unix variation: ${KERNEL}."
  166. fi;
  167. if [ -e "${profiledir}/.launcher.zip" ]; then
  168. # Unzip!
  169. unzip ${profiledir}/.launcher.zip -d ${profiledir}/
  170. fi;
  171. echo -n "Checking for launcher updates in ${profiledir} - ";
  172. if [ -e "${profiledir}/.launcher.sh.ignore" ]; then
  173. rm -Rf "${profiledir}/.launcher.sh.ignore"
  174. echo "Ignoring!";
  175. elif [ -e "${profiledir}/.launcher.sh" ]; then
  176. echo "Found!";
  177. echo "Attempting to update..";
  178. # The code below intentionally doesn't use the FUNCTIONS_FILE include as it
  179. # wouldn't correctly escape \${0} and \${2} where needed and thus stuff would
  180. # break!
  181. cat <<EOF> ${launcherUpdater}
  182. cd ${BASEDIR}
  183. if [ -e "${BASEDIR}/functions.sh" ]; then
  184. . ${BASEDIR}/functions.sh
  185. else
  186. echo "Unable to find functions.sh, using old functions"
  187. errordialog() {
  188. # Send message to console.
  189. echo ""
  190. echo "-----------------------------------------------------------------------"
  191. echo "Error: \${1}"
  192. echo "-----------------------------------------------------------------------"
  193. echo "\${2}"
  194. echo "-----------------------------------------------------------------------"
  195. if [ "${ISOSX}" = "1" -a "" != "${OSASCRIPT}" ]; then
  196. echo "Displaying dialog.."
  197. ${OSASCRIPT} -e 'tell application "System Events"' -e "activate" -e "display dialog \"${1}\n${2}\" buttons {\"Ok\"} with icon stop" -e 'end tell'
  198. else
  199. if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
  200. echo "Dialog on Display: ${DISPLAY}"
  201. ${KDIALOG} --title "DMDirc: \${1}" --error "\${1}\n\n\${2}"
  202. elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
  203. echo "Dialog on Display: ${DISPLAY}"
  204. ${ZENITY} --error --title "DMDirc: \${1}" --text "\${1}\n\n\${2}"
  205. fi
  206. fi
  207. }
  208. messagedialog() {
  209. # Send message to console.
  210. echo ""
  211. echo "-----------------------------------------------------------------------"
  212. echo "Info: \${1}"
  213. echo "-----------------------------------------------------------------------"
  214. echo "\${2}"
  215. echo "-----------------------------------------------------------------------"
  216. if [ "${ISOSX}" = "1" -a "" != "${OSASCRIPT}" ]; then
  217. echo "Displaying dialog.."
  218. ${OSASCRIPT} -e 'tell application "System Events"' -e "activate" -e "display dialog \"${1}\n${2}\" buttons {\"Ok\"} giving up after 120 with icon note" -e 'end tell'
  219. else
  220. if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
  221. echo "Dialog on Display: ${DISPLAY}"
  222. ${KDIALOG} --title "DMDirc: \${1}" --msgbox "\${1}\n\n\${2}"
  223. elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
  224. echo "Dialog on Display: ${DISPLAY}"
  225. ${ZENITY} --info --title "DMDirc: \${1}" --text "\${1}\n\n\${2}"
  226. fi
  227. fi;
  228. }
  229. fi;
  230. mv -fv ${profiledir}/.launcher.sh ${0}
  231. if [ ! -e "${profiledir}/.launcher.sh" ]; then
  232. echo "Launcher Update successful."
  233. messagedialog "Launcher Update" "Launcher Update successful"
  234. else
  235. if [ "${UID}" = "" ]; then
  236. UID=`id -u`;
  237. fi
  238. if [ "0" != "${UID}" ]; then
  239. if [ "${ISOSX}" = "1" ]; then
  240. messagedialog "DMDirc" "The DMDirc Client Updater was unable to modify the client installation, trying again with administrator access"
  241. if [ $? -eq 0 ]; then
  242. echo "Password dialog on display"
  243. osascript -e do shell script "mv -fv \"${profiledir}/.launcher.sh\" \"${0}\"" with administrator privileges
  244. fi;
  245. else
  246. if [ "" != "${ISKDE}" -a "" != "${KSUDO}" -a "" != "${DISPLAY}" ]; then
  247. echo "Password dialog on ${DISPLAY}"
  248. ${KSUDO} --comment "DMDirc Client Updater requires root access to modify the global installation" -- mv -fv "${profiledir}/.launcher.sh" "${0}"
  249. elif [ "" != "${ISGNOME}" -a "" != "${GSUDO}" -a "" != "${DISPLAY}" ]; then
  250. echo "Password dialog on ${DISPLAY}"
  251. ${GSUDO} -k --message "DMDirc Client Updater requires root access to modify the global installation" -- mv -fv "${profiledir}/.launcher.sh" "${0}"
  252. elif [ "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
  253. sudo -k
  254. ${ZENITY} --entry --title="DMDirc" --text="DMDirc Client Updater requires root access to modify the global installation, please enter your password to continue." --entry-text="" --hide-text | sudo -S -- mv -fv "${profiledir}/.launcher.sh" "${0}"
  255. else
  256. echo "DMDirc Client Updater requires root access to modify the global installation"
  257. sudo mv -fv "${profiledir}/.launcher.sh" "${0}"
  258. fi;
  259. fi;
  260. fi
  261. if [ ! -e "${profiledir}/.launcher.sh" ]; then
  262. echo "Update successful."
  263. messagedialog "Launcher Update" "Launcher Update successful"
  264. else
  265. echo "Launcher failed."
  266. errordialog "Launcher Update" "Launcher Update failed, using old version"
  267. touch ${profiledir}/.launcher.sh.ignore
  268. fi;
  269. fi;
  270. sh ${0} ${params}
  271. EOF
  272. chmod a+x ${launcherUpdater}
  273. ${launcherUpdater}
  274. exit 0;
  275. else
  276. echo "Not found.";
  277. fi;
  278. if [ -e "${launcherUpdater}" ]; then
  279. rm -Rf "${launcherUpdater}"
  280. fi;
  281. echo -n "Checking for client updates in ${profiledir} - ";
  282. UPDATESOURCE="${profiledir}/.DMDirc.jar"
  283. BSDIFF="0"
  284. if [ -e "${profiledir}/.DMDirc.jar.bsdiff" -a "${BSPATCH}" != "" ]; then
  285. UPDATESOURCE="${profiledir}/.DMDirc.jar.bsdiff"
  286. BSDIFF="1"
  287. fi;
  288. if [ -e "${UPDATESOURCE}" ]; then
  289. UPDATEOK="0"
  290. TRYROOT="1"
  291. echo "Found!";
  292. echo "Attempting to update..";
  293. if [ "${BSDIFF}" = "1" ]; then
  294. cp ${jar} ${jar}.bak
  295. ${BSPATCH} ${jar}.bak ${jar} ${UPDATESOURCE}
  296. if [ "${?}" = "0" ]; then
  297. FILEINFO=`which ${jar} | egrep "data$"`
  298. if [ "${FILEINFO}" = "" ]; then
  299. UPDATEOK="1"
  300. else
  301. # Let the user know the update failed.
  302. echo "1" >> "${profiledir}/.updatefailed";
  303. chmod 777 "${profiledir}/.updatefailed";
  304. # Replace the attempted update with the old jar
  305. cp ${jar}.bak ${jar}
  306. # Don't bother trying as root.
  307. TRYROOT="0"
  308. fi;
  309. fi;
  310. else
  311. mv -fv ${UPDATESOURCE} ${jar}
  312. if [ ! -e "${profiledir}/.DMDirc.jar" ]; then
  313. UPDATEOK="1"
  314. fi;
  315. fi;
  316. if [ "${UPDATEOK}" = "1" ]; then
  317. echo "Update successful."
  318. messagedialog "Client Update" "Client Update successful"
  319. if [ "${UPDATEONLY}" = "1" ]; then
  320. exit 0;
  321. fi;
  322. else
  323. if [ "${UID}" = "" ]; then
  324. UID=`id -u`;
  325. fi
  326. if [ "0" != "${UID}" -a "1" = "${TRYROOT}" ]; then
  327. if [ "${ISOSX}" = "1" ]; then
  328. messagedialog "DMDirc" "The DMDirc Client Updater was unable to modify the client installation, trying again with administrator access"
  329. if [ $? -eq 0 ]; then
  330. echo "Password dialog on display"
  331. # osascript -e "do shell script \"mv -fv \\\"${profiledir}/.DMDirc.jar\\\" \\\"${jar}\\\"\" with administrator privileges"
  332. osascript -e "do shell script \"sh ${0} ${params} -d "${profiledir}" --updateonly\" with administrator privileges"
  333. fi;
  334. else
  335. if [ "" != "${ISKDE}" -a "" != "${KSUDO}" -a "" != "${DISPLAY}" ]; then
  336. echo "Password dialog on ${DISPLAY}"
  337. # ${KSUDO} --comment "DMDirc Client Updater requires root access to modify the global installation" -- mv -fv "${profiledir}/.DMDirc.jar" "${jar}"
  338. ${KSUDO} --comment "DMDirc Client Updater requires root access to modify the global installation" -- sh ${0} ${params} -d "${profiledir}" --updateonly
  339. elif [ "" != "${ISGNOME}" -a "" != "${GSUDO}" -a "" != "${DISPLAY}" ]; then
  340. echo "Password dialog on ${DISPLAY}"
  341. # ${GSUDO} -k --message "DMDirc Client Updater requires root access to modify the global installation" -- mv -fv "${profiledir}/.DMDirc.jar" "${jar}"
  342. ${GSUDO} -k --message "DMDirc Client Updater requires root access to modify the global installation" -- sh ${0} ${params} -d "${profiledir}" --updateonly
  343. elif [ "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
  344. sudo -k
  345. ${ZENITY} --entry --title="DMDirc" --text="DMDirc Client Updater requires root access to modify the global installation, please enter your password to continue." --entry-text="" --hide-text | sudo -S -- sh ${0} ${params} -d "${profiledir}" --updateonly
  346. else
  347. echo "DMDirc Client Updater requires root access to modify the global installation"
  348. # sudo mv -fv "${profiledir}/.DMDirc.jar" "${jar}"
  349. sudo sh ${0} ${params} -d "${profiledir}" --updateonly
  350. fi;
  351. fi;
  352. elif [ "${UPDATEONLY}" = "1" ]; then
  353. # Update failed as root, so give up.
  354. echo "1" >> "${profiledir}/.updatefailed";
  355. chmod 777 "${profiledir}/.updatefailed";
  356. exit 1;
  357. fi;
  358. if [ ! -e "${profiledir}/.updatefailed" ]; then
  359. echo "Update successful."
  360. messagedialog "Client Update" "Client Update successful"
  361. else
  362. rm -Rf ${profiledir}/.updatefailed;
  363. echo "Update failed."
  364. errordialog "Client Update" "Client Update failed, using old version"
  365. if [ "${BSDIFF}" = "1" ]; then
  366. # Run the client without bspatch support
  367. LAUNCHERINFO=`echo ${LAUNCHERINFO} | sed 's/|bsdiff//'`
  368. fi;
  369. fi;
  370. fi
  371. else
  372. echo "Not found.";
  373. fi;
  374. if [ "${UPDATEONLY}" = "1" ]; then
  375. exit 0;
  376. fi;
  377. relaunch() {
  378. trap - INT TERM EXIT
  379. echo ""
  380. echo "============================================================="
  381. echo "ERROR"
  382. echo "============================================================="
  383. echo "${HOME}/.profile has errors in it (or an 'exit' command)."
  384. echo "Setup will now restart with the --noprofile option."
  385. echo "============================================================="
  386. sh ${0} ${params} --noprofile
  387. }
  388. echo -n "Looking for java - ";
  389. if [ "${ISOSX}" = "1" ]; then
  390. JAVA=`which java`
  391. if [ -e "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java" ]; then
  392. JAVA="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java"
  393. elif [ -e "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java" ]; then
  394. JAVA="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java"
  395. fi;
  396. else
  397. if [ -e "${HOME}/.profile" -a "${USEPROFILE}" = "1" ]; then
  398. # Source the profile incase java can't be found otherwise
  399. trap relaunch INT TERM EXIT
  400. . ${HOME}/.profile
  401. trap - INT TERM EXIT
  402. fi;
  403. JAVA=`which java`
  404. if [ ! -e "${JAVA}" ]; then
  405. # Location where ports on FreeBSD/PCBSD installs java6
  406. # check it first, because it isn't added to the path automatically
  407. JAVA=${BSDJava1}
  408. if [ ! -e "${JAVA}" ]; then
  409. # Try alternative BSD Location
  410. JAVA=${BSDJava2}
  411. fi;
  412. fi;
  413. fi;
  414. if [ "" != "${JAVA}" ]; then
  415. echo "Success! (${JAVA})"
  416. else
  417. echo "Failed!"
  418. ERROR="Sorry, java does not appear to be installed on this machine.";
  419. ERROR=${ERROR}"\n"
  420. if [ "${ISOSX}" = "1" ]; then
  421. ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM.";
  422. else
  423. ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from: http://www.java.com";
  424. ERROR=${ERROR}"\nor reinstall DMDirc and let the installer install one for you.";
  425. fi;
  426. errordialog "Unable to launch dmdirc!" "${ERROR}";
  427. exit 1;
  428. fi
  429. echo -n "Running DMDirc - "
  430. if [ -e "${jar}" ]; then
  431. # Check that DMDirc will run, if java is not 1.6 this will fail.
  432. # We do it this way otherwise segfaults etc would cause an unable to launch
  433. # error message to be printed.
  434. ${JAVA} -jar ${jar} --help >/dev/null 2>&1
  435. if [ $? -ne 0 ]; then
  436. FAILED=1
  437. # If we are on BSD, check to see if there is alternative versions of java
  438. # than the one in the path.
  439. if [ "`echo ${KERNEL} | grep -i BSD`" != "" ]; then
  440. if [ "${JAVA}" != "${BSDJava1}" -a "${JAVA}" != "${BSDJava2}" ]; then
  441. JAVA=${BSDJava1}
  442. if [ ! -e "${JAVA}" ]; then
  443. JAVA=${BSDJava2}
  444. fi;
  445. # Now check to see if DMDirc runs again.
  446. ${JAVA} -jar ${jar} --help >/dev/null 2>&1
  447. if [ $? -eq 0 ]; then
  448. # It runs!
  449. FAILED=0
  450. fi;
  451. fi;
  452. fi;
  453. if [ ${FAILED} -eq 1 ]; then
  454. echo "Failed."
  455. ERROR="Sorry, the currently installed version of java is not compatible with DMDirc.";
  456. ERROR=${ERROR}"\n";
  457. if [ "${ISOSX}" = "1" ]; then
  458. ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM.";
  459. else
  460. ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from: http://www.java.com";
  461. ERROR=${ERROR}"\nor reinstall DMDirc and let the installer install one for you.";
  462. fi;
  463. errordialog "Unable to launch dmdirc!" "${ERROR}";
  464. exit 1;
  465. fi;
  466. fi
  467. # Now we can run the client for real, this allows stderr/stdout output
  468. # to be seen, and the shell script exits with the correct exit code.
  469. APPLEOPTS=""
  470. if [ "${ISOSX}" = "1" ]; then
  471. APPLEOPTS="${APPLEOPTS} -Djava.library.path=${jarDir}"
  472. #APPLEOPTS="${APPLEOPTS} -Dcom.apple.mrj.application.growbox.intrudes=false"
  473. #APPLEOPTS="${APPLEOPTS} -Dcom.apple.mrj.application.live-resize=true"
  474. APPLEOPTS="${APPLEOPTS} -Dcom.apple.mrj.application.apple.menu.about.name=DMDirc"
  475. #APPLEOPTS="${APPLEOPTS} -Dapple.awt.showGrowBox=true"
  476. #APPLEOPTS="${APPLEOPTS} -Dapple.laf.useScreenMenuBar=true"
  477. fi;
  478. ${JAVA}${APPLEOPTS} -ea -jar ${jar} -l ${LAUNCHERINFO} ${params}
  479. EXITCODE=${?}
  480. if [ ${EXITCODE} -eq 42 ]; then
  481. # The client says we need to up update, rerun ourself before exiting.
  482. ${0} ${params}
  483. fi;
  484. exit ${EXITCODE};
  485. else
  486. echo "Failed.";
  487. errordialog "Unable to launch dmdirc!" "No jar file found";
  488. fi