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.

entrypoint 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. # Protect against buggy runc in docker <20.10.6 causing problems in with Alpine >= 3.14
  3. if [ ! -x /bin/sh ]; then
  4. echo "Executable test for /bin/sh failed. Your Docker version is too old to run Alpine 3.14+ and Gitea. You must upgrade Docker.";
  5. exit 1;
  6. fi
  7. if [ "${USER}" != "git" ]; then
  8. # Rename user
  9. sed -i -e "s/^git\:/${USER}\:/g" /etc/passwd
  10. fi
  11. if [ -z "${USER_GID}" ]; then
  12. USER_GID="`id -g ${USER}`"
  13. fi
  14. if [ -z "${USER_UID}" ]; then
  15. USER_UID="`id -u ${USER}`"
  16. fi
  17. # Change GID for USER?
  18. if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "`id -g ${USER}`" ]; then
  19. sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
  20. sed -i -e "s/^${USER}:\([^:]*\):\([0-9]*\):[0-9]*/${USER}:\1:\2:${USER_GID}/" /etc/passwd
  21. fi
  22. # Change UID for USER?
  23. if [ -n "${USER_UID}" ] && [ "${USER_UID}" != "`id -u ${USER}`" ]; then
  24. sed -i -e "s/^${USER}:\([^:]*\):[0-9]*:\([0-9]*\)/${USER}:\1:${USER_UID}:\2/" /etc/passwd
  25. fi
  26. for FOLDER in /data/gitea/conf /data/gitea/log /data/git /data/ssh; do
  27. mkdir -p ${FOLDER}
  28. done
  29. if [ $# -gt 0 ]; then
  30. exec "$@"
  31. else
  32. exec /bin/s6-svscan /etc/s6
  33. fi