-
Notifications
You must be signed in to change notification settings - Fork 0
/
bowlerstudio
86 lines (73 loc) · 2.46 KB
/
bowlerstudio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
#https://cdn.azul.com/zulu/bin/zulu8.42.0.23-ca-fx-jre8.0.232-linux_x64.tar.gz
JVERELEASE=zulu8.44.0.13-ca-fx-jdk8.0.242-linux_x64
#JVERELEASE=zulu8.42.0.23-ca-fx-jre8.0.232-linux_x64
if [ ! $(which curl) ] ; then
sudo apt install curl
fi
BOWLERVERSION=$(curl -s https://api.github.com/repos/CommonWealthRobotics/BowlerStudio/releases/latest | grep "tag_name"| cut -d : -f2|tr -d \" |tr -d ,|tr -d ' ')
unzipifiy(){
testget $1 $2
echo "Unzipping $1 to $2"
tar -xzf $2/$1.tar.gz -C $2
mv $2/$1/* $2/
rmdir $2/$1/
}
testget () {
if [ -f $JVERELEASE.tar.gz ]; then
echo "$JVERELEASE.tar.gz exist"
else
echo Downloading from https://www.azul.com/downloads/zulu/zulufx/
echo downloading https://cdn.azul.com/zulu/bin/$JVERELEASE.tar.gz
wget https://cdn.azul.com/zulu/bin/$JVERELEASE.tar.gz -O $2$1.tar.gz
fi
}
BOWLERROOT=$HOME/bin/BowlerStudioInstall/
NRDIR=$BOWLERROOT/$BOWLERVERSION/
DONTASKAGAIN=$BOWLERROOT/$BOWLERVERSION.txt
CURRENTVERSION=$BOWLERROOT/currentversion.txt
JVMDIR=$HOME/bin/java8/
JAR=BowlerStudio.jar
echo root $BOWLERROOT
echo latest = $NRDIR
echo current = $(cat $CURRENTVERSION)
mkdir -p $BOWLERROOT
if (! test -e $JVMDIR/$JVERELEASE.tar.gz) then
rm -rf $JVMDIR
mkdir -p $JVMDIR
unzipifiy $JVERELEASE $JVMDIR
fi
if ( ! test -e $DONTASKAGAIN ) then
if (! test -e $NRDIR$JAR)then
if ( test -e $CURRENTVERSION ) then
zenity --question --text="A new Version of BowlerStudio is availible, would you like to download it?"
fi
if [ $? = 0 ]; then
echo mkdir -p $NRDIR
mkdir -p $NRDIR
echo wget https://github.com/CommonWealthRobotics/BowlerStudio/releases/download/$BOWLERVERSION/$JAR -O $NRDIR$JAR
wget https://github.com/CommonWealthRobotics/BowlerStudio/releases/download/$BOWLERVERSION/$JAR -O $NRDIR$JAR
echo $BOWLERVERSION >$CURRENTVERSION
else
touch $DONTASKAGAIN
echo "Ok geez..." > $DONTASKAGAIN
fi
fi
else
echo "Skipping update check because $DONTASKAGAIN exists"
fi
BOWLERVERSION=$(cat $CURRENTVERSION)
NRDIR=$BOWLERROOT/$BOWLERVERSION/
MYJAR=$NRDIR$JAR
if ( ! test -e $MYJAR )then
rm $CURRENTVERSION
rm $DONTASKAGAIN
zenity --error --text="Jar Missing! Cleaning up, Try again!"
else
rm -rf $BOWLERROOT/BowlerStudio-current.jar
ln -s $NRDIR$JAR $BOWLERROOT/BowlerStudio-current.jar
chmod +x $BOWLERROOT/BowlerStudio-current.jar
echo $JVMDIR/jre/bin/java -jar $NRDIR$JAR "$@"
$JVMDIR/bin/java -jar $NRDIR$JAR "$@"
fi