Files
docker/hidche/app/entrypoint_hidche_app.sh
T
2019-09-15 14:32:31 +00:00

26 lines
882 B
Bash
Executable File

#!/bin/bash
set -euxo pipefail
shopt -s nullglob
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
printf "[PHP]\ndate.timezone = \"$TZ\"\n" > /usr/local/etc/php/conf.d/tzone.ini
wwwRoot="/var/www/html"
samRoot="$wwwRoot/sam"
imageRoot="$wwwRoot/image"
if [ ! -f "$samRoot/index.php" ]; then
gosu www-data git clone $gameGitPath /var/www/html/sam
fi
if [ $HIDCHE_IMAGE_USE_INTERNAL = "yes" ] && [ ! -d "$imageRoot" ]; then
if [[ "$imageRoot" =~ ^ssh ]]; then
query=`echo "<?php \\\$a=parse_url('$imageRoot');echo join(' ', [\\\$a['port']?'-p '.\\\$a['port']:'',\\\$a['host']]);" | php`
ssh-keyscan $query >> /var/www/.ssh/known_hosts 2>/dev/null;
chown www-data:www-data /var/www/.ssh/known_hosts
chmod 600 /var/www/.ssh/known_hosts
fi
gosu www-data git clone $imgGitPath /var/www/html/image
fi
exec "$@"