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.

35 lines
883 B

  1. #!/bin/sh
  2. if [ "${USER}" != "git" ]; then
  3. # rename user
  4. sed -i -e "s/^git\:/${USER}\:/g" /etc/passwd
  5. fi
  6. if [ -z "${USER_GID}" ]; then
  7. USER_GID="`id -g ${USER}`"
  8. fi
  9. if [ -z "${USER_UID}" ]; then
  10. USER_UID="`id -u ${USER}`"
  11. fi
  12. ## Change GID for USER?
  13. if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "`id -g ${USER}`" ]; then
  14. sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
  15. sed -i -e "s/^${USER}:\([^:]*\):\([0-9]*\):[0-9]*/${USER}:\1:\2:${USER_GID}/" /etc/passwd
  16. fi
  17. ## Change UID for USER?
  18. if [ -n "${USER_UID}" ] && [ "${USER_UID}" != "`id -u ${USER}`" ]; then
  19. sed -i -e "s/^${USER}:\([^:]*\):[0-9]*:\([0-9]*\)/${USER}:\1:${USER_UID}:\2/" /etc/passwd
  20. fi
  21. for FOLDER in /data/gitea/conf /data/gitea/log /data/git /data/ssh; do
  22. mkdir -p ${FOLDER}
  23. done
  24. if [ $# -gt 0 ]; then
  25. exec "$@"
  26. else
  27. exec /bin/s6-svscan /etc/s6
  28. fi