-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall_debian.sh
75 lines (64 loc) · 2.26 KB
/
install_debian.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
67
68
69
70
71
72
73
74
75
#!/bin/bash
# The commands in this script are meant to be ran by root.
# Add Ansible Repo and Install Ansible
apt install -y sudo
sudo apt update
sudo apt install -y software-properties-common ansible git
# Clone Repo
sudo git clone https://github.com/gabotronix/underpass.git /opt/underpass
# Install Ansible Roles
sudo ansible-galaxy install -r /opt/underpass/ansible/requirements.yml
# Run Ansible Playbook
cd /opt/underpass
sudo ansible-playbook install.yml
# Install Underpass
echo -e "===================================================="
echo -e "Installing Underpass Docker Apps"
echo -e "===================================================="
cd /opt/underpass
DockerNetwork=`sudo docker network ls | grep -c underpass`
if [ $DockerNetwork != 1 ]; then
sudo docker network create underpass --subnet 172.20.0.0/24
sudo docker-compose up -d
else
sudo docker-compose up -d
fi
# Enumerate Web UI's and Ports
UnderpassDir=`ls -l /opt | grep -c underpass`
WhichDockerCompose=`which docker-compose | grep -c /usr`
DockerPS=`sudo docker ps | grep -c mongodb`
function countdown { #https://www.cyberciti.biz/faq/how-to-display-countdown-timer-in-bash-shell-script-running-on-linuxunix/
local OLD_IFS="${IFS}"
IFS=":"
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START
while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))
printf "\r%02d:%02d:%02d" \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))
sleep 1
done
IFS="${OLD_IFS}"
echo " "
}
if [ $UnderpassDir != 1 ]; then
echo -e "Installation failed. Please run the installer again."
exit 1
elif [ $WhichDockerCompose != 1 ]; then
echo -e "Installation failed. Please run the installer again."
exit 1
elif [ $DockerPS != 1 ]; then
echo -e "Installation failed. Please run the installer again."
exit 1
else
echo -e "\n\n----------------------------------------------------------------------\n"
echo -e "This server will now reboot in order to complete the installation.\n"
echo -e "Please log in again after a minute or so.\n"
countdown "00:00:10"
sudo reboot
fi