diff --git a/bin/easyengine b/bin/easyengine index 092ea23a..505db325 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -131,6 +131,21 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then fi # EasyEngine mail server setup if [ "$EE_THIRD" = "--mail" ] || [ "$EE_THIRD" = "--all" ];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 \ + && 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 + 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 + fi + # Install Dovecot ee_mod_install_dovecot @@ -141,7 +156,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_ven_install_roundcube # Install Amavis - ee_mod_install_amavis + ee_mod_install_mailscan # Install Sieve ee_mod_install_sieve @@ -159,7 +174,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_ven_setup_roundcube # Setup Amavis - ee_mod_setup_amavis + ee_mod_setup_mailscan # Setup Sieve ee_mod_setup_sieve diff --git a/bin/update b/bin/update index d332bd74..6f3f05a0 100644 --- a/bin/update +++ b/bin/update @@ -285,7 +285,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then || ee_lib_error "Unable to generate SSL certificate for port 22222, exit status = " $? # Update PHP configuration - dpkg -l | grep php5-fpm &>> $EE_UPDATE_LOG + dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG if [ $? -eq 0 ]; then ee_lib_echo "Installing php5-xdebug package, please wait..." apt-get -y install php5-xdebug \ @@ -325,7 +325,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then || ee_lib_error "Unable to add xdebug settings for debug pool, exit status = " $? fi - dpkg -l | grep mysql-server &>> $EE_UPDATE_LOG + dpkg --get-selections | grep -v deinstall | grep mysql-server &>> $EE_UPDATE_LOG if [ $? -eq 0 ]; then ee_lib_echo "Installing percona-toolkit package, please wait..." apt-get -y install percona-toolkit \ @@ -396,7 +396,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then fi if [[ $EE_CURRENT_VERSION = 2.0.0 ]]; then - dpkg -l | grep php5-fpm &>> $EE_UPDATE_LOG + dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG if [ $? -eq 0 ]; then # WP-CLI change the installation method diff --git a/src/modules/stack/install/mail/ee_mod_install_dovecot.sh b/src/modules/stack/install/mail/ee_mod_install_dovecot.sh index 692dcad4..ed49ba86 100644 --- a/src/modules/stack/install/mail/ee_mod_install_dovecot.sh +++ b/src/modules/stack/install/mail/ee_mod_install_dovecot.sh @@ -3,23 +3,10 @@ function ee_mod_install_dovecot() { # Install Dovecot - dpkg -l | grep nginx > /dev/null \ - && dpkg -l | grep php5-fpm > /dev/null \ - && dpkg -l | grep mysql > /dev/null \ - && dpkg -l | 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 - fi - - dpkg -l | grep dovecot-core > /dev/null - if [ $? -eq 0 ];then - ee_lib_error "Found installed mail server, Please remove it before installation, exit status=" 1 - fi - 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 dovecot-sieve dovecot-managesieved postfix-mysql \ + $EE_APT_GET install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql \ || ee_lib_error "Unable to install Dovecot, exit status = " $? } diff --git a/src/modules/stack/install/mail/ee_mod_install_amavis.sh b/src/modules/stack/install/mail/ee_mod_install_mailscan.sh similarity index 56% rename from src/modules/stack/install/mail/ee_mod_install_amavis.sh rename to src/modules/stack/install/mail/ee_mod_install_mailscan.sh index 6f72603a..d30be7ef 100644 --- a/src/modules/stack/install/mail/ee_mod_install_amavis.sh +++ b/src/modules/stack/install/mail/ee_mod_install_mailscan.sh @@ -1,9 +1,9 @@ # Install Amavis package -function ee_mod_install_amavis() +function ee_mod_install_mailscan() { # Install Amavis - ee_lib_echo "Installing Amavis and ClamAV, please wait..." + ee_lib_echo "Installing Amavis, SpamAssassin and ClamAV, please wait..." $EE_APT_GET install amavisd-new spamassassin clamav clamav-daemon arj zoo nomarch cpio lzop cabextract apt-listchanges libauthen-sasl-perl libdbi-perl libmail-dkim-perl p7zip rpm unrar-free libsnmp-perl \ - || ee_lib_error "Unable to install Amavis and ClamAV, exit status = " $? + || ee_lib_error "Unable to install Amavis, SpamAssassin and ClamAV, exit status = " $? } diff --git a/src/modules/stack/install/mail/ee_mod_install_sieve.sh b/src/modules/stack/install/mail/ee_mod_install_sieve.sh index bf20b52e..e72503cb 100644 --- a/src/modules/stack/install/mail/ee_mod_install_sieve.sh +++ b/src/modules/stack/install/mail/ee_mod_install_sieve.sh @@ -4,6 +4,6 @@ function ee_mod_install_sieve() { # Install Sieve ee_lib_echo "Installing Sieve, please wait..." - $EE_APT_GET install amavisd-new spamassassin clamav clamav-daemon arj zoo nomarch cpio lzop cabextract apt-listchanges libauthen-sasl-perl libdbi-perl libmail-dkim-perl p7zip rpm unrar-free libsnmp-perl \ + $EE_APT_GET install apt-get install dovecot-sieve dovecot-managesieved \ || ee_lib_error "Unable to install Sieve, exit status = " $? } diff --git a/src/modules/stack/install/mail/ee_mod_setup_amavis.sh b/src/modules/stack/install/mail/ee_mod_setup_mailscan.sh similarity index 97% rename from src/modules/stack/install/mail/ee_mod_setup_amavis.sh rename to src/modules/stack/install/mail/ee_mod_setup_mailscan.sh index ce0e3177..811242e5 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_amavis.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_mailscan.sh @@ -1,6 +1,6 @@ # Setup Amavis -function ee_mod_setup_amavis() +function ee_mod_setup_mailscan() { # Confiure Amavis diff --git a/src/modules/stack/install/mail/ee_mod_setup_postfix.sh b/src/modules/stack/install/mail/ee_mod_setup_postfix.sh index c49b05f2..59dac0d6 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_postfix.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_postfix.sh @@ -9,6 +9,13 @@ function ee_mod_setup_postfix() fi EE_HOSTNAME=$(hostname -f) + + #We previously not used this package. So, if some one don't have Postfix-MySQL installed, + #Postfix will not work + ee_lib_echo "Installing Postfix-MySQL, please wait..." + $EE_APT_GET install postfix-mysql \ + || ee_lib_error "Unable to install Postfix-MySQL, exit status = " $? + ee_lib_echo "Setting up Postfix, please wait..." #Configure Master.cf sed -i 's/#submission/submission/' /etc/postfix/master.cf &&