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.

47 lines
1.0 KiB

  1. #!/bin/bash -
  2. #
  3. if ! test -d /data/gogs
  4. then
  5. mkdir -p /var/run/sshd
  6. mkdir -p /data/gogs/data /data/gogs/conf /data/gogs/log /data/git
  7. fi
  8. if ! test -d /data/ssh
  9. then
  10. mkdir /data/ssh
  11. ssh-keygen -q -f /data/ssh/ssh_host_key -N '' -t rsa1
  12. ssh-keygen -q -f /data/ssh/ssh_host_rsa_key -N '' -t rsa
  13. ssh-keygen -q -f /data/ssh/ssh_host_dsa_key -N '' -t dsa
  14. ssh-keygen -q -f /data/ssh/ssh_host_ecdsa_key -N '' -t ecdsa
  15. ssh-keygen -q -f /data/ssh/ssh_host_ed25519_key -N '' -t ed25519
  16. chown -R root:root /data/ssh/*
  17. chmod 600 /data/ssh/*
  18. fi
  19. service ssh start
  20. # sync templates
  21. test -d /data/gogs/templates || cp -ar ./templates /data/gogs/
  22. rsync -rtv /data/gogs/templates/ ./templates/
  23. ln -sf /data/gogs/log ./log
  24. ln -sf /data/gogs/data ./data
  25. ln -sf /data/git /home/git
  26. if ! test -d ~git/.ssh
  27. then
  28. mkdir ~git/.ssh
  29. chmod 700 ~git/.ssh
  30. fi
  31. if ! test -f ~git/.ssh/environment
  32. then
  33. echo "GOGS_CUSTOM=/data/gogs" > ~git/.ssh/environment
  34. chown git:git ~git/.ssh/environment
  35. chown 600 ~git/.ssh/environment
  36. fi
  37. chown -R git:git /data .
  38. exec su git -c "./gogs web"