From 1f4b5a6d65544ba293b58315b9b67fc99bfbe16d Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 27 Jun 2019 14:37:42 -0400 Subject: [PATCH] Add little deploy script for testing purposes --- build-and-deploy.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 build-and-deploy.sh diff --git a/build-and-deploy.sh b/build-and-deploy.sh new file mode 100755 index 00000000..3cda1783 --- /dev/null +++ b/build-and-deploy.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# A useful script for testing out changes to PVC by building the debs and deploying them out to a +# set of hosts automatically, including restarting the daemon (with a pause between) on the remote +# side. Mostly just useful for quickly testing/debugging changes as Ansible should be used for +# production upgrades. + +# Check if we're root, or not +if [[ $( id -u ) -eq 0 ]]; then + SUDO="" +else + SUDO="sudo" +fi + +HOSTS=( ${@} ) +echo "${HOSTS[@]}" + +# Build the packages +./build-deb.sh + +# Install the client(s) locally +$SUDO dpkg -i ../pvc-client*.deb + +for HOST in ${HOSTS[@]}; do + ssh $HOST mkdir /tmp/pvc + scp ../*.deb $HOST:/tmp/pvc/ + ssh $HOST $SUDO dpkg -i /tmp/pvc/*.deb + ssh $HOST $SUDO systemctl restart pvcd + ssh $HOST rm -rf /tmp/pvc + sleep 15 +done