Create ssh key only if necessary
This commit is contained in:
parent
d52ce97c6c
commit
aebc398989
1 changed files with 6 additions and 6 deletions
|
@ -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 directory to load the backup from: " \
|
||||||
"Please specify the path to the backup directory: "
|
"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
|
if $confirm $ssh[$index] n
|
||||||
read -gxP $server[$index] VALHALLA_BACKUP_SERVER
|
read -gxP $server[$index] VALHALLA_BACKUP_SERVER
|
||||||
read -gxP $port[$index] VALHALLA_BACKUP_SERVER_PORT
|
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" ]
|
if [ -n "$VALHALLA_BACKUP_SERVER" ]
|
||||||
set -l sshArgs
|
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" ]
|
if [ -n "$VALHALLA_BACKUP_SERVER_PORT" ]
|
||||||
set -a sshArgs -p "$VALHALLA_BACKUP_SERVER_PORT"
|
set -a sshArgs -p "$VALHALLA_BACKUP_SERVER_PORT"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue