|  | @@ -508,10 +508,10 @@ function remove_xmpp {
 | 
	
		
			
			| 508 | 508 |      remove_onion_service xmpp 5222 5223 5269
 | 
	
		
			
			| 509 | 509 |  
 | 
	
		
			
			| 510 | 510 |      apt-get -yq remove --purge prosody
 | 
	
		
			
			| 511 |  | -    if [ ! -f $INSTALL_DIR/$prosody_modules_filename ]; then
 | 
	
		
			
			|  | 511 | +    if [ -f $INSTALL_DIR/$prosody_modules_filename ]; then
 | 
	
		
			
			| 512 | 512 |          rm $INSTALL_DIR/$prosody_modules_filename
 | 
	
		
			
			| 513 | 513 |      fi
 | 
	
		
			
			| 514 |  | -    if [ ! -d $INSTALL_DIR/prosody-modules ]; then
 | 
	
		
			
			|  | 514 | +    if [ -d $INSTALL_DIR/prosody-modules ]; then
 | 
	
		
			
			| 515 | 515 |          rm -rf $INSTALL_DIR/prosody-modules
 | 
	
		
			
			| 516 | 516 |      fi
 | 
	
		
			
			| 517 | 517 |      if [ -d /etc/prosody ]; then
 | 
	
	
		
			
			|  | @@ -793,6 +793,18 @@ function install_xmpp_nightly {
 | 
	
		
			
			| 793 | 793 |  }
 | 
	
		
			
			| 794 | 794 |  
 | 
	
		
			
			| 795 | 795 |  function install_xmpp {
 | 
	
		
			
			|  | 796 | +    if [ ! -d $INSTALL_DIR ]; then
 | 
	
		
			
			|  | 797 | +        mkdir -p $INSTALL_DIR
 | 
	
		
			
			|  | 798 | +    fi
 | 
	
		
			
			|  | 799 | +
 | 
	
		
			
			|  | 800 | +    # remove any existing install attempt
 | 
	
		
			
			|  | 801 | +    if [ -f $INSTALL_DIR/$prosody_modules_filename ]; then
 | 
	
		
			
			|  | 802 | +        rm $INSTALL_DIR/$prosody_modules_filename
 | 
	
		
			
			|  | 803 | +    fi
 | 
	
		
			
			|  | 804 | +    if [ -d $INSTALL_DIR/prosody-modules ]; then
 | 
	
		
			
			|  | 805 | +        rm -rf $INSTALL_DIR/prosody-modules
 | 
	
		
			
			|  | 806 | +    fi
 | 
	
		
			
			|  | 807 | +
 | 
	
		
			
			| 796 | 808 |      update_prosody_modules
 | 
	
		
			
			| 797 | 809 |  
 | 
	
		
			
			| 798 | 810 |      if [[ $ONION_ONLY == 'no' ]]; then
 |