-
Notifications
You must be signed in to change notification settings - Fork 842
/
checks.sh
executable file
·62 lines (55 loc) · 2.58 KB
/
checks.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
#!/bin/bash
if [[ -z "$VIRTUAL_ENV" ]]; then
echo "*** We noticed you're not currently inside a virtual environment. Augur MUST be run inside a virtual environment. ***"
read -r -p "*** Would you like us to generate a environment for you automatically? If you select no, you must create it yourself. [Y/n] " response
case "$response" in
[yY][eE][sS]|[yY])
echo
$augur_python_command -m venv $HOME/.virtualenvs/augur_env
echo "*** Your environment was installed to $HOME/.virtualenvs/augur_env/. Please activate your environment using your shell's appropriate command. ***"
echo "*** For example, if you're using bash, run 'source $HOME/.virtualenvs/augur_env/bin/activate'. ***"
echo "*** Once you've activated your virtual environment, please rerun the installation command. ***"
exit 1
;;
*)
echo
echo "Please create & activate your virtual environment and rerun the installation command when you're finished."
exit 1
;;
esac
fi
function check_python_version() {
major_python_version=$($1 -c 'import sys; print(sys.version_info.major)')
minor_python_version=$($1 -c 'import sys; print(sys.version_info.minor)')
if [[ $major_python_version -lt 3 ]]; then
echo "Outdated major version of Python detected."
return 1
elif [[ $minor_python_version -lt 6 ]]; then
echo "Outdated minor version of Python detected."
return 1
fi
}
check_python_version "python"
if [[ $? -eq 1 ]]; then
echo "Insufficient Python version installed to `which python`."
echo "Checking `which python3`..."
check_python_version "python3"
if [[ $? -eq 1 ]]; then
echo "Insufficient Python version installed to `which python3`."
echo "Please install Python 3.6 or higher to either python or python3."
echo "Python 3.6 and higher can be found here: https://www.python.org/downloads/"
exit 1
fi
fi
if [[ ! $(command -v pip) ]]; then
echo "pip not found searching. Searching for pip3..."
if [[ ! $(command -v pip3) ]]; then
echo "Neither pip nor pip3 has been detected. Please make sure one of these two commands is installed and available in your PATH."
echo "Installation instructions can be found here: https://pip.pypa.io/en/stable/installing/"
exit 1
fi
fi
if [[ ! -d logs ]]; then
mkdir logs
fi
command -v go >/dev/null 2>&1 || { echo >&2 "We require 'go' to run Scorecard project to get data, Please install GO first....Aborting. Please issue the command: wget -c https://go.dev/dl/go1.19.3.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local"; exit 1; }