#!/bin/bash -xe
-# install composer
-curl -sS https://getcomposer.org/installer | php
-mv composer.phar /usr/local/bin/composer
+# install composer if it's not already installed
+which composer || (\
+ curl -sS https://getcomposer.org/installer | php && \
+ mv composer.phar /usr/local/bin/composer && \
+:) && (\
+ composer self-update &&\
+:)
# use composer to install drush7 and the drush launcher
cd /var/www
composer require drush/drush:8.*
-wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar
-chmod +x drush.phar
-mv drush.phar /usr/local/bin/drush
+# ^^ PLEASE note that we're installing DRUSH 8, not Drupal 8. drush8 works fine with drupal7
+## actually don't install the drush launcher because it doesn't work with the latest release of drupal7
+#wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar
+#chmod +x drush.phar
+#mv drush.phar /usr/local/bin/drush
# use vendor/bin/drush to download drupal
cd /var/www