1
0
Fork 0
mirror of https://github.com/actions/setup-java synced 2024-11-08 14:42:39 +00:00
setup-java/__tests__/verify-java.sh

34 lines
616 B
Bash
Raw Normal View History

2020-02-11 23:17:37 +00:00
#!/bin/sh
if [ -z "$1" ]; then
echo "::error::Must supply java version argument"
2020-02-11 23:17:37 +00:00
exit 1
fi
java_version="$(java -version 2>&1)"
echo "Found java version: $java_version"
if [ -z "$(echo $java_version | grep --fixed-strings $1)" ]; then
echo "::error::Unexpected version"
exit 1
fi
if [ -z "$2" ]; then
echo "::error::Must supply java path argument"
exit 1
fi
if [ "$2" != "$JAVA_HOME" ]; then
echo "::error::Unexpected path"
exit 1
fi
if [ -z "$3" ]; then
echo "::error::Must supply java version argument"
exit 1
fi
if [ "$1" != "$3" ]; then
echo "::error::Unexpected version"
2020-02-11 23:17:37 +00:00
exit 1
fi