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.

makeInstallerLinux.sh 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. #!/bin/sh
  2. #
  3. # This script generates a .run file that will install DMDirc
  4. #
  5. # DMDirc - Open Source IRC Client
  6. # Copyright (c) 2006-2008 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. # Final Name of the installer (without file extention)
  26. INSTALLERNAME=DMDirc-Setup
  27. # Location of .run stub start
  28. STARTLINE=`grep -n "^###START INCLUDE###$" $0`
  29. STARTLINE=$((${STARTLINE%%:*} + 1))
  30. # full name of the file to output to
  31. RUNNAME="${PWD}/${INSTALLERNAME}.run"
  32. # Compress stuff!
  33. compress() {
  34. tar cvfh - $@ | gzip - 2>/dev/null >>${RUNNAME} || {
  35. echo "Compression failed."
  36. kill -15 $$;
  37. };
  38. }
  39. # Go!
  40. echo "-----------"
  41. if [ -e "${RUNNAME}" ]; then
  42. echo "Removing existing .run file"
  43. rm -Rf ./*.run
  44. fi
  45. showHelp() {
  46. echo "This will generate a DMDirc installer for a unix based system."
  47. echo "The following command line arguments are known:"
  48. echo "---------------------"
  49. echo "-h, --help Help information"
  50. echo "-r, --release <version> Generate a file based on an svn tag (or branch with -b aswell)"
  51. echo "-b, --branch Release in -r is a branch "
  52. echo "-p, --plugins <plugins> What plugins to add to the jar file"
  53. echo "-c, --compile Recompile the .jar file"
  54. echo " --jre Include the JRE in this installer"
  55. echo " --jre64 Include the 64-Bit JRE in this installer"
  56. echo " --jar <file> use <file> as DMDirc.jar"
  57. echo " --current Use the current folder as the base for the build"
  58. echo "-t, --tag <tag> Tag to add to final exe name to distinguish this build from a standard build"
  59. echo "-k, --keep Keep the existing source tree when compiling"
  60. echo " (don't svn update beforehand)"
  61. echo "---------------------"
  62. exit 0;
  63. }
  64. # Check for some CLI params
  65. compileJar="false"
  66. updateSVN="true"
  67. isRelease=""
  68. finalTag=""
  69. BRANCH="0"
  70. plugins=""
  71. location="../../../"
  72. jarfile=""
  73. current=""
  74. jre=""
  75. jrename="jre" # Filename for JRE without the .bin
  76. while test -n "$1"; do
  77. case "$1" in
  78. --plugins|-p)
  79. shift
  80. plugins=${1}
  81. ;;
  82. --jar)
  83. shift
  84. jarfile=${1}
  85. ;;
  86. --jre)
  87. jre="http://www.dmdirc.com/getjava/linux/i686"
  88. ;;
  89. --jre64)
  90. jre="http://www.dmdirc.com/getjava/linux/x86_64"
  91. jrename="jre64"
  92. ;;
  93. --current)
  94. location="../../"
  95. current="1"
  96. ;;
  97. --compile|-c)
  98. compileJar="true"
  99. ;;
  100. --release|-r)
  101. shift
  102. isRelease=${1}
  103. ;;
  104. --tag|-t)
  105. shift
  106. finalTag=${1}
  107. RUNNAME="${PWD}/${INSTALLERNAME}-${1}.run"
  108. ;;
  109. --keep|-k)
  110. updateSVN="false"
  111. ;;
  112. --help|-h)
  113. showHelp;
  114. ;;
  115. --branch|-b)
  116. BRANCH="1"
  117. ;;
  118. esac
  119. shift
  120. done
  121. if [ "" = "${current}" ]; then
  122. jarPath="${location}trunk"
  123. else
  124. jarPath="${location}"
  125. fi
  126. if [ "${isRelease}" != "" ]; then
  127. if [ "${BRANCH}" != "0" ]; then
  128. if [ -e "${location}/${isRelease}" ]; then
  129. jarPath="${location}/${isRelease}"
  130. else
  131. echo "Branch "${isRelease}" not found."
  132. exit 1;
  133. fi
  134. else
  135. if [ -e "${location}/${isRelease}" ]; then
  136. jarPath="${location}/${isRelease}"
  137. else
  138. echo "Tag "${isRelease}" not found."
  139. exit 1;
  140. fi
  141. fi
  142. fi
  143. if [ "" = "${jarfile}" ]; then
  144. jarfile=${jarPath}"/dist/DMDirc.jar"
  145. if [ ! -e ${jarPath}"/dist/DMDirc.jar" -o "${compileJar}" = "true" ]; then
  146. echo "Creating jar.."
  147. OLDPWD=${PWD}
  148. cd ${jarPath}
  149. if [ "${updateSVN}" = "true" ]; then
  150. svn update
  151. fi
  152. rm -Rf build dist
  153. ant jar
  154. if [ ! -e "dist/DMDirc.jar" ]; then
  155. echo "There was an error creating the .jar file. Aborting."
  156. exit 1;
  157. fi;
  158. cd ${OLDPWD}
  159. fi;
  160. elif [ ! -e "${jarfile}" ]; then
  161. echo "Requested Jar file (${jarfile}) does not exist."
  162. exit 1;
  163. fi;
  164. if [ "" = "${plugins}" ]; then
  165. echo "Linking jar (${jarfile}).."
  166. ln -sf ${jarfile} "./DMDirc.jar"
  167. else
  168. echo "Copying jar (${jarfile}).."
  169. cp ${jarfile} "./DMDirc.jar"
  170. echo "Adding plugins to jar"
  171. ln -sf ${jarPath}"/plugins"
  172. pluginList=""
  173. for plugin in ${plugins}; do
  174. pluginList=${pluginList}" plugins/${plugin}"
  175. done
  176. jar -uvf "DMDirc.jar" ${pluginList}
  177. rm -Rf plugins;
  178. fi
  179. echo "Creating .run file"
  180. echo "Adding stub.."
  181. tail -n +${STARTLINE} $0 > ${RUNNAME}
  182. # Add release info.
  183. awk '{gsub(/###ADDITIONAL_STUFF###/,"isRelease=\"'${isRelease}'\"");print}' ${RUNNAME} > ${RUNNAME}.tmp
  184. mv ${RUNNAME}.tmp ${RUNNAME}
  185. FILES="DMDirc.jar";
  186. echo "Compressing files.."
  187. for FILE in "getjre.sh" "installjre.sh" "progressbar.sh"; do
  188. if [ -e "${FILE}" ]; then
  189. FILES="${FILES} ${FILE}"
  190. fi
  191. done;
  192. if [ "" != "${jre}" ]; then
  193. if [ ! -e "../common/${jrename}.bin" ]; then
  194. echo "Downloading JRE to include in installer"
  195. wget ${jre} -O ../common/${jrename}.bin
  196. fi
  197. ln -sf ../common/${jrename}.bin jre.bin
  198. FILES="${FILES} jre.bin"
  199. fi;
  200. if [ -e "setup.sh" ]; then
  201. FILES="${FILES} setup.sh"
  202. else
  203. echo "[WARNING] Creating setup-less archive. This will just extract and immediately delete the .jar file unless the -e flag is used"
  204. fi
  205. #if [ -e "../common/installer.jar" ]; then
  206. # ln -sf ../common/installer.jar ./installer.jar
  207. # FILES="${FILES} installer.jar"
  208. #else
  209. # echo "[WARNING] Creating installer-less archive - relying on setup.sh"
  210. #fi
  211. if [ -e ${jarPath}"/src/com/dmdirc/res/source/logo.svg" ]; then
  212. ln -sf ${jarPath}"/src/com/dmdirc/res/source/logo.svg" ./icon.svg
  213. FILES="${FILES} icon.svg"
  214. fi
  215. if [ "${isRelease}" != "" ]; then
  216. DOCSDIR=${jarPath}
  217. else
  218. DOCSDIR="../common"
  219. fi
  220. if [ -e "${DOCSDIR}/README.TXT" ]; then
  221. ln -sf "${DOCSDIR}/README.TXT" .
  222. FILES="${FILES} README.TXT"
  223. fi
  224. if [ -e "${DOCSDIR}/CHANGES.TXT" ]; then
  225. ln -sf "${DOCSDIR}/CHANGES.TXT" .
  226. FILES="${FILES} CHANGES.TXT"
  227. elif [ -e "${DOCSDIR}/CHANGELOG.TXT" ]; then
  228. ln -sf "${DOCSDIR}/CHANGELOG.TXT" .
  229. FILES="${FILES} CHANGELOG.TXT"
  230. fi
  231. if [ -e "${jarPath}/launcher/linux" ]; then
  232. ln -sf ${jarPath}/launcher/linux/DMDirc.sh .
  233. FILES="${FILES} DMDirc.sh"
  234. fi
  235. compress $FILES
  236. MD5BIN=`which md5sum`
  237. AWK=`which awk`
  238. getMD5() {
  239. echo "test" | ${MD5BIN} -
  240. if [ $? -eq 0 ]; then
  241. getMD5Linux $@
  242. else
  243. getMD5OSX $@
  244. fi;
  245. }
  246. getMD5Linux() {
  247. # Everything below the MD5SUM Line
  248. MD5LINE=`grep -na "^MD5=\".*\"$" ${1}`
  249. MD5LINE=$((${MD5LINE%%:*} + 1))
  250. MD5SUM=`tail -n +${MD5LINE} "${1}" | ${MD5BIN} - | ${AWK} '{print $1}'`
  251. return;
  252. }
  253. getMD5OSX() {
  254. # Everything below the MD5SUM Line
  255. MD5LINE=`grep -na "^MD5=\".*\"$" ${1}`
  256. MD5LINE=$((${MD5LINE%%:*} + 1))
  257. MD5SUM=`tail -n +${MD5LINE} "${1}" | ${MD5BIN} | ${AWK} '{print $1}'`
  258. return;
  259. }
  260. if [ "${MD5BIN}" != "" -a "${AWK}" != "" ]; then
  261. echo "Adding MD5.."
  262. MD5SUM=""
  263. getMD5 ${RUNNAME} ${MD5SUM}
  264. echo "SUM obtained is: ${MD5SUM}"
  265. LINENUM=`grep -na "^MD5=\"\"$" ${RUNNAME}`
  266. LINENUM=${LINENUM%%:*}
  267. head -n $((${LINENUM} -1)) ${RUNNAME} > ${RUNNAME}.tmp
  268. echo 'MD5="'${MD5SUM}'"' >> ${RUNNAME}.tmp
  269. tail -n +$((${LINENUM} +1)) ${RUNNAME} >> ${RUNNAME}.tmp
  270. mv ${RUNNAME}.tmp ${RUNNAME}
  271. else
  272. echo "Not Adding MD5.."
  273. fi;
  274. echo "Chmodding"
  275. chmod a+x ${RUNNAME}
  276. if [ "${isRelease}" != "" ]; then
  277. if [ "${BRANCH}" = "1" ]; then
  278. isRelease=branch-${isRelease}
  279. fi;
  280. if [ "" != "${finalTag}" ]; then
  281. finalTag="-${finalTag}"
  282. fi;
  283. finalname=DMDirc-${isRelease}-Setup${finalTag}.run
  284. else
  285. finalname=${RUNNAME##*/}
  286. fi;
  287. if [ "" != "${jre}" ]; then
  288. finalname=`echo ${finalname} | sed "s/.run$/.${jrename}.run/"`
  289. fi;
  290. mv ${RUNNAME} ../output/${finalname}
  291. mv setup.sh setup.sh.tmp
  292. mv getjre.sh getjre.sh.tmp
  293. mv installjre.sh installjre.sh.tmp
  294. mv progressbar.sh progressbar.sh.tmp
  295. rm -f ${FILES}
  296. mv setup.sh.tmp setup.sh
  297. mv getjre.sh.tmp getjre.sh
  298. mv installjre.sh.tmp installjre.sh
  299. mv progressbar.sh.tmp progressbar.sh
  300. echo "-----------"
  301. echo "Done."
  302. echo "-----------"
  303. # and Done \o
  304. exit 0;
  305. ### Everything below here is part of the .run stub.
  306. ###START INCLUDE###
  307. #!/bin/sh
  308. #
  309. # This script installs dmdirc
  310. #
  311. # DMDirc - Open Source IRC Client
  312. # Copyright (c) 2006-2008 Chris Smith, Shane Mc Cormack, Gregory Holmes
  313. #
  314. # Permission is hereby granted, free of charge, to any person obtaining a copy
  315. # of this software and associated documentation files (the "Software"), to deal
  316. # in the Software without restriction, including without limitation the rights
  317. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  318. # copies of the Software, and to permit persons to whom the Software is
  319. # furnished to do so, subject to the following conditions:
  320. #
  321. # The above copyright notice and this permission notice shall be included in
  322. # all copies or substantial portions of the Software.
  323. #
  324. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  325. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  326. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  327. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  328. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  329. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  330. # SOFTWARE.
  331. MD5=""
  332. # Check the which command exists
  333. WHICH=`which`
  334. if [ "" != "${WHICH}" ]; then
  335. echo "which command not found. Aborting.";
  336. exit 0;
  337. fi
  338. ###ADDITIONAL_STUFF###
  339. errordialog() {
  340. # Send message to console.
  341. echo ""
  342. echo "-----------------------------------------------------------------------"
  343. echo "Error: ${1}"
  344. echo "-----------------------------------------------------------------------"
  345. echo "${2}"
  346. echo "-----------------------------------------------------------------------"
  347. # Now try to use the GUI Dialogs.
  348. PIDOF=`which pidof`
  349. if [ "${PIDOF}" = "" ]; then
  350. # For some reason some distros hide pidof...
  351. if [ -e /sbin/pidof ]; then
  352. PIDOF=/sbin/pidof
  353. elif [ -e /usr/sbin/pidof ]; then
  354. PIDOF=/usr/sbin/pidof
  355. fi;
  356. fi;
  357. ## Helper Functions
  358. if [ "${PIDOF}" = "" ]; then
  359. ISKDE=`${PIDOF} -x -s kdeinit`
  360. ISGNOME=`${PIDOF} -x -s gnome-panel`
  361. else
  362. ISKDE=`ps ux | grep kdeinit | grep -v grep`
  363. ISGNOME=`ps ux | grep gnome-panel | grep -v grep`
  364. fi;
  365. KDIALOG=`which kdialog`
  366. ZENITY=`which zenity`
  367. if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
  368. echo "Dialog on Display: ${DISPLAY}"
  369. ${KDIALOG} --title "DMDirc: ${1}" --error "${1}\n\n${2}"
  370. elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
  371. echo "Dialog on Display: ${DISPLAY}"
  372. ${ZENITY} --error --title "DMDirc: ${1}" --text "${1}\n\n${2}"
  373. fi
  374. }
  375. # Location of .run stub end
  376. ENDLINE=`grep -na "^###END INCLUDE###$" $0`
  377. ENDLINE=$((${ENDLINE%%:*} + 1))
  378. if [ "" = "${ENDLINE}" ]; then
  379. errordialog "DMDirc Setup" "End of stub not found. Aborting.";
  380. exit 0;
  381. fi
  382. # Attempt to get a name for a random dir in /tmp
  383. random() {
  384. # First off, lets try mktemp.
  385. MKTEMP=`which mktemp`
  386. if [ "" != "${MKTEMP}" ]; then
  387. # mktemp exists \o
  388. DIR=`${MKTEMP} -d /tmp/DMDirc.XXXXXX`
  389. eval "$1=${DIR}"
  390. return;
  391. fi
  392. TMPDIR=${TMPDIR:=/tmp}
  393. BASEDIR=${TMPDIR}dmdirc_`whoami`_
  394. DIR=${PWD}
  395. while [ -d "${DIR}" ]; do
  396. if [ "" != "${RANDOM}" ]; then
  397. # Bash has a psuedo random number generator that can be accessed
  398. # using ${RANDOM}
  399. RND=${RANDOM}${RANDOM}${RANDOM}
  400. else
  401. # Dash (the ubuntu default sh) however does not.
  402. # od and awk however usually exist, and we can get a random number
  403. # from /dev/urandom or /dev/random
  404. OD=`which od`
  405. AWK=`which awk`
  406. RND=""
  407. if [ "" != "$OD" -a "" != "$AWK" ]; then
  408. # Try /dev/urandom first
  409. RAND=/dev/urandom
  410. # If it doesn't exist try /dev/random
  411. if [ ! -e "${RAND}" ]; then
  412. RAND=/dev/urandom;
  413. fi
  414. # This makes sure we only try to read if one exists
  415. if [ ! -e "${RAND}" ]; then
  416. RND=$(head -1 ${RAND} | od -N 3 -t u | awk '{ print $2 }')
  417. fi;
  418. fi;
  419. # No random number was generated, getting to here means that
  420. # ${RANDOM} doesn't exist, /dev/random doesn't exist, /dev/urandom doesn't exist
  421. # or that od/awk don't exist. Annoying.
  422. # Try using this processes PID instead!
  423. if [ "${RND}" = "" ]; then
  424. RND=$$
  425. DIR=${BASEDIR}${RND}
  426. if [ -e "${DIR}" ]; then
  427. # Lets hope this never happens.
  428. errordialog "DMDirc Setup" "Unable to create random directory";
  429. exit 0;
  430. fi;
  431. fi;
  432. fi;
  433. DIR=${BASEDIR}${RND}
  434. done
  435. mkdir ${DIR}
  436. eval "$1=${DIR}"
  437. }
  438. uncompress() {
  439. tail -n +${ENDLINE} "${OLDPWD}/$0" | gzip -cd | tar -xvf - 2>/dev/null || {
  440. echo "Decompression failed."
  441. kill -15 $$;
  442. };
  443. }
  444. showHelp() {
  445. echo "This will install DMDirc on a unix based system."
  446. echo "The following command line arguments are known:"
  447. echo "---------------------"
  448. echo "-h, --help Help information"
  449. echo "-e, --extract Extract .run file only, do not run setup.sh"
  450. # echo "-s, --script Don't use installer.jar (not implemented yet)"
  451. echo "---------------------"
  452. exit 0;
  453. }
  454. # Defaults
  455. extractOnly="false"
  456. setupParams=""
  457. skipMD5="false"
  458. # Begin
  459. echo "---------------------"
  460. echo "DMDirc Unix Setup"
  461. if [ "${isRelease}" != "" ]; then
  462. echo "Version: "${isRelease};
  463. setupParams="${setupParams} --release "${isRelease}
  464. fi;
  465. echo "---------------------"
  466. # Check for cmdline args
  467. while test -n "$1"; do
  468. case "$1" in
  469. --help|-h)
  470. showHelp
  471. ;;
  472. --extract|-e)
  473. extractOnly="true"
  474. ;;
  475. --script|-s)
  476. setupParams="${setupParams} --script"
  477. ;;
  478. --nomd5)
  479. skipMD5="true"
  480. ;;
  481. esac
  482. shift
  483. done
  484. MD5BIN=`which md5sum`
  485. AWK=`which awk`
  486. getMD5() {
  487. # Everything below the MD5SUM Line
  488. MD5LINE=`grep -na "^MD5=\".*\"$" ${1}`
  489. MD5LINE=$((${MD5LINE%%:*} + 1))
  490. MD5SUM=`tail -n +${MD5LINE} "${1}" | ${MD5BIN} - | ${AWK} '{print $1}'`
  491. return;
  492. }
  493. if [ "${MD5BIN}" != "" ]; then
  494. if [ ${skipMD5} != "true" ]; then
  495. #if [ -e "${0}.md5" ]; then
  496. # echo "Checking MD5 using ${0}.md5.."
  497. # ${MD5BIN} --check --status ${0}.md5
  498. # if [ $? = 0 ]; then
  499. # echo "MD5 Check Passed!"
  500. # else
  501. # ERROR="This copy of the DMDirc installer appears to be damaged and will now exit.";
  502. # ERROR=${ERROR}"\nYou may choose to skip this check and run it anyway by passing the --nomd5 parameter";
  503. # errordialog "DMDirc Setup: MD5 Check Failed!" "${ERROR}";
  504. # exit 1;
  505. # fi
  506. #elif [ "${MD5}" != "" ]; then
  507. if [ "${MD5}" != "" ]; then
  508. echo "Checking MD5 using built in hash.."
  509. if [ "${AWK}" != "" ]; then
  510. MD5SUM=""
  511. getMD5 ${0} ${MD5SUM}
  512. echo "SUM obtained is: ${MD5SUM}"
  513. echo "SUM expected is: ${MD5}"
  514. if [ "${MD5SUM}" = "${MD5}" ]; then
  515. echo "MD5 Check Passed!"
  516. else
  517. ERROR="This copy of the DMDirc installer appears to be damaged and will now exit.";
  518. ERROR=${ERROR}"\nYou may choose to skip this check and run it anyway by passing the --nomd5 parameter";
  519. errordialog "DMDirc Setup: MD5 Check Failed!" "${ERROR}";
  520. exit 1;
  521. fi;
  522. else
  523. echo "MD5 Check skipped (awk not found).."
  524. fi;
  525. else
  526. #if [ "${MD5BIN}" = "" ]; then
  527. # echo "MD5 Check skipped (md5sum not found).."
  528. #else
  529. echo "MD5 Check skipped (No MD5 hash found to compare against).."
  530. #fi
  531. fi;
  532. else
  533. echo "MD5 Check skipped (Requested).."
  534. fi
  535. fi;
  536. OLDPWD=${PWD}
  537. echo "Getting Temp Dir"
  538. random TEMPDIR
  539. echo "Got Temp Dir: ${TEMPDIR}"
  540. cd ${TEMPDIR}
  541. echo "Uncompressing to temp dir.."
  542. uncompress
  543. echo "Done."
  544. # Check if extract only was wanted.
  545. if [ "${extractOnly}" = "true" ]; then
  546. echo "Extracted. (Files can be found in: ${TEMPDIR})"
  547. exit 0;
  548. fi
  549. if [ -e "${TEMPDIR}/setup.sh" ]; then
  550. echo "Running setup.."
  551. chmod a+x ${TEMPDIR}/setup.sh
  552. ${TEMPDIR}/setup.sh ${setupParams}
  553. echo ""
  554. if [ $? -eq 0 ]; then
  555. echo "Setup completed."
  556. else
  557. echo "Setup failed."
  558. fi
  559. else
  560. echo "No setup.sh found. This was pointless?"
  561. fi
  562. echo "Removing temp dir"
  563. cd ${OLDPWD}
  564. rm -Rf ${TEMPDIR}
  565. echo "Installation Completed."
  566. # Job Done!
  567. exit 0;
  568. ###END INCLUDE###