Browse Source

eeupdate script

old-stable
Mitesh Shah 10 years ago
parent
commit
c56dde7875
  1. 187
      bin/eeupdate
  2. 3
      bin/install.sh
  3. 120
      bin/update

187
bin/eeupdate

@ -0,0 +1,187 @@
#!/bin/bash
# Define variables
readonly EE_UPDATE_LOG=/var/log/easyengine/update.log
# Define echo function
# Blue color
function ee_lib_echo()
{
echo $(tput setaf 4)$@$(tput sgr0)
}
# White color
function ee_lib_echo_info()
{
echo $(tput setaf 7)$@$(tput sgr0)
}
# Red color
function ee_lib_echo_fail()
{
echo $(tput setaf 1)$@$(tput sgr0)
}
# Capture errors
function ee_lib_error()
{
echo "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG
exit $2
}
# Initialize Git
function ee_lib_git()
{
for ee_git_dir in ${@:1:$(($#-1))}; do
# Change directory
cd $ee_git_dir || ee_lib_error "Unable to change directory $ee_git_dir, exit status = " $?
# Check .git
if [ ! -d .git ]; then
# ee_lib_echo "Initialize Git on ${ee_git_dir}"
git init &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to initialize Git on $ee_git_dir, exit status = " $?
fi
# Check for untracked files
if [ $(git status -s | wc -l) -ne 0 ]; then
# Add files in Git version control
ee_lib_echo "Git commit on $ee_git_dir, please wait..."
git add --all && git commit -am "${@: -1}" &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to Git commit on $ee_git_dir, exit status = " $?
fi
done
}
# Update EasyEngine (ee)
EE_CURRENT_VERSION=$(ee version | awk '{print($3)}')
EE_LATEST_VERSION=$(curl -sL https://api.github.com/repos/rtCamp/easyengine/releases | grep tag_name | awk '{print($2)}' | cut -d'"' -f2 | cut -c2- | head -n1)
echo EE_CURRENT_VERSION = $EE_CURRENT_VERSION EE_LATEST_VERSION = $EE_LATEST_VERSION &>> $EE_UPDATE_LOG
if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
read -p "Update EasyEngine to $EE_LATEST_VERSION (y/n): " EE_ANS
if [ "$EE_ANS" = "y" ] || [ "$EE_ANS" = "Y" ]; then
ee_lib_echo "EasyEngine (ee) update started [$(date)]" | tee -ai $EE_UPDATE_LOG
# Git backup
ee_lib_git /etc/nginx/ /etc/php5/ /etc/mysql/ /etc/postfix /etc/easyengine "EasyEngine version $EE_CURRENT_VERSION"
# Remove old version of EasyEngine (ee)
rm -rf /tmp/easyengine &>> /dev/null
# Let's clone EasyEngine (ee)
ee_lib_echo "Cloning EasyEngine (ee) stable branch, please wait..." | tee -ai $EE_UPDATE_LOG
git clone -b stable https://github.com/rtCamp/easyengine.git /tmp/easyengine &>> $EE_UPDATE_LOG \
|| ee_lib_error "Unable to clone EasyEngine (ee) stable branch, exit status = " $?
# Setup EasyEngine (ee)
if [ ! -d /etc/easyengine ]; then
mkdir -p /etc/easyengine \
|| ee_lib_error "Unable to create /etc/easyengine directory, exit status = " $?
fi
if [ ! -d /usr/share/easyengine/ ]
then
mkdir -p /usr/share/easyengine/ \
|| ee_lib_error "Unable to create /usr/share/easyengine/ directory, exit status = " $?
fi
if [ ! -d /usr/local/lib/easyengine ]
then
mkdir -p /usr/local/lib/easyengine \
|| ee_lib_error "Unable to create /usr/local/lib/easyengine directory, exit status = " $?
fi
# Setup EasyEngine (ee)
# EasyEngine (ee) auto completion file
cp -av /tmp/easyengine/config/bash_completion.d/ee /etc/bash_completion.d/ \
|| ee_lib_error "Unable to copy EasyEngine (ee) auto completion file, exit status = " $?
# Templates
cp -a /tmp/easyengine/config/nginx /tmp/easyengine/templates/* /usr/share/easyengine/ \
|| ee_lib_error "Unable to copy NGINX sample files, exit status = " $?
# NGINX COMMON
rsync -avz --exclude acl.conf /usr/share/easyengine/nginx/common/* /etc/nginx/common/ \
|| ee_lib_error "Unable to rsync NGINX common files, exit status = " $?
# EasyEngine (ee) library and modules
cp -av /tmp/easyengine/src/* /usr/local/lib/easyengine \
|| ee_lib_error "Unable to copy src files, exit status = " $?
# EasyEngine (ee) command
cp -av /tmp/easyengine/bin/easyengine /usr/local/sbin/ \
|| ee_lib_error "Unable to copy EasyEngine (ee) command, exit status = " $?
# Change permission of EasyEngine (ee) command
chmod 750 /usr/local/sbin/easyengine || ee_lib_error "Unable to change permission of EasyEngine (ee) command, exit status = " $?
# Create symbolic link
if [ ! -L /usr/local/sbin/ee ]; then
ln -s /usr/local/sbin/easyengine /usr/local/sbin/ee
fi
# EasyEngine (ee) man page
cp -av /tmp/easyengine/docs/man/ee.8 /usr/share/man/man8/ &>> $EE_UPDATE_LOG \
|| ee_lib_error "Unable to copy EasyEngine (ee) man page, exit status = " $?
if [[ $EE_CURRENT_VERSION < 2.0.0 ]]; then
# Lets used our code
# Include library
for ee_include in $(find /usr/local/lib/easyengine/ -iname "*.sh"); do
source $ee_include
done
# EasyEngine (ee) config file
cp /etc/easyengine/ee.conf /etc/easyengine/ee.bak
cp -av /tmp/easyengine/config/easyengine/ee.conf /etc/easyengine/ \
|| ee_lib_error "Unable to copy EasyEngine (ee) config file, exit status = " $?
# Get old value from ee.bak file
local ee_stack_ip=$(grep ip_address /etc/easyengine/ee.bak | cut -d'=' -f2)
local ee_auth_user=$(grep htpasswduser /etc/easyengine/ee.bak | cut -d'=' -f2)
local ee_auth_pass=$(grep htpasswdpass /etc/easyengine/ee.bak | cut -d'=' -f2)
local ee_mysql_host=$(grep mysqlhost /etc/easyengine/ee.bak | cut -d'=' -f2)
local ee_wp_user=$(grep wpadminuser /etc/easyengine/ee.bak | cut -d'=' -f2)
local ee_wp_pass=$(grep wpadminpass /etc/easyengine/ee.bak | cut -d'=' -f2)
local ee_wp_email=$(grep wpadminemail /etc/easyengine/ee.bak | cut -d'=' -f2)
# Update value in ee.conf file
$EE_CONFIG_SET stack.ip-address "$ee_stack_ip" && \
$EE_CONFIG_SET auth.user "$ee_auth_user" && \
$EE_CONFIG_SET auth.password "$ee_auth_pass" && \
$EE_CONFIG_SET mysql.host "$ee_mysql_host" && \
$EE_CONFIG_SET wordpress.user "$ee_wp_user" && \
$EE_CONFIG_SET wordpress.password "$ee_wp_pass" && \
$EE_CONFIG_SET wordpress.email "$ee_wp_email" \
|| ee_lib_error "Unable to update ee.conf file, exit status = " $?
# # NGINX conf.d
cp -v /usr/share/easyengine/nginx/conf.d/fastcgi.conf /etc/nginx/conf.d/ \
|| ee_lib_error "Unable to copy fastcgi.conf file, exit status = " $?
grep debug /etc/nginx/conf.d/upstream.conf &>> $EE_UPDATE_LOG
if [ $? -ne 0 ]; then
cp -v /usr/share/easyengine/nginx/conf.d/upstream.conf /etc/nginx/conf.d/ \
|| ee_lib_error "Unable to copy upstream.conf file, exit status = " $?
fi
# Install required packages
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then
ee_lib_package_check graphviz python-software-properties software-properties-common
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then
ee_lib_package_check graphviz python-software-properties
fi
if [ ! -x /usr/bin/tee ] || [ ! -x /bin/ed ] || [ ! -x /usr/bin/bc ] || [ ! -x /usr/bin/wget ] || [ ! -x /usr/bin/curl ] || [ ! -x /bin/tar ] || [ ! -x /usr/bin/git ] || [ -n "$EE_PACKAGE_NAME" ]; then
ee_lib_echo "Installing required packages, please wait..." | tee -ai $EE_UPDATE_LOG
apt-get -y install coreutils ed bc wget curl tar git-core $EE_PACKAGE_NAME | tee -ai $EE_UPDATE_LOG\
|| ee_lib_error "Unable to install required packages, exit status = " $?
fi
fi
fi
fi

3
bin/install.sh

@ -118,7 +118,8 @@ rm -rf /tmp/easyengine &>> /dev/null
# Let's clone EasyEngine (ee) # Let's clone EasyEngine (ee)
ee_lib_echo "Cloning EasyEngine (ee) $BRANCH branch, please wait..." | tee -ai $EE_INSTALL_LOG ee_lib_echo "Cloning EasyEngine (ee) $BRANCH branch, please wait..." | tee -ai $EE_INSTALL_LOG
git clone -b $BRANCH https://github.com/rtCamp/easyengine.git /tmp/easyengine &>> $EE_INSTALL_LOG || ee_lib_error "Unable to clone EasyEngine (ee) $BRANCH branch, exit status = " $? git clone -b $BRANCH https://github.com/rtCamp/easyengine.git /tmp/easyengine &>> $EE_INSTALL_LOG \
|| ee_lib_error "Unable to clone EasyEngine (ee) $BRANCH branch, exit status = " $?
# Setup EasyEngine (ee) # Setup EasyEngine (ee)

120
bin/update

@ -2,13 +2,13 @@
# Make Variables Available For Later Use # Make Variables Available For Later Use
INSTALLLOG=/var/log/easyengine/install.log EE_UPDATE_LOG=/var/log/easyengine/install.log
LINUX_DISTRO=$(lsb_release -i |awk '{print $3}') LINUX_DISTRO=$(lsb_release -i |awk '{print $3}')
# Capture Errors # Capture Errors
OwnError() OwnError()
{ {
echo -e "[ `date` ] \033[31m$@\e[0m" | tee -ai $INSTALLLOG echo -e "[ `date` ] \033[31m$@\e[0m" | tee -ai $EE_UPDATE_LOG
exit 101 exit 101
} }
@ -22,14 +22,14 @@ GITCOMMIT ()
then then
# Initialise Git # Initialise Git
echo -e "\033[34mInitialise Git On $EEGITDIR...\e[0m" echo -e "\033[34mInitialise Git On $EEGITDIR...\e[0m"
git init &>> $INSTALLLOG || OwnError "Unable To Initialize Git On $EEGITDIR" git init &>> $EE_UPDATE_LOG || OwnError "Unable To Initialize Git On $EEGITDIR"
fi fi
# Check For Untracked Files # Check For Untracked Files
if [ $(git status -s | wc -l) -ne 0 ] if [ $(git status -s | wc -l) -ne 0 ]
then then
# Add Files In Git Version Control # Add Files In Git Version Control
git add --all && git commit -am "$EEGITMESSAGE" &>> $INSTALLLOG \ git add --all && git commit -am "$EEGITMESSAGE" &>> $EE_UPDATE_LOG \
|| OwnError "Unable To Git Commit On $EEGITDIR" || OwnError "Unable To Git Commit On $EEGITDIR"
fi fi
} }
@ -38,21 +38,21 @@ EEUPDATE()
{ {
# Clone EasyEngine (ee) Stable Repository # Clone EasyEngine (ee) Stable Repository
rm -rf /tmp/easyengine rm -rf /tmp/easyengine
echo -e "\033[34mUpdating EasyEngine (ee), Please Wait...\e[0m" | tee -ai $INSTALLLOG echo -e "\033[34mUpdating EasyEngine (ee), Please Wait...\e[0m" | tee -ai $EE_UPDATE_LOG
git clone -b stable git://github.com/rtCamp/easyengine.git /tmp/easyengine &>> $INSTALLLOG || OwnError "Unable To Clone Easy Engine" git clone -b stable git://github.com/rtCamp/easyengine.git /tmp/easyengine &>> $EE_UPDATE_LOG || OwnError "Unable To Clone Easy Engine"
# EasyEngine (ee) /etc Files # EasyEngine (ee) /etc Files
cp -a /tmp/easyengine/etc/bash_completion.d/ee /etc/bash_completion.d/ &>> $INSTALLLOG || OwnError "Unable To Copy EE Auto Complete File" cp -a /tmp/easyengine/etc/bash_completion.d/ee /etc/bash_completion.d/ &>> $EE_UPDATE_LOG || OwnError "Unable To Copy EE Auto Complete File"
# EE /usr/share/easyengine Files # EE /usr/share/easyengine Files
cp -a /tmp/easyengine/etc/nginx/* /usr/share/easyengine/nginx/ &>> $INSTALLLOG || OwnError "Unable To Copy Configuration Files " cp -a /tmp/easyengine/etc/nginx/* /usr/share/easyengine/nginx/ &>> $EE_UPDATE_LOG || OwnError "Unable To Copy Configuration Files "
cp -a /tmp/easyengine/usr/share/easyengine/* /usr/share/easyengine/ &>> $INSTALLLOG || OwnError "Unable To Copy Configuration Files " cp -a /tmp/easyengine/usr/share/easyengine/* /usr/share/easyengine/ &>> $EE_UPDATE_LOG || OwnError "Unable To Copy Configuration Files "
# EE Command # EE Command
cp -a /tmp/easyengine/usr/local/sbin/easyengine /usr/local/sbin/ &>> $INSTALLLOG || OwnError "Unable To Copy EasyEngine Command" cp -a /tmp/easyengine/usr/local/sbin/easyengine /usr/local/sbin/ &>> $EE_UPDATE_LOG || OwnError "Unable To Copy EasyEngine Command"
# EE Man Pages # EE Man Pages
cp -a /tmp/easyengine/man/ee.8 /usr/share/man/man8/ &>> $INSTALLLOG || OwnError "Unable To Copy EasyEngine Man Pages" cp -a /tmp/easyengine/man/ee.8 /usr/share/man/man8/ &>> $EE_UPDATE_LOG || OwnError "Unable To Copy EasyEngine Man Pages"
# Change Permission For EE # Change Permission For EE
chmod 750 /usr/local/sbin/easyengine || OwnError "Unable To Change EasyEngine Command Permission" chmod 750 /usr/local/sbin/easyengine || OwnError "Unable To Change EasyEngine Command Permission"
@ -70,9 +70,9 @@ EEUPDATE()
if [ -z "$EEGITNAME" ] || [ -z "$EEGITEMAIL" ] if [ -z "$EEGITNAME" ] || [ -z "$EEGITEMAIL" ]
then then
echo echo
echo -e "\033[34mEasyEngine (ee) Required Your Name & Email Address To Track Changes You Made Under The Git\e[0m" | tee -ai $INSTALLLOG echo -e "\033[34mEasyEngine (ee) Required Your Name & Email Address To Track Changes You Made Under The Git\e[0m" | tee -ai $EE_UPDATE_LOG
echo -e "\033[34mEasyEngine (ee) Will Be Able To Send You Daily Reports & Alerts In Upcoming Version\e[0m" | tee -ai $INSTALLLOG echo -e "\033[34mEasyEngine (ee) Will Be Able To Send You Daily Reports & Alerts In Upcoming Version\e[0m" | tee -ai $EE_UPDATE_LOG
echo -e "\033[34mEasyEngine (ee) Will NEVER Send Your Information Across\e[0m" | tee -ai $INSTALLLOG echo -e "\033[34mEasyEngine (ee) Will NEVER Send Your Information Across\e[0m" | tee -ai $EE_UPDATE_LOG
fi fi
# Check Git User Is Empty Or Not # Check Git User Is Empty Or Not
if [ -z "$EEGITNAME" ] if [ -z "$EEGITNAME" ]
@ -83,7 +83,7 @@ EEUPDATE()
then then
EEGITNAME=$(whoami) EEGITNAME=$(whoami)
fi fi
git config --global user.name "$EEGITNAME" &>> $INSTALLLOG git config --global user.name "$EEGITNAME" &>> $EE_UPDATE_LOG
fi fi
# Check Git User Is Empty Or Not # Check Git User Is Empty Or Not
@ -95,7 +95,7 @@ EEUPDATE()
then then
EEGITEMAIL=$(whoami)@$(hostname -f) EEGITEMAIL=$(whoami)@$(hostname -f)
fi fi
git config --global user.email $EEGITEMAIL &>> $INSTALLLOG git config --global user.email $EEGITEMAIL &>> $EE_UPDATE_LOG
fi fi
} }
@ -150,7 +150,7 @@ MYCNFCHECK()
EE101() EE101()
{ {
# EasyEngine (ee) /etc Files # EasyEngine (ee) /etc Files
cp -a /tmp/easyengine/etc/easyengine/ee.conf /etc/easyengine/ &>> $INSTALLLOG || OwnError "Unable To Copy ee.conf File" cp -a /tmp/easyengine/etc/easyengine/ee.conf /etc/easyengine/ &>> $EE_UPDATE_LOG || OwnError "Unable To Copy ee.conf File"
# Let Copy Some Missing Files & Chnage Nginx As Per Latest EasyEngine # Let Copy Some Missing Files & Chnage Nginx As Per Latest EasyEngine
(sed "/allow/,+2d" /usr/share/easyengine/nginx/common/acl.conf; grep -v ^# /etc/nginx/common/allowed_ip.conf ) > /etc/nginx/common/acl.conf (sed "/allow/,+2d" /usr/share/easyengine/nginx/common/acl.conf; grep -v ^# /etc/nginx/common/allowed_ip.conf ) > /etc/nginx/common/acl.conf
@ -160,7 +160,7 @@ EE101()
sed -i "s/.*\$body_bytes_sent'/\t\t'\$http_host \"\$request\" \$status \$body_bytes_sent '/" /etc/nginx/nginx.conf sed -i "s/.*\$body_bytes_sent'/\t\t'\$http_host \"\$request\" \$status \$body_bytes_sent '/" /etc/nginx/nginx.conf
# Check SSL Settings # Check SSL Settings
grep ssl_ /etc/nginx/nginx.conf &>> $INSTALLLOG grep ssl_ /etc/nginx/nginx.conf &>> $EE_UPDATE_LOG
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
sed -i "/client_max_body_size/a \ \n\t# SSL Settings\n\tssl_session_cache shared:SSL:20m;\n\tssl_session_timeout 10m;\n\tssl_prefer_server_ciphers on;\n\tssl_ciphers HIGH:\!aNULL:\!MD5:\!kEDH;\n\n" /etc/nginx/nginx.conf sed -i "/client_max_body_size/a \ \n\t# SSL Settings\n\tssl_session_cache shared:SSL:20m;\n\tssl_session_timeout 10m;\n\tssl_prefer_server_ciphers on;\n\tssl_ciphers HIGH:\!aNULL:\!MD5:\!kEDH;\n\n" /etc/nginx/nginx.conf
@ -231,11 +231,11 @@ PHP_PACKAGES()
# Download Webgrind # Download Webgrind
echo -e "\033[34mCloning Webgrind, Please Wait...\e[0m" echo -e "\033[34mCloning Webgrind, Please Wait...\e[0m"
git clone https://github.com/jokkedk/webgrind.git /var/www/22222/htdocs/php/webgrind/ &>> $INSTALLLOG || OwnError "Unable To Clone Webgrind" git clone https://github.com/jokkedk/webgrind.git /var/www/22222/htdocs/php/webgrind/ &>> $EE_UPDATE_LOG || OwnError "Unable To Clone Webgrind"
sed -i "s'/usr/local/bin/dot'/usr/bin/dot'" /var/www/22222/htdocs/php/webgrind/config.php sed -i "s'/usr/local/bin/dot'/usr/bin/dot'" /var/www/22222/htdocs/php/webgrind/config.php
# Install Graphviz # Install Graphviz
dpkg -l | grep graphviz &>> $INSTALLLOG dpkg -l | grep graphviz &>> $EE_UPDATE_LOG
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo -e "\033[34mInstalling Graphviz, Please Wait...\e[0m" echo -e "\033[34mInstalling Graphviz, Please Wait...\e[0m"
@ -272,7 +272,7 @@ ANEMOMETER_INSTALL()
# Download Anemometer # Download Anemometer
echo -e "\033[34mCloning Anemometer, Please Wait...\e[0m" echo -e "\033[34mCloning Anemometer, Please Wait...\e[0m"
git clone https://github.com/box/Anemometer.git /var/www/22222/htdocs/db/anemometer &>> $INSTALLLOG \ git clone https://github.com/box/Anemometer.git /var/www/22222/htdocs/db/anemometer &>> $EE_UPDATE_LOG \
|| OwnError "Unable To Clone Anemometer" || OwnError "Unable To Clone Anemometer"
# Setup Anemometer # Setup Anemometer
@ -392,24 +392,24 @@ EE122()
# Generate SSL Key # Generate SSL Key
echo -e "\033[34mGenerating SSL Private Key, Please Wait...\e[0m" echo -e "\033[34mGenerating SSL Private Key, Please Wait...\e[0m"
openssl genrsa -out /var/www/22222/cert/22222.key 2048 &>> $INSTALLLOG \ openssl genrsa -out /var/www/22222/cert/22222.key 2048 &>> $EE_UPDATE_LOG \
|| OwnError "Unable To Generate SSL Private Key" || OwnError "Unable To Generate SSL Private Key"
echo -e "\033[34mGenerating a Certificate Signing Request (CSR), Please Wait...\e[0m" echo -e "\033[34mGenerating a Certificate Signing Request (CSR), Please Wait...\e[0m"
openssl req -new -batch -subj /commonName=127.0.0.1/ -key /var/www/22222/cert/22222.key -out /var/www/22222/cert/22222.csr &>> $INSTALLLOG \ openssl req -new -batch -subj /commonName=127.0.0.1/ -key /var/www/22222/cert/22222.key -out /var/www/22222/cert/22222.csr &>> $EE_UPDATE_LOG \
|| OwnError "Unable To Generate Certificate Signing Request (CSR)" || OwnError "Unable To Generate Certificate Signing Request (CSR)"
echo -e "\033[34mRemoving Passphrase From SSL Private Key, Please Wait...\e[0m" echo -e "\033[34mRemoving Passphrase From SSL Private Key, Please Wait...\e[0m"
mv /var/www/22222/cert/22222.key /var/www/22222/cert/22222.key.org mv /var/www/22222/cert/22222.key /var/www/22222/cert/22222.key.org
openssl rsa -in /var/www/22222/cert/22222.key.org -out /var/www/22222/cert/22222.key &>> $INSTALLLOG \ openssl rsa -in /var/www/22222/cert/22222.key.org -out /var/www/22222/cert/22222.key &>> $EE_UPDATE_LOG \
|| OwnError "Unable To Remove Passphrase From SSL Private Key" || OwnError "Unable To Remove Passphrase From SSL Private Key"
echo -e "\033[34mGenerating SSL Certificate, Please Wait...\e[0m" echo -e "\033[34mGenerating SSL Certificate, Please Wait...\e[0m"
openssl x509 -req -days 3652 -in /var/www/22222/cert/22222.csr -signkey /var/www/22222/cert/22222.key -out /var/www/22222/cert/22222.crt &>> $INSTALLLOG \ openssl x509 -req -days 3652 -in /var/www/22222/cert/22222.csr -signkey /var/www/22222/cert/22222.key -out /var/www/22222/cert/22222.crt &>> $EE_UPDATE_LOG \
|| OwnError "Unable To Generate SSL Certificate" || OwnError "Unable To Generate SSL Certificate"
# PHP Setup # PHP Setup
dpkg -l | grep php5-fpm &>> $INSTALLLOG dpkg -l | grep php5-fpm &>> $EE_UPDATE_LOG
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
# Install Packages # Install Packages
@ -438,7 +438,7 @@ EE122()
sed -i "s/pm = dynamic/pm = ondemand/" /etc/php5/fpm/pool.d/debug.conf || OwnError "Unable To Chnage Process Manager From Dynamic To Ondemand" sed -i "s/pm = dynamic/pm = ondemand/" /etc/php5/fpm/pool.d/debug.conf || OwnError "Unable To Chnage Process Manager From Dynamic To Ondemand"
sed -i "s';slowlog.*'slowlog = /var/log/php5/slow.log'" /etc/php5/fpm/pool.d/debug.conf || OwnError "Unable To Change PHP Slowlog" sed -i "s';slowlog.*'slowlog = /var/log/php5/slow.log'" /etc/php5/fpm/pool.d/debug.conf || OwnError "Unable To Change PHP Slowlog"
sed -i "s';request_slowlog_timeout.*'request_slowlog_timeout = 10s'" /etc/php5/fpm/pool.d/debug.conf || OwnError "Unable To Change PHP Request Slowlog Timeout" sed -i "s';request_slowlog_timeout.*'request_slowlog_timeout = 10s'" /etc/php5/fpm/pool.d/debug.conf || OwnError "Unable To Change PHP Request Slowlog Timeout"
echo -e "php_admin_value[xdebug.profiler_output_dir] = /tmp/ \nphp_admin_value[xdebug.profiler_output_name] = cachegrind.out.%p-%H-%R \nphp_admin_flag[xdebug.profiler_enable_trigger] = on \nphp_admin_flag[xdebug.profiler_enable] = off" | tee -ai /etc/php5/fpm/pool.d/debug.conf &>> $INSTALLLOG \ echo -e "php_admin_value[xdebug.profiler_output_dir] = /tmp/ \nphp_admin_value[xdebug.profiler_output_name] = cachegrind.out.%p-%H-%R \nphp_admin_flag[xdebug.profiler_enable_trigger] = on \nphp_admin_flag[xdebug.profiler_enable] = off" | tee -ai /etc/php5/fpm/pool.d/debug.conf &>> $EE_UPDATE_LOG \
|| OwnError "Unable To Add Xdebug Settings" || OwnError "Unable To Add Xdebug Settings"
else else
@ -460,7 +460,7 @@ EE122()
EE133() EE133()
{ {
# Change PHP5-FPM Process Manager # Change PHP5-FPM Process Manager
grep "^pm = ondemand" /etc/php5/fpm/pool.d/www.conf &>> $INSTALLLOG grep "^pm = ondemand" /etc/php5/fpm/pool.d/www.conf &>> $EE_UPDATE_LOG
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
sed -i "s/pm = dynamic/pm = ondemand/" /etc/php5/fpm/pool.d/www.conf \ sed -i "s/pm = dynamic/pm = ondemand/" /etc/php5/fpm/pool.d/www.conf \
@ -483,12 +483,12 @@ EE134()
# Add rtCamp Nginx Launchpad Repository # Add rtCamp Nginx Launchpad Repository
echo -e "\033[34mAdding rtCamp Nginx Launchpad Repository, Please Wait...\e[0m" echo -e "\033[34mAdding rtCamp Nginx Launchpad Repository, Please Wait...\e[0m"
add-apt-repository -y ppa:rtcamp/nginx &>> $INSTALLLOG \ add-apt-repository -y ppa:rtcamp/nginx &>> $EE_UPDATE_LOG \
|| OwnError "Unable To Add Nginx Launchpad Repository" || OwnError "Unable To Add Nginx Launchpad Repository"
# Update The APT Cache # Update The APT Cache
echo -e "\033[34mUpdating APT Cache, Please Wait...\e[0m" echo -e "\033[34mUpdating APT Cache, Please Wait...\e[0m"
apt-get update &>> $INSTALLLOG || OwnError "Unable To Update APT Cache" apt-get update &>> $EE_UPDATE_LOG || OwnError "Unable To Update APT Cache"
# Update Nginx # Update Nginx
apt-get -o Dpkg::Options::="--force-confold" -y install nginx-custom \ apt-get -o Dpkg::Options::="--force-confold" -y install nginx-custom \
@ -503,7 +503,7 @@ EE134()
#Remove Old WP-CLI #Remove Old WP-CLI
rm -rf /usr/share/easyengine/wp-cli /usr/bin/wp /etc/bash_completion.d/wp-completion.bash rm -rf /usr/share/easyengine/wp-cli /usr/bin/wp /etc/bash_completion.d/wp-completion.bash
curl -sL https://raw.github.com/wp-cli/wp-cli.github.com/master/installer.sh | INSTALL_DIR='/usr/share/easyengine/wp-cli' VERSION='0.14.1' bash &>> $INSTALLLOG \ curl -sL https://raw.github.com/wp-cli/wp-cli.github.com/master/installer.sh | INSTALL_DIR='/usr/share/easyengine/wp-cli' VERSION='0.14.1' bash &>> $EE_UPDATE_LOG \
|| OwnError "Unable To Update WP-CLI" || OwnError "Unable To Update WP-CLI"
# Add WP-CLI Command In PATH Variable # Add WP-CLI Command In PATH Variable
@ -555,8 +555,8 @@ HTTPAUTH()
RESTARTSERVICE() RESTARTSERVICE()
{ {
echo -e "\033[34mRestarting Nginx & PHP5-FPM Configuration, Please Wait...\e[0m" echo -e "\033[34mRestarting Nginx & PHP5-FPM Configuration, Please Wait...\e[0m"
(php5-fpm -t && service php5-fpm restart) &>> $INSTALLLOG || OwnError "Unable To Restart PHP5-FPM After Update" (php5-fpm -t && service php5-fpm restart) &>> $EE_UPDATE_LOG || OwnError "Unable To Restart PHP5-FPM After Update"
(nginx -t && service nginx restart) &>> $INSTALLLOG || OwnError "Unable To Restart Nginx After Update" (nginx -t && service nginx restart) &>> $EE_UPDATE_LOG || OwnError "Unable To Restart Nginx After Update"
} }
@ -564,26 +564,26 @@ RESTARTSERVICE()
# Update EasyEngine (ee) # Update EasyEngine (ee)
EECURRENTVERSION=$(ee version | awk '{print($3)}') EE_CURRENT_VERSION=$(ee version | awk '{print($3)}')
EELATESTVERSION=$(curl -sL https://api.github.com/repos/rtCamp/easyengine/releases | grep tag_name | awk '{print($2)}' | cut -d'"' -f2 | cut -c2- | head -n1) EE_LATEST_VERSION=$(curl -sL https://api.github.com/repos/rtCamp/easyengine/releases | grep tag_name | awk '{print($2)}' | cut -d'"' -f2 | cut -c2- | head -n1)
echo EECURRENTVERSION = $EECURRENTVERSION EELATESTVERSION = $EELATESTVERSION &>> $INSTALLLOG echo EE_CURRENT_VERSION = $EE_CURRENT_VERSION EE_LATEST_VERSION = $EE_LATEST_VERSION &>> $EE_UPDATE_LOG
if [[ $EECURRENTVERSION < $EELATESTVERSION ]] if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]
then then
stty echo stty echo
read -p "Would You Like To Update EasyEngine To $EELATESTVERSION (y/n): " EEUPDATE read -p "Would You Like To Update EasyEngine To $EE_LATEST_VERSION (y/n): " EEUPDATE
# Check User Choice # Check User Choice
if [ "$EEUPDATE" = "y" ] || [ "$EEUPDATE" = "Y" ] if [ "$EEUPDATE" = "y" ] || [ "$EEUPDATE" = "Y" ]
then then
# Lets Start Update # Lets Start Update
echo &>> $INSTALLLOG echo &>> $EE_UPDATE_LOG
echo &>> $INSTALLLOG echo &>> $EE_UPDATE_LOG
echo -e "\033[34mEasyEngine (ee) Update Started [$(date)]\e[0m" | tee -ai $INSTALLLOG echo -e "\033[34mEasyEngine (ee) Update Started [$(date)]\e[0m" | tee -ai $EE_UPDATE_LOG
# Before Update Take Nginx Conf In GIT # Before Update Take Nginx Conf In GIT
EEGITDIR=/etc/nginx EEGITDIR=/etc/nginx
EEGITMESSAGE="Before Updating EasyEngine To $EELATESTVERSION" EEGITMESSAGE="Before Updating EasyEngine To $EE_LATEST_VERSION"
GITCOMMIT GITCOMMIT
# Before Update Take PHP Conf In GIT # Before Update Take PHP Conf In GIT
@ -594,38 +594,38 @@ then
EEUPDATE EEUPDATE
if [[ $EECURRENTVERSION = 1.0.0 ]] || [[ $EECURRENTVERSION = 1.0.1 ]] if [[ $EE_CURRENT_VERSION = 1.0.0 ]] || [[ $EE_CURRENT_VERSION = 1.0.1 ]]
then then
EE101 EE101
HTTPAUTH HTTPAUTH
MYCNFCHECK MYCNFCHECK
EECURRENTVERSION="1.1.0" EE_CURRENT_VERSION="1.1.0"
fi fi
if [[ $EECURRENTVERSION = 1.1.0 ]] if [[ $EE_CURRENT_VERSION = 1.1.0 ]]
then then
EE110 EE110
EECURRENTVERSION="1.1.1" EE_CURRENT_VERSION="1.1.1"
fi fi
if [[ $EECURRENTVERSION = 1.1.1 ]] || [[ $EECURRENTVERSION = 1.1.2 ]] || [[ $EECURRENTVERSION = 1.1.3 ]] || [[ $EECURRENTVERSION = 1.1.4 ]] || [[ $EECURRENTVERSION = 1.1.5 ]] || [[ $EECURRENTVERSION = 1.2.0 ]] || [[ $EECURRENTVERSION = 1.2.1 ]] if [[ $EE_CURRENT_VERSION = 1.1.1 ]] || [[ $EE_CURRENT_VERSION = 1.1.2 ]] || [[ $EE_CURRENT_VERSION = 1.1.3 ]] || [[ $EE_CURRENT_VERSION = 1.1.4 ]] || [[ $EE_CURRENT_VERSION = 1.1.5 ]] || [[ $EE_CURRENT_VERSION = 1.2.0 ]] || [[ $EE_CURRENT_VERSION = 1.2.1 ]]
then then
EECURRENTVERSION="1.2.2" EE_CURRENT_VERSION="1.2.2"
fi fi
if [[ $EECURRENTVERSION = 1.2.2 ]] if [[ $EE_CURRENT_VERSION = 1.2.2 ]]
then then
EE122 EE122
EECURRENTVERSION="1.3.0" EE_CURRENT_VERSION="1.3.0"
fi fi
if [[ $EECURRENTVERSION = 1.3.0 ]] || [[ $EECURRENTVERSION = 1.3.1 ]] || [[ $EECURRENTVERSION = 1.3.2 ]] || [[ $EECURRENTVERSION = 1.3.3 ]] if [[ $EE_CURRENT_VERSION = 1.3.0 ]] || [[ $EE_CURRENT_VERSION = 1.3.1 ]] || [[ $EE_CURRENT_VERSION = 1.3.2 ]] || [[ $EE_CURRENT_VERSION = 1.3.3 ]]
then then
EE133 EE133
EECURRENTVERSION="1.3.4" EE_CURRENT_VERSION="1.3.4"
fi fi
if [[ $EECURRENTVERSION = 1.3.4 ]] || [[ $EECURRENTVERSION = 1.3.5 ]] || [[ $EECURRENTVERSION = 1.3.6 ]] || [[ $EECURRENTVERSION = 1.3.7 ]] if [[ $EE_CURRENT_VERSION = 1.3.4 ]] || [[ $EE_CURRENT_VERSION = 1.3.5 ]] || [[ $EE_CURRENT_VERSION = 1.3.6 ]] || [[ $EE_CURRENT_VERSION = 1.3.7 ]]
then then
EE134 EE134
fi fi
@ -636,20 +636,20 @@ then
# Let's Take Conf In Git Version Control # Let's Take Conf In Git Version Control
EEGITDIR=/etc/nginx EEGITDIR=/etc/nginx
EEGITMESSAGE="After Updating EasyEngine To $EELATESTVERSION" EEGITMESSAGE="After Updating EasyEngine To $EE_LATEST_VERSION"
GITCOMMIT GITCOMMIT
EEGITDIR=/etc/php5 EEGITDIR=/etc/php5
GITCOMMIT GITCOMMIT
# Source EasyEngine (ee) Auto Complete To Take Effect # Source EasyEngine (ee) Auto Complete To Take Effect
echo -e "\033[34mFor EasyEngine (ee) Auto Completion Run Following Command\e[0m" | tee -ai $INSTALLLOG echo -e "\033[34mFor EasyEngine (ee) Auto Completion Run Following Command\e[0m" | tee -ai $EE_UPDATE_LOG
echo -e "\033[37msource /etc/bash_completion.d/ee\e[0m" | tee -ai $INSTALLLOG echo -e "\033[37msource /etc/bash_completion.d/ee\e[0m" | tee -ai $EE_UPDATE_LOG
echo echo
echo -e "\033[34mEasyEngine (ee) Updated Successfully\e[0m" | tee -ai $INSTALLLOG echo -e "\033[34mEasyEngine (ee) Updated Successfully\e[0m" | tee -ai $EE_UPDATE_LOG
echo -e "\033[34mPlease Ignore If You See Anything After This Line.\e[0m" | tee -ai $INSTALLLOGfwww echo -e "\033[34mPlease Ignore If You See Anything After This Line.\e[0m" | tee -ai $EE_UPDATE_LOGfwww
echo -e "\033[34mKilling The Parent Process\e[0m" &>> $INSTALLLOG echo -e "\033[34mKilling The Parent Process\e[0m" &>> $EE_UPDATE_LOG
ps ax | grep $PPID | grep -v grep &>> $INSTALLLOG ps ax | grep $PPID | grep -v grep &>> $EE_UPDATE_LOG
kill -9 $PPID kill -9 $PPID
else else

Loading…
Cancel
Save