Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. # generic variables
  3. GITEA_DIRS="/data/gitea/conf /data/gitea/log /data/git /data/ssh"
  4. # ensuring s6 service files permissions
  5. chmod +x /etc/s6/**/*
  6. ### COPIED FROM ORIGINAL /usr/bin/entrypoint
  7. if [ "${USER}" != "git" ]; then
  8. # rename user
  9. sed -i -e "s/^git\:/${USER}\:/g" /etc/passwd
  10. # switch sshd config to different user
  11. sed -i -e "s/AllowUsers git/AllowUsers ${USER}/g" /etc/ssh/sshd_config
  12. fi
  13. ## Change GID for USER?
  14. if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "`id -g ${USER}`" ]; then
  15. sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
  16. sed -i -e "s/^${USER}:\([^:]*\):\([0-9]*\):[0-9]*/${USER}:\1:\2:${USER_GID}/" /etc/passwd
  17. fi
  18. ## Change UID for USER?
  19. if [ -n "${USER_UID}" ] && [ "${USER_UID}" != "`id -u ${USER}`" ]; then
  20. sed -i -e "s/^${USER}:\([^:]*\):[0-9]*:\([0-9]*\)/${USER}:\1:${USER_UID}:\2/" /etc/passwd
  21. fi
  22. ### END OF COPY
  23. # create missing dirs if they doesn't exist
  24. for DIR in $GITEA_DIRS; do
  25. mkdir -p $DIR
  26. done
  27. # configuration bootstrap (if configuration file exists it takes precedence over shell variables)
  28. set -a
  29. if [ -f /data/gitea/conf/app.ini ]; then
  30. DB_HOST=$(iniget /data/gitea/conf/app.ini database HOST)
  31. DB_TYPE=$(iniget /data/gitea/conf/app.ini database DB_TYPE)
  32. DB_USER=$(iniget /data/gitea/conf/app.ini database USER)
  33. DB_NAME=$(iniget /data/gitea/conf/app.ini database NAME)
  34. DB_PASSWD=$(iniget /data/gitea/conf/app.ini database NAME)
  35. else
  36. DB_HOST="localhost:3306"
  37. DB_TYPE="mysql"
  38. DB_USER=${DB_USER:-"gitea"}
  39. DB_NAME=${DB_NAME:-"gitea"}
  40. if [ -z "${DB_PASSWD}" ] ; then
  41. export DB_PASSWD=$(pwgen -1 32)
  42. echo "Automagically generated database password: $DB_PASSWD"
  43. fi
  44. fi
  45. set +a
  46. exec /bin/s6-svscan /etc/s6