-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·62 lines (52 loc) · 1.17 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·62 lines (52 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
UNAME=$( command -v uname)
ROOT_DIR=".."
TARGET_DIR="target/"
RESOURCES="/"
java_reg=^14\.[0-9]\.[0-9]$
# TEST JAVA
if type -p java; then
echo found java executable in PATH
_java=java
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
echo found java executable in JAVA_HOME
_java="$JAVA_HOME/bin/java"
else
echo "no java"
fi
if [[ "$_java" ]]; then
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo version "$version"
if [[ "$version" =~ $java_reg ]]; then
echo java version $version is correct
else
echo ERROR java version $version is incorrect
exit 1
fi
fi
run_unix (){
cd $ROOT_DIR
cd $TARGET_DIR
echo $@
java --enable-preview com.labsky.timotej.BigShop "$@"
}
run_win (){
cd ./$TARGET_DIR
echo $@
java --enable-preview com.labsky.timotej.BigShop "$@"
}
case $( "${UNAME}" | tr '[:upper:]' '[:lower:]') in
linux* | darwin*)
printf 'linux\n'
run_unix "$@"
;;
msys* | cygwin* | mingw* | nt|win*)
# or possible 'bash on windowsi'
run_win "$@"
printf 'windows\n'
;;
*)
printf 'unkonwn'
exit 1
;;
esac