-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup.sh
executable file
·51 lines (47 loc) · 1.36 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
#!/bin/sh
# Usage: ./setup.sh [bootstrap] [shell] [nginx] [ssl [--ssl-test]] [mail] [pf] [vpn]
# By default runs all
run_all=yes
for arg in "$@"; do
case "$arg" in
--ssl-test) ssl_test=yes ; continue ;;
esac
unset run_all
case "$arg" in
bootstrap) run_bootstrap=yes ;;
shell) run_shell=yes ;;
nginx) run_nginx=yes ;;
ssl) run_ssl=yes ;;
mail) run_mail=yes ;;
pf) run_pf=yes ;;
vpn) run_vpn=yes ;;
esac
done
# ----
BASE="$(pwd)"
SCRIPTS="$BASE/scripts"
ENVS="$BASE/env.d"
. "$ENVS/general.sh"
self=$$
echo -n "${YELLOW}${BOLD}"
echo "User: $USER_NAME"
echo "Base domain name: $DOMAIN_NAME"
echo "Mail domain name: $MAIL_DOMAIN"
echo "VPN domain name: $VPN_DOMAIN"
echo -n "${NORM}"
[ -n "$ssl_test" ] && export CERTBOT_FLAGS="--server https://{{local}}:14000/dir --no-verify-ssl"
i=0
for stage in bootstrap shell nginx ssl mail pf vpn
do
i=$((i+1))
[ -n "$run_all" ] || eval "[ -n \"\$run_$stage\" ]" && {
echo "${YELLOW}${BOLD}---Stage $stage---${NORM}" | postinstall | log
{
"$SCRIPTS/$(printf '%03d' $i)_$stage.sh" || {
echo "${RED}${BOLD}[FATAL] Something went wrong here${NORM}" | postinstall
kill $self
}
} | log
echo "${YELLOW}${BOLD}---Stage $stage DONE---${NORM}" | postinstall | log
}
done