Commit 7d1ce931 authored by ergonlogic's avatar ergonlogic

Issue #2619158: Switch to the latest Drush 8 phar by default.

parent 4eb2a454
...@@ -51,27 +51,61 @@ case "$1" in ...@@ -51,27 +51,61 @@ case "$1" in
# fix permissions on installed directories # fix permissions on installed directories
chown aegir:aegir "$VARLIB" chown aegir:aegir "$VARLIB"
# Install composer.
COMPOSER_HOME="$HOME/.composer"
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
db_get "aegir/drush_version" db_get "aegir/drush_version"
DRUSH_VERSION="$RET" DRUSH_VERSION="$RET"
DRUSH_MAJOR_VERSION=$(echo $DRUSH_VERSION| cut -d. -f1)
if [ "$DRUSH_VERSION" = "stable" ]; then
DRUSH_PHAR_URL="http://files.drush.org/drush.phar"
elif [ "$DRUSH_VERSION" = "unstable" ]; then
DRUSH_PHAR_URL="http://files.drush.org/drush-unstable.phar"
elif [ "$DRUSH_MAJOR_VERSION" -ge "8" ]; then
DRUSH_PHAR_URL="https://github.com/drush-ops/drush/releases/download/$DRUSH_VERSION/drush.phar"
fi
if [ -n "$DRUSH_PHAR_URL" ]; then
curl -Ss $DRUSH_PHAR_URL -o drush
chmod +x drush
DRUSH_PATH="/usr/local/bin/drush"
# Rename an old drush executable.
if [ -f $DRUSH_PATH ]; then
mv $DRUSH_PATH $DRUSH_PATH-old-$(date +'%Y-%m-%d')
fi
mv drush $DRUSH_PATH
else # Drush versions prior to 8 aren't available as .phar's.
# Install composer.
COMPOSER_HOME="$HOME/.composer"
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
# Install Drush.
su -c "composer global require drush/drush:$DRUSH_VERSION" aegir
# Add composer's bin dir to the $PATH.
echo "export PATH=\"\$HOME/.composer/vendor/bin:\$PATH\"" >> ~aegir/.bashrc
# Install Drush. # Rename an old drush executable.
su -c "composer global require drush/drush:$DRUSH_VERSION" aegir if [ -f /usr/local/bin/drush ]; then
mv /usr/local/bin/drush /usr/local/bin/drush-old-$(date +'%Y-%m-%d')
fi
# Add composer's bin dir to the $PATH. # Symlink Drush for other users to use.
echo "export PATH=\"\$HOME/.composer/vendor/bin:\$PATH\"" >> ~aegir/.bashrc ln -s ~aegir/.composer/vendor/bin/drush /usr/local/bin
# Rename an old drush executable.
if [ -f /usr/local/bin/drush ]; then
mv /usr/local/bin/drush /usr/local/bin/drush-old-$(date +'%Y-%m-%d')
fi fi
# Symlink Drush for other users to use.
ln -s ~aegir/.composer/vendor/bin/drush /usr/local/bin
;; ;;
abort-upgrade|abort-remove|abort-deconfigure) abort-upgrade|abort-remove|abort-deconfigure)
......
Template:aegir/drush_version Template:aegir/drush_version
Type: string Type: string
Default: 8.0.0 Default: stable
Description: Drush version to use. Description: Drush version to use. "stable" will fetch the latest release.
"unstable" will fetch the daily dev build. Otherwise, specify a version
number, e.g. "8.0.3".
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment