Skip backup questions if specified

This commit is contained in:
Manuel Thalmann 2024-11-23 17:26:12 +01:00
parent 522ebd9ede
commit 57f56e0e9b

View file

@ -14,31 +14,33 @@ function backupAction -V dir
set -l deployScript (getDeploymentScript) set -l deployScript (getDeploymentScript)
if fish "$dir/../../../lib/modules/partition/confirm.fish" "Do you wish to store the backup on an SSH server?" n if [ -z "$VALHALLA_BACKUP_DIR" ]
read -xP "Please specify the host name of the SSH server: " VALHALLA_BACKUP_SERVER if fish "$dir/../../../lib/modules/partition/confirm.fish" "Do you wish to store the backup on an SSH server?" n
read -xP "Please specify the port of the SSH server (default 22): " VALHALLA_BACKUP_SERVER_PORT read -xP "Please specify the host name of the SSH server: " VALHALLA_BACKUP_SERVER
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 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
if [ -z "$VALHALLA_BACKUP_SERVER_PORT" ] if [ -z "$VALHALLA_BACKUP_SERVER_PORT" ]
set -x VALHALLA_BACKUP_SERVER_PORT 22 set -x VALHALLA_BACKUP_SERVER_PORT 22
end
if [ -n "$VALHALLA_BACKUP_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."
echo
echo "$(tput bold)This command should succeed without user interaction:$(tput sgr0)"
echo "ssh -o PasswordAuthentication=no -p $VALHALLA_BACKUP_SERVER_PORT $VALHALLA_BACKUP_SERVER true"
read -P "Press enter once you're done: "
echo
end end
if [ -n "$VALHALLA_BACKUP_USER" ] read -xP "Please specify the path to the directory to save the backup to: " VALHALLA_BACKUP_DIR
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."
echo
echo "$(tput bold)This command should succeed without user interaction:$(tput sgr0)"
echo "ssh -o PasswordAuthentication=no -p $VALHALLA_BACKUP_SERVER_PORT $VALHALLA_BACKUP_SERVER true"
read -P "Press enter once you're done: "
echo
end end
read -xP "Please specify the path to the directory to save the backup to: " VALHALLA_BACKUP_DIR
runHook backupSoftware || begin runHook backupSoftware || begin
echo "Backing up software..." echo "Backing up software..."