source: main/trunk/release-kits/shared/mac/Wrapper.app/Contents/MacOS/greenstone@ 31141

Last change on this file since 31141 was 31141, checked in by ak19, 7 years ago

Fix to silly error introduced in previous commit. With this fix, have confirmed on Sally Jo's El Capitan Mac that update-userdb/setting an admin pwd during installation now works without needing a JDK installed.

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/bash
2
3BINDIR="`dirname "$0"`"
4cd "$BINDIR/.."
5BASEDIR="`pwd`"
6
7# Debugging with a msg box. Need double quotes around msg for $var expansion
8#osascript -e "tell app \"System Events\" to display alert \"bindir is: $BINDIR\" as warning giving up after 10"
9
10## But this doesn't work:
11# http://stackoverflow.com/questions/23923017/osascript-using-bash-variable-with-a-space
12#osascript -e "display notification \"$BINDIR\""
13#osascript -e 'display notification "'"$BINDIR"'"'
14
15# extract the JRE into /tmp and use its java to run the GS jar installer
16# the /tmp/jre folder will be moved into GS3/packages by the GS3 installer
17
18if [[ -e "$BASEDIR/Resources/Java/jre_bin" ]]; then
19 cp "$BASEDIR/Resources/Java/jre_bin" /tmp/. && chmod +x "/tmp/jre_bin" && "/tmp/jre_bin" -o"/tmp" #&& rm "/tmp/jre_bin"
20
21 if [[ -e "/tmp/jre.tar" ]]; then
22 rm /tmp/jre_bin
23 # get the GS jar installer's name and run it with a dock icon (http://stackoverflow.com/questions/6006173/how-do-you-change-the-dock-icon-of-a-java-program)
24 cd "$BASEDIR/Resources/Java/"
25 gs_installer=`ls Greenstone-*-MacOS-intel.jar`
26 export JRE_HOME=/tmp/jre
27 export PATH=$JRE_HOME/bin:$PATH
28 tar -xvf /tmp/jre.tar -C /tmp && rm /tmp/jre.tar && "/tmp/jre/bin/java" -jar -Xdock:icon="$BASEDIR/Resources/icon.icns" "$gs_installer"
29
30 # if after running the installer, the user cancelled installation, then the jre would still be in tmp, remove it to
31 if [[ -e "/tmp/jre" ]]; then
32 rm -rf /tmp/jre
33 fi
34
35 else
36 # Issues extracting the jre.tar into /tmp (maybe we couldn't even copy it there) - display error message
37 # see: https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW11
38 osascript -e "tell app \"System Events\" to display alert \"Unable to unpack jre into /tmp folder\" as warning giving up after 10"
39 # exit
40 fi
41else
42 # try using a system java to run the installer, as there is no bundled jre_bin for 32 bit Mac OS since these already came with java installed
43
44 # get the GS jar installer's name and run it with a dock icon (http://stackoverflow.com/questions/6006173/how-do-you-change-the-dock-icon-of-a-java-program)
45 cd "$BASEDIR/Resources/Java/"
46 gs_installer=`ls Greenstone-*-MacOS-intel.jar`
47
48 # on a mac, the system java is returned by running /usr/libexec/java_home
49 # use this to run the greenstone installer
50 `/usr/libexec/java_home`/bin/java -jar -Xdock:icon="$BASEDIR/Resources/icon.icns" "$gs_installer"
51fi
Note: See TracBrowser for help on using the repository browser.