11#! /bin/bash
22
3- function installJava () {
3+ function installJavaForBrickPi () {
44 apt-key adv --recv-key --keyserver keyserver.ubuntu.com EEA14886
55 echo " deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list
66 echo " deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list
@@ -11,43 +11,36 @@ function installJava() {
1111 # https://askubuntu.com/questions/190582/installing-java-automatically-with-silent-option
1212}
1313
14+ function installJavaForEV3(){
15+ if [ -e " /home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" ]; then
16+ tar -zxvf " /home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" -C /opt
17+ update-alternatives --install /usr/bin/java java /opt/ejdk1.8.0/linux_arm_sflt/jre/bin/java 1
18+ java -version
19+ else
20+ echo " Sorry, the installer didn´t detect ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz"
21+ echo " on /home/robot"
22+ echo " try to copy the file again to the EV3 Brick."
23+ echo
24+ exit 1
25+ fi
26+ }
27+
1428# 1. Detect Java
1529# 1.1 Install Java
1630# 1.2 Create JAVA_HOME PENDING
1731if type -p java; then
1832 echo " Found java executable in PATH"
1933 java -version
2034elif [[ -n " $JAVA_HOME " ]] && [[ -x " $JAVA_HOME /bin/java" ]]; then
21- echo " found java executable in JAVA_HOME"
35+ echo " Found java executable in JAVA_HOME"
2236else
23- echo " no java"
37+ echo " No java detected "
2438
2539 if [ " $PLATFORM " == " $EV3 " ]; then
26- echo " You have to follow this documentation to install to continue using this installer"
27- echo " https://github.com/ev3dev-lang-java/docs/blob/master/docs/GettingStartedBrick.md"
28-
29- if [ -e " /home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" ]; then
30- echo " ok"
31- else
32- echo " nok"
33- fi
34-
35- # Manual installer of Java 8
36- # wget https://raw.githubusercontent.com/ev3dev-lang-java/installer/develop/modules/java-ev3-java8-installer.sh
37- # source modules/java-ev3-java8-installer.sh
38-
40+ installJavaForEV3
3941 elif [ " $PLATFORM " == " $BRICKPI " ]; then
40- installJava
42+ installJavaForBrickPi
4143 fi
4244
4345fi
4446
45- if [ -e " /home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" ]; then
46- echo " ok"
47- tar -zxvf " /home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" -C /home/robot/
48- # /opt
49- # update-alternatives --install /usr/bin/java java /opt/ejdk1.8.0/linux_arm_sflt/jre/bin/java 1
50- # java -version
51- else
52- echo " nok"
53- fi
0 commit comments