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.

43 lines
947 B

  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. ln -sf /data/gogs/log ./log
  21. ln -sf /data/gogs/data ./data
  22. ln -sf /data/git /home/git
  23. if ! test -d ~git/.ssh
  24. then
  25. mkdir ~git/.ssh
  26. chmod 700 ~git/.ssh
  27. fi
  28. if ! test -f ~git/.ssh/environment
  29. then
  30. echo "GOGS_CUSTOM=/data/gogs" > ~git/.ssh/environment
  31. chown git:git ~git/.ssh/environment
  32. chown 600 ~git/.ssh/environment
  33. fi
  34. chown -R git:git /data .
  35. exec su git -c "./gogs web"