diff --git a/btrbk b/btrbk index 0da31d5..98aa35f 100755 --- a/btrbk +++ b/btrbk @@ -66,13 +66,19 @@ function runFullRestore { esac echo "Specify the remote path with trailing slash [remote:/path/to/backupdir/]" read -r -p "Dir: " rcloneDir - rclone copy $rcloneDir"config/btrbk.conf" /etc/btrbk.conf - echo "Enter Path of your gpg public and secret key" - read -r -p "Publickey: " gpgPub - read -r -p "Secretkey: " gpgPriv - gpg --import $gpgPub - gpg --import $gpgPriv - + read -r -p "Import GPG key?[y/N]: " gpgtest + case "$gpgtest" in + [yY]) + echo "Enter Path of your gpg public and secret key" + read -r -p "Publickey: " gpgPub + read -r -p "Secretkey: " gpgPriv + gpg --import $gpgPub + gpg --pinentry-mode loopback --import $gpgPriv;; + *) ;; + esac + if ! [ -e "/etc/btrbk.conf" ]; then + rclone copy $rcloneDir"config/btrbk.conf" "/etc/btrbk.conf" + fi source /etc/btrbk.conf local bkSuffix=("${INCR[0]}" "${FULL[0]}") btrfs subvolume create $restoreDir"restore" @@ -161,12 +167,11 @@ while true; do -r|--restore) restore=1; restoreVol=$2; shift;; -x|--full-restore) fullRestore=1; restoreDir=$2; shift;; -h|--help) Help; shift; break;; - --) shift; echoHelp;; + --) shift; break;; \?) echo "error"; exit 1;; esac shift done -echo $fullRestore if [ $fullRestore = "1" ]; then runFullRestore else