#!/bin/bash set -e repos=( s2n common checksums event-stream cal io compression auth http mqtt ) build_log=`pwd`/build_log.txt for path in ${repos[@]}; do pushd "$path" > /dev/null branch=`git rev-parse --abbrev-ref HEAD` echo "Pulling ${path} (${branch})" if ! git pull > /dev/null 2>&1; then echo "!!! Pulling branch ${branch} failed, switching to master" git checkout master > /dev/null 2>&1 git pull > /dev/null 2>&1 fi echo "Building ${path}" ninja -C build install > ${build_log} 2>&1 || (cat ${build_log} && exit 1) popd > /dev/null done rm -f ${build_log} echo "Update complete"