#!/usr/bin/env sh

wget -O /usr/local/bin/composer https://getcomposer.org/download/1.2.1/composer.phar
chmod +x /usr/local/bin/composer

#EXPECTED_SIGNATURE=$(wget https://composer.github.io/installer.sig -O - -q)
#/opt/remi/php56/root/usr/bin/php -r "copy('https://getcomposer.org/installer', '/tmp/composer/composer-setup.php');"
#ACTUAL_SIGNATURE=$(/opt/remi/php56/root/usr/bin/php -r "echo hash_file('SHA384', '/tmp/composer/composer-setup.php');")

#if [ "$EXPECTED_SIGNATURE" = "$ACTUAL_SIGNATURE" ]
#then
#    echo "Signature ok, installing"
#    mkdir -p /tmp/composer/bin/
#    /opt/remi/php56/root/usr/bin/php /tmp/composer/composer-setup.php --install-dir=/tmp/composer/bin/ --filename=composer --no-ansi
#    RESULT=$?
#    rm /tmp/composer/composer-setup.php
#    if [ -f /tmp/composer/bin/composer ]; then
#        mv /tmp/composer/bin/composer /usr/local/bin/composer
#        rm -fr /tmp/composer/bin
#    fi
#    exit $RESULT
#else
#    >&2 echo 'ERROR: Invalid installer signature'
#    rm /tmp/composer/composer-setup.php
#    exit 1
#fi
