docker-run.sh 803 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. if [[ -z "$GID" ]]; then
  3. GID="$UID"
  4. fi
  5. # Define functions.
  6. function fixperms {
  7. chown -R $UID:$GID /data /opt/mautrix-whatsapp
  8. }
  9. if [[ ! -f /data/config.yaml ]]; then
  10. cp /opt/mautrix-whatsapp/example-config.yaml /data/config.yaml
  11. echo "Didn't find a config file."
  12. echo "Copied default config file to /data/config.yaml"
  13. echo "Modify that config file to your liking."
  14. echo "Start the container again after that to generate the registration file."
  15. exit
  16. fi
  17. if [[ ! -f /data/registration.yaml ]]; then
  18. /usr/bin/mautrix-whatsapp -g -c /data/config.yaml -r /data/registration.yaml
  19. echo "Didn't find a registration file."
  20. echo "Generated one for you."
  21. echo "Copy that over to synapses app service directory."
  22. exit
  23. fi
  24. cd /data
  25. fixperms
  26. exec su-exec $UID:$GID /usr/bin/mautrix-whatsapp