|
|
- #!/usr/bin/env bash
- #
- #
- #
-
- set -o errexit
- set -o pipefail
- set -o nounset
-
- _hash=${1:-}
-
- if [ -z "${_hash}" ]; then
- echo -e "\$1 is required, please check on https://composer.github.io/pubkeys.html"
- exit 0
- fi
-
- # installing dependencies
- apt install -y curl php-cli php-mbstring php-dom git unzip
-
- # download installer
- curl -sS https://getcomposer.org/installer -o composer-setup.php
-
- # check hash
- php -r "if (hash_file('SHA384', 'composer-setup.php') === '$_hash') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php --install-dir=/usr/local/bin --filename=composer
-
- # remove installer
- rm composer-setup.php
|