From 1780f9fa8de3f482fdea6519f23de8be912e83de Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Sun, 8 Nov 2015 22:14:27 -0700 Subject: [PATCH] re-exec the PBR script each time, in case it's changed --- scripts/pull-build-rsync | 55 ++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/scripts/pull-build-rsync b/scripts/pull-build-rsync index 3ab2b8d..2d31d7b 100755 --- a/scripts/pull-build-rsync +++ b/scripts/pull-build-rsync @@ -4,25 +4,48 @@ RSYNC_DEST=emcboard@www.linuxcnc.org:www.linuxcnc.org/new -git fetch -t origin - -MASTER_SHA=$(git rev-parse master) -ORIGIN_MASTER_SHA=$(git rev-parse origin/master) - -if [ $MASTER_SHA = $ORIGIN_MASTER_SHA ] && [ "$1" != "--force" ]; then - echo "master and origin/master are the same, nothing to do" - echo "run with --force to do it anyway" - exit 0 -fi - -git reset --hard -git checkout master -git reset --hard origin/master - +# +# build the site +# ./scripts/update-version jekyll build --trace || exit 1 -rsync -e 'ssh -i /home/seb/.ssh/wlo' --archive --quiet _site/ $RSYNC_DEST +# +# upload it to wlo +# + +rsync -e 'ssh -i /home/seb/.ssh/wlo' --archive --verbose _site/ $RSYNC_DEST + + +# +# wait for new commits to show up in the git repo +# + +while : ; do + git fetch -t origin + + MASTER_SHA=$(git rev-parse master) + ORIGIN_MASTER_SHA=$(git rev-parse origin/master) + + if [ $MASTER_SHA = $ORIGIN_MASTER_SHA ]; then + echo "$(date +'%F %T') master and origin/master are the same, nothing to do" + sleep 60 + else + echo "$(date +'%F %T') new commits in origin/master!" + break + fi +done + + +# +# new commits are available, and have been fetched into this repo +# + +git reset --hard +git checkout master +git reset --hard origin/master + +exec scripts/pull-build-rsync