Skip to content

Commit

Permalink
Update Batect to v0.66.0
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate-bot authored and renovate[bot] committed Jan 26, 2021
1 parent e9d3cb4 commit 440d208
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
45 changes: 36 additions & 9 deletions batect
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# You should commit this file to version control alongside the rest of your project. It should not be installed globally.
# For more information, visit https://github.com/batect/batect.

VERSION="0.65.1"
CHECKSUM="${BATECT_DOWNLOAD_CHECKSUM:-3f3669ed188790f203494b9cf4e3b5e40f5160c040b59c903d276a11f0b42480}"
VERSION="0.66.0"
CHECKSUM="${BATECT_DOWNLOAD_CHECKSUM:-c07ba245e9aded109e129bda3864e47a833536f3b65f71a29a5920f2607f3e6c}"
DOWNLOAD_URL_ROOT=${BATECT_DOWNLOAD_URL_ROOT:-"https://dl.bintray.com/batect/batect"}
DOWNLOAD_URL=${BATECT_DOWNLOAD_URL:-"$DOWNLOAD_URL_ROOT/$VERSION/bin/batect-$VERSION.jar"}
QUIET_DOWNLOAD=${BATECT_QUIET_DOWNLOAD:-false}
Expand Down Expand Up @@ -71,23 +71,33 @@
function runApplication() {
checkForJava

java_version=$(getJavaVersion)
java_version_info=$(getJavaVersionInfo)
checkJavaVersion "$java_version_info"

java_version=$(extractJavaVersion "$java_version_info")
java_version_major=$(extractJavaMajorVersion "$java_version")

if (( java_version_major >= 9 )); then
JAVA_OPTS="--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
JAVA_OPTS=(--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED)
else
JAVA_OPTS=()
fi

if [[ "$(uname -o 2>&1)" == "Msys" ]] && hash winpty 2>/dev/null; then
GIT_BASH_PTY_WORKAROUND=(winpty)
else
JAVA_OPTS=""
GIT_BASH_PTY_WORKAROUND=()
fi

BATECT_WRAPPER_SCRIPT_DIR="$SCRIPT_PATH" \
BATECT_WRAPPER_CACHE_DIR="$BATECT_WRAPPER_CACHE_DIR" \
BATECT_WRAPPER_DID_DOWNLOAD="$BATECT_WRAPPER_DID_DOWNLOAD" \
HOSTNAME="$HOSTNAME" \
exec \
"${GIT_BASH_PTY_WORKAROUND[@]}" \
java \
-Djava.net.useSystemProxies=true \
$JAVA_OPTS \
"${JAVA_OPTS[@]}" \
-jar "$JAR_PATH" \
"$@"
}
Expand All @@ -104,8 +114,11 @@
echo "Java is not installed or not on your PATH. Please install it and try again." >&2
exit 1
fi
}

java_version=$(getJavaVersion)
function checkJavaVersion() {
java_version_info="$1"
java_version=$(extractJavaVersion "$java_version_info")
java_version_major=$(extractJavaMajorVersion "$java_version")
java_version_minor=$(extractJavaMinorVersion "$java_version")

Expand All @@ -114,10 +127,20 @@
echo "If you have a newer version of Java installed, please make sure your PATH is set correctly."
exit 1
fi

if ! javaIs64Bit "$java_version_info"; then
echo "The version of Java that is available on your PATH is a 32-bit version, but Batect requires a 64-bit Java runtime."
echo "If you have a 64-bit version of Java installed, please make sure your PATH is set correctly."
exit 1
fi
}

function getJavaVersionInfo() {
java -version 2>&1
}

function getJavaVersion() {
java -version 2>&1 | grep version | sed -En ';s/.* version "([0-9]+)(\.([0-9]+))?.*".*/\1.\3/p;'
function extractJavaVersion() {
echo "$1" | grep version | sed -En ';s/.* version "([0-9]+)(\.([0-9]+))?.*".*/\1.\3/p;'
}

function extractJavaMajorVersion() {
Expand All @@ -133,6 +156,10 @@
echo "${java_version_minor:-0}"
}

function javaIs64Bit() {
echo "$1" | grep -q '64-[Bb]it'
}

main "$@"
exit $?
}
6 changes: 3 additions & 3 deletions batect.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rem For more information, visit https://github.com/batect/batect.

setlocal EnableDelayedExpansion

set "version=0.65.1"
set "version=0.66.0"

if "%BATECT_CACHE_DIR%" == "" (
set "BATECT_CACHE_DIR=%USERPROFILE%\.batect\cache"
Expand All @@ -22,7 +22,7 @@ $ErrorActionPreference = 'Stop'^

^

$Version='0.65.1'^
$Version='0.66.0'^

^

Expand All @@ -48,7 +48,7 @@ $UrlEncodedVersion = [Uri]::EscapeDataString($Version)^

$DownloadUrl = getValueOrDefault $env:BATECT_DOWNLOAD_URL "$DownloadUrlRoot/$UrlEncodedVersion/bin/batect-$UrlEncodedVersion.jar"^

$ExpectedChecksum = getValueOrDefault $env:BATECT_DOWNLOAD_CHECKSUM '3f3669ed188790f203494b9cf4e3b5e40f5160c040b59c903d276a11f0b42480'^
$ExpectedChecksum = getValueOrDefault $env:BATECT_DOWNLOAD_CHECKSUM 'c07ba245e9aded109e129bda3864e47a833536f3b65f71a29a5920f2607f3e6c'^

^

Expand Down

0 comments on commit 440d208

Please sign in to comment.