docker-entrypoint.sh 583 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. set -e
  3. # first check if we're passing flags, if so
  4. # prepend with sentry
  5. if [ "${1:0:1}" = '-' ]; then
  6. set -- sentry "$@"
  7. fi
  8. if [[ $1 =~ ^[[:alnum:]]+$ ]] && grep -Fxq "$1" /sentry-commands.txt; then
  9. set -- sentry "$@";
  10. fi
  11. if [ "$1" = 'sentry' ]; then
  12. set -- tini -- "$@"
  13. if [ "$(id -u)" = '0' ]; then
  14. mkdir -p /data/files
  15. sentry_uid=$(id -u sentry)
  16. if [ "$(stat -c %u /data)" != "$sentry_uid" ] || [ "$(stat -c %u /data/files)" != "$sentry_uid" ]; then
  17. find /data ! -user sentry -exec chown sentry {} \;
  18. fi
  19. set -- gosu sentry "$@"
  20. fi
  21. fi
  22. exec "$@"