From 8096e627ffaf1465b1f58ee347616177d31ca192 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 5 Dec 2024 09:47:32 +0100 Subject: [PATCH] Create ssh key only if necessary --- scripts/lib/restoration.fish | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/lib/restoration.fish b/scripts/lib/restoration.fish index d85707f9..3e40056e 100644 --- a/scripts/lib/restoration.fish +++ b/scripts/lib/restoration.fish @@ -37,12 +37,6 @@ function initBackupConfig -V dir -d "Fetches the configuration by prompting the "Please specify the path to the directory to load the backup from: " \ "Please specify the path to the backup directory: " - if [ -z "$$keyVar" ] - set -gx "$keyVar" "$keyPath" - sudo mkdir -p (dirname "$keyPath") - sudo ssh-keygen -f "$$keyVar" -N "" - end - if $confirm $ssh[$index] n read -gxP $server[$index] VALHALLA_BACKUP_SERVER read -gxP $port[$index] VALHALLA_BACKUP_SERVER_PORT @@ -52,6 +46,12 @@ function initBackupConfig -V dir -d "Fetches the configuration by prompting the if [ -n "$VALHALLA_BACKUP_SERVER" ] set -l sshArgs + if [ -z "$$keyVar" ] + set -gx "$keyVar" "$keyPath" + sudo mkdir -p (dirname "$keyPath") + sudo ssh-keygen -f "$$keyVar" -N "" + end + if [ -n "$VALHALLA_BACKUP_SERVER_PORT" ] set -a sshArgs -p "$VALHALLA_BACKUP_SERVER_PORT" end