Kaynağa Gözat

Deprecate obnam backup functions

Bob Mottram 7 yıl önce
ebeveyn
işleme
a14ac0ff82
2 değiştirilmiş dosya ile 6 ekleme ve 88 silme
  1. 6
    0
      src/freedombone-app-rss
  2. 0
    88
      src/freedombone-utils-backup

+ 6
- 0
src/freedombone-app-rss Dosyayı Görüntüle

151
     if [ -d /etc/share/tt-rss ]; then
151
     if [ -d /etc/share/tt-rss ]; then
152
         echo $"Backing up ttrss"
152
         echo $"Backing up ttrss"
153
 
153
 
154
+        function_check get_mariadb_password
155
+        get_mariadb_password
156
+
154
         function_check backup_database_to_usb
157
         function_check backup_database_to_usb
155
         backup_database_to_usb ttrss
158
         backup_database_to_usb ttrss
156
 
159
 
222
         function_check suspend_site
225
         function_check suspend_site
223
         suspend_site ttrss
226
         suspend_site ttrss
224
 
227
 
228
+        function_check get_mariadb_password
229
+        get_mariadb_password
230
+
225
         function_check backup_database_to_friend
231
         function_check backup_database_to_friend
226
         backup_database_to_friend ttrss
232
         backup_database_to_friend ttrss
227
 
233
 

+ 0
- 88
src/freedombone-utils-backup Dosyayı Görüntüle

279
     echo $"Database dump was created for ${1}"
279
     echo $"Database dump was created for ${1}"
280
 }
280
 }
281
 
281
 
282
-function set_obnam_client_name {
283
-    # obnam can backup multiple machines with different domain names to
284
-    # a repository. To be able to restore directories from different
285
-    # machines we need to enforce a single client name for all backups
286
-    echo '[config]' > /etc/obnam.conf
287
-    echo "client-name = ${PROJECT_NAME}" >> /etc/obnam.conf
288
-}
289
-
290
 function backup_directory_to_usb_duplicity {
282
 function backup_directory_to_usb_duplicity {
291
     create_backups_temp_directory
283
     create_backups_temp_directory
292
     echo "$BACKUP_DUMMY_PASSWORD" | duplicity full --gpg-options "$BACKUP_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --encrypt-key $MY_BACKUP_KEY_ID --full-if-older-than 4W --exclude-other-filesystems ${1} file://$USB_MOUNT/backup/${2}
284
     echo "$BACKUP_DUMMY_PASSWORD" | duplicity full --gpg-options "$BACKUP_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --encrypt-key $MY_BACKUP_KEY_ID --full-if-older-than 4W --exclude-other-filesystems ${1} file://$USB_MOUNT/backup/${2}
320
     remove_backups_temp_directory
312
     remove_backups_temp_directory
321
 }
313
 }
322
 
314
 
