diff --git a/src/Backup/Crypter/Gpg.php b/src/Backup/Crypter/Gpg.php index c24f3950..9318e00d 100644 --- a/src/Backup/Crypter/Gpg.php +++ b/src/Backup/Crypter/Gpg.php @@ -55,7 +55,7 @@ public function setup(array $options = []) $this->pathToGpg = Util\Arr::getValue($options, 'pathToOpenSSL', ''); $this->keepUncrypted = Util\Str::toBoolean(Util\Arr::getValue($options, 'keepUncrypted', ''), false); - $this->user = $this->toAbsolutePath(Util\Arr::getValue($options, 'user', '')); + $this->user = Util\Arr::getValue($options, 'user', ''); } /** diff --git a/src/Cli/Executable/Gpg.php b/src/Cli/Executable/Gpg.php index 6aaf24db..20e99742 100644 --- a/src/Cli/Executable/Gpg.php +++ b/src/Cli/Executable/Gpg.php @@ -139,12 +139,26 @@ protected function createCommandLine(): CommandLine $cmd = new Cmd($this->binary); $process->addCommand($cmd); + $this->setOptions($cmd); $this->addDeleteCommand($process); return $process; } + /** + * Set the gpg command line options + * + * @param \SebastianFeldmann\Cli\Command\Executable $cmd + */ + protected function setOptions(Cmd $cmd): void + { + $cmd->addOption('--' . ($this->action === 'e' ? 'encrypt' : 'decrypt')); + $cmd->addOption('-r', $this->user, ' '); + $cmd->addOption('-o', $this->targetFile, ' '); + $cmd->addArgument($this->sourceFile); + } + /** * Add the 'rm' command to remove the uncrypted file *