-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
80 lines (69 loc) · 2.28 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
#!/bin/bash -e
if [[ ! -x $(which lsb_release 2>/dev/null) ]]; then
echo "ERROR: lsb_release is not installed"
echo "Cannot evaluate the platform"
echo "Please install lsb_release and retry"
echo "Red Hat based Systems : yum install redhat-lsb-core"
echo "Debian based Systems : apt-get install lsb-release"
exit 1
fi
# GET OS VENDOR
os_VENDOR=$(lsb_release -i -s)
# GET OS MAJOR VERSION
os_VERSION=$(lsb_release -r -s | cut -d. -f 1)
echo "*** Detected Linux $os_VENDOR $os_VERSION ***"
if git --version &> /dev/null ; then
echo "Git is already installed."
else
if [[ "Debian" =~ $os_VENDOR || "Raspbian" =~ $os_VENDOR || "Ubuntu" =~ $os_VENDOR || "LinuxMint" =~ $os_VENDOR ]]; then
sudo apt-get update
sudo apt-get install -y git
else
echo "*** Unsupported platform ${os_VENDOR}: ${os_VERSION} ***"
exit 1
fi
if ( git --version &> /dev/null ); then
echo "*** $(git --version | head -n1) installed successfully ***"
else
echo "Something went wrong, please have a look at the script output"
exit 1
fi
fi
if ansible --version &> /dev/null ; then
echo "Ansible is already installed."
else
if [[ "Debian" =~ $os_VENDOR || "Raspbian" =~ $os_VENDOR ]]; then
sudo apt-get update
sudo apt-get install -y ansible
elif [[ "Ubuntu" =~ $os_VENDOR || "LinuxMint" =~ $os_VENDOR ]]; then
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible
else
echo "*** Unsupported platform ${os_VENDOR}: ${os_VERSION} ***"
exit 1
fi
if ( ansible --version &> /dev/null ); then
echo "*** $(ansible --version | head -n1) installed successfully ***"
else
echo "Something went wrong, please have a look at the script output"
exit 1
fi
fi
if [[ -d "asm-installer" ]]; then
echo "Removing existing installer directory"
rm -rf asm-installer
fi
if git clone https://github.com/jreyes/asm-installer.git; then
echo "*** Another Smart Mirror installer cloned ***"
else
echo "*** Unable to clone the Another Smart Mirror installer ***"
exit 1;
fi
cd asm-installer
sudo ansible-galaxy install -r ansible/requirements.yml
ansible-playbook -i "localhost", -vvv -c local ansible/setup-asm.yml
cd ..
set +x
echo "Installation completed."