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.

userSetup.sh 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. # More/less taken from https://github.com/linuxserver/docker-baseimage-alpine/blob/3eb7146a55b7bff547905e0d3f71a26036448ae6/root/etc/cont-init.d/10-adduser
  3. RUN_AS=root
  4. if [ -n "$PUID" ] && [ ! "$(id -u root)" -eq "$PUID" ]; then
  5. RUN_AS=abc
  6. if [ ! "$(id -u ${RUN_AS})" -eq "$PUID" ]; then usermod -o -u "$PUID" ${RUN_AS} ; fi
  7. if [ ! "$(id -g ${RUN_AS})" -eq "$PGID" ]; then groupmod -o -g "$PGID" ${RUN_AS} ; fi
  8. echo "Setting owner for transmission paths to ${PUID}:${PGID}"
  9. chown -R ${RUN_AS}:${RUN_AS} \
  10. /config \
  11. ${TRANSMISSION_HOME} \
  12. ${TRANSMISSION_DOWNLOAD_DIR} \
  13. ${TRANSMISSION_INCOMPLETE_DIR} \
  14. ${TRANSMISSION_WATCH_DIR}
  15. echo "Setting permission for files (644) and directories (755)"
  16. chmod -R go=rX,u=rwX \
  17. /config \
  18. ${TRANSMISSION_HOME} \
  19. ${TRANSMISSION_DOWNLOAD_DIR} \
  20. ${TRANSMISSION_INCOMPLETE_DIR} \
  21. ${TRANSMISSION_WATCH_DIR}
  22. fi
  23. echo "
  24. -------------------------------------
  25. Transmission will run as
  26. -------------------------------------
  27. User name: ${RUN_AS}
  28. User uid: $(id -u ${RUN_AS})
  29. User gid: $(id -g ${RUN_AS})
  30. -------------------------------------
  31. "
  32. export PUID
  33. export PGID
  34. export RUN_AS