323
-function backup_directory_to_usb_obnam {
324
-    set_obnam_client_name
325
-    echo "$BACKUP_DUMMY_PASSWORD" | obnam force-lock -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}
326
-    echo "$BACKUP_DUMMY_PASSWORD" | obnam backup -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}
327
-    if [[ $ENABLE_BACKUP_VERIFICATION == "yes" ]]; then
328
-        echo "$BACKUP_DUMMY_PASSWORD" | obnam verify -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}
329
-        if [ ! "$?" = "0" ]; then
330
-            umount $USB_MOUNT
331
-            rm -rf $USB_MOUNT
332
-            if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
333
-                shred -zu ${1}/*
334
-                rm -rf ${1}
335
-            fi
336
-            function_check restart_site
337
-            restart_site
338
-            exit 683252
339
-        fi
340
-    fi
341
-    echo "$BACKUP_DUMMY_PASSWORD" | obnam forget --keep=30d -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID
342
-    if [ ! "$?" = "0" ]; then
343
-        umount $USB_MOUNT
344
-        rm -rf $USB_MOUNT
345
-        if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
346
-            shred -zu ${1}/*
347
-            rm -rf ${1}
348
-        fi
349
-        function_check restart_site
350
-        restart_site
351
-        exit 7
352
-    fi
353
-}
354
-
355
 function backup_directory_to_usb {
315
 function backup_directory_to_usb {
356
     if [ ! -d ${1} ]; then
316
     if [ ! -d ${1} ]; then
357
         echo $"WARNING: directory does not exist: ${1}"
317
         echo $"WARNING: directory does not exist: ${1}"
370
         fi
330
         fi
371
 
331
 
372
         backup_directory_to_usb_duplicity ${1} ${2}
332
         backup_directory_to_usb_duplicity ${1} ${2}
373
-        #backup_directory_to_usb_obnam ${1} ${2}
374
 
333
 
375
         if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
334
         if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
376
             shred -zu ${1}/*
335
             shred -zu ${1}/*
379
     fi
338
     fi
380
 }
339
 }
381
 
340
 
382
-function restore_directory_from_usb_obnam {
383
-    set_obnam_client_name
384
-    echo "$BACKUP_DUMMY_PASSWORD" | obnam restore -r $USB_MOUNT/backup/${2} --to ${1}
385
-}
386
-
387
 function restore_directory_from_usb_duplicity {
341
 function restore_directory_from_usb_duplicity {
388
     create_backups_temp_directory
342
     create_backups_temp_directory
389
     PASSPHRASE="$BACKUP_DUMMY_PASSWORD" duplicity restore --gpg-options "$BACKUP_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --force file://$USB_MOUNT/backup/${2} ${1}
343
     PASSPHRASE="$BACKUP_DUMMY_PASSWORD" duplicity restore --gpg-options "$BACKUP_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --force file://$USB_MOUNT/backup/${2} ${1}
409
         mkdir ${1}
363
         mkdir ${1}
410
     fi
364
     fi
411
     restore_directory_from_usb_duplicity ${1} ${2}
365
     restore_directory_from_usb_duplicity ${1} ${2}
412
-    #restore_directory_from_usb_obnam ${1} ${2}
413
-}
414
-
415
-function restore_directory_from_friend_obnam {
416
-    set_obnam_client_name
417
-    echo "$BACKUP_DUMMY_PASSWORD" | obnam restore -r $SERVER_DIRECTORY/backup/${2} --to ${1}
418
 }
366
 }
419
 
367
 
420
 function restore_directory_from_friend_duplicity {
368
 function restore_directory_from_friend_duplicity {
426
 
374
 
427
 function restore_directory_from_friend {
375
 function restore_directory_from_friend {
428
     if [ ! ${1} ]; then
376
     if [ ! ${1} ]; then
429
-        echo "obnam restore -r $SERVER_DIRECTORY/backup/${2} --to ${1}"
430
         echo $'No restore destination given'
377
         echo $'No restore destination given'
431
         return
378
         return
432
     fi
379
     fi
433
     if [ ! ${2} ]; then
380
     if [ ! ${2} ]; then
434
-        echo "obnam restore -r $SERVER_DIRECTORY/backup/${2} --to ${1}"
435
         echo $'No restore source given'
381
         echo $'No restore source given'
436
         return
382
         return
437
     fi
383
     fi
439
         mkdir ${1}
385
         mkdir ${1}
440
     fi
386
     fi
441
     restore_directory_from_friend_duplicity ${1} ${2}
387
     restore_directory_from_friend_duplicity ${1} ${2}
442
-    #restore_directory_from_friend_obnam ${1} ${2}
443
 }
388
 }
444
 
389
 
445
 function backup_database_to_usb {
390
 function backup_database_to_usb {
493
     remove_backups_temp_directory
438
     remove_backups_temp_directory
494
 }
439
 }
495
 
440
 
496
-function backup_directory_to_friend_obnam {
497
-    set_obnam_client_name
498
-    echo "$BACKUP_DUMMY_PASSWORD" | obnam force-lock -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} ${1}
499
-    echo "$BACKUP_DUMMY_PASSWORD" | obnam backup -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} ${1}
500
-    if [[ $ENABLE_VERIFICATION == "yes" ]]; then
501
-        echo "$BACKUP_DUMMY_PASSWORD" | obnam verify -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} ${1}
502
-        if [ ! "$?" = "0" ]; then
503
-            if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
504
-                shred -zu /root/temp${2}/*
505
-                rm -rf /root/temp${2}
506
-            fi
507
-            # Send a warning email
508
-            echo "Unable to verify ${2}" | mail -s "${PROJECT_NAME} backup to friends" ${ADMIN_EMAIL_ADDRESS}
509
-            function_check restart_site
510
-            restart_site
511
-            exit 953
512
-        fi
513
-    fi
514
-    echo "$BACKUP_DUMMY_PASSWORD" | obnam forget --keep=30d -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID}
515
-    if [ ! "$?" = "0" ]; then
516
-        if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
517
-            shred -zu /root/temp${2}/*
518
-            rm -rf /root/temp${2}
519
-        fi
520
-        # Send a warning email
521
-        echo "Unable to backup ${2}" | mail -s "${PROJECT_NAME} backup to friends" ${ADMIN_EMAIL_ADDRESS}
522
-        function_check restart_site
523
-        restart_site
524
-        exit 853
525
-    fi
526
-}
527
-
528
 function backup_directory_to_friend {
441
 function backup_directory_to_friend {
529
     BACKUP_KEY_EXISTS=$(gpg --list-keys "$ADMIN_NAME (backup key)")
442
     BACKUP_KEY_EXISTS=$(gpg --list-keys "$ADMIN_NAME (backup key)")
530
     if [ ! "$?" = "0" ]; then
443
     if [ ! "$?" = "0" ]; then
540
     fi
453
     fi
541
 
454
 
542
     backup_directory_to_friend_duplicity ${1} ${2}
455
     backup_directory_to_friend_duplicity ${1} ${2}
543
-    #backup_directory_to_friend_obnam ${1} ${2}
544
 
456
 
545
     if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
457
     if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
546
         shred -zu /root/temp${2}/*
458
         shred -zu /root/temp${2}/*