Bladeren bron

duplicity gpg options

Bob Mottram 7 jaren geleden
bovenliggende
commit
1e0ca1c3e2
1 gewijzigde bestanden met toevoegingen van 7 en 6 verwijderingen
  1. 7
    6
      src/freedombone-utils-backup

+ 7
- 6
src/freedombone-utils-backup Bestand weergeven

35
 BACKUP_DUMMY_PASSWORD='backup'
35
 BACKUP_DUMMY_PASSWORD='backup'
36
 
36
 
37
 BACKUP_TEMP_DIRECTORY=/root/.backuptemp
37
 BACKUP_TEMP_DIRECTORY=/root/.backuptemp
38
+BACKUPS_GPG_OPTIONS="--no-show-photos --pinentry-mode loopback"
38
 
39
 
39
 function create_backups_temp_directory {
40
 function create_backups_temp_directory {
40
     if [ ! -d $BACKUP_TEMP_DIRECTORY ]; then
41
     if [ ! -d $BACKUP_TEMP_DIRECTORY ]; then
263
 
264
 
264
 function backup_directory_to_usb_duplicity {
265
 function backup_directory_to_usb_duplicity {
265
     create_backups_temp_directory
266
     create_backups_temp_directory
266
-    echo "$BACKUP_DUMMY_PASSWORD" | duplicity full --tempdir $BACKUP_TEMP_DIRECTORY --encrypt-key $MY_BACKUP_KEY_ID --full-if-older-than 4W --exclude-other-filesystems ${1} file://$USB_MOUNT/backup/${2}
267
+    echo "$BACKUP_DUMMY_PASSWORD" | duplicity full --gpg-options "$BACKUPS_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}
267
     if [ ! "$?" = "0" ]; then
268
     if [ ! "$?" = "0" ]; then
268
         umount $USB_MOUNT
269
         umount $USB_MOUNT
269
         rm -rf $USB_MOUNT
270
         rm -rf $USB_MOUNT
277
         exit 8352925
278
         exit 8352925
278
     fi
279
     fi
279
     if [[ $ENABLE_BACKUP_VERIFICATION == "yes" ]]; then
280
     if [[ $ENABLE_BACKUP_VERIFICATION == "yes" ]]; then
280
-        echo "$BACKUP_DUMMY_PASSWORD" | duplicity verify --tempdir $BACKUP_TEMP_DIRECTORY --encrypt-key $MY_BACKUP_KEY_ID --full-if-older-than 4W --exclude-other-filesystems ${1} file://$USB_MOUNT/backup/${2}
281
+        echo "$BACKUP_DUMMY_PASSWORD" | duplicity verify --gpg-options "$BACKUPS_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}
281
         if [ ! "$?" = "0" ]; then
282
         if [ ! "$?" = "0" ]; then
282
             umount $USB_MOUNT
283
             umount $USB_MOUNT
283
             rm -rf $USB_MOUNT
284
             rm -rf $USB_MOUNT
360
 
361
 
361
 function restore_directory_from_usb_duplicity {
362
 function restore_directory_from_usb_duplicity {
362
     create_backups_temp_directory
363
     create_backups_temp_directory
363
-    echo "$BACKUP_DUMMY_PASSWORD" | duplicity restore --tempdir $BACKUP_TEMP_DIRECTORY --force file://$USB_MOUNT/backup/${2} ${1}
364
+    echo "$BACKUP_DUMMY_PASSWORD" | duplicity restore --gpg-options "$BACKUPS_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --force file://$USB_MOUNT/backup/${2} ${1}
364
     remove_backups_temp_directory
365
     remove_backups_temp_directory
365
 }
366
 }
366
 
367
 
389
 
390
 
390
 function restore_directory_from_friend_duplicity {
391
 function restore_directory_from_friend_duplicity {
391
     create_backups_temp_directory
392
     create_backups_temp_directory
392
-    echo "$BACKUP_DUMMY_PASSWORD" | duplicity restore --tempdir $BACKUP_TEMP_DIRECTORY --force file://$SERVER_DIRECTORY/backup/${2} ${1}
393
+    echo "$BACKUP_DUMMY_PASSWORD" | duplicity restore --gpg-options "$BACKUPS_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --force file://$SERVER_DIRECTORY/backup/${2} ${1}
393
     remove_backups_temp_directory
394
     remove_backups_temp_directory
394
 }
395
 }
395
 
396
 
435
 
436
 
436
 function backup_directory_to_friend_duplicity {
437
 function backup_directory_to_friend_duplicity {
437
     create_backups_temp_directory
438
     create_backups_temp_directory
438
-    echo "$BACKUP_DUMMY_PASSWORD" | duplicity full --tempdir $BACKUP_TEMP_DIRECTORY --ssh-askpass --encrypt-key ${ADMIN_BACKUP_KEY_ID} --full-if-older-than 4W --exclude-other-filesystems ${1} $SERVER_DIRECTORY/backup/${2}
439
+    echo "$BACKUP_DUMMY_PASSWORD" | duplicity full --gpg-options "$BACKUPS_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --ssh-askpass --encrypt-key ${ADMIN_BACKUP_KEY_ID} --full-if-older-than 4W --exclude-other-filesystems ${1} $SERVER_DIRECTORY/backup/${2}
439
     if [ ! "$?" = "0" ]; then
440
     if [ ! "$?" = "0" ]; then
440
         if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
441
         if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
441
             shred -zu ${1}/*
442
             shred -zu ${1}/*
447
         exit 5293526
448
         exit 5293526
448
     fi
449
     fi
449
     if [[ $ENABLE_BACKUP_VERIFICATION == "yes" ]]; then
450
     if [[ $ENABLE_BACKUP_VERIFICATION == "yes" ]]; then
450
-        echo "$BACKUP_DUMMY_PASSWORD" | duplicity verify --tempdir $BACKUP_TEMP_DIRECTORY --ssh-askpass --encrypt-key ${ADMIN_BACKUP_KEY_ID} --full-if-older-than 4W --exclude-other-filesystems ${1} $SERVER_DIRECTORY/backup/${2}
451
+        echo "$BACKUP_DUMMY_PASSWORD" | duplicity verify --gpg-options "$BACKUPS_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --ssh-askpass --encrypt-key ${ADMIN_BACKUP_KEY_ID} --full-if-older-than 4W --exclude-other-filesystems ${1} $SERVER_DIRECTORY/backup/${2}
451
         if [ ! "$?" = "0" ]; then
452
         if [ ! "$?" = "0" ]; then
452
             if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
453
             if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
453
                 shred -zu ${1}/*
454
                 shred -zu ${1}/*