From 5d7df33209fb9a5d446642cc8d70e23f17d504a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Van=C4=9Bk?= Date: Wed, 28 Mar 2018 19:16:57 +0200 Subject: [PATCH 1/6] Installer refactor --- installer.sh | 102 ++++++++++++++++-------------- modules/battery-monitor.sh | 61 +++++++----------- modules/copy-installer.sh | 14 ++-- modules/copy-jdk.sh | 23 +++++-- modules/experimental/bluetooth.sh | 10 +-- modules/java.sh | 60 ++++++++++++------ modules/native-libraries.sh | 21 +++--- modules/platform.sh | 61 ++++++++---------- modules/utilities.sh | 16 ++--- modules/vars.sh | 40 ++++++++++++ 10 files changed, 226 insertions(+), 182 deletions(-) create mode 100644 modules/vars.sh diff --git a/installer.sh b/installer.sh index 09b03e6..99b92d8 100755 --- a/installer.sh +++ b/installer.sh @@ -1,6 +1,38 @@ #!/bin/bash # A Bash script to install Linux Libraries used on EV3Dev-lang-java. # Author: Juan Antonio Breña Moral, bren@juanantonio.info +# Author: Jakub Vaněk, linuxtardis@gmail.com + +MODULE="unknown" +MODULE_FOLDER="module2" +ROOT_URL="https://raw.githubusercontent.com/ev3dev-lang-java/installer/develop/modules" + +# $1 => module name +function download_module() { + pushd "./$MODULE_FOLDER" >/dev/null + wget -qN "$ROOT_URL/$1.sh" + popd >/dev/null +} + +# $1 => module name +function run_module() { + MODULE="$1" + createHeader "$1" + download_module "$1" + source "$MODULE_FOLDER/$1.sh" +} + +# $1 => module name +function inc_module() { + download_module "$1" + source "$MODULE_FOLDER/$1.sh" +} + +function init_installer() { + echo "Init installer" + rm -rf "$MODULE_FOLDER" + mkdir -p "$MODULE_FOLDER" +} echo echo "##############################" @@ -10,61 +42,35 @@ echo "# Last update: 2017/06/18 #" echo "##############################" echo -OFF=0 -MODULE="EMPTY" -MODULE_FOLDER="module2" -function runModule(){ - if ! [ "$2" == "$OFF" ]; then - createHeader $1 - fi - local domain="https://raw.githubusercontent.com/ev3dev-lang-java/installer/develop/modules" - wget -N "$domain/$1.sh" - MODULE=$1 - mv ./$1.sh ./$MODULE_FOLDER/$1.sh - source "$MODULE_FOLDER/$1.sh" -} - -function initInstaller(){ - echo "Init installer" - mkdir -p $MODULE_FOLDER - rm ./$MODULE_FOLDER/* -} - -MODE_HELP="help" -MODE_JDK="jdk" -MODE_BATTERY_MONITOR="batteryMonitor" -MODE_COPY_INSTALLER="copy-installer" -MODE_EXTENDED="extended" #Init -initInstaller -runModule utilities 0 +init_installer +inc_module vars +inc_module utilities -if [ "$1" == "$MODE_HELP" ]; then - runModule help -fi +run_module platform -#TODO Disable this option if platform is not EV3BRICK -CREDENTIAL="" -if [ "$1" == "$MODE_JDK" ]; then - CREDENTIAL=$2 - runModule copy-jdk -fi +if [ "$1" == "help" ]; then + run_module help -if [ "$1" == "$MODE_COPY_INSTALLER" ]; then - CREDENTIAL=$2 - runModule copy-installer -fi +elif [ "$1" == "jdk" ]; then + CREDENTIAL="$2" + run_module copy-jdk -runModule platform -runModule java +elif [ "$1" == "copy-installer" ]; then + CREDENTIAL="$2" + run_module copy-installer -if [ "$1" == "$MODE_BATTERY_MONITOR" ]; then - runModule battery-monitor -fi +elif [ "$1" == "batteryMonitor" ]; then + run_module java + run_module battery-monitor + +elif [ "$1" == "extended" ]; then + run_module java + run_module native-libraries -if [ "$1" == "$MODE_EXTENDED" ]; then - runModule native-libraries +else + run_module java fi -exit 0 \ No newline at end of file +exit 0 diff --git a/modules/battery-monitor.sh b/modules/battery-monitor.sh index f0cf246..869b857 100644 --- a/modules/battery-monitor.sh +++ b/modules/battery-monitor.sh @@ -1,51 +1,36 @@ #!/bin/bash -function installBatteryMonitor() { - cd /home/robot - wget https://github.com/ev3dev-lang-java/batteryMonitor/raw/release/v0.2.0-RELEASE/releases/batteryMonitor-0.2.0-RELEASE.zip - - #TODO Move block to function - isInstalled unzip - if [ "$INSTALLED" == "$INSTALLED_NO" ]; then - if [ "$PLATFORM" == "$EV3" ]; then - - mkdir -p packages - cd packages - wget http://ftp.us.debian.org/debian/pool/main/u/unzip/unzip_6.0-16+deb8u3_armel.deb - sudo dpkg -i unzip_6.0-16+deb8u3_armel.deb - cd .. - else - apt-get install unzip - fi - - fi - - #TODO Move to a function - unzip batteryMonitor-0.2.0-RELEASE.zip - mv batteryMonitor-0.2.0-RELEASE batteryMonitor - cd batteryMonitor - chmod +x ./start.sh - chmod +x ./stop.sh - cp batteryMonitor-service.sh /etc/init.d - cd /etc/init.d - chmod +x batteryMonitor-service.sh +function battmon_install() { + wget "$BATTMON_URL" -O "$BATTMON_FILE" + + apt-get install unzip + + unzip "$BATTMON_FILE" + mv "$BATTMON_ZIPBASE" "$BATTMON_BASE" + chmod +x "$BATTMON_BASE/start.sh" + chmod +x "$BATTMON_BASE/stop.sh" + chmod +x "$BATTMON_BASE/batteryMonitor-service.sh" + ln -s "$BATTMON_BASE/batteryMonitor-service.sh" "/etc/init.d" + update-rc.d batteryMonitor-service.sh defaults - cd /home/robot/batteryMonitor - ./start.sh & + "$BATTMON_BASE/start.sh" & } -if [ "$PLATFORM" == "$UNKNOWN" ]; then - echo "This platform: $PLATFORM is not suitable for Battery Monitor." - echo -else +if [ "$PLATFORM" == "ev3" ] || + [ "$PLATFORM" == "brickpi" ] || + [ "$PLATFORM" == "brickpi3" ] || + [ "$PLATFORM" == "pistorms" ]; then - if [ -d "/home/robot/batteryMonitor" ]; then + if [ -d "$BATTMON_BASE" ]; then echo "We have detected a previous installation." echo "We will skip this step." else - installBatteryMonitor + battmon_install fi +else + echo "This platform: $PLATFORM is not suitable for Battery Monitor." + echo fi -createHeader "END $MODULE" \ No newline at end of file +createHeader "END $MODULE" diff --git a/modules/copy-installer.sh b/modules/copy-installer.sh index 4842e3e..ad416f9 100644 --- a/modules/copy-installer.sh +++ b/modules/copy-installer.sh @@ -1,11 +1,11 @@ #!/bin/bash -if [ -e "/home/robot/installer/installer.sh" ]; then - echo $CREDENTIAL - ssh $CREDENTIAL 'uptime' - ssh $CREDENTIAL 'sudo mkdir /home/robot/installer/' - scp "/home/robot/installer/installer.sh" "$CREDENTIAL:/home/robot/installer" - ssh $CREDENTIAL 'sudo chmod +x /home/robot/installer.sh' +if [ -e "$INSTALLER_EXE" ]; then + chmod +x "$INSTALLER_EXE" + + echo "SSHing to: $CREDENTIAL" + ssh "$CREDENTIAL" "uptime; sudo mkdir -p $INSTALLER_DIR" + scp "$INSTALLER_EXE" "$CREDENTIAL:$INSTALLER_DIR" exit else echo "Sorry, the installer didn´t detect the installer" @@ -13,4 +13,4 @@ else echo "try to review your installation on your EV3 Brick." echo exit 1 -fi \ No newline at end of file +fi diff --git a/modules/copy-jdk.sh b/modules/copy-jdk.sh index cbad3ac..6a668cd 100644 --- a/modules/copy-jdk.sh +++ b/modules/copy-jdk.sh @@ -1,13 +1,24 @@ #!/bin/bash -if [ -e "/home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" ]; then - echo $CREDENTIAL - scp "/home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" "$CREDENTIAL:/home/robot" - exit +local JAVA_PAK + +if [ -e "$JRE_ORACLE_PATH" ]; then + JAVA_PAK="$JRE_ORACLE_PATH" + +elif [ -e "$JRI_OPENJDK_PATH" ]; then + JAVA_PAK="$JRI_OPENJDK_PATH" + +elif [ -e "$JDK_OPENJDK_PATH" ]; then + JAVA_PAK="$JDK_OPENJDK_PATH" + else - echo "Sorry, the installer didn´t detect ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" + echo "Sorry, the installer didn't detect any Java archive." echo "on /home/robot" echo "try to copy the file again to the EV3 Brick." echo exit 1 -fi \ No newline at end of file +fi + +echo "SSHing to: $CREDENTIAL" +scp "$JAVA_PAK" "$CREDENTIAL:/home/robot" +exit diff --git a/modules/experimental/bluetooth.sh b/modules/experimental/bluetooth.sh index c935589..46f28f8 100644 --- a/modules/experimental/bluetooth.sh +++ b/modules/experimental/bluetooth.sh @@ -7,14 +7,14 @@ echo "##############################" echo "" #2. Install Bluetooth -if [ "$PLATFORM" == "$EV3" ]; +if [ "$PLATFORM" == "ev3" ]; then - echo $EV3 + echo "EV3" #isInstalled libbluetooth-dev #wget http://ftp.us.debian.org/debian/pool/main/b/bluez/libbluetooth-dev_5.23-2+b1_armel.deb #dpkg --force-depends-version -i libbluetooth-dev_5.23-2+b1_armel.deb else - echo $BRICKPI - isInstalled libbluetooth-dev + echo "BrickPi" + isInstalled "$BT_BRICKPI_PKG" #apt-get install libbluetooth-dev -fi \ No newline at end of file +fi diff --git a/modules/java.sh b/modules/java.sh index 8243f99..6ed31ec 100644 --- a/modules/java.sh +++ b/modules/java.sh @@ -1,25 +1,44 @@ #!/bin/bash -function installJavaForEV3(){ - if [ -e "/home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" ]; then - tar -zxvf "/home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" -C /opt - update-alternatives --install /usr/bin/java java /opt/ejdk1.8.0/linux_arm_sflt/jre/bin/java 1 - java -version +function java_install_bundle(){ + local JAVA_PAK + local JAVA_EXE + + if [ -e "$JRE_ORACLE_PATH" ]; then + JAVA_PAK="$JRE_ORACLE_PATH" + JAVA_EXE="$JRE_ORACLE_EXE" + + elif [ -e "$JRI_OPENJDK_PATH" ]; then + JAVA_PAK="$JRI_OPENJDK_PATH" + JAVA_EXE="$JRI_OPENJDK_EXE" + + elif [ -e "$JDK_OPENJDK_PATH" ]; then + JAVA_PAK="$JDK_OPENJDK_PATH" + JAVA_EXE="$JDK_OPENJDK_EXE" + else - echo "Sorry, the installer didn´t detect ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" - echo "on /home/robot" - echo "try to copy the file again to the EV3 Brick." + echo "Sorry, the installer didn't detect any Java archive" + echo "in /home/robot. Try to copy the file again." echo exit 1 fi + + echo "Java package detected, installing..." + tar -xf "$JAVA_PAK" -C /opt + update-alternatives --install /usr/bin/java java "$JAVA_EXE" 1 + + echo "Extraction complete. Java version:" + java -version + + echo "Dumping class cache..." + java -Xshare:dump } -function installJavaForBrickPi() { - apt-key adv --recv-key --keyserver keyserver.ubuntu.com EEA14886 - echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list - echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list - sudo apt-get update - sudo apt-get install oracle-java8-installer +function java_install_ppa() { + echo "$WEBUPD8_REPO" | sudo tee -a /etc/apt/sources.list + apt-key adv --recv-key --keyserver keyserver.ubuntu.com "$WEBUPD8_KEY" + apt-get update + apt-get install oracle-java8-installer #Review in the future how to accept licence automatically #https://askubuntu.com/questions/190582/installing-java-automatically-with-silent-option @@ -33,17 +52,16 @@ if type -p java; then java -version elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then echo "Found java executable in JAVA_HOME" + "$JAVA_HOME/bin/java" -version else echo "No java detected" if [ "$PLATFORM" == "$EV3" ]; then - installJavaForEV3 - elif [ "$PLATFORM" == "$BRICKPI" ]; then - installJavaForBrickPi - elif [ "$PLATFORM" == "$BRICKPI3" ]; then - installJavaForBrickPi - elif [ "$PLATFORM" == "$PISTORMS" ]; then - installJavaForBrickPi + java_install_bundle + elif [ "$PLATFORM" == "$BRICKPI" ] || + [ "$PLATFORM" == "$BRICKPI3" ] || + [ "$PLATFORM" == "$PISTORMS" ]; then + java_install_ppa fi fi diff --git a/modules/native-libraries.sh b/modules/native-libraries.sh index 83de42d..11678b2 100644 --- a/modules/native-libraries.sh +++ b/modules/native-libraries.sh @@ -2,19 +2,16 @@ #This installation is the same for EV3 Brick & BrickPi/PiStorms -if [ "$PLATFORM" == "$UNKNOWN" ]; then +if [ "$PLATFORM" == "ev3" ] || + [ "$PLATFORM" == "brickpi" ] || + [ "$PLATFORM" == "brickpi3" ] || + [ "$PLATFORM" == "pistorms" ]; then + + apt-get update && apt-get install libopencv2.4-java librxtx-java + +else echo "This platform: $PLATFORM is not suitable for Battery Monitor." echo -else - apt-get update - isInstalled libopencv2.4-java - if [ "$INSTALLED" == "$INSTALLED_NO" ]; then - apt-get install libopencv2.4-java - fi - isInstalled librxtx-java - if [ "$INSTALLED" == "$INSTALLED_NO" ]; then - apt-get install librxtx-java - fi fi -createHeader "END $MODULE" \ No newline at end of file +createHeader "END $MODULE" diff --git a/modules/platform.sh b/modules/platform.sh index 222cfaf..2854bcc 100644 --- a/modules/platform.sh +++ b/modules/platform.sh @@ -1,44 +1,24 @@ #!/bin/bash -EV3="EV3" -BRICKPI="BRICKPI" -BRICKPI="BRICKPI3" -PISTORMS="PISTORMS" -UNKNOWN="UNKNOWN" -PLATFORM=$UNKNOWN - -EV3_EV3DEV="4.4.47-19-ev3dev-ev3" +PLATFORM="unknown" #1. Detect platform -#1.1 Detect if the brick is not using latest kernel -if [ -d "/sys/class/power_supply/legoev3-battery" ]; then - echo "The user has a EV3 Brick" - PLATFORM=$EV3 - ev3dev_version="$(uname -r)" - if [ "$ev3dev_version" == "$EV3_EV3DEV" ]; then - echo "You have latest ev3dev version: $EV3_EV3DEV" - else - echo "Please review your ev3dev version to continue"; - echo - echo "sudo apt-get update" - echo "sudo apt-get upgrade" - echo "sudo apt-get dist-upgrade" - echo "sudo reboot" - fi -elif [ -d "/sys/class/power_supply/brickpi-battery" ]; then - echo "The user has a BrickPi+" - PLATFORM=$BRICKPI -elif [ -d "/sys/class/power_supply/brickpi3-battery" ]; then - echo "The user has a BrickPi3" - PLATFORM=$BRICKPI3 -elif [ -d "/sys/class/power_supply/pistorms-battery" ]; then - echo "The user has a PiStorms" - PLATFORM=$PISTORMS +if [ -d "$BATT_EV3" ]; then + PLATFORM="ev3" + +elif [ -d "$BATT_BRICKPI" ]; then + PLATFORM="brickpi" + +elif [ -d "$BATT_BRICKPI3" ]; then + PLATFORM="brickpi3" + +elif [ -d "$BATT_PISTORMS" ]; then + PLATFORM="pistorms" fi echo "Platform detected: $PLATFORM" echo -if [ "$PLATFORM" == "$UNKNOWN" ]; then +if [ "$PLATFORM" == "unknown" ]; then echo "Sorry, this platform is not recognized by the installer." echo "This installer was designed for EV3Dev hardware." echo @@ -46,4 +26,17 @@ if [ "$PLATFORM" == "$UNKNOWN" ]; then echo "https://github.com/ev3dev-lang-java/ev3dev-lang-java/issues" echo exit 1 -fi \ No newline at end of file +fi + +#1.1 Detect if the brick is not using latest kernel +ev3dev_version="$(uname -r)" +if [ "$ev3dev_version" == "$EV3DEV_TESTED" ]; then + echo "You have a supported kernel version ($ev3dev_version)." +else + echo "This installer wasn't tested with the current kernel version ($ev3dev_version)."; + echo + echo "sudo apt-get update" + echo "sudo apt-get upgrade" + echo "sudo apt-get dist-upgrade" + echo "sudo reboot" +fi diff --git a/modules/utilities.sh b/modules/utilities.sh index 85c4df7..61e8351 100644 --- a/modules/utilities.sh +++ b/modules/utilities.sh @@ -2,9 +2,6 @@ #Functions to draw header & footer for modules -CHARACTER="#" -SPACE=" " -TOTAL=40 function createLine() { local LINE=$CHARACTER for i in $(seq 1 $TOTAL); @@ -33,15 +30,12 @@ function createHeader() { } # Detect a library -INSTALLED_YES="YES"; -INSTALLED_NO="NO"; -INSTALLED=$INSTALLED_NO; -PATTERN_NOT_FOUND="no packages found"; function isInstalled(){ + local found if dpkg-query -W $1; then - INSTALLED=$INSTALLED_YES + found="yes" else - INSTALLED=$INSTALLED_NO + found="no" fi - echo $INSTALLED -} \ No newline at end of file + echo "$found" +} diff --git a/modules/vars.sh b/modules/vars.sh new file mode 100644 index 0000000..03065cc --- /dev/null +++ b/modules/vars.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# java archive paths + JRE_ORACLE_PATH="/home/robot/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz" +JRI_OPENJDK_PATH="/home/robot/jri-ev3.tar.gz" +JDK_OPENJDK_PATH="/home/robot/jdk-ev3.tar.gz" + +# java exe paths + JRE_ORACLE_EXE="/opt/ejdk1.8.0/linux_arm_sflt/jre/bin/java" +JRI_OPENJDK_EXE="/opt/jri-ev3/bin/java" +JDK_OPENJDK_EXE="/opt/jdk/bin/java" + +# brickpi java repository +WEBUPD8_KEY="C2518248EEA14886" +WEBUPD8_REPO="deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" + +# graphics +CHARACTER="#" +SPACE=" " +TOTAL=40 + +# bluetooth +BT_BRICKPI_PKG="libbluetooth-dev" + +# platform detection +EV3DEV_TESTED="4.4.47-19-ev3dev-ev3" +BATT_EV3="/sys/class/power_supply/legoev3-battery" +BATT_BRICKPI="/sys/class/power_supply/brickpi-battery" +BATT_BRICKPI3="/sys/class/power_supply/brickpi3-battery" +BATT_PISTORMS="/sys/class/power_supply/pistorms-battery" + +# installer copy +INSTALLER_DIR="/home/robot/installer" +INSTALLER_EXE="/home/robot/installer/installer.sh" + +# battery monitor +BATTMON_URL="https://github.com/ev3dev-lang-java/batteryMonitor/raw/release/v0.2.0-RELEASE/releases/batteryMonitor-0.2.0-RELEASE.zip" +BATTMON_FILE="/home/robot/batterymonitor.zip" +BATTMON_ZIPBASE="/home/robot/batteryMonitor-0.2.0-RELEASE" +BATTMON_BASE="/home/robot/batteryMonitor" From fc0ccb0ede79b08ed311b775d11b3f6878cf45ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Van=C4=9Bk?= Date: Sat, 14 Apr 2018 22:10:48 +0200 Subject: [PATCH 2/6] Unify xshare dump code for all java installation paths --- modules/java.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/java.sh b/modules/java.sh index 1c0c3d9..ff8a0fe 100644 --- a/modules/java.sh +++ b/modules/java.sh @@ -16,16 +16,12 @@ function java_install_bundle(){ fi # extract it, rename it and point the symlink to it - echo "Java package detected, installing..." + echo "Java package acquired, installing..." tar -xf "$JAVA_ZIP" -C "$JAVA_OPT" mv "$JAVA_PATH_ZIP" "$JAVA_PATH_NEW" update-alternatives --install /usr/bin/java java "$JAVA_EXE" 1 - echo "Extraction complete. Java version:" - java -version - - echo "Dumping class cache..." - java -Xshare:dump + JAVA_REAL_EXE="$JAVA_PATH_NEW" } #TODO Upgrade this function with the support of OpenJDK 10 @@ -34,7 +30,8 @@ function java_install_ppa() { apt-key adv --recv-key --keyserver keyserver.ubuntu.com "$WEBUPD8_KEY" apt-get update apt-get install --yes --no-install-recommends oracle-java8-installer - java -Xshare:dump + + JAVA_REAL_EXE="$(which java)" #Review in the future how to accept licence automatically #https://askubuntu.com/questions/190582/installing-java-automatically-with-silent-option @@ -43,12 +40,15 @@ function java_install_ppa() { #1. Detect Java #1.1 Install Java #1.2 Create JAVA_HOME PENDING + if type -p java; then echo "Found java executable in PATH" - java -version + JAVA_REAL_EXE="$(which java)" + elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then echo "Found java executable in JAVA_HOME" - "$JAVA_HOME/bin/java" -version + JAVA_REAL_EXE="$JAVA_HOME/bin/java" + else echo "No java detected" @@ -60,3 +60,9 @@ else java_install_ppa fi fi + +echo "Installation complete. Java version:" +"$JAVA_REAL_EXE" -version + +echo "Dumping class cache..." +"$JAVA_REAL_EXE" -Xshare:dump From 15334ee83100e3c70cb2b6c329c6fd6188847e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Van=C4=9Bk?= Date: Sat, 14 Apr 2018 23:09:06 +0200 Subject: [PATCH 3/6] Fix bug with exchanged java home/exe --- modules/java.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/java.sh b/modules/java.sh index ff8a0fe..8a93bd1 100644 --- a/modules/java.sh +++ b/modules/java.sh @@ -21,7 +21,7 @@ function java_install_bundle(){ mv "$JAVA_PATH_ZIP" "$JAVA_PATH_NEW" update-alternatives --install /usr/bin/java java "$JAVA_EXE" 1 - JAVA_REAL_EXE="$JAVA_PATH_NEW" + JAVA_REAL_EXE="$JAVA_EXE" } #TODO Upgrade this function with the support of OpenJDK 10 From 1e36210cc94b141bd841ec2a528accf391f0464c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Van=C4=9Bk?= Date: Sat, 14 Apr 2018 23:11:57 +0200 Subject: [PATCH 4/6] Refactor oracle java 8 package name to vars --- modules/java.sh | 2 +- modules/vars.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/java.sh b/modules/java.sh index 8a93bd1..cd066a4 100644 --- a/modules/java.sh +++ b/modules/java.sh @@ -29,7 +29,7 @@ function java_install_ppa() { echo "$WEBUPD8_REPO" | sudo tee -a /etc/apt/sources.list apt-key adv --recv-key --keyserver keyserver.ubuntu.com "$WEBUPD8_KEY" apt-get update - apt-get install --yes --no-install-recommends oracle-java8-installer + apt-get install --yes --no-install-recommends "$WEBUPD8_PKG" JAVA_REAL_EXE="$(which java)" diff --git a/modules/vars.sh b/modules/vars.sh index 345b355..ab17bbf 100644 --- a/modules/vars.sh +++ b/modules/vars.sh @@ -12,6 +12,7 @@ JAVA_EXE="$JAVA_PATH_NEW/bin/java" # brickpi java repository WEBUPD8_KEY="C2518248EEA14886" WEBUPD8_REPO="deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" +WEBUPD8_PKG="oracle-java8-installer" # graphics CHARACTER="#" From d5ade9f5a36282d6d47856fa68181297f5886e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Van=C4=9Bk?= Date: Sat, 14 Apr 2018 23:28:52 +0200 Subject: [PATCH 5/6] Bump the installer update date --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index d69be8e..f888a4d 100755 --- a/installer.sh +++ b/installer.sh @@ -38,7 +38,7 @@ echo echo "##############################" echo "# EV3Dev-lang-java Installer #" echo "##############################" -echo "# Last update: 2018/03/30 #" +echo "# Last update: 2018/04/14 #" echo "##############################" echo From 0c4ac939a3ecbcaa1e24dfb2e3b71a5a8530e2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Van=C4=9Bk?= Date: Sun, 15 Apr 2018 00:18:55 +0200 Subject: [PATCH 6/6] Download JDK10 from Debian Buster on RasPi --- modules/java.sh | 36 ++++++++++++++++++++++++++---------- modules/vars.sh | 6 +++--- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/modules/java.sh b/modules/java.sh index cd066a4..663c7be 100644 --- a/modules/java.sh +++ b/modules/java.sh @@ -1,13 +1,13 @@ #!/bin/bash -function java_install_bundle(){ +function java_install_bundle() { if [ -d "$JAVA_PATH_NEW" ]; then echo "Sorry, we detected a previous installation in path: /opt/jri-10-build-050" echo exit 1 fi - + if [ ! -f "$JAVA_ZIP" ]; then echo "Downloading new Java..." wget "$JAVA_URL" -O "$JAVA_ZIP" @@ -20,21 +20,37 @@ function java_install_bundle(){ tar -xf "$JAVA_ZIP" -C "$JAVA_OPT" mv "$JAVA_PATH_ZIP" "$JAVA_PATH_NEW" update-alternatives --install /usr/bin/java java "$JAVA_EXE" 1 - + JAVA_REAL_EXE="$JAVA_EXE" } -#TODO Upgrade this function with the support of OpenJDK 10 function java_install_ppa() { - echo "$WEBUPD8_REPO" | sudo tee -a /etc/apt/sources.list - apt-key adv --recv-key --keyserver keyserver.ubuntu.com "$WEBUPD8_KEY" + ### + # Add Debian Buster repo to Stretch + + # prevent distro upgrade + cat >/etc/apt/preferences.d/jdk <