forked from ernestjohn/remote-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·109 lines (95 loc) · 3.02 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env bash
cleanup() {
return_value=$?
if [[ ${return_value} == "0" ]]; then
echo "INSTALL SCRIPT COMPLETED"
else
echo "INSTALL SCRIPT ERROR: ${return_value}"
fi
exit $return_value
}
trap "cleanup" EXIT
ansible_2_9_install_deb() {
sudo apt-get -y update
DEB_FILE=/tmp/ansible_2.9.16.deb
if [ ! -f $DEB_FILE ]; then
wget http://launchpadlibrarian.net/516153033/ansible_2.9.16+dfsg-1.1_all.deb -O $DEB_FILE
fi
sudo apt install -y $DEB_FILE
}
ansible_install_newstyle() {
sudo apt-get -y update
sudo apt-get install -y ansible=2.9.*
}
ansible_install_oldschool() {
sudo apt-get -y update
sudo apt install -y software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt-get install -y ansible=2.9.*
}
ansible_install_debian() {
sudo apt-get -y update
sudo apt-get install -y software-properties-common gnupg dirmngr
sudo apt-add-repository 'deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
sudo apt-get update
sudo apt-get install -y ansible=2.9.*
}
ansible_install_yum() {
sudo yum -y install epel-repo
sudo yum -y install epel-release
sudo yum -y update
sudo yum -y install ansible
}
cd "$(dirname "$0")"
distro_name=$(lsb_release -i | cut -f2)
distro_version=$(lsb_release -r | cut -f2)
echo "Installing Ansible software to deploy Headwind Remote .."
echo "Checking if we're using Ubuntu: name=\"${distro_name}\" and version=\"${distro_version}\""
case ${distro_name} in
"Ubuntu")
case ${distro_version} in
"16.04" | "18.04")
echo "OK, start installing on old LTS ${distro_name} ${distro_version} .."
ansible_install_oldschool
;;
"20.04")
echo "OK, start installing on actual LTS ${distro_name} ${distro_version} .."
ansible_install_newstyle
;;
"21.04")
echo "OK, start installing Ansible from .deb on ${distro_name} ${distro_version} .."
ansible_2_9_install_deb
;;
*)
echo "Could not install Headwind Remote on your Ubuntu version: $distro_version. We support only LTS Ubuntu versions: 16.04, 18.04, 20.04, 21.04"
exit 1
;;
esac
;;
"Debian")
echo "OK, start installing on ${distro_name} ${distro_version} .."
ansible_install_debian
;;
*)
# Check if yum exists
yum --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Yum package manager detected, installing using Yum"
ansible_install_yum
else
echo "Could not install Headwind Remote on your distro. Please contact us at https://headwind-remote.com."
exit 1
fi
;;
esac
echo "Start deploying Headwind Remote .."
sudo ansible-playbook deploy/install.yaml
echo "Starting Headwind Remote .."
sudo ansible-playbook deploy/start.yaml
#
#janus_api_secret=$(cat ./deploy/dist/credentials/janus_api_secret)
#
#echo "To control your mobile devices remotely, install the Headwind Remote Android agent and use the following server URL and secret:"
#echo "URL: https://srv.headwind-remote.com/web-admin/"
#echo "API Secret: ${janus_api_secret}"