Skip to content

Commit

Permalink
Merge pull request #282 from NoelDeMartin/macos
Browse files Browse the repository at this point in the history
#188 Fix scripts in MacOS
  • Loading branch information
stronk7 authored Mar 12, 2024
2 parents a089f76 + fb86296 commit dabb6a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/moodle-docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ if [ -z "$MOODLE_DOCKER_APP_RUNTIME" ];
then
if [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]];
then
appversion="$(cat $MOODLE_DOCKER_APP_PATH/package.json | grep -oP '"version": "\K\d\.\d\.\d{1,2}(-\w+)?(?=")')"
appversion="$(cat $MOODLE_DOCKER_APP_PATH/package.json | sed -n -E 's/\s*"version": "([0-9]+\.[0-9]+\.[0-9]+)(.*)?",/\1/p')"
elif [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]];
then
appversion=$MOODLE_DOCKER_APP_VERSION
fi

if [[ ! -z $appversion ]];
then
if [[ ! -z "$(echo $appversion | grep -oP '\d\.\d\.\d{1,2}')" ]];
if [[ ! -z "$(echo $appversion | sed -n -E 's/([0-9]+\.[0-9]+\.[0-9]+)/\1/p')" ]];
then
appmajorversion="$(echo $appversion | grep -oP '\d(?=\.\d\.\d{1,2})')"
appminorversion="$(echo $appversion | grep -oP '\d\.\K\d(?=\.\d{1,2})')"
appmajorversion="$(echo $appversion | sed -n -E 's/([0-9]+)\.[0-9]+\.[0-9]+/\1/p')"
appminorversion="$(echo $appversion | sed -n -E 's/[0-9]+\.([0-9]+)\.[0-9]+/\1/p')"

if (( $appmajorversion > 4 || $appminorversion > 3));
then
Expand All @@ -103,7 +103,7 @@ fi
# Guess mobile app node version (only for local app development)
if [[ -z "$MOODLE_DOCKER_APP_NODE_VERSION" ]] && [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]];
then
appnodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | grep -oP '(\d+\.?)+' || true)"
appnodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | sed -E "s/v(([0-9]+\.?)+)/\1/" || true)"

export MOODLE_DOCKER_APP_NODE_VERSION="$appnodeversion"
fi
Expand Down

0 comments on commit dabb6a6

Please sign in to comment.