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 17KB

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