#!/bin/bash set -e set -u APPSTORE_HOME=$(git config appstore.home) . $APPSTORE_HOME/lib/common # HEADER END # stdin contains the refs pushed. APPS="$(git config appstore.apps)" REPO="$(pwd)" cd "$APPS" unset GIT_DIR git pull -q "$REPO" master IFS=$'\t' csvtool -u TAB namedcol dir,resolver,resolver_args,version,state apps.csv | \ while read dir resolver resolver_args version state do cd "$APPS" if [ -d "$dir" ] then cd "$dir" dir=`pwd` old_version=$(app conf get app.version) if [[ $new_version == $old_version ]] then continue fi echo "Updating $dir to $version" app conf set app.version "$version" app update else echo "New application: $dir" app init -d "$dir" "$resolver" "$resolver_args" cd "$dir" dir=`pwd` fi cd "$dir" if [[ $state == enabled ]] then cmd=start title="Starting" else cmd=stop title="Stopping" fi echo "$title appliation" set +e app $cmd ret=$? set -e if [[ $ret != 0 ]] then echo "$cmd command failed." fi done unset IFS