#!/bin/sh

DIST=""
ARCH=A64

if which wget > /dev/null; then
   CMD="wget -O"; 
else
   CMD="curl -o";
fi

echo -------------------
echo Downloading java...
$CMD jdk.tgz https://openaf.io/java/java$ARCH.tgz
echo ------------------
echo Download openaf...
$CMD openaf.jar.orig https://openaf.io/$DIST/openaf.jar
$CMD openaf.jar https://openaf.io/$DIST/openaf.jar.repacked
echo -----------------
echo Unpacking java...
tar xzf jdk.tgz
echo --------------------
echo Installing openaf...
mv *jre* jre
`find . | egrep /bin/java$` -jar openaf.jar --install
rm jdk.tgz

echo ------------------
