diff --git a/monujo/lib/common b/monujo/lib/common index 9b4048e..1ef0efb 100644 --- a/monujo/lib/common +++ b/monujo/lib/common @@ -1,11 +1,11 @@ - +# -*- mode: shell-script -*- APP_NAME=monujo SOURCE_URL="https://docker.0k.io/downloads" LOCATION="$SERVICE_CONFIGSTORE/opt/apps/$APP_NAME" CONFIGFILE="$LOCATION/config.json" -version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } +version_gt() { test "$(semver "$@" | head -n 1)" != "$1"; } monujo:get_source_url() { @@ -35,11 +35,14 @@ monujo:code_init() { fi fi if [ -d "$LOCATION" ]; then - find "$LOCATION" -mindepth 1 -delete + find "$LOCATION" -mindepth 1 -delete || return 1 else - mkdir -p "$LOCATION" + mkdir -p "$LOCATION" || return 1 fi - cd "$LOCATION" + cd "$LOCATION" || { + err "Couldn't cd to '$LOCATION'." + return 1 + } source_url="$(monujo:get_source_url "$APP_NAME" "$version")" info "Downloading '$source_url'." wget -q "$source_url" -O file.tar.bz2 || {