| 
				
			 | 
			
			
				@@ -154,7 +154,7 @@ function upgrade_matrix { 
			 | 
		
	
		
			
			| 
				154
			 | 
			
				154
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				155
			 | 
			
				155
			 | 
			
			
				     pip install --upgrade --process-dependency-links . 
			 | 
		
	
		
			
			| 
				156
			 | 
			
				156
			 | 
			
			
				     chown -R matrix:matrix /etc/matrix 
			 | 
		
	
		
			
			| 
				157
			 | 
			
				
			 | 
			
			
				-    chown -R matrix:matrix /var/lib/matrix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				157
			 | 
			
			
				+    chown -R matrix:matrix $MATRIX_DATA_DIR 
			 | 
		
	
		
			
			| 
				158
			 | 
			
				158
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				159
			 | 
			
				159
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				160
			 | 
			
				160
			 | 
			
			
				 function backup_local_matrix { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -163,7 +163,7 @@ function backup_local_matrix { 
			 | 
		
	
		
			
			| 
				163
			 | 
			
				163
			 | 
			
			
				         systemctl stop matrix 
			 | 
		
	
		
			
			| 
				164
			 | 
			
				164
			 | 
			
			
				         function_check backup_directory_to_usb 
			 | 
		
	
		
			
			| 
				165
			 | 
			
				165
			 | 
			
			
				         backup_directory_to_usb $source_directory matrix 
			 | 
		
	
		
			
			| 
				166
			 | 
			
				
			 | 
			
			
				-        source_directory=/var/lib/matrix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				166
			 | 
			
			
				+        source_directory=$MATRIX_DATA_DIR 
			 | 
		
	
		
			
			| 
				167
			 | 
			
				167
			 | 
			
			
				         if [ -d $source_directory ]; then 
			 | 
		
	
		
			
			| 
				168
			 | 
			
				168
			 | 
			
			
				             backup_directory_to_usb $source_directory matrixdata 
			 | 
		
	
		
			
			| 
				169
			 | 
			
				169
			 | 
			
			
				         fi 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -189,14 +189,14 @@ function restore_local_matrix { 
			 | 
		
	
		
			
			| 
				189
			 | 
			
				189
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				190
			 | 
			
				190
			 | 
			
			
				         temp_restore_dir=/root/tempmatrixdata 
			 | 
		
	
		
			
			| 
				191
			 | 
			
				191
			 | 
			
			
				         restore_directory_from_usb $temp_restore_dir matrixdata 
			 | 
		
	
		
			
			| 
				192
			 | 
			
				
			 | 
			
			
				-        cp -r $temp_restore_dir/var/lib/matrix/* /var/lib/matrix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				192
			 | 
			
			
				+        cp -r $temp_restore_dir$MATRIX_DATA_DIR/* $MATRIX_DATA_DIR 
			 | 
		
	
		
			
			| 
				193
			 | 
			
				193
			 | 
			
			
				         if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				194
			 | 
			
				194
			 | 
			
			
				             function_check backup_unmount_drive 
			 | 
		
	
		
			
			| 
				195
			 | 
			
				195
			 | 
			
			
				             backup_unmount_drive 
			 | 
		
	
		
			
			| 
				196
			 | 
			
				196
			 | 
			
			
				             exit 78352 
			 | 
		
	
		
			
			| 
				197
			 | 
			
				197
			 | 
			
			
				         fi 
			 | 
		
	
		
			
			| 
				198
			 | 
			
				198
			 | 
			
			
				         rm -rf $temp_restore_dir 
			 | 
		
	
		
			
			| 
				199
			 | 
			
				
			 | 
			
			
				-        chown -R matrix:matrix /var/lib/matrix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				199
			 | 
			
			
				+        chown -R matrix:matrix $MATRIX_DATA_DIR 
			 | 
		
	
		
			
			| 
				200
			 | 
			
				200
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				201
			 | 
			
				201
			 | 
			
			
				         systemctl start matrix 
			 | 
		
	
		
			
			| 
				202
			 | 
			
				202
			 | 
			
			
				     fi 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -208,7 +208,7 @@ function backup_remote_matrix { 
			 | 
		
	
		
			
			| 
				208
			 | 
			
				208
			 | 
			
			
				         systemctl stop matrix 
			 | 
		
	
		
			
			| 
				209
			 | 
			
				209
			 | 
			
			
				         function_check backup_directory_to_friend 
			 | 
		
	
		
			
			| 
				210
			 | 
			
				210
			 | 
			
			
				         backup_directory_to_friend $source_directory matrix 
			 | 
		
	
		
			
			| 
				211
			 | 
			
				
			 | 
			
			
				-        source_directory=/var/lib/matrix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				211
			 | 
			
			
				+        source_directory=$MATRIX_DATA_DIR 
			 | 
		
	
		
			
			| 
				212
			 | 
			
				212
			 | 
			
			
				         if [ -d $source_directory ]; then 
			 | 
		
	
		
			
			| 
				213
			 | 
			
				213
			 | 
			
			
				             backup_directory_to_friend $source_directory matrixdata 
			 | 
		
	
		
			
			| 
				214
			 | 
			
				214
			 | 
			
			
				         fi 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -232,12 +232,12 @@ function restore_remote_matrix { 
			 | 
		
	
		
			
			| 
				232
			 | 
			
				232
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				233
			 | 
			
				233
			 | 
			
			
				         temp_restore_dir=/root/tempmatrixdata 
			 | 
		
	
		
			
			| 
				234
			 | 
			
				234
			 | 
			
			
				         restore_directory_from_friend $temp_restore_dir matrixdata 
			 | 
		
	
		
			
			| 
				235
			 | 
			
				
			 | 
			
			
				-        cp -r $temp_restore_dir/var/lib/matrix/* /var/lib/matrix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				235
			 | 
			
			
				+        cp -r $temp_restore_dir$MATRIX_DATA_DIR/* $MATRIX_DATA_DIR 
			 | 
		
	
		
			
			| 
				236
			 | 
			
				236
			 | 
			
			
				         if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				237
			 | 
			
				237
			 | 
			
			
				             exit 60923 
			 | 
		
	
		
			
			| 
				238
			 | 
			
				238
			 | 
			
			
				         fi 
			 | 
		
	
		
			
			| 
				239
			 | 
			
				239
			 | 
			
			
				         rm -rf $temp_restore_dir 
			 | 
		
	
		
			
			| 
				240
			 | 
			
				
			 | 
			
			
				-        chown -R matrix:matrix /var/lib/matrix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				240
			 | 
			
			
				+        chown -R matrix:matrix $MATRIX_DATA_DIR 
			 | 
		
	
		
			
			| 
				241
			 | 
			
				241
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				242
			 | 
			
				242
			 | 
			
			
				         systemctl start matrix 
			 | 
		
	
		
			
			| 
				243
			 | 
			
				243
			 | 
			
			
				     fi 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -331,10 +331,10 @@ function install_matrix { 
			 | 
		
	
		
			
			| 
				331
			 | 
			
				331
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				332
			 | 
			
				332
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				333
			 | 
			
				333
			 | 
			
			
				     groupadd matrix 
			 | 
		
	
		
			
			| 
				334
			 | 
			
				
			 | 
			
			
				-    useradd -c "Matrix system account" -d /var/lib/matrix -m -r -g matrix matrix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				334
			 | 
			
			
				+    useradd -c "Matrix system account" -d $MATRIX_DATA_DIR -m -r -g matrix matrix 
			 | 
		
	
		
			
			| 
				335
			 | 
			
				335
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				336
			 | 
			
				336
			 | 
			
			
				     chown -R matrix:matrix /etc/matrix 
			 | 
		
	
		
			
			| 
				337
			 | 
			
				
			 | 
			
			
				-    chown -R matrix:matrix /var/lib/matrix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				337
			 | 
			
			
				+    chown -R matrix:matrix $MATRIX_DATA_DIR 
			 | 
		
	
		
			
			| 
				338
			 | 
			
				338
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				339
			 | 
			
				339
			 | 
			
			
				     echo '[Unit]' > /etc/systemd/system/matrix.service 
			 | 
		
	
		
			
			| 
				340
			 | 
			
				340
			 | 
			
			
				     echo 'Description=Matrix federated messaging' >> /etc/systemd/system/matrix.service 
			 |