Skip backup questions if specified
This commit is contained in:
parent
b9e05c784d
commit
b281236b47
1 changed files with 23 additions and 21 deletions
|
@ -14,31 +14,33 @@ function backupAction -V dir
|
|||
|
||||
set -l deployScript (getDeploymentScript)
|
||||
|
||||
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 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
|
||||
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
|
||||
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
|
||||
|
||||
if [ -z "$VALHALLA_BACKUP_SERVER_PORT" ]
|
||||
set -x VALHALLA_BACKUP_SERVER_PORT 22
|
||||
if [ -z "$VALHALLA_BACKUP_SERVER_PORT" ]
|
||||
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
|
||||
|
||||
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
|
||||
read -xP "Please specify the path to the directory to save the backup to: " VALHALLA_BACKUP_DIR
|
||||
end
|
||||
|
||||
read -xP "Please specify the path to the directory to save the backup to: " VALHALLA_BACKUP_DIR
|
||||
|
||||
runHook backupSoftware || begin
|
||||
echo "Backing up software..."
|
||||
|
||||
|
|
Loading…
Reference in a new issue