forked from tiny-pilot/tinypilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quick-install
executable file
·46 lines (40 loc) · 1.06 KB
/
quick-install
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
#!/usr/bin/env bash
# Echo commands to stdout.
set -x
# Exit on first error.
set -e
# Remove the legacy nginx config, as it will conflict with tinypilot.conf if
# both are present.
if [ -f /etc/nginx/sites-enabled/KVMPi.conf ]
then
sudo rm /etc/nginx/sites-enabled/KVMPi.conf
fi
if [ -z "$TINYPILOT_INSTALL_VARS" ]
then
TINYPILOT_INSTALL_VARS=""
echo "Using default install vars"
else
echo "Install vars: $TINYPILOT_INSTALL_VARS"
fi
# Treat undefined environment variables as errors.
set -u
pushd $(mktemp -d)
sudo apt-get update
sudo apt-get install -y libffi-dev libssl-dev python3-dev python3-venv
python3 -m venv venv
. venv/bin/activate
# Ansible depends on wheel.
pip install wheel==0.34.2
pip install ansible==2.9.10
echo "[defaults]
roles_path = $PWD
interpreter_python = /usr/bin/python3
" > ansible.cfg
ansible-galaxy install mtlynch.tinypilot
echo "- hosts: localhost
connection: local
become: true
become_method: sudo
roles:
- role: mtlynch.tinypilot" > install.yml
ansible-playbook -i localhost, install.yml --extra-vars "$TINYPILOT_INSTALL_VARS"