You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

setup 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. if [ ! -d /data/git/.ssh ]; then
  3. mkdir -p /data/git/.ssh
  4. chmod 700 /data/git/.ssh
  5. fi
  6. if [ ! -f /data/git/.ssh/environment ]; then
  7. echo "GITEA_CUSTOM=/data/gitea" >| /data/git/.ssh/environment
  8. chmod 600 /data/git/.ssh/environment
  9. fi
  10. if [ ! -f /data/gitea/conf/app.ini ]; then
  11. mkdir -p /data/gitea/conf
  12. # Set INSTALL_LOCK to true only if SECRET_KEY is not empty and
  13. # INSTALL_LOCK is empty
  14. if [ -n "$SECRET_KEY" ] && [ -z "$INSTALL_LOCK" ]; then
  15. INSTALL_LOCK=true
  16. fi
  17. # Substitude the environment variables in the template
  18. APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \
  19. RUN_MODE=${RUN_MODE:-"dev"} \
  20. SSH_DOMAIN=${SSH_DOMAIN:-"localhost"} \
  21. HTTP_PORT=${HTTP_PORT:-"3000"} \
  22. ROOT_URL=${ROOT_URL:-""} \
  23. DISABLE_SSH=${DISABLE_SSH:-"false"} \
  24. SSH_PORT=${SSH_PORT:-"22"} \
  25. DB_TYPE=${DB_TYPE:-"sqlite3"} \
  26. DB_HOST=${DB_HOST:-"localhost:3306"} \
  27. DB_NAME=${DB_NAME:-"gitea"} \
  28. DB_USER=${DB_USER:-"root"} \
  29. DB_PASSWD=${DB_PASSWD:-""} \
  30. INSTALL_LOCK=${INSTALL_LOCK:-"false"} \
  31. DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-"false"} \
  32. REQUIRE_SIGNIN_VIEW=${REQUIRE_SIGNIN_VIEW:-"false"} \
  33. SECRET_KEY=${SECRET_KEY:-""} \
  34. envsubst < /etc/templates/app.ini > /data/gitea/conf/app.ini
  35. fi
  36. # only chown if current owner is not already the gitea ${USER}. No recursive check to save time
  37. if ! [[ $(ls -ld /data/gitea | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /data/gitea; fi
  38. if ! [[ $(ls -ld /app/gitea | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /app/gitea; fi
  39. if ! [[ $(ls -ld /data/git | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /data/git; fi
  40. chmod 0755 /data/gitea /app/gitea /data/git