Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Commit

Permalink
Better Java detection on Apple
Browse files Browse the repository at this point in the history
Helps #37
tresf committed Jun 9, 2015
1 parent b669de5 commit d0e65f4
Showing 4 changed files with 9 additions and 16 deletions.
2 changes: 2 additions & 0 deletions ant/apple/apple-keygen.sh.in
Original file line number Diff line number Diff line change
@@ -35,13 +35,15 @@ keystorepath=$(echo "$keystore" | sed -e "s|$install|$installdir|g")
makekeystore=$(echo "$makekeystore" | sed -e "s|$storepass|$password|g")
makekeystore=$(echo "$makekeystore" | sed -e "s|$keypass|$password|g")
makekeystore=$(echo "$makekeystore" | sed -e "s|$keystore|$keystorepath|g")
makekeystore="${apple.jvmcmd} $makekeystore"

# Cert export variable substitutions
dercertpath=$(echo "$dercert" | sed -e "s|$install|$installdir|g")
makedercert=$(echo "$makedercert" | sed -e "s|$storepass|$password|g")
makedercert=$(echo "$makedercert" | sed -e "s|$keypass|$password|g")
makedercert=$(echo "$makedercert" | sed -e "s|$keystore|$keystorepath|g")
makedercert=$(echo "$makedercert" | sed -e "s|$dercert|$dercertpath|g")
makedercert="${apple.jvmcmd} $makedercert"

# Property file containing jks signing info
propspath=$(echo "$props" | sed -e "s|$install|$installdir|g")
2 changes: 1 addition & 1 deletion ant/apple/apple-launcher.sh.in
Original file line number Diff line number Diff line change
@@ -3,5 +3,5 @@
installpath=$(echo "$0" | rev | cut -d/ -f4- | rev)
jarpath=$installpath/${build.socket.name}.jar
iconpath=$installpath/${apple.resources}/${apple.icon}
java -Xdock:name="${socket.name}" -Xdock:icon="$iconpath" -jar "$jarpath"
${apple.jvmcmd} java -Xdock:name="${socket.name}" -Xdock:icon="$iconpath" -jar "$jarpath"
exit $?
19 changes: 4 additions & 15 deletions ant/apple/apple-preinstall.sh.in
Original file line number Diff line number Diff line change
@@ -10,22 +10,11 @@
# $ ./preinstall #
###############################################################################

# Check minimum java version
function check_java() {
curver=$(java -version 2>&1 | grep -i version | cut -d'"' -f2 | cut -d'.' -f1-2)
minver="${javac.socket.target}"
# Use java_home command to check minimum Java version
${apple.jvmver}

if [ -z "$curver" ]; then
curver="0.0"
fi

if [ $(echo "$curver>=$minver" | bc -l) -eq 0 ]; then
exit 1
fi
}

check_java
code=$?

# Kill any running versions
kill -9 $(ps -e |grep "${build.socket.name}.jar" |grep -v grep|awk '{print $1}') > /dev/null 2>&1
exit 0
exit $code
2 changes: 2 additions & 0 deletions ant/apple/apple.properties
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ apple.keygen.store=trustRoot
apple.keygen.name=apple-keygen.sh
apple.keygen.in=${basedir}/ant/apple/${apple.keygen.name}.in
apple.keygen.out=${dist.socket.dir}/auth/${apple.keygen.name}
apple.jvmver=/usr/libexec/java_home -v ${javac.socket.target}+
apple.jvmcmd=${apple.jvmver} --exec

apple.postinstall.in=${basedir}/ant/apple/apple-postinstall.sh.in
apple.postinstall.out=${apple.scripts}/postinstall

0 comments on commit d0e65f4

Please sign in to comment.