-
Notifications
You must be signed in to change notification settings - Fork 1
/
verify.sh
executable file
·51 lines (44 loc) · 1.33 KB
/
verify.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
#!/bin/bash
# This script runs all checks across the entire project.
# Checks if a dependency is installed on a system.
function checkDependency {
local depName="$1"
if hash "$depName"; then
return 0
else
echo "ERROR: dependency not installed '$depName'"
return 1
fi
}
# Installs Docker and dependencies
# Docker is installed through python, we install python & pip first, then docker.
# Last, we add current user to the 'docker' group to enable sudo-less docker.
function installDocker {
if [ "$(uname)" == "Darwin" ]; then
echo "Follow these steps to install docker: https://store.docker.com/editions/community/docker-ce-desktop-mac"
exit 1
fi
echo "Installing python and pip, a dependency of docker"
if hash yum; then
set -x
sudo yum update -y
sudo yum install -y python3 python3-pip
set +x
else
set -x
sudo apt install -y python3 python3-pip
set +x
fi
echo "Installing Docker (with pip)"
set -x
pip3 install docker docker-compose
set +x
echo "Adding current user: $USER to group: 'docker' (allows sudo-less docker)."
echo "Log back in for these changes to take effect."
groups | grep -q "docker" || sudo usermod -a -G docker "$USER"
}
scriptDir="$(dirname $0)"
set -o pipefail
set -eu
checkDependency "docker" || installDocker
"$scriptDir/gradlew" spotlessApply check $@