diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-11-12 13:39:41 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-11-12 13:39:41 +0100 |
commit | 5dd16e14dd41f1565687142ba7cefa7c4cf64658 (patch) | |
tree | d571b793928cdf89feb6d040b359c3db2a00c766 /hooks/post-receive | |
parent | 0d92ff5fd34d79b54c30c38ac41bc600acf7b7c4 (diff) | |
download | appstore-5dd16e14dd41f1565687142ba7cefa7c4cf64658.tar.gz appstore-5dd16e14dd41f1565687142ba7cefa7c4cf64658.tar.bz2 appstore-5dd16e14dd41f1565687142ba7cefa7c4cf64658.tar.xz appstore-5dd16e14dd41f1565687142ba7cefa7c4cf64658.zip |
Diffstat (limited to 'hooks/post-receive')
-rwxr-xr-x | hooks/post-receive | 89 |
1 files changed, 3 insertions, 86 deletions
diff --git a/hooks/post-receive b/hooks/post-receive index c52ac9c..7cc91f5 100755 --- a/hooks/post-receive +++ b/hooks/post-receive @@ -10,93 +10,10 @@ APPSTORE_HOME=$(git config appstore.home) # stdin contains the refs pushed. -conf_get() { - name=$1; shift - var=$1; shift - value=$(app cat-conf -f "$APPS/appstore.config" -k "$var" | cut -f 2- -d =) - eval ${name}='${value}' -} - -check_app() { - local app=$1; shift - - dir=$app - conf_get resolver "${app}.resolver" - conf_get resolver_args "${app}.resolver_args" - conf_get version "${app}.version" - conf_get state "${app}.state" - - if [[ -z $resolver ]] || [[ -z $resolver_args ]] || [[ -z $version ]] || [[ -z $state ]] - then - echo "$app: invalid configuration, missing one of ${app}.resolver, ${app}.resolver_args, ${app}.version, ${app}.state" - return - fi - - cd "$APPS" - - if [ -d "$dir" ] - then - cd "$dir" - dir=`pwd` - old_version=$(app conf get app.version) - - if [[ $new_version = $old_version ]] - then - echo "$dir: already at $version" - continue - fi - - echo "$dir: updating to $version" - app conf set app.version "$version" - app update - else - echo "$dir: new app" - if [[ -r ${dir}.config ]] - then - append_config="${dir}.config" - fi - - app init \ - ${append_config:+-c} $append_config \ - -d "$dir" \ - "$resolver" "$resolver_args" - cd "$dir" - dir=`pwd` - fi - - cd "$dir" - - if [[ $state = enabled ]] - then - app start || true - else - app stop || true - fi -} - +#REPO="$(pwd)" +REPO="$GIT_DIR" APPS="$(git config appstore.apps)" -REPO="$(pwd)" - -cd "$APPS" - unset GIT_DIR -git pull -q "$REPO" master - -conf_get apps appstore.apps -apps=$(echo "$apps" | sed "s/, */,/g") - -IFS=, -for app in $apps -do - if [[ $app = "" ]] - then - continue - fi - - assert_valid_app_name "$app" - - check_app "$app" || true -done -echo "Done." +exec appstore server-sync "$REPO" "$APPS" |