mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 05:23:03 +07:00
Improve composer installer on darwin
- Check to signature. - Add error handling.
This commit is contained in:
parent
c6f956927a
commit
a0b0e58cb3
@ -6,9 +6,23 @@ ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s
|
|||||||
ext_dir=$(/usr/bin/php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
ext_dir=$(/usr/bin/php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||||
sudo chmod 777 "$ini_file"
|
sudo chmod 777 "$ini_file"
|
||||||
mkdir -p "$(pecl config-get ext_dir)"
|
mkdir -p "$(pecl config-get ext_dir)"
|
||||||
curl -sS https://getcomposer.org/installer | php
|
if [ ! -e "/usr/bin/composer" ]; then
|
||||||
chmod +x composer.phar
|
EXPECTED_SIGNATURE="$(curl -s https://composer.github.io/installer.sig)"
|
||||||
mv composer.phar /usr/local/bin/composer
|
curl -s -L https://getcomposer.org/installer > composer-setup.php
|
||||||
|
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
|
||||||
|
|
||||||
|
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then
|
||||||
|
>&2 echo 'ERROR: Invalid installer signature'
|
||||||
|
rm composer-setup.php
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMPOSER_ALLOW_SUPERUSER=1
|
||||||
|
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||||
|
RESULT=$?
|
||||||
|
rm composer-setup.php
|
||||||
|
exit $RESULT
|
||||||
|
fi
|
||||||
composer global require hirak/prestissimo
|
composer global require hirak/prestissimo
|
||||||
php -v
|
php -v
|
||||||
composer -V
|
composer -V
|
Loading…
Reference in New Issue
Block a user