1
0
mirror of https://github.com/php/systems.git synced 2026-03-23 23:32:12 +01:00
Files
archived-systems/install-composer
2025-06-19 18:17:51 +01:00

21 lines
588 B
Bash
Executable File

#!/bin/sh
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet --install-dir=/local
RESULT=$?
if [ ! -f /local/composer ]; then
ln -s /local/composer.phar /local/composer
fi
rm composer-setup.php
exit $RESULT