Skip to content

Commit

Permalink
update gitpod configuration to install composer programatically
Browse files Browse the repository at this point in the history
  • Loading branch information
austintoddj committed Oct 31, 2022
1 parent b6d61a3 commit 5a16467
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,26 @@ tasks:
# Reload the .bash_profile to utilize the composer-link() function
source ~/.bash_profile
# Install Composer v2.0
# Remove any existing Composer installation
sudo rm /usr/bin/composer
# Install Composer v2.0
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
# Make Composer globally accessible
sudo mv composer.phar /usr/bin/composer
cd /workspace
Expand Down

0 comments on commit 5a16467

Please sign in to comment.