annotate package-files/osx/JavaApplicationStub @ 58:6b300da7d800

Update Readme, add License.
author David Barts <davidb@stashtea.com>
date Tue, 12 May 2020 16:23:43 -0700
parents 4903ac32a287
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
1 #!/bin/bash
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
2
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
3 # This is based on Tobias Fischer's universalJavaApplicationStub:
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
4 # https://github.com/tofi86/universalJavaApplicationStub
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
5 #
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
6 # Therefore this part of JpegWasher is covered by the same MIT license
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
7 # that his code is:
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
8 #
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
9 # The MIT License (MIT)
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
10 #
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
11 # Copyright (c) 2014-2020 Tobias Fischer
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
12 #
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
13 # Permission is hereby granted, free of charge, to any person obtaining a copy
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
14 # of this software and associated documentation files (the "Software"), to deal
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
15 # in the Software without restriction, including without limitation the rights
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
16 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
17 # copies of the Software, and to permit persons to whom the Software is
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
18 # furnished to do so, subject to the following conditions:
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
19 #
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
20 # The above copyright notice and this permission notice shall be included in all
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
21 # copies or substantial portions of the Software.
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
22 #
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
23 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
24 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
25 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
26 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
27 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
28 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
29 # SOFTWARE.
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
30
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
31 # Establish our application names
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
32 appname="@app.name@"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
33 appdom="@app.domain@"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
34
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
35 # Make a place for our logs to go
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
36 appsupp="$HOME/Library/Application Support/$appdom"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
37 logfile="$appsupp/launcher.log"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
38
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
39 function die {
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
40 osascript -e "tell application \"System Events\" to display dialog \"${1}\" with title \"Fatal Error\" buttons {\" OK \"} default button 1"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
41 exit ${2:-1}
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
42 }
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
43
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
44 # Initialize files and dirs, bail if we can't.
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
45 if [ ! -d "$appsupp" ]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
46 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
47 if ! mkdir -p "$appsupp"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
48 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
49 die "Unable to create folder '$appsupp'" 2
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
50 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
51 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
52 > "$logfile"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
53 if [ $? -ne 0 ]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
54 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
55 die "Unable to create file '$logfile'" 2
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
56 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
57
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
58 function stub_logger {
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
59 echo "$(date +%c) - $1" >> "$logfile"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
60 }
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
61
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
62 # Was originally just for debugging, but I think this could be useful
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
63 # for later troubleshooting "in the wild."
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
64 stub_logger "execution begins"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
65 {
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
66 echo "****** BEGIN ARGUMENT AND ENVIRONMENT DUMP *******"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
67 echo "Arguments:" "$0" "$@"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
68 echo "Directory:" $(pwd)
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
69 env
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
70 echo "******* END ARGUMENT AND ENVIRONMENT DUMP ********"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
71 } >> "$logfile"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
72
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
73 # Change to the application root directory, two up from where this script
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
74 # (which should contain an absolute path) is.
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
75 mydir="${0%/*}"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
76 cd "$mydir/../.." || die "Unable to cd '$mydir/../..'"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
77
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
78 # Determine where Java is, bail if we can't.
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
79 if [ -n "$JAVA_HOME" ]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
80 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
81 if [ ! -d "$JAVA_HOME" ]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
82 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
83 die "'$JAVA_HOME' does not exist"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
84 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
85 else
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
86 export JAVA_HOME="$(/usr/libexec/java_home)"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
87 if [ $? -ne 0 -o ! -d "$JAVA_HOME" ]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
88 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
89 die "Unable to locate Java."
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
90 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
91 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
92
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
93 java="$JAVA_HOME/bin/java"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
94 if [ ! -x "$java" ]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
95 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
96 die "'$java' not found or not executable"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
97 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
98
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
99 function plist_get {
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
100 /usr/libexec/PlistBuddy -c "print $1" Contents/Info.plist 2> /dev/null
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
101 }
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
102 function must_get {
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
103 plist_get "$@" || die "Info.plist key '$1' not found."
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
104 }
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
105
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
106 # Load some parameters from Contents/Info.plist
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
107 estat=0
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
108 CFBundleName=$(must_get ':CFBundleName')
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
109 CFBundleIconFile=$(must_get ':CFBundleIconFile')
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
110 JVMMainClassName=$(must_get ':JVMMainClassName')
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
111 JVMClassPath=$(must_get ':JVMClassPath')
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
112 JVMVersion=$(must_get ':JVMVersion')
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
113
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
114 # Sanity check our JVM version
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
115 if [[ "$JVMVersion" == *+ ]]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
116 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
117 op='>'
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
118 JVMVersion="${JVMVersion%+}"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
119 else
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
120 op='='
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
121 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
122 version=$("$java" -version 2>&1 | awk '/version/{print $3}' | sed -E -e 's/"//g' -e 's/-ea//g')
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
123 if [ ! "$version" "$op" "$JVMVersion" ]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
124 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
125 die "'$java' too old"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
126 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
127
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
128 # Load the JVMOptions array (if found)
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
129 JVMOptions=()
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
130 let i=0
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
131 while true
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
132 do
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
133 j="$(plist_get :JVMOptions:$i)"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
134 if [ -z "$j" ]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
135 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
136 break
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
137 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
138 JVMOptions+=("$j")
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
139 let i+=1
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
140 done
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
141
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
142 # Fatal error if we cannot change to HOME or HOME not defined
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
143 approot="$(pwd)"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
144 if [ -z "$HOME" ]
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
145 then
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
146 die "HOME not defined!"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
147 fi
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
148 cd "$HOME" || die "Unable to cd '$HOME'"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
149
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
150 # And off we go!
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
151 jcmd=( "$JAVA_HOME/bin/java" -cp "$approot/$JVMClassPath"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
152 -Xdock:icon="$approot/Contents/Resources/$CFBundleIconFile"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
153 -Xdock:name="$CFBundleName" "${JVMOptions[@]}" "$JVMMainClassName" )
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
154
41
4903ac32a287 Work around minor bash bug.
David Barts <n5jrn@me.com>
parents: 40
diff changeset
155 stub_logger "Executing: ${jcmd[*]}"
39
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
156 exec "${jcmd[@]}"
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
157
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
158 # This shouldn't happen...
89d7f4d91f67 Got a working, non-bloated Apple Mac bundle!
David Barts <n5jrn@me.com>
parents:
diff changeset
159 die "Could not launch Java."