2016-11-28 22:13:18 +09:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ ! -d /data/git/.ssh ]; then
|
|
|
|
mkdir -p /data/git/.ssh
|
|
|
|
chmod 700 /data/git/.ssh
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f /data/git/.ssh/environment ]; then
|
|
|
|
echo "GITEA_CUSTOM=/data/gitea" >| /data/git/.ssh/environment
|
|
|
|
chmod 600 /data/git/.ssh/environment
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f /data/gitea/conf/app.ini ]; then
|
|
|
|
mkdir -p /data/gitea/conf
|
2017-10-31 17:55:46 +09:00
|
|
|
|
|
|
|
# Set INSTALL_LOCK to true only if SECRET_KEY is not empty and
|
|
|
|
# INSTALL_LOCK is empty
|
|
|
|
if [ -n "$SECRET_KEY" ] && [ -z "$INSTALL_LOCK" ]; then
|
|
|
|
INSTALL_LOCK=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Substitude the environment variables in the template
|
|
|
|
APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \
|
2017-11-03 06:08:21 +09:00
|
|
|
RUN_MODE=${RUN_MODE:-"dev"} \
|
2017-10-31 17:55:46 +09:00
|
|
|
SSH_DOMAIN=${SSH_DOMAIN:-"localhost"} \
|
|
|
|
HTTP_PORT=${HTTP_PORT:-"3000"} \
|
|
|
|
ROOT_URL=${ROOT_URL:-""} \
|
|
|
|
DISABLE_SSH=${DISABLE_SSH:-"false"} \
|
|
|
|
SSH_PORT=${SSH_PORT:-"22"} \
|
|
|
|
DB_TYPE=${DB_TYPE:-"sqlite3"} \
|
|
|
|
DB_HOST=${DB_HOST:-"localhost:3306"} \
|
|
|
|
DB_NAME=${DB_NAME:-"gitea"} \
|
|
|
|
DB_USER=${DB_USER:-"root"} \
|
|
|
|
DB_PASSWD=${DB_PASSWD:-""} \
|
|
|
|
INSTALL_LOCK=${INSTALL_LOCK:-"false"} \
|
2018-05-24 00:31:12 +09:00
|
|
|
DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-"false"} \
|
|
|
|
REQUIRE_SIGNIN_VIEW=${REQUIRE_SIGNIN_VIEW:-"false"} \
|
2017-10-31 17:55:46 +09:00
|
|
|
SECRET_KEY=${SECRET_KEY:-""} \
|
|
|
|
envsubst < /etc/templates/app.ini > /data/gitea/conf/app.ini
|
2016-11-28 22:13:18 +09:00
|
|
|
fi
|
|
|
|
|
2018-05-17 00:58:44 +09:00
|
|
|
chown -R ${USER}:git /data/gitea /app/gitea /data/git
|
2016-11-28 22:13:18 +09:00
|
|
|
chmod 0755 /data/gitea /app/gitea /data/git
|