-
Notifications
You must be signed in to change notification settings - Fork 9
/
bootstrap
executable file
·61 lines (50 loc) · 1.22 KB
/
bootstrap
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
#!/bin/bash
set -eEu
set -o pipefail
################################################################################
# Run "ci/bootstrap" to install dependencies for the test harness.
################################################################################
. ci/functions.sh
main() {
setup_python_path
install_precommit
add_upstream_git_remote
fetch_upstream
}
setup_python_path() {
if command -v python3 &>/dev/null; then
python="python3"
else
python="python"
fi
python_path="$(${python} -c "import site; print(site.USER_BASE)")"
readonly python_path
if ! grep -q "${python_path}/bin" <(env | grep PATH); then
export PATH="${PATH}:${python_path}/bin"
fi
}
install_precommit() {
if command -v pip3 &>/dev/null; then
pip="pip3"
else
pip="pip"
fi
# Install for just this user. Does not need root.
"${pip}" install \
--compile \
--disable-pip-version-check \
--quiet \
--user \
--verbose \
-r ci/requirements.txt
run pre-commit install-hooks
}
add_upstream_git_remote() {
if ! git remote show upstream &>/dev/null; then
git remote add upstream https://github.com/jumanjihouse/docker-tftp-hpa.git
fi
}
fetch_upstream() {
git fetch upstream
}
main