Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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