From 1edf0e2fd4929ad0f60b6aaa0e056d463d8f8700 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 4 Dec 2024 18:14:15 +0100 Subject: [PATCH] Create new ssh key implicitly --- scripts/Common/OS/backup.fish | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/Common/OS/backup.fish b/scripts/Common/OS/backup.fish index 5d432edc..58313c18 100644 --- a/scripts/Common/OS/backup.fish +++ b/scripts/Common/OS/backup.fish @@ -16,10 +16,17 @@ function backupAction -V dir if [ -z "$VALHALLA_BACKUP_DIR" ] if fish "$dir/../../../lib/modules/partition/confirm.fish" "Do you wish to store the backup on an SSH server?" n + set -l keyVar VALHALLA_BACKUP_SERVER_KEY + set -l keyPath ~root/.config/port-valhalla/valhalla read -xP "Please specify the host name of the SSH server: " VALHALLA_BACKUP_SERVER read -xP "Please specify the port of the SSH server (default 22): " VALHALLA_BACKUP_SERVER_PORT read -xP "Please specify the name of the user to log in to the SSH server: " VALHALLA_BACKUP_SERVER_USER - read -xP "Please specify the path to the key file for logging in to the SSH server: " VALHALLA_BACKUP_SERVER_KEY + + if [ -z "$$keyVar" ] + set -gx "$keyVar" "$keyPath" + mkdir -p (dirname "$keyPath") + ssh-keygen -f "$$keyVar" -N "" + end if [ -z "$VALHALLA_BACKUP_SERVER_PORT" ] set -x VALHALLA_BACKUP_SERVER_PORT 22