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.

29 lines
875 B

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