Skip to content

Commit 9830552

Browse files
committed
Extract composer install to separate script
1 parent c989da5 commit 9830552

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

.evergreen/install-dependencies.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ install_extension ()
3838
fi
3939

4040
sudo cp ${PROJECT_DIRECTORY}/.evergreen/config/php.ini ${PHP_PATH}/lib/php.ini
41+
42+
php --ri mongodb
43+
}
44+
45+
install_composer ()
46+
{
47+
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
48+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
49+
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
50+
51+
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
52+
>&2 echo 'ERROR: Invalid installer checksum'
53+
rm composer-setup.php
54+
exit 1
55+
fi
56+
57+
php composer-setup.php --quiet
58+
RESULT=$?
59+
rm composer-setup.php
60+
exit $RESULT
4161
}
4262

4363
# Functions to fetch MongoDB binaries
@@ -88,12 +108,6 @@ OLD_PATH=$PATH
88108
PATH=$PHP_PATH/bin:$OLD_PATH
89109

90110
install_extension
91-
92-
php --ri mongodb
93-
94-
# Install composer
95-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
96-
php composer-setup.php
97-
php -r "unlink('composer-setup.php');"
111+
install_composer
98112

99113
php composer.phar update $COMPOSER_FLAGS

0 commit comments

Comments
 (0)