|
|
@ -24,32 +24,36 @@ gogocarto:init() { |
|
|
|
return 1 |
|
|
|
} |
|
|
|
fi |
|
|
|
if [ "$current_version" != "$GOGOCARTO_RELEASE" ]; then |
|
|
|
cd "${GOGOCARTO_CODE}" || return 1 |
|
|
|
if [ -d "$PWD"/.git ]; then |
|
|
|
rm -rf "$PWD"/* "$PWD"/{.version,.env} || return 1 |
|
|
|
else |
|
|
|
err "Can't find the '.git' directory in ${GOGOCARTO_CODE}." |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
curl -L "$GOGOCARTO_URL" | tar xj || { |
|
|
|
err "Couldn't download $GOGOCARTO_URL." |
|
|
|
return 1 |
|
|
|
} |
|
|
|
echo "$GOGOCARTO_RELEASE" > .version |
|
|
|
git add -A . || { |
|
|
|
err "'git add -A .' in '${GOGOCARTO_CODE}' failed." |
|
|
|
|
|
|
|
## Check if we need to upgrade code. |
|
|
|
if [ "$current_version" == "$GOGOCARTO_RELEASE" ]; then |
|
|
|
return 0 |
|
|
|
fi |
|
|
|
|
|
|
|
cd "${GOGOCARTO_CODE}" || return 1 |
|
|
|
if [ -d "$PWD"/.git ]; then |
|
|
|
rm -rf "$PWD"/* "$PWD"/{.version,.env} || return 1 |
|
|
|
else |
|
|
|
err "Can't find the '.git' directory in ${GOGOCARTO_CODE}." |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
curl -L "$GOGOCARTO_URL" | tar xj || { |
|
|
|
err "Couldn't download $GOGOCARTO_URL." |
|
|
|
return 1 |
|
|
|
} |
|
|
|
echo "$GOGOCARTO_RELEASE" > .version |
|
|
|
git add -A . || { |
|
|
|
err "'git add -A .' in '${GOGOCARTO_CODE}' failed." |
|
|
|
return 1 |
|
|
|
} |
|
|
|
if git diff --staged -s --exit-code; then |
|
|
|
info "No differences with last saved version." |
|
|
|
else |
|
|
|
git commit -m "Release $GOGOCARTO_RELEASE" || { |
|
|
|
err "'git commit' failed." |
|
|
|
return 1 |
|
|
|
} |
|
|
|
if git diff --staged -s --exit-code; then |
|
|
|
info "No differences with last saved version." |
|
|
|
else |
|
|
|
git commit -m "Release $GOGOCARTO_RELEASE" || { |
|
|
|
err "'git commit' failed." |
|
|
|
return 1 |
|
|
|
} |
|
|
|
rm -rf "$SERVICE_DATASTORE/var/cache/gogocarto/"* |
|
|
|
fi |
|
|
|
rm -rf "$SERVICE_DATASTORE/var/cache/gogocarto/"* |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|