From 3c58c76dca9f7260c05deb32f857787ff8aa7b25 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 7 Feb 2017 16:03:45 +0000 Subject: [PATCH] Check if sydent was installed --- src/freedombone-app-matrix | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/freedombone-app-matrix b/src/freedombone-app-matrix index 0f02ed43..622efd0b 100755 --- a/src/freedombone-app-matrix +++ b/src/freedombone-app-matrix @@ -170,7 +170,9 @@ function matrix_nginx { systemctl restart nginx systemctl restart turn systemctl restart matrix - systemctl restart sydent + if [ -f /etc/systemd/system/sydent.service ]; then + systemctl restart sydent + fi # wait for nginx to start otherwise user add fails later sleep 5 @@ -482,27 +484,31 @@ function remove_matrix { firewall_remove ${MATRIX_HTTP_PORT} systemctl stop matrix - systemctl stop sydent + if [ -f /etc/systemd/system/sydent.service ]; then + systemctl stop sydent + fi function_check remove_turn remove_turn systemctl disable matrix - systemctl disable sydent + if [ -f /etc/systemd/system/sydent.service ]; then + systemctl disable sydent + rm /etc/systemd/system/sydent.service + fi if [ -f /etc/systemd/system/matrix.service ]; then rm /etc/systemd/system/matrix.service fi - if [ -f /etc/systemd/system/sydent.service ]; then - rm /etc/systemd/system/sydent.service - fi apt-get -y remove --purge coturn cd /etc/matrix pip uninstall . - cd /etc/sydent - pip uninstall . + if [ -d /etc/sydent ]; then + cd /etc/sydent + pip uninstall . + rm -rf /etc/sydent + fi rm -rf $MATRIX_DATA_DIR rm -rf /etc/matrix - rm -rf /etc/sydent deluser matrix delgroup matrix remove_onion_service matrix ${MATRIX_ONION_PORT}