|
@ -842,25 +842,18 @@ cmdline.spec:vps-backup:cmd:recover:run() { |
|
|
admin=${BACKUP_TARGET%%@*} |
|
|
admin=${BACKUP_TARGET%%@*} |
|
|
server=${BACKUP_TARGET#*@} |
|
|
server=${BACKUP_TARGET#*@} |
|
|
|
|
|
|
|
|
## XXXvlab: in this first implementation we expect to have access |
|
|
|
|
|
## to the server main ssh port 22, so we won't use the provided port. |
|
|
|
|
|
# ssh_options=() |
|
|
|
|
|
|
|
|
ssh_options=() |
|
|
if [[ "$server" == *":"* ]]; then |
|
|
if [[ "$server" == *":"* ]]; then |
|
|
# ssh_options+=(-p "${server#*:}") |
|
|
|
|
|
|
|
|
ssh_options+=(-p "${server#*:}") |
|
|
ssh_server=${server%%:*} |
|
|
ssh_server=${server%%:*} |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
BACKUP_PATH="/srv/datastore/data/rsync-backup-target/var/mirror" |
|
|
BACKUP_PATH="/srv/datastore/data/rsync-backup-target/var/mirror" |
|
|
|
|
|
|
|
|
if ! rtype=$(echo " |
|
|
|
|
|
if [ -d '$BACKUP_PATH/$id/var/lib/docker/volumes/mailcowdockerized_crypt-vol-1' ]; then |
|
|
|
|
|
echo mailcow |
|
|
|
|
|
elif [ -d '$BACKUP_PATH/$id/compose.yml' ]; then |
|
|
|
|
|
echo compose |
|
|
|
|
|
fi |
|
|
|
|
|
true |
|
|
|
|
|
" | ssh:run "root@${ssh_server}" -- bash ); then |
|
|
|
|
|
|
|
|
if ! rtype=$(ssh:run "$admin"@"${ssh_server}" "${ssh_options[@]}" -- ssh-key get-type "$id" ); then |
|
|
err "Could not get backup type." |
|
|
err "Could not get backup type." |
|
|
|
|
|
echo " Do you have admin access to $admin@$server ?" >&2 |
|
|
|
|
|
echo " Are you sure '$id' backup identifier belongs to '$admin' admin on '$server' ?" >&2 |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|