Browse Source

Optimized Update script and WP-CLI setup

bugfixes
gau1991 11 years ago
parent
commit
dea32668b8
  1. 34
      bin/update
  2. 6
      src/vendor/ee_ven_install_wpcli.sh

34
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,26 +395,10 @@ 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
# Install WP-CLI
ee_ven_install_wpcli
fi
# Update EasyEngine current version
EE_CURRENT_VERSION="2.0.1"
fi
if [[ $EE_CURRENT_VERSION = 2.0.1 ]]; then
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
fi
fi
if [[ $EE_CURRENT_VERSION < 2.1.0 ]];then
# 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
@ -427,6 +411,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
|| ee_lib_error "Unable to change EasyEngine admin port, 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 \
@ -441,11 +426,14 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
# 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

6
src/vendor/ee_ven_install_wpcli.sh

@ -2,7 +2,10 @@
function ee_ven_install_wpcli()
{
if [ ! -f /usr/bin/wp ]; then
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 = " $?
@ -14,4 +17,5 @@ function ee_ven_install_wpcli()
# 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
}

Loading…
Cancel
Save