Parcourir la source

Backup and restore matrix identity server

Bob Mottram il y a 8 ans
Parent
révision
a0972bab26
1 fichiers modifiés avec 28 ajouts et 0 suppressions
  1. 28
    0
      src/freedombone-app-matrix

+ 28
- 0
src/freedombone-app-matrix Voir le fichier

@@ -342,6 +342,10 @@ function backup_local_matrix {
342 342
         if [ -d $source_directory ]; then
343 343
             backup_directory_to_usb $source_directory matrixdata
344 344
         fi
345
+        source_directory=/etc/sydent
346
+        if [ -d $source_directory ]; then
347
+            backup_directory_to_usb $source_directory matrixid
348
+        fi
345 349
         systemctl start matrix
346 350
     fi
347 351
 }
@@ -373,6 +377,17 @@ function restore_local_matrix {
373 377
         rm -rf $temp_restore_dir
374 378
         chown -R matrix:matrix $MATRIX_DATA_DIR
375 379
 
380
+        temp_restore_dir=/root/tempmatrixid
381
+        restore_directory_from_usb $temp_restore_dir matrixid
382
+        cp -r $temp_restore_dir/etc/sydent/* /etc/sydent
383
+        if [ ! "$?" = "0" ]; then
384
+            function_check backup_unmount_drive
385
+            backup_unmount_drive
386
+            exit 29562
387
+        fi
388
+        rm -rf $temp_restore_dir
389
+        chown -R matrix:matrix /etc/sydent
390
+
376 391
         systemctl start matrix
377 392
     fi
378 393
 }
@@ -387,6 +402,10 @@ function backup_remote_matrix {
387 402
         if [ -d $source_directory ]; then
388 403
             backup_directory_to_friend $source_directory matrixdata
389 404
         fi
405
+        source_directory=/etc/sydent
406
+        if [ -d $source_directory ]; then
407
+            backup_directory_to_friend $source_directory matrixid
408
+        fi
390 409
         systemctl start matrix
391 410
     fi
392 411
 }
@@ -414,6 +433,15 @@ function restore_remote_matrix {
414 433
         rm -rf $temp_restore_dir
415 434
         chown -R matrix:matrix $MATRIX_DATA_DIR
416 435
 
436
+        temp_restore_dir=/root/tempmatrixid
437
+        restore_directory_from_friend $temp_restore_dir matrixid
438
+        cp -r $temp_restore_dir/etc/sydent/* /etc/sydent
439
+        if [ ! "$?" = "0" ]; then
440
+            exit 738356
441
+        fi
442
+        rm -rf $temp_restore_dir
443
+        chown -R matrix:matrix /etc/sydent
444
+
417 445
         systemctl start matrix
418 446
     fi
419 447
 }