ansible-roles/composer/templates/composer-installer.j2

19 lines
634 B
Django/Jinja

#!/bin/bash
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
php -r "copy('{{ composer_get_url }}', '{{ composer_setup }}');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('{{ composer_signature_type }}', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php {{ composer_setup }} --install-dir={{ composer_dest_dir }} --filename={{ composer_exec_name }} --quiet
RESULT=$?
php -r "unlink('{{ composer_setup }}');"
chmod 755 {{ composer_dest_dir }}/{{ composer_exec_name }}
exit $RESULT