#!/bin/bash # # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ # # Wrap rsync with options to use port 1202, the standard Bubble SSH port. # If your rsync command already contains a `-e` or `--rsh` option, this wrapper will not work. # # Environment variables: # # BUBBLE_SSH_PORT : If set, this port will be used instead of 1202 # SCRIPT="${0}" SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)" . "${SCRIPT_DIR}"/bubble_common if [[ -z "${BUBBLE_SSH_PORT}" ]] ; then BUBBLE_SSH_PORT="1202" fi if [[ $(echo "${@}" | grep -c -- "-e ") -gt 0 || $(echo "${@}" | grep -c -- "--rsh") -gt 0 ]] ; then die "$0 does not work correctly when -e or --rsh is used, since it sets its own: ${@}" fi RSYNC_SSH_OPTS="$(which ssh) -p ${BUBBLE_SSH_PORT}" rsync -e "${RSYNC_SSH_OPTS}" "${@}"