From 99d7f7baa609ff8ca2e48138dd3dc9b160df8f65 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 25 Aug 2017 11:09:46 +0100 Subject: [PATCH] gpg passphrase --- src/freedombone-app-cryptpad | 6 ++++++ src/freedombone-utils-backup | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/freedombone-app-cryptpad b/src/freedombone-app-cryptpad index 7b3e6712..ffb77383 100755 --- a/src/freedombone-app-cryptpad +++ b/src/freedombone-app-cryptpad @@ -122,7 +122,13 @@ function restore_local_cryptpad { temp_restore_dir=/root/tempcryptpad function_check restore_directory_from_usb restore_directory_from_usb $temp_restore_dir cryptpad + if [ ! -d $temp_restore_dir$CRYPTPAD_DIR/datastore ]; then + systemctl start cryptpad + echo 'Failed to restore cryptpad' + rm -rf $temp_restore_dir + fi cp -r $temp_restore_dir$CRYPTPAD_DIR/datastore/* $CRYPTPAD_DIR/datastore/ + rm -rf $temp_restore_dir systemctl start cryptpad fi } diff --git a/src/freedombone-utils-backup b/src/freedombone-utils-backup index c50f4312..66296bcc 100755 --- a/src/freedombone-utils-backup +++ b/src/freedombone-utils-backup @@ -361,7 +361,11 @@ function restore_directory_from_usb_obnam { function restore_directory_from_usb_duplicity { create_backups_temp_directory - echo "$BACKUP_DUMMY_PASSWORD" | duplicity restore --gpg-options "$BACKUP_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --force file://$USB_MOUNT/backup/${2} ${1} + PASSPHRASE="$BACKUP_DUMMY_PASSWORD" duplicity restore --gpg-options "$BACKUP_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --force file://$USB_MOUNT/backup/${2} ${1} + if [ ! "$?" = "0" ]; then + echo "WARNING: failed to restore $USB_MOUNT/backup/${2} to ${1}" + fi + PASSPHRASE= remove_backups_temp_directory } @@ -390,7 +394,8 @@ function restore_directory_from_friend_obnam { function restore_directory_from_friend_duplicity { create_backups_temp_directory - echo "$BACKUP_DUMMY_PASSWORD" | duplicity restore --gpg-options "$BACKUP_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --force file://$SERVER_DIRECTORY/backup/${2} ${1} + PASSPHRASE="$BACKUP_DUMMY_PASSWORD" duplicity restore --gpg-options "$BACKUP_GPG_OPTIONS" --tempdir $BACKUP_TEMP_DIRECTORY --force file://$SERVER_DIRECTORY/backup/${2} ${1} + PASSPHRASE= remove_backups_temp_directory }