WIP add a Docker-based test env
[plcapi.git] / tests / ci / setup / get_composer.sh
1 #!/bin/sh
2
3 # Installs Composer (latest version, to avoid relying on old ones bundled with the OS)
4 # @todo allow users to lock down to Composer v1 if needed
5
6 EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
7 php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
8 ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
9
10 if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
11 then
12     >&2 echo 'ERROR: Invalid installer signature'
13     rm composer-setup.php
14     exit 1
15 fi
16
17 php composer-setup.php --install-dir=/usr/local/bin
18 RESULT=$?
19 rm composer-setup.php
20 exit $RESULT