Browse Source

Otimized Code

bugfixes
gau1991 10 years ago
parent
commit
4ba2c91d58
  1. 6
      bin/easyengine
  2. 14
      bin/update
  3. 2
      src/lib/ee_lib_error.sh
  4. 2
      src/modules/stack/install/mail/ee_mod_install_dovecot.sh
  5. 9
      src/modules/stack/install/mail/ee_mod_install_sieve.sh
  6. 2
      src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh
  7. 10
      src/modules/stack/remove/mail/ee_mod_remove_sieve.sh

6
bin/easyengine

@ -135,15 +135,15 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
# Check required Packages are installed or not
dpkg --get-selections | grep -v deinstall | grep nginx > /dev/null \
&& dpkg --get-selections | grep -v deinstall | grep php5-fpm > /dev/null \
&& dpkg --get-selections | grep -v deinstall | grep mysql > /dev/null \
&& mysqladmin ping &> /dev/null \
&& dpkg --get-selections | grep -v deinstall | grep postfix > /dev/null
if [ $? -ne 0 ];then
ee_lib_error "Failed to find pre dependencies. Please install Nginx, PHP5, MySQL and Postfix using command ee stack install, exit status " 1
ee_lib_error "Failed to find pre dependencies.\nPlease install Nginx, PHP5, MySQL and Postfix using command ee stack install, exit status " 1
fi
dpkg --get-selections | grep -v deinstall | grep dovecot-core > /dev/null
if [ $? -eq 0 ];then
ee_lib_error "Found installed mail server, Please remove it before installation, exit status=" 1
ee_lib_error "Found installed Dovecot Packages server, exit status=" 1
fi
# Install Dovecot

14
bin/update

@ -415,11 +415,17 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
fi
if [[ $EE_CURRENT_VERSION < 2.1.0 ]];then
if [ -f /etc/nginx/common/locations.conf ];then
cp -av /usr/share/easyengine/nginx/common/locations.conf /etc/nginx/common/locations.conf &>> $EE_UPDATE_LOG
fi
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
if [ -d /var/www/22222/htdocs/db/anemometer ];then
# Download pt-query-advisor Fixed #189
@ -431,7 +437,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
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
# Update EasyEngine current version
EE_CURRENT_VERSION="2.0.1"
fi

2
src/lib/ee_lib_error.sh

@ -2,6 +2,6 @@
function ee_lib_error()
{
echo "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG
echo -e "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG
exit $2
}

2
src/modules/stack/install/mail/ee_mod_install_dovecot.sh

@ -6,7 +6,7 @@ function ee_mod_install_dovecot()
ee_lib_echo "Installing Dovecot, please wait..."
debconf-set-selections <<< "dovecot-core dovecot-core/create-ssl-cert boolean yes"
debconf-set-selections <<< "dovecot-core dovecot-core/ssl-cert-name string $(hostname -f)"
$EE_APT_GET install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql \
$EE_APT_GET install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved \
|| ee_lib_error "Unable to install Dovecot, exit status = " $?
}

9
src/modules/stack/install/mail/ee_mod_install_sieve.sh

@ -1,9 +0,0 @@
# Install Sieve package
function ee_mod_install_sieve()
{
# Install Sieve
ee_lib_echo "Installing Sieve, please wait..."
$EE_APT_GET install dovecot-sieve dovecot-managesieved \
|| ee_lib_error "Unable to install Sieve, exit status = " $?
}

2
src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh

@ -3,7 +3,7 @@
function ee_mod_remove_dovecot()
{
ee_lib_echo "$EE_SECOND Dovecot package, please wait..."
$EE_APT_GET $EE_SECOND dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql \
$EE_APT_GET $EE_SECOND dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved \
|| ee_lib_error "Unable to $EE_SECOND Dovecot, exit status = " $?
userdel -rf vmail || ee_lib_error "Unable to Remove user vmail, exit status = " $?

10
src/modules/stack/remove/mail/ee_mod_remove_sieve.sh

@ -1,10 +0,0 @@
# Remove Sieve package
function ee_mod_remove_sieve()
{
ee_lib_echo "$EE_SECOND Sieve package, please wait..."
$EE_APT_GET $EE_SECOND dovecot-sieve dovecot-managesieved \
|| ee_lib_error "Unable to $EE_SECOND Sieve, exit status = " $?
}
Loading…
Cancel
Save