#!/bin/bash set -e set -u APPSTORE_HOME=$(cd $(dirname "$0")/.. && pwd) . $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 if [ -d "$dir" ] then cd $dir 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 cd .. else echo "New application: $dir" app init -d "$dir" "$resolver" "$resolver_args" fi cd "$dir" if [[ $state == enabled ]] then echo "Starting appliation" app start else echo "Stopping appliation" app stop fi done unset IFS