-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-env
executable file
·64 lines (55 loc) · 1.57 KB
/
setup-env
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
60
61
62
63
64
# Run this script with:
#
# source ./setup-env
unset WTL_DEV_KIT_PATH
unset WTL_DEV_KIT_REPOS_PATH
unset WTL_DEV_KIT_BIN_PATH
if [ "$0" == "/bin/bash" ] || [ "$0" == "bash" ] || [ "$0" == "-bash" ]
then
unset WTL_THIS_SCRIPT_PATH
if [[ $(echo -e "$BASH_VERSION\n4.4.0" | sort -V | head -1) != "4.4.0" ]]
then
echo "Your bash version is too old ($BASH_VERSION)"
return 1 &> /dev/null
exit 1
fi
WTL_THIS_SCRIPT_PATH="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )"
else
echo "Can't detect a way to setup your shell ($0), sorry"
echo
echo "Are you load this file with '. ./setup-env' or 'source ./setup-env'?"
echo
return 1 &> /dev/null
exit 1
fi
if [[ -z "$WTL_THIS_SCRIPT_PATH" ]]
then
echo "Missing \$WTL_THIS_SCRIPT_PATH"
echo "Error in the setup process, exit"
return 1 &> /dev/null
exit 1
fi
WTL_DEV_KIT_PATH=$WTL_THIS_SCRIPT_PATH
WTL_DEV_KIT_REPOS_PATH=$WTL_DEV_KIT_PATH"/repositories"
if test ! -d $WTL_DEV_KIT_REPOS_PATH
then
echo "Missing directory '$WTL_DEV_KIT_REPOS_PATH'"
return 1
fi
WTL_DEV_KIT_BIN_PATH=$WTL_DEV_KIT_PATH"/bin"
if test ! -d $WTL_DEV_KIT_BIN_PATH
then
echo "Missing directory '$WTL_DEV_KIT_BIN_PATH'"
return 1
fi
if ! echo "$PATH" | grep -Eq "(^|:)$WTL_DEV_KIT_BIN_PATH($|:)"
then
PATH="$PATH:$WTL_DEV_KIT_BIN_PATH"
fi
export WTL_DEV_KIT_PATH
export WTL_DEV_KIT_REPOS_PATH
export WTL_DEV_KIT_BIN_PATH
eval "$(register-python-argcomplete3 wtl-services-build)"
eval "$(register-python-argcomplete3 wtl-services-run)"
eval "$(register-python-argcomplete3 wtl-services-stop)"
export KEYCLOAK_AUTH_REALM=wikitolearn-local