docker-run.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. # Define functions.
  3. function fixperms {
  4. chown -R $UID:$GID /data
  5. # /opt/mautrix-instagram is read-only, so disable file logging if it's pointing there.
  6. if [[ "$(yq e '.logging.handlers.file.filename' /data/config.yaml)" == "./mautrix-instagram.log" ]]; then
  7. yq -I4 e -i 'del(.logging.root.handlers[] | select(. == "file"))' /data/config.yaml
  8. yq -I4 e -i 'del(.logging.handlers.file)' /data/config.yaml
  9. fi
  10. }
  11. cd /opt/mautrix-instagram
  12. if [ ! -f /data/config.yaml ]; then
  13. cp example-config.yaml /data/config.yaml
  14. echo "Didn't find a config file."
  15. echo "Copied default config file to /data/config.yaml"
  16. echo "Modify that config file to your liking."
  17. echo "Start the container again after that to generate the registration file."
  18. fixperms
  19. exit
  20. fi
  21. if [ ! -f /data/registration.yaml ]; then
  22. python3 -m mautrix_instagram -g -c /data/config.yaml -r /data/registration.yaml || exit $?
  23. echo "Didn't find a registration file."
  24. echo "Generated one for you."
  25. echo "See https://docs.mau.fi/bridges/general/registering-appservices.html on how to use it."
  26. fixperms
  27. exit
  28. fi
  29. fixperms
  30. exec su-exec $UID:$GID python3 -m mautrix_instagram -c /data/config.yaml