aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/mayor-base/bin/install-composer.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mayor-orig/mayor-base/bin/install-composer.sh')
-rwxr-xr-xmayor-orig/mayor-base/bin/install-composer.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/mayor-orig/mayor-base/bin/install-composer.sh b/mayor-orig/mayor-base/bin/install-composer.sh
new file mode 100755
index 00000000..a61aff80
--- /dev/null
+++ b/mayor-orig/mayor-base/bin/install-composer.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
+php -r "copy('https://getcomposer.org/installer', '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
+exit $RESULT