Skip to content
Snippets Groups Projects
Commit fd3cd8f1 authored by Bob Mottram's avatar Bob Mottram
Browse files

Ensure that the python command points to the correct version

parent de1eab49
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,48 @@ matrix_variables=(ONION_ONLY
MATRIX_EXPIRE_MONTHS
MATRIX_CODE)
function matrix_systemd_daemon {
matrix_systemd_daemon_recreate=
if [ ! -f /etc/matrix/run-matrix ]; then
matrix_systemd_daemon_recreate=1
else
if ! grep -q "$MATRIX_PYTHON " /etc/matrix/run-matrix; then
matrix_systemd_daemon_recreate=1
fi
fi
if [ ! -f /etc/systemd/system/matrix.service ]; then
matrix_systemd_daemon_recreate=1
fi
if [ ! $matrix_systemd_daemon_recreate ]; then
return
fi
{ echo '#!/bin/bash';
echo 'cd /etc/matrix || exit 1';
echo "alias python='$MATRIX_PYTHON'";
echo "$MATRIX_PYTHON -m synapse.app.homeserver --config-path ${MATRIX_DATA_DIR}/homeserver.yaml"; } > /etc/matrix/run-matrix
chmod +x /etc/matrix/run-matrix
{ echo '[Unit]';
echo 'Description=Synapse Matrix homeserver';
echo 'After=network.target nginx.target';
echo '';
echo '[Service]';
echo 'Type=simple';
echo 'User=matrix';
echo "WorkingDirectory=/etc/matrix";
echo 'ExecStart=/etc/matrix/run-matrix';
echo 'Restart=on-failure';
echo 'RestartSec=10';
echo '';
echo '[Install]';
echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/matrix.service
systemctl enable matrix
systemctl daemon-reload
}
function matrix_expire_old_posts {
read_config_param ONION_ONLY
read_config_param MY_USERNAME
......@@ -448,10 +490,7 @@ function upgrade_matrix {
fi
export TMPDIR=/etc/matrix/tmp
if ! grep -q "$MATRIX_PYTHON" /etc/systemd/system/matrix.service; then
sed -i "s|/usr/bin/python|$MATRIX_PYTHON|g" /etc/systemd/system/matrix.service
systemctl daemon-reload
fi
matrix_systemd_daemon
$MATRIX_PIP install --upgrade --process-dependency-links .
$MATRIX_PIP install --upgrade --force "pynacl>=1.2.1"
......@@ -665,22 +704,7 @@ function install_home_server {
sed -i 's/ssl.PROTOCOL_SSLv23/ssl.PROTOCOL_TLSv1/g' /usr/local/bin/register_new_matrix_user
{ echo '[Unit]';
echo 'Description=Synapse Matrix homeserver';
echo 'After=network.target nginx.target';
echo '';
echo '[Service]';
echo 'Type=simple';
echo 'User=matrix';
echo "WorkingDirectory=/etc/matrix";
echo "ExecStart=$MATRIX_PYTHON -m synapse.app.homeserver --config-path ${MATRIX_DATA_DIR}/homeserver.yaml";
echo 'Restart=on-failure';
echo 'RestartSec=10';
echo '';
echo '[Install]';
echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/matrix.service
systemctl enable matrix
systemctl daemon-reload
matrix_systemd_daemon
systemctl start matrix
# wait for the database to be created
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment