diff --git a/scripts/Common/OS/backup.fish b/scripts/Common/OS/backup.fish index ad7848d6..5d432edc 100644 --- a/scripts/Common/OS/backup.fish +++ b/scripts/Common/OS/backup.fish @@ -25,10 +25,6 @@ function backupAction -V dir set -x VALHALLA_BACKUP_SERVER_PORT 22 end - if [ -n "$VALHALLA_BACKUP_SERVER_USER" ] - set -x VALHALLA_BACKUP_SERVER "$VALHALLA_BACKUP_SERVER_USER@$VALHALLA_BACKUP_SERVER" - end - echo echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)" echo "For a seamless experience, please make sure that you are able to establish an unattended ssh connection using key authentication." diff --git a/scripts/lib/restoration.fish b/scripts/lib/restoration.fish index 49ce3190..b1f63c9d 100644 --- a/scripts/lib/restoration.fish +++ b/scripts/lib/restoration.fish @@ -57,12 +57,17 @@ function runRestorationCommand $argv else set -l args + set -l host "$VALHALLA_BACKUP_SERVER" + + if [ -n "$VALHALLA_BACKUP_SERVER_USER" ] + set host "$VALHALLA_BACKUP_SERVER_USER@$host" + end if [ -n "$VALHALLA_BACKUP_SERVER_PORT" ] set -a args -p $VALHALLA_BACKUP_SERVER_PORT end - sudo ssh -i $(string escape -- "$VALHALLA_BACKUP_SERVER_KEY") $args "$VALHALLA_BACKUP_SERVER" (string escape -- $argv) + sudo ssh -i $(string escape -- "$VALHALLA_BACKUP_SERVER_KEY") $args "$host" (string escape -- $argv) end end