setup 803 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. if ! test -d ~git/.ssh; then
  3. mkdir -p ~git/.ssh
  4. chmod 700 ~git/.ssh
  5. fi
  6. if ! test -f ~git/.ssh/environment; then
  7. echo "GOGS_CUSTOM=${GOGS_CUSTOM}" > ~git/.ssh/environment
  8. chmod 600 ~git/.ssh/environment
  9. fi
  10. cd /app/gogs
  11. # Link volumed data with app data
  12. ln -sfn /data/gogs/log ./log
  13. ln -sfn /data/gogs/data ./data
  14. # Backward Compatibility with Gogs Container v0.6.15
  15. ln -sfn /data/git /home/git
  16. # Only chown for the first time, owner of '/data' is 'git' inside Docker after installation
  17. if [ $(stat -c '%U' /data) != 'git' ]; then
  18. chown -R git:git /data ~git/
  19. fi
  20. # Check ownership of '/app/gogs' in case the image changed and '/data' is persistent
  21. if [ $(stat -c '%U' /app/gogs) != 'git' ]; then
  22. chown -R git:git /app/gogs
  23. fi
  24. chmod 0755 /data /data/gogs ~git/