docker-entrypoint.sh 579 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. set -eu
  3. if [ "$(id -u)" = '0' ]; then
  4. binary="$1"
  5. if [ "${PCAP:-}" == "" ] ; then
  6. # If Syncthing should have no extra capabilities, make sure to remove them
  7. # from the binary. This will fail with an error if there are no
  8. # capabilities to remove, hence the || true etc.
  9. setcap -r "$binary" 2>/dev/null || true
  10. else
  11. # Set capabilities on the Syncthing binary before launching it.
  12. setcap "$PCAP" "$binary"
  13. fi
  14. chown "${PUID}:${PGID}" "${HOME}" \
  15. && exec su-exec "${PUID}:${PGID}" \
  16. env HOME="$HOME" "$@"
  17. else
  18. exec "$@"
  19. fi