diff --git a/bin/update b/bin/update index 9da1d456..ae78248b 100644 --- a/bin/update +++ b/bin/update @@ -363,8 +363,8 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then fi # Update NGINX if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then - nginx -v 2>&1 | grep 1.6.0 &>> $EE_UPDATE_LOG - if [ $? -ne 0 ]; then + ls /etc/apt/sources.list.d/brianmercer-nginx* &>> $EE_UPDATE_LOG + if [ $? -eq 0 ]; then rm /etc/apt/sources.list.d/brianmercer-nginx* # Add rtCamp nginx launchpad repository ee_lib_echo "Adding rtCamp NGINX launchpad repository, please wait..." @@ -395,57 +395,45 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then done fi - if [[ $EE_CURRENT_VERSION = 2.0.0 ]]; then - dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG - if [ $? -eq 0 ]; then - - # WP-CLI change the installation method - rm -rf /usr/share/easyengine/wp-cli /usr/share/wp-cli /usr/bin/wp /etc/bash_completion.d/wp-completion.bash + if [[ $EE_CURRENT_VERSION = 2.0.0 ]] || [[ $EE_CURRENT_VERSION = 2.0.1 ]]; then + sed -i 's/host =.*/grant-host = localhost/' /etc/easyengine/ee.conf - # Install WP-CLI - ee_ven_install_wpcli + # Add Vimbadmin rules + if [ -f /etc/nginx/sites-available/22222 ];then + ee_port=$(grep listen /etc/nginx/sites-available/22222 | awk '{ print $2 }') + cp -av /usr/share/easyengine/nginx/22222 /etc/nginx/sites-available/ &>> $EE_UPDATE_LOG + if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then + sed -i "s/listen.*/listen $ee_port default_server ssl spdy;/" /etc/nginx/sites-available/22222 \ + || ee_lib_error "Unable to change EasyEngine admin port, exit status = " $? + elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then + # Dotdeb nginx repository doesn't support spdy + sed -i "s/listen.*/listen $ee_port default_server ssl;/" /etc/nginx/sites-available/22222 \ + || ee_lib_error "Unable to change EasyEngine admin port, exit status = " $? + fi fi - # Update EasyEngine current version - EE_CURRENT_VERSION="2.0.1" - fi - if [[ $EE_CURRENT_VERSION = 2.0.1 ]]; then - sed -i 's/host =.*/grant-host = localhost/' /etc/easyengine/ee.conf - fi - fi + if [ -d /var/www/22222/htdocs/db/anemometer ];then + # Download pt-query-advisor Fixed #189 + wget -q http://bazaar.launchpad.net/~percona-toolkit-dev/percona-toolkit/2.1/download/head:/ptquerydigest-20110624220137-or26tn4expb9ul2a-16/pt-query-digest -O /usr/bin/pt-query-advisor \ + || ee_lib_error "Unable to copy download pt-query-advisor, exit status = " $? + chmod 0755 /usr/bin/pt-query-advisor - if [[ $EE_CURRENT_VERSION < 2.1.0 ]];then - if [ -f /etc/nginx/sites-available/22222 ];then - ee_port=$(grep listen /etc/nginx/sites-available/22222 | awk '{ print $2 }') - cp -av /usr/share/easyengine/nginx/22222 /etc/nginx/sites-available/ &>> $EE_UPDATE_LOG - if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then - sed -i "s/listen.*/listen $ee_port default_server ssl spdy;/" /etc/nginx/sites-available/22222 \ - || ee_lib_error "Unable to change EasyEngine admin port, exit status = " $? - elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then - # Dotdeb nginx repository doesn't support spdy - sed -i "s/listen.*/listen $ee_port default_server ssl;/" /etc/nginx/sites-available/22222 \ - || ee_lib_error "Unable to change EasyEngine admin port, exit status = " $? + # Enable pt-query-advisor plugin in Anemometer + sed -i "s/# 'query_advisor'/ 'query_advisor'/" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \ + || ee_lib_error "Unable to to activate pt-query-advisor plugin, exit status = " $? fi - fi - if [ -d /var/www/22222/htdocs/db/anemometer ];then - # Download pt-query-advisor Fixed #189 - wget -q http://bazaar.launchpad.net/~percona-toolkit-dev/percona-toolkit/2.1/download/head:/ptquerydigest-20110624220137-or26tn4expb9ul2a-16/pt-query-digest -O /usr/bin/pt-query-advisor \ - || ee_lib_error "Unable to copy download pt-query-advisor, exit status = " $? - chmod 0755 /usr/bin/pt-query-advisor - - # Enable pt-query-advisor plugin in Anemometer - sed -i "s/# 'query_advisor'/ 'query_advisor'/" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \ - || ee_lib_error "Unable to to activate pt-query-advisor plugin, exit status = " $? + + # Update EasyEngine current version + EE_CURRENT_VERSION="2.1.0" fi - # Update EasyEngine current version - EE_CURRENT_VERSION="2.1.0" - fi - if [[ $EE_CURRENT_VERSION < 2.1.1 ]]; then - # Install WP-CLI - ee_ven_install_wpcli + # if [[ $EE_CURRENT_VERSION = 2.1.0 ]]; then + # fi fi + # Update WP-CLI + ee_ven_install_wpcli + # Restart service ee_lib_service nginx php5-fpm restart diff --git a/src/vendor/ee_ven_install_wpcli.sh b/src/vendor/ee_ven_install_wpcli.sh index 0a1f5a07..e7dc1abe 100644 --- a/src/vendor/ee_ven_install_wpcli.sh +++ b/src/vendor/ee_ven_install_wpcli.sh @@ -2,16 +2,20 @@ function ee_ven_install_wpcli() { - if [ ! -f /usr/bin/wp ]; then - ee_lib_echo "Downloading WP-CLI, please wait..." - wget -qO /usr/bin/wp https://github.com/wp-cli/wp-cli/releases/download/v${EE_WP_CLI_VERSION}/wp-cli.phar \ - || ee_lib_error "Unable to download WP-CLI, exit status = " $? + dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_COMMAND_LOG + if [ $? -eq 0 ]; then + ee_wp_cli_current=$(wp --allow-root --info 2> /dev/null | grep 'WP-CLI' | grep version | awk '{print $3}') + if [[ $ee_wp_cli_current < $EE_WP_CLI_VERSION ]]; then + ee_lib_echo "Downloading WP-CLI, please wait..." + wget -qO /usr/bin/wp https://github.com/wp-cli/wp-cli/releases/download/v${EE_WP_CLI_VERSION}/wp-cli.phar \ + || ee_lib_error "Unable to download WP-CLI, exit status = " $? - # Executable permission - chmod a+x /usr/bin/wp \ - || ee_lib_error "Unable to set executable permission for wp-cli, exit status = " $? + # Executable permission + chmod a+x /usr/bin/wp \ + || ee_lib_error "Unable to set executable permission for wp-cli, exit status = " $? - # Download auto completion - wget -qO /etc/bash_completion.d/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/v${EE_WP_CLI_VERSION}/utils/wp-completion.bash + # Download auto completion + wget -qO /etc/bash_completion.d/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/v${EE_WP_CLI_VERSION}/utils/wp-completion.bash + fi fi }