mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Remove Java Installation Scripts
The scripts are outdated and install the wrong Java version anyway.
This commit is contained in:
parent
5a3283ef17
commit
b17603eec9
@ -1,56 +0,0 @@
|
|||||||
:: This script will download and install the appropriate JDK for use with Bisq development.
|
|
||||||
:: It will also configure it as the default system JDK.
|
|
||||||
:: If you need to change to another default JDK for another purpose later, you just need to
|
|
||||||
:: change the JAVA_HOME environment variable. For example, use the following command:
|
|
||||||
:: setx /M JAVA_HOME "<JDK_PATH>"
|
|
||||||
|
|
||||||
@echo off
|
|
||||||
|
|
||||||
:: Ensure we have administrative privileges in order to install files and set environment variables
|
|
||||||
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
|
||||||
if '%errorlevel%' == '0' (
|
|
||||||
::If no error is encountered, we have administrative privileges
|
|
||||||
goto GotAdminPrivileges
|
|
||||||
)
|
|
||||||
echo Requesting administrative privileges...
|
|
||||||
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadminprivileges.vbs"
|
|
||||||
set params = %*:"=""
|
|
||||||
echo UAC.ShellExecute "%~s0", "%params%", "", "runas", 1 >> "%temp%\getadminprivileges.vbs"
|
|
||||||
"%temp%\getadminprivileges.vbs"
|
|
||||||
exit /B
|
|
||||||
:GotAdminPrivileges
|
|
||||||
if exist "%temp%\getadminprivileges.vbs" ( del "%temp%\getadminprivileges.vbs" )
|
|
||||||
pushd "%CD%"
|
|
||||||
cd /D "%~dp0"
|
|
||||||
|
|
||||||
title Install Java
|
|
||||||
|
|
||||||
set jdk_version=11.0.2
|
|
||||||
set jdk_filename=openjdk-%jdk_version%_windows-x64_bin
|
|
||||||
set jdk_url=https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_windows-x64_bin.zip
|
|
||||||
|
|
||||||
if exist "%PROGRAMFILES%\Java\openjdk\jdk-%jdk_version%" (
|
|
||||||
echo %PROGRAMFILES%\Java\openjdk\jdk-%jdk_version% already exists, skipping install
|
|
||||||
goto SetEnvVars
|
|
||||||
)
|
|
||||||
|
|
||||||
echo Downloading required files to %TEMP%
|
|
||||||
powershell -Command "Invoke-WebRequest %jdk_url% -OutFile $env:temp\%jdk_filename%.zip"
|
|
||||||
|
|
||||||
echo Extracting and installing JDK to %PROGRAMFILES%\Java\openjdk\jdk-%jdk_version%
|
|
||||||
powershell -Command "Expand-Archive $env:temp\%jdk_filename%.zip -DestinationPath %TEMP%\openjdk-%jdk_version% -Force"
|
|
||||||
md "%PROGRAMFILES%\Java\openjdk"
|
|
||||||
move "%TEMP%\openjdk-%jdk_version%\jdk-%jdk_version%" "%PROGRAMFILES%\Java\openjdk"
|
|
||||||
|
|
||||||
echo Removing downloaded files
|
|
||||||
rmdir /S /Q %TEMP%\openjdk-%jdk_version%
|
|
||||||
del /Q %TEMP%\%jdk_filename%.zip
|
|
||||||
|
|
||||||
:SetEnvVars
|
|
||||||
echo Setting environment variables
|
|
||||||
powershell -Command "[Environment]::SetEnvironmentVariable('JAVA_HOME', '%PROGRAMFILES%\Java\openjdk\jdk-%jdk_version%', 'Machine')"
|
|
||||||
set java_bin=%%JAVA_HOME%%\bin
|
|
||||||
echo %PATH%|find /i "%java_bin%">nul || powershell -Command "[Environment]::SetEnvironmentVariable('PATH', '%PATH%;%java_bin%', 'Machine')"
|
|
||||||
|
|
||||||
echo Done!
|
|
||||||
pause
|
|
@ -1,82 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# This script will download and install the appropriate JDK for use with Bisq development.
|
|
||||||
# It will also configure it as the default system JDK.
|
|
||||||
# If you need to change to another default JDK for another purpose later, you can use the
|
|
||||||
# following commands and select the default JDK:
|
|
||||||
# Linux:
|
|
||||||
# update-alternatives --config java
|
|
||||||
# update-alternatives --config javac
|
|
||||||
# MacOS:
|
|
||||||
# echo 'export JAVA_HOME=/Library/Java/JavaVirtualMachines/<ENTER_NEW_JDK>/Contents/Home' >>~/.bash_profile
|
|
||||||
# echo 'export PATH=$JAVA_HOME/bin:$PATH' >>~/.bash_profile
|
|
||||||
# source ~/.bash_profile
|
|
||||||
set -e
|
|
||||||
|
|
||||||
unameOut="$(uname -s)"
|
|
||||||
case "${unameOut}" in
|
|
||||||
Linux*)
|
|
||||||
JAVA_HOME=/usr/lib/jvm/openjdk-11.0.2
|
|
||||||
JDK_FILENAME=openjdk-11.0.2_linux-x64_bin.tar.gz
|
|
||||||
JDK_URL=https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
|
|
||||||
|
|
||||||
# Determine which package manager to use depending on the distribution
|
|
||||||
declare -A osInfo;
|
|
||||||
osInfo[/etc/redhat-release]=yum
|
|
||||||
osInfo[/etc/arch-release]=pacman
|
|
||||||
osInfo[/etc/gentoo-release]=emerge
|
|
||||||
osInfo[/etc/SuSE-release]=zypp
|
|
||||||
osInfo[/etc/debian_version]=apt-get
|
|
||||||
|
|
||||||
for f in "${!osInfo[@]}"
|
|
||||||
do
|
|
||||||
if [[ -f $f ]]; then
|
|
||||||
PACKAGE_MANAGER=${osInfo[$f]}
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "$JAVA_HOME" ]; then
|
|
||||||
# Ensure curl is installed since it may not be
|
|
||||||
$PACKAGE_MANAGER -y install curl
|
|
||||||
|
|
||||||
curl -L -O $JDK_URL
|
|
||||||
mkdir -p $JAVA_HOME
|
|
||||||
tar -zxf $JDK_FILENAME -C $JAVA_HOME --strip 1
|
|
||||||
rm $JDK_FILENAME
|
|
||||||
|
|
||||||
update-alternatives --install /usr/bin/java java $JAVA_HOME/bin/java 2000
|
|
||||||
update-alternatives --install /usr/bin/javac javac $JAVA_HOME/bin/javac 2000
|
|
||||||
fi
|
|
||||||
|
|
||||||
update-alternatives --set java $JAVA_HOME/bin/java
|
|
||||||
update-alternatives --set javac $JAVA_HOME/bin/javac
|
|
||||||
;;
|
|
||||||
Darwin*)
|
|
||||||
JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
|
|
||||||
JDK_FILENAME=openjdk-11.0.2_osx-x64_bin.tar.gz
|
|
||||||
JDK_URL=https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_osx-x64_bin.tar.gz
|
|
||||||
if [ ! -d "$JAVA_HOME" ]; then
|
|
||||||
if [[ $(command -v brew) == "" ]]; then
|
|
||||||
echo "Installing Homebrew"
|
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
||||||
else
|
|
||||||
echo "Updating Homebrew"
|
|
||||||
brew update
|
|
||||||
fi
|
|
||||||
|
|
||||||
brew install curl
|
|
||||||
curl -L -O $JDK_URL
|
|
||||||
sudo mkdir /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk | sudo bash
|
|
||||||
gunzip -c $JDK_FILENAME | tar xopf -
|
|
||||||
sudo mv jdk-11.0.2.jdk/* /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk
|
|
||||||
sudo rmdir jdk-11.0.2.jdk
|
|
||||||
rm $JDK_FILENAME
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo export JAVA_HOME=$JAVA_HOME >>~/.bash_profile
|
|
||||||
echo export PATH=$JAVA_HOME/bin:"$PATH" >>~/.bash_profile
|
|
||||||
source "$HOME/.bash_profile"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
esac
|
|
||||||
java -version
|
|
@ -1,143 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Install OpenJDK 11.0.2 on Linux
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# Download and install locations
|
|
||||||
JDK_URL=https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
|
|
||||||
JAVA_HOME_DIR=/usr/lib/jvm/openjdk-11.0.2
|
|
||||||
|
|
||||||
alpine_openjdk_package=openjdk11
|
|
||||||
alpine_openjdk_location=/usr/lib/jvm/java-11-openjdk
|
|
||||||
|
|
||||||
|
|
||||||
OS=$(uname)
|
|
||||||
if [ "$OS" != Linux ]
|
|
||||||
then
|
|
||||||
echo This script supports Linux only >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
PACKAGE_MANAGER=
|
|
||||||
for tool in apk yum pacman emerge zypper apt-get dnf
|
|
||||||
do
|
|
||||||
if command -v $tool >/dev/null
|
|
||||||
then
|
|
||||||
PACKAGE_MANAGER=$tool
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "$PACKAGE_MANAGER" ]
|
|
||||||
then
|
|
||||||
echo "Unknown OS" >&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
missing=
|
|
||||||
for cmd in curl tar gzip
|
|
||||||
do
|
|
||||||
if ! command -v $cmd >/dev/null
|
|
||||||
then
|
|
||||||
missing="${missing+$missing }$cmd"
|
|
||||||
if [ "$cmd" = curl ]
|
|
||||||
then
|
|
||||||
missing="$missing ca-certificates"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
sudo_exec () {
|
|
||||||
if [ "${EID-500}" -eq 0 ] || [ "${HOME-/home}" = /root ]
|
|
||||||
then
|
|
||||||
"$@"
|
|
||||||
elif command -v sudo
|
|
||||||
then
|
|
||||||
sudo "$@"
|
|
||||||
else
|
|
||||||
echo "Can't execute with elevated priviliges: $*" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install missing packages
|
|
||||||
if [ -n "$missing" ]
|
|
||||||
then
|
|
||||||
case "$PACKAGE_MANAGER" in
|
|
||||||
apk)
|
|
||||||
: no need to install missing packages, because
|
|
||||||
: we will install OpenJDK using apk
|
|
||||||
;;
|
|
||||||
pacman)
|
|
||||||
sudo_exec pacman -Syy --noconfirm "$missing"
|
|
||||||
;;
|
|
||||||
apt-get)
|
|
||||||
sudo_exec apt-get update
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
sudo_exec apt-get install -y --no-install-recommends $missing
|
|
||||||
;;
|
|
||||||
dnf|emerge|yum|zypper)
|
|
||||||
sudo_exec "$PACKAGE_MANAGER" update
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
sudo_exec "$PACKAGE_MANAGER" install -y $missing
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "The following packages are missing from your system: $missing" >&2
|
|
||||||
echo "Please install these packages before proceeding" >&2
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PACKAGE_MANAGER" = apk ]
|
|
||||||
then
|
|
||||||
if sudo_exec apk add --no-cache ${alpine_openjdk_package}
|
|
||||||
then
|
|
||||||
echo "Installed Java to $alpine_openjdk_location"
|
|
||||||
echo "To start using 'javac', add $alpine_openjdk_location/bin to your PATH:"
|
|
||||||
echo "export PATH=$alpine_openjdk_location/bin:\$PATH"
|
|
||||||
fi
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
JDK_FILENAME=$(basename "$JDK_URL")
|
|
||||||
tmpdir=$(mktemp -d)
|
|
||||||
trap -- 'rm -rf "$tmpdir"' EXIT
|
|
||||||
|
|
||||||
mkdir "$tmpdir/JAVA_HOME_DIR"
|
|
||||||
curl -L -o "$tmpdir/$JDK_FILENAME" "$JDK_URL"
|
|
||||||
tar -xf "$tmpdir/$JDK_FILENAME" -C "$tmpdir/JAVA_HOME_DIR" --strip-components=1
|
|
||||||
|
|
||||||
if [ -d "$tmpdir/JAVA_HOME_DIR/bin" ]
|
|
||||||
then
|
|
||||||
sudo_exec rm -rf "$JAVA_HOME_DIR"
|
|
||||||
sudo_exec mkdir -p "$(dirname "$JAVA_HOME_DIR")"
|
|
||||||
sudo_exec mv "$tmpdir/JAVA_HOME_DIR" "$JAVA_HOME_DIR"
|
|
||||||
else
|
|
||||||
echo "Error extracting archive contents" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Java has been installed in $JAVA_HOME_DIR"
|
|
||||||
|
|
||||||
if command -v update-alternatives >/dev/null
|
|
||||||
then
|
|
||||||
update-alternatives --install /usr/bin/java java "$JAVA_HOME_DIR/bin/java" 2000
|
|
||||||
update-alternatives --install /usr/bin/javac javac "$JAVA_HOME_DIR/bin/javac" 2000
|
|
||||||
update-alternatives --set java "$JAVA_HOME_DIR/bin/java"
|
|
||||||
update-alternatives --set javac "$JAVA_HOME_DIR/bin/javac"
|
|
||||||
|
|
||||||
echo "and configured as the default JDK using 'update-alternatives'."
|
|
||||||
echo "If you need to change to another JDK later, you can do so like so:"
|
|
||||||
echo " update-alternatives --config java"
|
|
||||||
echo " update-alternatives --config javac"
|
|
||||||
else
|
|
||||||
echo "To start using it, please set/update your 'JAVA_HOME' and 'PATH' environment variables like so:"
|
|
||||||
echo
|
|
||||||
echo "export JAVA_HOME=\"$JAVA_HOME_DIR\""
|
|
||||||
echo "export PATH=\"$JAVA_HOME_DIR/bin:\$PATH\""
|
|
||||||
echo
|
|
||||||
echo "Consider adding the above lines to one of your personal initialization files"
|
|
||||||
echo " like ~/.bashrc, ~/.bash_profile, ~/.profile, or similar."
|
|
||||||
fi
|
|
@ -1,60 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Install OpenJDK 11.0.2 on macOS
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# Download and install locations
|
|
||||||
JDK_URL=https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_osx-x64_bin.tar.gz
|
|
||||||
JAVA_HOME_DIR=/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk
|
|
||||||
|
|
||||||
|
|
||||||
OS=$(uname)
|
|
||||||
if [[ $OS != Darwin ]]
|
|
||||||
then
|
|
||||||
echo This script supports macOS only >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
command -v curl >/dev/null || { echo "cURL is not available" >&2; exit 1; }
|
|
||||||
command -v tar >/dev/null || { echo "tar is not available" >&2; exit 1; }
|
|
||||||
|
|
||||||
sudo_exec () {
|
|
||||||
if [[ $EUID -eq 0 ]]
|
|
||||||
then
|
|
||||||
"$@"
|
|
||||||
else
|
|
||||||
sudo "$@"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
JDK_FILENAME=$(basename "$JDK_URL")
|
|
||||||
|
|
||||||
tmpdir=$(mktemp -d)
|
|
||||||
trap -- 'rm -rf "$tmpdir"' EXIT
|
|
||||||
|
|
||||||
mkdir "$tmpdir/JAVA_HOME_DIR"
|
|
||||||
curl -L -o "$tmpdir/$JDK_FILENAME" "$JDK_URL"
|
|
||||||
tar -xf "$tmpdir/$JDK_FILENAME" -C "$tmpdir/JAVA_HOME_DIR" --strip-components=2
|
|
||||||
|
|
||||||
if [[ -d "$tmpdir/JAVA_HOME_DIR/Contents" ]]
|
|
||||||
then
|
|
||||||
sudo_exec rm -rf "$JAVA_HOME_DIR"
|
|
||||||
sudo_exec mkdir -p "$(dirname "$JAVA_HOME_DIR")"
|
|
||||||
sudo_exec mv "$tmpdir/JAVA_HOME_DIR" "$JAVA_HOME_DIR"
|
|
||||||
else
|
|
||||||
echo "Error extracting archive contents" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Java has been installed in $JAVA_HOME_DIR"
|
|
||||||
echo "To start using it, please set/update your 'JAVA_HOME' and 'PATH' environment variables like so:"
|
|
||||||
echo
|
|
||||||
echo " export JAVA_HOME=\"$JAVA_HOME_DIR/Contents/Home\""
|
|
||||||
echo " export PATH=\"$JAVA_HOME_DIR/Contents/Home/bin:\$PATH\""
|
|
||||||
echo
|
|
||||||
echo "Consider adding the above lines to one of your personal initialization files."
|
|
||||||
echo "(~/.bashrc, ~/.bash_profile, ~/.profile, or similar)."
|
|
||||||
|
|
||||||
export JAVA_HOME="$JAVA_HOME_DIR/Contents/Home"
|
|
||||||
export PATH="$JAVA_HOME_DIR/Contents/Home/bin":$PATH
|
|
Loading…
Reference in New Issue
Block a user