32 lines
1.1 KiB
Bash
Executable File
32 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euxo pipefail
|
|
shopt -s nullglob
|
|
|
|
cp -n /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
|
|
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"
|
|
samRoot="$wwwRoot/html/sam"
|
|
imageRoot="$wwwRoot/html/image"
|
|
if [ ! -f "$samRoot/index.php" ]; then
|
|
echo generate $samRoot
|
|
mkdir -p $samRoot
|
|
chown -R www-data:www-data $wwwRoot
|
|
gosu www-data git clone $gameGitPath $samRoot
|
|
gosu www-data git checkout $gameGitBranch
|
|
fi
|
|
|
|
if [ "$HIDCHE_IMAGE_USE_INTERNAL" = "yes" ] && [ ! -d "$imageRoot" ]; then
|
|
if [[ "$imgGitPath" =~ ^ssh ]]; then
|
|
query=`echo "<?php \\\$a=parse_url('$imgGitPath');echo join(' ', [\\\$a['port']?'-p '.\\\$a['port']:'',\\\$a['host']]);" | php`
|
|
gosu www-data ssh-keyscan $query >> /var/www/.ssh/known_hosts 2>/dev/null;
|
|
gosu www-data chmod 600 /var/www/.ssh/known_hosts
|
|
fi
|
|
echo generate $imageRoot
|
|
mkdir -p $imageRoot
|
|
chown -R www-data:www-data $imageRoot
|
|
gosu www-data git clone $imgGitPath $imageRoot
|
|
fi
|
|
|
|
exec "$@" |