forked from esm-tools/esm_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·66 lines (52 loc) · 1.97 KB
/
install.sh
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
65
66
#!/usr/bin/env bash
# boolean variable to exit the program on error
shall_exit=false
# prints the error message as the first argument and exits the program with non-zero status
function quit_install () {
echo ""
echo "$(tput setaf 1)ERROR: ${1} $(tput sgr 0)"
echo "please set the LANG and LC_ALL variables in your shell startup script (eg. .bashrc, .bash_profile) to the following values: "
echo " export LC_ALL=en_US.UTF-8"
echo " export LANG=en_US.UTF-8"
echo "and re-execute them so that the changes take place. Exiting the installation process"
exit 1
}
# check if LANG environment is set to the correct value
if [[ -z ${LANG+x} ]]; then
err_msg="LANG environment variable is not set"
shall_exit=true
elif [[ ${LANG} != "en_US.UTF-8" ]]; then
err_msg="LANG environment variable is not set correctly. The current value is ${LANG}"
shall_exit=true
fi
# check if LC_ALL variable is set to the correct value
if [[ -z ${LC_ALL+x} ]]; then
err_msg="LC_ALL variable is not set"
shall_exit=true
elif [[ ${LC_ALL} != "en_US.UTF-8" ]]; then
err_msg="LC_ALL environment variable is not set correctly. The current value is ${LC_ALL}"
shall_exit=true
fi
# we have an error, terminate the script
if [[ ${shall_exit} == true ]]; then
quit_install "${err_msg}"
fi
git_error_message="You need git version >= 2.13 to install the esm_tools (see README.rst)."
if hash git 2>/dev/null; then
git_version=`git --version | rev | cut -d' ' -f 1 | rev`
major_git_version=`git --version | rev | cut -d' ' -f 1 | rev | cut -d'.' -f 1`
minor_git_version=`git --version | rev | cut -d' ' -f 1 | rev | cut -d'.' -f 2`
if test ${major_git_version} -lt "2"; then
echo $git_error_message
echo "git version found: ${git_version}"
else
if test ${minor_git_version} -lt "13"; then
echo $git_error_message
echo "git version found: ${git_version}"
fi
fi
else
echo $git_error_message
echo "No installed git version found."
fi
pip install --user -e .