diff --git a/src/scripts/common.sh b/src/scripts/common.sh index 35d13e67..80e06741 100644 --- a/src/scripts/common.sh +++ b/src/scripts/common.sh @@ -7,9 +7,10 @@ export jit_versions="8.[0-9]" export nightly_versions="8.[1-9]" export xdebug3_versions="7.[2-4]|8.[0-9]" export tool_path_dir="/usr/local/bin" -export composer_bin="$HOME/.composer/vendor/bin" -export composer_json="$HOME/.composer/composer.json" -export composer_lock="$HOME/.composer/composer.lock" +export composer_home="$HOME/.composer" +export composer_bin="$composer_home/vendor/bin" +export composer_json="$composer_home/composer.json" +export composer_lock="$composer_home/composer.lock" export latest="releases/latest/download" export github="https://github.com/shivammathur" export jsdeliver="https://cdn.jsdelivr.net/gh/shivammathur" @@ -232,10 +233,14 @@ configure_composer() { add_log "$cross" "composer" "Could not download composer" exit 1 fi + if ! [ -d "$composer_home" ]; then + sudo -u "$(id -un)" -g "$(id -gn)" mkdir -p -m=00755 "$composer_home" + else + sudo chown -R "$(id -un)":"$(id -gn)" "$composer_home" + fi if ! [ -e "$composer_json" ]; then - sudo mkdir -p "$(dirname "$composer_json")" echo '{}' | tee "$composer_json" >/dev/null - sudo chmod 644 "$composer_json" + chmod 644 "$composer_json" fi composer -q config -g process-timeout 0 echo "$composer_bin" >>"$GITHUB_PATH"