AnPDockerServer/AnPServer/scripts/entrypoint.sh

59 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
closed=
# rm -R /Projects/*
if [[ "$1" == "1" ]];then
rm -R /Projects/*
fi
[[ "$(cat /etc/passwd|grep kyman)" == "" ]] && useradd -u 1000 -m kyman
[[ "$(cat /etc/passwd|grep www-data)" == "" ]] && useradd -u 33 www-data
build(){
local name=$2
cd /Projects
if [[ ! -d $name ]];then
local group=$1
git clone https://git.k3y.pw/$group/$name
if [[ "$name" == "AnP" ]];then
[[ -d /Projects/$name/Python/Modules ]] || mkdir /Projects/$name/Python/Modules
for module in ErrorsManager WMarkDown;do
ln -s /Projects/$module/Python/$module.py /Projects/$name/Python/Modules/$module.py
done
else
[[ -d /Projects/$name/Python/Abstracts ]] || mkdir /Projects/$name/Python/Abstracts
for file in AnPMap Applications;do
ln -s /Projects/AnP/Python/Abstracts/$file.py /Projects/$name/Python/Abstracts/$file.py
done
fi
fi
}
build KyMAN ErrorsManager
build Whalers WMarkDown
build AnP AnP
build KyMAN PythonMapper
build KyMAN CDN
[[ -f /Projects/AnP/JSON/AnP.py.settings.secrets.json ]] ||
ln -s /Files/AnP.py.settings.secrets.json /Projects/AnP/JSON/AnP.py.settings.secrets.json
[[ -f /Projects/AnP/JSON/AnP.py.settings.server.secrets.json ]] ||
ln -s /Files/AnP.py.settings.server.secrets.json /Projects/AnP/JSON/AnP.py.settings.server.secrets.json
trap "closed=1" INT TERM EXIT
while [[ "$closed" != "1" ]];do
wait || wait
sleep 1
done
# [[ -f /Scripts/stop.sh ]] && source /Scripts/stop.sh