File matrix-synapse-init.sh of Package matrix-synapse

#!/bin/bash

echo "----------------------------------------"
echo "This will setup matrix-synapse."
echo "Attention: Use this only for first time!"
echo "----------------------------------------"

echo ""
read -p "Do you will setup? <y|n>" yesno
if [ "$yesno" == "y" ]; then

#   echo "Python2 or Python3 (2 or 3):"
#   read pyver

   echo "Your server-name (matrix.example.com):"
   read servername

   echo "Your domain-name domain.name (example.com):"
   read domainname

   echo "Generate homeserver.yaml..."
   cd /var/lib/matrix-synapse
#   sudo -u synapse python$pyver -m synapse.app.homeserver --server-name $servername --config-path /etc/matrix-synapse/homeserver.yaml --generate-config --report-stats=no
   sudo -u synapse /usr/bin/python3 -m synapse.app.homeserver --server-name $servername --config-path /etc/matrix-synapse/homeserver.yaml --generate-config --report-stats=no
   sed -i 's|public_baseurl: https://example.com/|public_baseurl: https://$servername/|g' /etc/matrix-synapse/homeserver.yaml
   sed -i 's|/var/lib/matrix-synapse/homeserver.log|/var/log/matrix-synapse/homeserver.log|g' /etc/matrix-synapse/$servername.log.config
   sed -i 's|pid_file: /var/lib/matrix-synapse/homeserver.pid|pid_file: /var/run/matrix-synapse/homeserver.pid|g' /etc/matrix-synapse/homeserver.yaml
   sed -i 's|example.com|'$domainname'|g' /etc/apache2/vhosts.d/matrix-synapse.conf
   
   
   

   read -p "Do you want start now? <y|n>" yesno
   if [ "$yesno" == "y" ]; then
      systemctl start matrix-synapse
      read -p "Do you want create your first user? <y|n>" yesno
      if [ "$yesno" == "y" ]; then
         sudo -u synapse register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008
      fi
   else
      echo "Now you can start synapse with: systemctl start matrix-synapse"
      echo ""
      echo "After that you can create your first user with: register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008"
      echo ""
      echo "Good luck."
   fi

fi
openSUSE Build Service is sponsored by