-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsetup.sh
executable file
·62 lines (52 loc) · 1.37 KB
/
setup.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
#!/bin/bash
cd "$(dirname "$0")" || exit 1
echo
echo 'Checking if prerequisites are installed...'
echo
error=0
for cmd in curl dialog docker git htpasswd; do
if ! command -v "$cmd" >/dev/null 2>/dev/null; then
echo "$cmd - NOT FOUND, must be installed" 2>&1
error=1
fi
done
if ! ( command -v docker >/dev/null 2>&1 && \
docker compose version >/dev/null 2>&1 ) && \
! command -v docker-compose >/dev/null 2>&1; then
echo "docker compose - NOT FOUND, must be installed" 2>&1
error=1
fi
if [[ $error -eq 0 ]]; then
echo 'All good.'
echo
else
echo 1>&2
echo "Some of the required programs above are missing." 1>&2
distro_script="setup.$(lsb_release -is | tr '[:upper:]' '[:lower:]').sh"
if [[ -f "$distro_script" ]]; then
echo
echo "Attempting to install them using $distro_script..."
echo
bash "$distro_script" || exit 1
else
echo "Please install them first and run setup.sh again." 1>&2
echo 1>&2
exit 1
fi
fi
mkdir -p session-templates
if [[ ! -d webadmin ]]
then
./update-webadmin.sh
fi
if [[ ! -f nginx-config/htpasswd ]]
then
./set-webadmin-password.sh
fi
if [[ ! -f .env ]]
then
./configure.sh
fi
clear
echo "Setup complete. Refer to README.md for extra changes you might want to make."
echo "To start the server, run: ./docker-compose-wrapper up -d"