|  | @@ -170,7 +170,9 @@ function matrix_nginx {
 | 
	
		
			
			| 170 | 170 |      systemctl restart nginx
 | 
	
		
			
			| 171 | 171 |      systemctl restart turn
 | 
	
		
			
			| 172 | 172 |      systemctl restart matrix
 | 
	
		
			
			| 173 |  | -    systemctl restart sydent
 | 
	
		
			
			|  | 173 | +    if [ -f /etc/systemd/system/sydent.service ]; then
 | 
	
		
			
			|  | 174 | +        systemctl restart sydent
 | 
	
		
			
			|  | 175 | +    fi
 | 
	
		
			
			| 174 | 176 |  
 | 
	
		
			
			| 175 | 177 |      # wait for nginx to start otherwise user add fails later
 | 
	
		
			
			| 176 | 178 |      sleep 5
 | 
	
	
		
			
			|  | @@ -482,27 +484,31 @@ function remove_matrix {
 | 
	
		
			
			| 482 | 484 |      firewall_remove ${MATRIX_HTTP_PORT}
 | 
	
		
			
			| 483 | 485 |  
 | 
	
		
			
			| 484 | 486 |      systemctl stop matrix
 | 
	
		
			
			| 485 |  | -    systemctl stop sydent
 | 
	
		
			
			|  | 487 | +    if [ -f /etc/systemd/system/sydent.service ]; then
 | 
	
		
			
			|  | 488 | +        systemctl stop sydent
 | 
	
		
			
			|  | 489 | +    fi
 | 
	
		
			
			| 486 | 490 |  
 | 
	
		
			
			| 487 | 491 |      function_check remove_turn
 | 
	
		
			
			| 488 | 492 |      remove_turn
 | 
	
		
			
			| 489 | 493 |  
 | 
	
		
			
			| 490 | 494 |      systemctl disable matrix
 | 
	
		
			
			| 491 |  | -    systemctl disable sydent
 | 
	
		
			
			| 492 |  | -    if [ -f /etc/systemd/system/matrix.service ]; then
 | 
	
		
			
			| 493 |  | -        rm /etc/systemd/system/matrix.service
 | 
	
		
			
			| 494 |  | -    fi
 | 
	
		
			
			| 495 | 495 |      if [ -f /etc/systemd/system/sydent.service ]; then
 | 
	
		
			
			|  | 496 | +        systemctl disable sydent
 | 
	
		
			
			| 496 | 497 |          rm /etc/systemd/system/sydent.service
 | 
	
		
			
			| 497 | 498 |      fi
 | 
	
		
			
			|  | 499 | +    if [ -f /etc/systemd/system/matrix.service ]; then
 | 
	
		
			
			|  | 500 | +        rm /etc/systemd/system/matrix.service
 | 
	
		
			
			|  | 501 | +    fi
 | 
	
		
			
			| 498 | 502 |      apt-get -y remove --purge coturn
 | 
	
		
			
			| 499 | 503 |      cd /etc/matrix
 | 
	
		
			
			| 500 | 504 |      pip uninstall .
 | 
	
		
			
			| 501 |  | -    cd /etc/sydent
 | 
	
		
			
			| 502 |  | -    pip uninstall .
 | 
	
		
			
			|  | 505 | +    if [ -d /etc/sydent ]; then
 | 
	
		
			
			|  | 506 | +        cd /etc/sydent
 | 
	
		
			
			|  | 507 | +        pip uninstall .
 | 
	
		
			
			|  | 508 | +        rm -rf /etc/sydent
 | 
	
		
			
			|  | 509 | +    fi
 | 
	
		
			
			| 503 | 510 |      rm -rf $MATRIX_DATA_DIR
 | 
	
		
			
			| 504 | 511 |      rm -rf /etc/matrix
 | 
	
		
			
			| 505 |  | -    rm -rf /etc/sydent
 | 
	
		
			
			| 506 | 512 |      deluser matrix
 | 
	
		
			
			| 507 | 513 |      delgroup matrix
 | 
	
		
			
			| 508 | 514 |      remove_onion_service matrix ${MATRIX_ONION_PORT}
 |