Skip to content

Instantly share code, notes, and snippets.

@yvh
Last active May 3, 2018 07:58
Show Gist options
  • Save yvh/686465fcdfde293a25dba4f338888052 to your computer and use it in GitHub Desktop.
Save yvh/686465fcdfde293a25dba4f338888052 to your computer and use it in GitHub Desktop.
Installer for composer by shell script
#!/usr/bin/env bash
# Author Yannick Vanhaeren
curl -Ss https://getcomposer.org/installer -o composer-setup.php
sha384sum -c <<< "`curl -Ss https://composer.github.io/installer.sig` composer-setup.php"
if [ $? -eq 0 ]; then
FILENAME="composer"
if [ -n "$1" ]; then
FILENAME="$1"
fi
mkdir -p /usr/local/bin
php composer-setup.php --quiet --install-dir=/usr/local/bin --filename=$FILENAME
RESULT=$?
rm composer-setup.php
exit $RESULT
else
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment