11#! /bin/bash
22
33
4- function java_install_bundle(){
4+ function java_install_bundle() {
55 if [ -d " $JAVA_PATH_NEW " ]; then
66 echo " Sorry, we detected a previous installation in path: /opt/jri-10-build-050"
77 echo
88 exit 1
99 fi
10-
10+
1111 if [ ! -f " $JAVA_ZIP " ]; then
1212 echo " Downloading new Java..."
1313 wget " $JAVA_URL " -O " $JAVA_ZIP "
@@ -20,21 +20,37 @@ function java_install_bundle(){
2020 tar -xf " $JAVA_ZIP " -C " $JAVA_OPT "
2121 mv " $JAVA_PATH_ZIP " " $JAVA_PATH_NEW "
2222 update-alternatives --install /usr/bin/java java " $JAVA_EXE " 1
23-
23+
2424 JAVA_REAL_EXE=" $JAVA_EXE "
2525}
2626
27- # TODO Upgrade this function with the support of OpenJDK 10
2827function java_install_ppa() {
29- echo " $WEBUPD8_REPO " | sudo tee -a /etc/apt/sources.list
30- apt-key adv --recv-key --keyserver keyserver.ubuntu.com " $WEBUPD8_KEY "
28+ # ##
29+ # Add Debian Buster repo to Stretch
30+
31+ # prevent distro upgrade
32+ cat > /etc/apt/preferences.d/jdk << EOF
33+ Package: *
34+ Pin: release a=stable
35+ Pin-Priority: 200
36+
37+ Package: *
38+ Pin: release a=testing
39+ Pin-Priority: 100
40+ EOF
41+ # workaround for cyclic dependency
42+ ln -sf " $JDEB_TMP_LINK " " /usr/bin/java"
43+
44+ # add repo, update
45+ echo " $JDEB_REPO " | sudo tee " /etc/apt/sources.list.d/jdk.list"
3146 apt-get update
32- apt-get install --yes --no-install-recommends " $WEBUPD8_PKG "
3347
34- JAVA_REAL_EXE=" $( which java) "
48+ # install package
49+ # (the symlink above gets discarded, but
50+ # it is needed during the installation)
51+ apt-get install --yes --no-install-recommends " $JDEB_PKG "
3552
36- # Review in the future how to accept licence automatically
37- # https://askubuntu.com/questions/190582/installing-java-automatically-with-silent-option
53+ JAVA_REAL_EXE=" $( which java) "
3854}
3955
4056# 1. Detect Java
0 commit comments