Skip to content

Instantly share code, notes, and snippets.

@jamesdube
Last active March 20, 2020 09:40
Show Gist options
  • Save jamesdube/80bd63b6c034a5601454fbe9875c16d0 to your computer and use it in GitHub Desktop.
Save jamesdube/80bd63b6c034a5601454fbe9875c16d0 to your computer and use it in GitHub Desktop.
Script to install composer
#!/bin/sh
EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
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
RESULT=$?
mv composer.phar /usr/local/bin/composer
rm composer-setup.php
exit $RESULT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment