forked from chaitin/SafeLine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
safeline-ce.sh
executable file
·43 lines (35 loc) · 963 Bytes
/
safeline-ce.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
#! /bin/bash
set -eE
installer_path=$1
version_file="VERSION.TXT"
if [[ ! -f $version_file ]]; then
echo "Error: VERSION.TXT not found!"
exit 1
fi
version=$(cat VERSION.TXT)
if [ -z "$installer_path" ];then
installer_path="/data/safeline-ce"
fi
if [[ ! -e $installer_path ]]; then
echo "WAF will be installed at $installer_path, y/N"
read answer
if [ "$answer" != "${answer#[Yy]}" ] ; then
echo "Start installing..."
else
echo "End"
exit 1
fi
elif [[ ! -d $installer_path ]]; then
echo "Error: $installer_path already exists but is not a directory"
exit 1
fi
env_file=".env"
if [[ ! -f $env_file ]]; then
echo -n "POSTGRES_PASSWORD=$(LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c 32)
HOST_RESOURCES_DIR=$installer_path/resources
HOST_LOGS_DIR=$installer_path/logs
IMAGE_TAG=$version
COMPOSE_PROJECT_NAME=safeline-ce
COMPOSE_FILE=compose.yaml" > $env_file
fi
mkdir -p $installer_path