#! /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 $env_file fi mkdir -p $installer_path