Commit 3c68977d authored by Guy Thouret's avatar Guy Thouret
Browse files

(chore) Adapt recommended composer install script into our setup to remove the...

(chore) Adapt recommended composer install script into our setup to remove the static hash comparison - Fixes #815
parent fd67bc47
Loading
Loading
Loading
Loading
+18 −5
Original line number Original line Diff line number Diff line
@@ -4,10 +4,23 @@
rm -rf ../vendor
rm -rf ../vendor


# Setup composer
# Setup composer
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
php composer-setup.php
php -r "unlink('composer-setup.php');"


# Grab dependencies
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
  >&2 echo 'ERROR: Invalid installer signature'
  rm composer-setup.php
  exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
if [ $RESULT -eq 0 ]; then
then
  php composer.phar install --ignore-platform-reqs
  php composer.phar install --ignore-platform-reqs
else
  >&2 echo 'ERROR: composer-setup.php failed'
fi