-
Notifications
You must be signed in to change notification settings - Fork 34
/
install.sh
executable file
·49 lines (41 loc) · 1.04 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
#!/bin/bash
umask 0022
sudo() {
# the -E pulls in environment variables like HAB_LICENSE
[[ $EUID = 0 ]] || set -- command sudo -E "$@"
"$@"
}
check_envfile() {
if [ -f ../bldr.env ]; then
# shellcheck disable=SC1091
source ../bldr.env
elif [ -f /vagrant/bldr.env ]; then
# shellcheck disable=SC1091
source /vagrant/bldr.env
else
echo "ERROR: bldr.env file is missing!"
exit 1
fi
}
cat NOTICE
echo
license="${HAB_LICENSE:-}"
declare response
if [ "$license" == "accept" ] || [ "$license" == "accept-no-persist" ]; then
echo "INFO: Detected HAB_LICENSE=${HAB_LICENSE}"
echo "Continuing with installation"
response="y"
else
cat LICENSE-NOTICE
echo
read -r -p "Do you accept the terms of this license? Answering yes will proceed with the installation. [y/N] " response
fi
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
pushd scripts >/dev/null || exit
export HAB_LICENSE=accept
sudo ./install-hab.sh
check_envfile
sudo ./hab-sup.service.sh
sudo ./provision.sh "$@"
popd >/dev/null || exit
fi