diff --git a/bin/bpatchfull b/bin/bpatchfull index 04e96ce2..55235807 100755 --- a/bin/bpatchfull +++ b/bin/bpatchfull @@ -21,9 +21,13 @@ SCRIPT="${0}" SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) . ${SCRIPT_DIR}/bubble_common -HOST=${1:?no host provided} +HOST="${1:?no host provided}" NO_RESTART=${2} +if [[ -z "$(echo "${HOST}" | tr -cd '[:alnum:].-')" ]] ; then + die "invalid host: ${HOST}" +fi + if [[ -z "${BUBBLE_SSH_PORT}" ]] ; then BUBBLE_SSH_PORT="1202" fi @@ -55,14 +59,14 @@ else fi if [[ ! -z "${NO_RESTART}" && "${NO_RESTART}" == "norestart" ]] ; then - echo "Patching but not restarting..." + echo "Patching but not restarting: ${HOST} ..." ssh -p ${BUBBLE_SSH_PORT} ${HOST} "cat /tmp/bubble.jar > ~bubble/api/bubble.jar" else - echo "Patching and restarting..." + echo "Patching and restarting: ${HOST} ..." ssh -p ${BUBBLE_SSH_PORT} ${HOST} "cat /tmp/bubble.jar > ~bubble/api/bubble.jar && supervisorctl restart bubble" fi if unzip -Z -1 ./target/bubble*.jar | grep -q "^site/$" ; then - echo "Deploying new web..." + echo "Deploying new web: ${HOST} ..." ssh -p ${BUBBLE_SSH_PORT} ${HOST} "cd ~bubble && unzip -o /tmp/bubble.jar 'site/*' && chown -R bubble:bubble site" fi