From 6cff6d3703a6da136aca9ce3fdde1678faf6617f Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 12 Feb 2015 12:14:59 +0530 Subject: [PATCH 01/18] Exceptions at user input corrected --- ee/cli/plugins/site_functions.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index b12d3673..e4460a7a 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -442,7 +442,12 @@ def updatewpuserpassword(self, ee_domain, ee_site_webroot): Log.error(self, "{0} does not seem to be a WordPress site" .format(ee_domain)) - ee_wp_user = input("Provide WordPress user name [admin]: ") + try: + ee_wp_user = input("Provide WordPress user name [admin]: ") + except Exception as e: + Log.debug(self, "{0}".format(e)) + Log.error(self, "\nCould not update password") + if ee_wp_user == "?": Log.info(self, "Fetching WordPress user list") EEShellExec.cmd_exec(self, "wp --allow-root user list " @@ -457,8 +462,14 @@ def updatewpuserpassword(self, ee_domain, ee_site_webroot): .format(ee_wp_user)) if is_user_exist: - ee_wp_pass = input("Provide password for {0} user: " - .format(ee_wp_user)) + try: + ee_wp_pass = getpass.getpass(prompt="Provide password for " + "{0} user: " + .format(ee_wp_user)) + except Exception as e: + Log.debug(self, "{0}".format(e)) + Log.error(self, "Could not update password") + if len(ee_wp_pass) > 8: EEShellExec.cmd_exec(self, "wp --allow-root user update {0}" " --user_pass={1}" From eb13ae25d6fdf14661b0e9958c136ab3f74ab425 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 12 Feb 2015 12:16:08 +0530 Subject: [PATCH 02/18] proper message displayed than before in middle of execution --- ee/core/shellexec.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ee/core/shellexec.py b/ee/core/shellexec.py index 112fed9a..b70e37d1 100644 --- a/ee/core/shellexec.py +++ b/ee/core/shellexec.py @@ -26,16 +26,18 @@ class EEShellExec(): if errormsg: Log.error(self, errormsg) else: - Log.debug(self, "{0}".format(e)) - Log.error(self, "Unable to execute command {0}" + Log.debug(self, "Unable to execute command {0}" .format(command)) + Log.debug(self, "{0}".format(e)) + Log.error(self, "Error occured while executing command") except Exception as e: if errormsg: Log.error(self, errormsg) else: - Log.debug(self, "{0}".format(e)) - Log.error(self, "Unable to execute command {0}" + Log.debug(self, "Unable to execute command {0}" .format(command)) + Log.debug(self, "{0}".format(e)) + Log.error(self, "Error occurred while executing command") def invoke_editor(self, filepath, errormsg=''): """ From b3297c0c5e692f3ebc14bcd59974159e8c5e00ed Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 12 Feb 2015 14:26:57 +0530 Subject: [PATCH 03/18] Attempt to Fix #409, Python locale issue --- ee/cli/plugins/debug.py | 19 +++--- ee/cli/plugins/site.py | 7 ++- ee/cli/plugins/site_functions.py | 3 +- ee/cli/plugins/stack.py | 104 ++++++++++++++++++++----------- ee/core/addswap.py | 3 +- ee/core/apt_repo.py | 9 ++- ee/core/aptget.py | 24 +++---- ee/core/checkfqdn.py | 4 +- ee/core/fileutils.py | 2 +- ee/core/logwatch.py | 4 +- install | 85 ++++++++++++++++++------- 11 files changed, 174 insertions(+), 90 deletions(-) diff --git a/ee/cli/plugins/debug.py b/ee/cli/plugins/debug.py index 0e384246..9728a563 100644 --- a/ee/cli/plugins/debug.py +++ b/ee/cli/plugins/debug.py @@ -63,7 +63,7 @@ class EEDebugController(CementBaseController): debug_address = ['0.0.0.0/0'] for ip_addr in debug_address: if not ("debug_connection "+ip_addr in open('/etc/nginx/' - 'nginx.conf').read()): + 'nginx.conf', encoding='utf-8').read()): Log.info(self, "Setting up Nginx debug connection" " for "+ip_addr) EEShellExec.cmd_exec(self, "sed -i \"/events {{/a\\ \\ \\ " @@ -79,7 +79,8 @@ class EEDebugController(CementBaseController): # stop global debug elif not self.start and not self.app.pargs.site_name: - if "debug_connection " in open('/etc/nginx/nginx.conf').read(): + if "debug_connection " in open('/etc/nginx/nginx.conf', + encoding='utf-8').read(): Log.info(self, "Disabling Nginx debug connections") EEShellExec.cmd_exec(self, "sed -i \"/debug_connection.*/d\"" " /etc/nginx/nginx.conf") @@ -146,7 +147,8 @@ class EEDebugController(CementBaseController): data = dict(php="9001", debug="9001") Log.info(self, 'Writting the Nginx debug configration to file ' '/etc/nginx/conf.d/upstream.conf ') - ee_nginx = open('/etc/nginx/conf.d/upstream.conf', 'w') + ee_nginx = open('/etc/nginx/conf.d/upstream.conf', + encoding='utf-8', mode='w') self.app.render((data), 'upstream.mustache', out=ee_nginx) ee_nginx.close() self.trigger_php = True @@ -165,7 +167,8 @@ class EEDebugController(CementBaseController): data = dict(php="9000", debug="9001") Log.debug(self, 'Writting the Nginx debug configration to file' ' /etc/nginx/conf.d/upstream.conf ') - ee_nginx = open('/etc/nginx/conf.d/upstream.conf', 'w') + ee_nginx = open('/etc/nginx/conf.d/upstream.conf', + encoding='utf-8', mode='w') self.app.render((data), 'upstream.mustache', out=ee_nginx) ee_nginx.close() self.trigger_php = True @@ -186,7 +189,8 @@ class EEDebugController(CementBaseController): config.remove_option('global', 'include') config['global']['log_level'] = 'debug' config['global']['include'] = '/etc/php5/fpm/pool.d/*.conf' - with open('/etc/php5/fpm/php-fpm.conf', 'w') as configfile: + with open('/etc/php5/fpm/php-fpm.conf', + encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writting php5-FPM configuration into " "/etc/php5/fpm/php-fpm.conf") config.write(configfile) @@ -206,7 +210,8 @@ class EEDebugController(CementBaseController): config.remove_option('global', 'include') config['global']['log_level'] = 'notice' config['global']['include'] = '/etc/php5/fpm/pool.d/*.conf' - with open('/etc/php5/fpm/php-fpm.conf', 'w') as configfile: + with open('/etc/php5/fpm/php-fpm.conf', + encoding='utf-8', mode='w') as configfile: Log.debug(self, "writting php5 configuration into " "/etc/php5/fpm/php-fpm.conf") config.write(configfile) @@ -278,7 +283,7 @@ class EEDebugController(CementBaseController): " grep true".format(wp_config)): Log.info(self, "Starting WordPress debug") open("{0}/htdocs/wp-content/debug.log".format(webroot), - 'a').close() + encoding='utf-8', mode='a').close() EEShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/wp-" "content/debug.log" "".format(webroot, diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index f73ea40c..38050a97 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -152,7 +152,8 @@ class EESiteController(CementBaseController): .format(ee_domain)): Log.info(self, "Display NGINX configuration for {0}" .format(ee_domain)) - f = open('/etc/nginx/sites-available/{0}'.format(ee_domain), "r") + f = open('/etc/nginx/sites-available/{0}'.format(ee_domain), + encoding='utf-8', mode='r') text = f.read() Log.info(self, Log.ENDC + text) f.close() @@ -436,7 +437,7 @@ class EESiteCreateController(CementBaseController): data = setupdatabase(self, data) try: eedbconfig = open("{0}/ee-config.php".format(ee_site_webroot), - 'w') + encoding='utf-8', mode='w') eedbconfig.write("") EEFileUtils.chown(self, "{0}22222" @@ -471,7 +492,8 @@ class EEStackController(CementBaseController): if not os.path.isfile("/etc/mysql/my.cnf"): config = ("[mysqld]\nwait_timeout = 30\n" "interactive_timeout=60\nperformance_schema = 0") - config_file = open("/etc/mysql/my.cnf", "w") + config_file = open("/etc/mysql/my.cnf", + encoding='utf-8', mode='w') config_file.write(config) config_file.close() else: @@ -505,7 +527,8 @@ class EEStackController(CementBaseController): data = dict(email=EEVariables.ee_email) Log.debug(self, "Writting configuration into file" "/etc/dovecot/conf.d/99-ee.conf ") - ee_dovecot = open('/etc/dovecot/conf.d/99-ee.conf', 'w') + ee_dovecot = open('/etc/dovecot/conf.d/99-ee.conf', + encoding='utf-8', mode='w') self.app.render((data), 'dovecot.mustache', out=ee_dovecot) ee_dovecot.close() @@ -595,7 +618,8 @@ class EEStackController(CementBaseController): data = dict() Log.debug(self, "Writting configuration of EasyEngine into " "file /var/lib/dovecot/sieve/default.sieve") - ee_sieve = open('/var/lib/dovecot/sieve/default.sieve', 'w') + ee_sieve = open('/var/lib/dovecot/sieve/default.sieve', + encoding='utf-8', mode='w') self.app.render((data), 'default-sieve.mustache', out=ee_sieve) ee_sieve.close() @@ -619,7 +643,7 @@ class EEStackController(CementBaseController): Log.debug(self, "Configuring file /etc/amavis/conf.d" "/15-content_filter_mode") ee_amavis = open('/etc/amavis/conf.d/15-content_filter_mode', - 'w') + encoding='utf-8', mode='w') self.app.render((data), '15-content_filter_mode.mustache', out=ee_amavis) ee_amavis.close() @@ -634,7 +658,8 @@ class EEStackController(CementBaseController): "$3 }\' | tr -d '\\n'").read() data = dict(host=vm_host, password=vm_pass) - vm_config = open('/etc/amavis/conf.d/50-user', 'w') + vm_config = open('/etc/amavis/conf.d/50-user', + encoding='utf-8', mode='w') self.app.render((data), '50-user.mustache', out=vm_config) vm_config.close() @@ -670,7 +695,8 @@ class EEStackController(CementBaseController): -o smtpd_client_connection_rate_limit=0 -o local_header_rewrite_clients=""") - with open("/etc/postfix/master.cf", "a") as am_config: + with open("/etc/postfix/master.cf", + encoding='utf-8', mode='a') as am_config: am_config.write(amavis_master) # Amavis ClamAV configuration @@ -795,7 +821,8 @@ class EEStackController(CementBaseController): user='anemometer', password=chars) ee_anemometer = open('{0}22222/htdocs/db/anemometer' '/conf/config.inc.php' - .format(EEVariables.ee_webroot), 'w') + .format(EEVariables.ee_webroot), + encoding='utf-8', mode='w') self.app.render((data), 'anemometer.mustache', out=ee_anemometer) ee_anemometer.close() @@ -861,7 +888,8 @@ class EEStackController(CementBaseController): .format(EEVariables.ee_webroot)) ee_vmb = open('{0}22222/htdocs/vimbadmin/application/' 'configs/application.ini' - .format(EEVariables.ee_webroot), 'w') + .format(EEVariables.ee_webroot), + encoding='utf-8', mode='w') self.app.render((data), 'vimbadmin.mustache', out=ee_vmb) ee_vmb.close() @@ -900,7 +928,7 @@ class EEStackController(CementBaseController): host=EEVariables.ee_mysql_host) vm_config = open('/etc/postfix/mysql/virtual_alias_maps.cf', - 'w') + encoding='utf-8', mode='w') self.app.render((data), 'virtual_alias_maps.mustache', out=vm_config) vm_config.close() @@ -909,7 +937,7 @@ class EEStackController(CementBaseController): "/etc/postfix/mysql" "/virtual_domains_maps.cf file") vm_config = open('/etc/postfix/mysql/virtual_domains_maps.cf', - 'w') + encoding='utf-8', mode='w') self.app.render((data), 'virtual_domains_maps.mustache', out=vm_config) vm_config.close() @@ -918,7 +946,7 @@ class EEStackController(CementBaseController): "/etc/postfix/mysql" "/virtual_mailbox_maps.cf file") vm_config = open('/etc/postfix/mysql/virtual_mailbox_maps.cf', - 'w') + encoding='utf-8', mode='w') self.app.render((data), 'virtual_mailbox_maps.mustache', out=vm_config) vm_config.close() @@ -926,7 +954,7 @@ class EEStackController(CementBaseController): Log.debug(self, "Writting configration" " to /etc/dovecot/dovecot-sql.conf.ext file ") vm_config = open('/etc/dovecot/dovecot-sql.conf.ext', - 'w') + encoding='utf-8', mode='w') self.app.render((data), 'dovecot-sql-conf.mustache', out=vm_config) vm_config.close() @@ -935,7 +963,7 @@ class EEStackController(CementBaseController): # Amvis settings if set(EEVariables.ee_mailscanner).issubset(set(apt_packages)): vm_config = open('/etc/amavis/conf.d/50-user', - 'w') + encoding='utf-8', mode='w') self.app.render((data), '50-user.mustache', out=vm_config) vm_config.close() @@ -1024,7 +1052,8 @@ class EEStackController(CementBaseController): Log.debug(self, 'Writting the nginx configuration for ' 'RoundCubemail') - ee_rc = open('/etc/nginx/sites-available/webmail.conf', 'w') + ee_rc = open('/etc/nginx/sites-available/webmail.conf', + encoding='utf-8', mode='w') self.app.render((data), 'virtualconf.mustache', out=ee_rc) ee_rc.close() @@ -1053,8 +1082,7 @@ class EEStackController(CementBaseController): .format(EEVariables.ee_webroot)]) # Remove roundcube installer EEService.reload_service(self, 'nginx') - EEFileUtils.remove(self, ["{0}roundcubemail" - "/htdocs/installer" + EEFileUtils.remove(self, ["{0}roundcubemail/htdocs/installer" .format(EEVariables.ee_webroot)]) EEFileUtils.chown(self, '{0}roundcubemail' .format(EEVariables.ee_webroot), diff --git a/ee/core/addswap.py b/ee/core/addswap.py index 717d67a1..a398ff7c 100644 --- a/ee/core/addswap.py +++ b/ee/core/addswap.py @@ -23,5 +23,6 @@ class EESwap(): EEFileUtils.chown(self, "/ee-swapfile", "root", "root") EEFileUtils.chmod(self, "/ee-swapfile", 0o600) EEShellExec.cmd_exec(self, "swapon /ee-swapfile") - with open("/etc/fstab", "a") as swap_file: + with open("/etc/fstab", + encoding='utf-8', mode='a') as swap_file: swap_file.write("/ee-swapfile\tnone\tswap\tsw\t0 0") diff --git a/ee/core/apt_repo.py b/ee/core/apt_repo.py index d3e82ed9..aea5b2a7 100644 --- a/ee/core/apt_repo.py +++ b/ee/core/apt_repo.py @@ -26,12 +26,15 @@ class EERepo(): + EEVariables().ee_repo_file) try: if not os.path.isfile(repo_file_path): - with open(repo_file_path, "a") as repofile: + with open(repo_file_path, + encoding='utf-8', mode='a') as repofile: repofile.write(repo_url) repofile.write('\n') repofile.close() - elif repo_url not in open(repo_file_path).read(): - with open(repo_file_path, "a") as repofile: + elif repo_url not in open(repo_file_path, + encoding='utf-8').read(): + with open(repo_file_path, + encoding='utf-8', mode='a') as repofile: repofile.write(repo_url) repofile.write('\n') repofile.close() diff --git a/ee/core/aptget.py b/ee/core/aptget.py index b33b3d1d..cd0aa4f5 100644 --- a/ee/core/aptget.py +++ b/ee/core/aptget.py @@ -17,7 +17,8 @@ class EEAptGet(): apt_cache = apt.cache.Cache() import sys orig_out = sys.stdout - sys.stdout = open(self.app.config.get('log.logging', 'file'), 'a') + sys.stdout = open(self.app.config.get('log.logging', 'file'), + encoding='utf-8', mode='a') apt_cache.update(apt.progress.text.AcquireProgress()) sys.stdout = orig_out # success = (apt_cache.commit( @@ -43,7 +44,7 @@ class EEAptGet(): success = (apt_cache.commit( apt.progress.text.AcquireProgress(), apt.progress.base.InstallProgress())) - #apt_cache.close() + # apt_cache.close() return success except AttributeError as e: Log.error(self, 'AttributeError: ' + str(e)) @@ -64,11 +65,11 @@ class EEAptGet(): pkg = apt_cache[package_name.strip()] if package_name.strip() in apt_cache: if pkg.is_installed: - #apt_pkg.PkgSystemUnLock() + # apt_pkg.PkgSystemUnLock() Log.debug(self, 'Trying to install a package that ' 'is already installed (' + package_name.strip() + ')') - #apt_cache.close() + # apt_cache.close() return False else: try: @@ -78,7 +79,7 @@ class EEAptGet(): Log.debug(self, str(e)) Log.error(self, str(e)) else: - #apt_cache.close() + # apt_cache.close() Log.error(self, 'Unknown package selected (' + package_name.strip() + ')') @@ -88,19 +89,19 @@ class EEAptGet(): if apt_cache.install_count > 0: try: - #apt_pkg.PkgSystemUnLock() + # apt_pkg.PkgSystemUnLock() orig_out = sys.stdout sys.stdout = open(self.app.config.get('log.logging', 'file'), - 'a') + encoding='utf-8', mode='a') result = apt_cache.commit(apt.progress.text.AcquireProgress(), apt.progress.base.InstallProgress()) sys.stdout = orig_out - #apt_cache.close() + # apt_cache.close() return result except SystemError as e: Log.debug(self, 'SystemError: ' + str(e)) Log.error(self, 'SystemError: ' + str(e)) - #apt_cache.close() + # apt_cache.close() except Exception as e: Log.debug(self, str(e)) Log.error(self, str(e)) @@ -145,7 +146,7 @@ class EEAptGet(): # apt_pkg.PkgSystemUnLock() orig_out = sys.stdout sys.stdout = open(self.app.config.get('log.logging', 'file'), - 'a') + encoding='utf-8', mode='a') result = apt_cache.commit(apt.progress.text.AcquireProgress(), apt.progress.base.InstallProgress()) sys.stdout = orig_out @@ -165,7 +166,8 @@ class EEAptGet(): """ try: orig_out = sys.stdout - sys.stdout = open(self.app.config.get('log.logging', 'file'), 'a') + sys.stdout = open(self.app.config.get('log.logging', 'file'), + encoding='utf-8', mode='a') apt_get.autoclean("-y") sys.stdout = orig_out except ErrorReturnCode as e: diff --git a/ee/core/checkfqdn.py b/ee/core/checkfqdn.py index 915b2e24..4caf9380 100644 --- a/ee/core/checkfqdn.py +++ b/ee/core/checkfqdn.py @@ -5,10 +5,10 @@ import os def check_fqdn(self, ee_host): """FQDN check with EasyEngine, for mail server hostname must be FQDN""" - #ee_host=os.popen("hostname -f | tr -d '\n'").read() + # ee_host=os.popen("hostname -f | tr -d '\n'").read() if '.' in ee_host: EEVariables.ee_fqdn = ee_host - with open('/etc/hostname', 'w') as hostfile: + with open('/etc/hostname', encoding='utf-8', mode='w') as hostfile: hostfile.write(ee_host) EEShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts" diff --git a/ee/core/fileutils.py b/ee/core/fileutils.py index 5e8a4b68..6b53585e 100644 --- a/ee/core/fileutils.py +++ b/ee/core/fileutils.py @@ -196,7 +196,7 @@ class EEFileUtils(): Searches for string in file and returns the matched line. """ try: - for line in open(fnm): + for line in open(fnm, encoding='utf-8'): if sstr in line: return line except OSError as e: diff --git a/ee/core/logwatch.py b/ee/core/logwatch.py index 818f50d3..ec2e210f 100644 --- a/ee/core/logwatch.py +++ b/ee/core/logwatch.py @@ -96,7 +96,7 @@ class LogWatcher(object): def tail(fname, window): """Read last N lines from file fname.""" try: - f = open(fname, 'r') + f = open(fname, encoding='utf-8', mode='r') except IOError as err: if err.errno == errno.ENOENT: return [] @@ -166,7 +166,7 @@ class LogWatcher(object): def watch(self, fname): try: - file = open(fname, "r") + file = open(fname, encoding='utf-8', mode='r') fid = self.get_file_id(os.stat(fname)) except EnvironmentError as err: if err.errno != errno.ENOENT: diff --git a/install b/install index bb2cb291..b7801795 100644 --- a/install +++ b/install @@ -34,22 +34,20 @@ function ee_lib_error() function install_dep() { - # Execute: apt-get update - ee_lib_echo "Executing apt-get update" - apt-get update &>> /dev/null # Install Python3 on users system ee_lib_echo "Installing pre depedencies" - apt-get -y install python3 python3-apt python3-setuptools python3-dev sqlite3 git - if [[ $? -ne 0 ]]; then - ee_lib_echo_fail "Unable to install pre depedencies" - exit 1 + if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then + apt-get -y install python-software-properties software-properties-common python3 python3-apt python3-setuptools python3-dev sqlite3 git || ee_lib_error "Unable to install pre depedencies, exit status " 1 + elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then + apt-get -y install graphviz python-software-properties python3 python3-apt python3-setuptools python3-dev sqlite3 git || ee_lib_error "Unable to pre depedencies, exit status " 1 fi + } function sync_db() { - mkdir /var/lib/ee + mkdir -p /var/lib/ee # Sqlite query to create table `sites` into ee.db which will be used by ee.3.0 echo "CREATE TABLE sites ( @@ -194,7 +192,7 @@ function update_to_ee3() rm -rf /etc/bash_completion.d/ee /etc/easyengine/ /usr/share/easyengine/ /usr/local/lib/easyengine /usr/local/sbin/easyengine /usr/local/sbin/ee /var/log/easyengine # Softlink to fix command not found error - ln -s /usr/local/bin/ee /usr/local/sbin/ee + ln -s /usr/local/bin/ee /usr/local/sbin/ee || ee_lib_error "Unable to create softlink to old EasyEngine, exit status " 1 } @@ -217,28 +215,73 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi +# Execute: apt-get update +ee_lib_echo "Executing apt-get update" +apt-get update &>> /dev/null + +# Checking lsb_release package +if [ ! -x /usr/bin/lsb_release ]; then + ee_lib_echo "Installing lsb-release, please wait..." + apt-get -y install lsb-release &>> /dev/null +fi + +# Define variables for later use +readonly EE_LOG_DIR=/var/log/ee/ +readonly EE_INSTALL_LOG=/var/log/ee/install.log +readonly EE_LINUX_DISTRO=$(lsb_release -i | awk '{print $3}') +readonly EE_DEBIAN_VERSION=$(lsb_release -sc) + +# Checking linux distro +if [ "$EE_LINUX_DISTRO" != "Ubuntu" ] && [ "$EE_LINUX_DISTRO" != "Debian" ]; then + ee_lib_echo_fail "EasyEngine (ee) is made for Ubuntu and Debian only as of now" + ee_lib_echo_fail "You are free to fork EasyEngine (ee): https://github.com/rtCamp/easyengine/fork" + ee_lib_echo_fail "EasyEngine (ee) only support Ubuntu 12.04/14.04 and Debian 7.x" + exit 100 +fi + +# EasyEngine (ee) only support all Ubuntu/Debian distro except the distro reached EOL +lsb_release -d | egrep -e "12.04|14.04|wheezy" &>> /dev/null +if [ "$?" -ne "0" ]; then + exit 100 +fi + + +# Pre checks to avoid later screw ups +# Checking EasyEngine (ee) log directory +if [ ! -d $EE_LOG_DIR ]; then + + ee_lib_echo "Creating EasyEngine log directory, please wait..." + mkdir -p $EE_LOG_DIR || ee_lib_error "Creating log directory failed, exit status " 1 + + # Create EasyEngine log files + touch /var/log/ee/{ee.log,install.log} + + # Keep EasyEngine log folder accessible to root only + chmod -R 700 /var/log/ee || ee_lib_error "Unable to setup log directory permissions , exit status " 1 +fi + if [ -f /usr/local/sbin/easyengine ]; then # Check old EasyEngine version ee version | grep ${old_ee_version} &>> /dev/null if [[ $? -ne 0 ]]; then - ee_lib_echo "EasyEngine $old_ee_version not found on your system" - ee_lib_echo "Updating your EasyEngine to $old_ee_version for compability" - wget -q https://raw.githubusercontent.com/rtCamp/easyengine/old-stable/bin/update && bash update + ee_lib_echo "EasyEngine $old_ee_version not found on your system" | tee -ai $EE_INSTALL_LOG + ee_lib_echo "Updating your EasyEngine to $old_ee_version for compability" | tee -ai $EE_INSTALL_LOG + wget -q https://raw.githubusercontent.com/rtCamp/easyengine/old-stable/bin/update && bash update | tee -ai $EE_INSTALL_LOG if [[ $? -ne 0 ]]; then ee_lib_echo_info "Unbale to update EasyEngine2 to $old_ee_version" exit 1 fi fi - install_dep - sync_db - install_ee3 - update_to_ee3 - git_init + install_dep | tee -ai $EE_INSTALL_LOG + sync_db | tee -ai $EE_INSTALL_LOG + install_ee3 | tee -ai $EE_INSTALL_LOG + update_to_ee3 | tee -ai $EE_INSTALL_LOG + git_init | tee -ai $EE_INSTALL_LOG elif [ ! -f /usr/local/bin/ee ]; then - install_dep - install_ee3 - git_init + install_dep | tee -ai $EE_INSTALL_LOG + install_ee3 | tee -ai $EE_INSTALL_LOG + git_init | tee -ai $EE_INSTALL_LOG else - ee_lib_echo_fail "EasyEngine 3 allready installed on your system" + ee_lib_echo_fail "EasyEngine 3 allready installed on your system" | tee -ai $EE_INSTALL_LOG exit 1 fi From 8f7e058f0b1292c2dcc34b77c60615f6a5f24088 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 12 Feb 2015 15:10:50 +0530 Subject: [PATCH 04/18] global Exception handling --- ee/cli/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ee/cli/main.py b/ee/cli/main.py index 8f6019dd..98de372f 100644 --- a/ee/cli/main.py +++ b/ee/cli/main.py @@ -94,6 +94,9 @@ def main(): # Default Cement signals are SIGINT and SIGTERM, exit 0 (non-error) code = 0 print(e) + except Exception as e: + code = 1 + print(e) finally: # Print an exception (if it occurred) and --debug was passed if app.debug: From ec69cc6090ccd92ccd91e98f4be5ee729fdee054 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 12 Feb 2015 15:12:54 +0530 Subject: [PATCH 05/18] Traceback handled --- ee/cli/plugins/site.py | 18 ++++++++++++++---- ee/cli/plugins/site_functions.py | 8 +++++--- ee/core/aptget.py | 1 + 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index f73ea40c..58f9c006 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -47,12 +47,14 @@ class EESiteController(CementBaseController): .format(ee_domain), '/etc/nginx/sites-enabled/{0}' .format(ee_domain)]) - + EEGit.add(self, ["/etc/nginx"], + msg="Enabled {0} " + .format(ee_domain)) updateSiteInfo(self, ee_domain, enabled=True) Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") EEService.reload_service(self, 'nginx') else: - Log.error(self, " site {0} does not exists".format(ee_domain)) + Log.error(self, "\nsite {0} does not exists".format(ee_domain)) @expose(help="Disable site example.com") def disable(self): @@ -62,12 +64,15 @@ class EESiteController(CementBaseController): .format(ee_domain)): if not os.path.isfile('/etc/nginx/sites-enabled/{0}' .format(ee_domain)): - Log.debug(self, "Site {0} already disabled" + ee_domain) + Log.debug(self, "Site {0} already disabled".format(ee_domain)) Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]") else: EEFileUtils.remove_symlink(self, '/etc/nginx/sites-enabled/{0}' .format(ee_domain)) + EEGit.add(self, ["/etc/nginx"], + msg="Disabled {0} " + .format(ee_domain)) updateSiteInfo(self, ee_domain, enabled=False) Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") EEService.reload_service(self, 'nginx') @@ -934,7 +939,7 @@ class EESiteDeleteController(CementBaseController): label = 'delete' stacked_on = 'site' stacked_type = 'nested' - description = 'To delete website' + description = 'delete an existing website' arguments = [ (['site_name'], dict(help='domain name to be deleted')), @@ -950,6 +955,7 @@ class EESiteDeleteController(CementBaseController): ] @expose(help="Delete website configuration and files") + @expose(hide=True) def default(self): # TODO Write code for ee site update here (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name) @@ -1011,7 +1017,11 @@ class EESiteDeleteController(CementBaseController): Log.debug(self, "Removing Nginx configuration") EEFileUtils.rm(self, '/etc/nginx/sites-available/{0}' .format(ee_domain)) + EEGit.add(self, ["/etc/nginx"], + msg="Deleted {0} " + .format(ee_domain)) deleteSiteInfo(self, ee_domain) + Log.info(self, "Deleted site {0}".format(ee_domain)) else: Log.error(self, " site {0} does not exists".format(ee_domain)) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index e4460a7a..cad422a5 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -112,20 +112,22 @@ def setupdatabase(self, data): Log.info(self, "Setting up database\t\t", end='') Log.debug(self, "Creating databse {0}".format(ee_db_name)) EEMysql.execute(self, "create database {0}" - .format(ee_db_name)) + .format(ee_db_name), errormsg="Cannot create database") # Create MySQL User Log.debug(self, "Creating user {0}".format(ee_db_username)) EEMysql.execute(self, "create user {0}@{1} identified by '{2}'" .format(ee_db_username, ee_mysql_grant_host, - ee_db_password)) + ee_db_password), + errormsg="Cannot setup database user") # Grant permission Log.debug(self, "Setting up user privileges") EEMysql.execute(self, "grant all privileges on {0}.* to {1}@{2}" - .format(ee_db_name, ee_db_username, ee_mysql_grant_host)) + .format(ee_db_name, ee_db_username, ee_mysql_grant_host), + errormsg="Cannot setup database user privileges") Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") data['ee_db_name'] = ee_db_name diff --git a/ee/core/aptget.py b/ee/core/aptget.py index b33b3d1d..74c1aeb5 100644 --- a/ee/core/aptget.py +++ b/ee/core/aptget.py @@ -4,6 +4,7 @@ import apt_pkg import sys from ee.core.logging import Log from sh import apt_get +from sh import ErrorReturnCode class EEAptGet(): From 3855b1f2f106e353f27cc5746cef8a863554d859 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 12 Feb 2015 15:33:26 +0530 Subject: [PATCH 06/18] Fixed Nginx config issue --- ee/cli/plugins/secure.py | 4 ++-- ee/cli/plugins/stack.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ee/cli/plugins/secure.py b/ee/cli/plugins/secure.py index 359d8513..a9a78bc6 100644 --- a/ee/cli/plugins/secure.py +++ b/ee/cli/plugins/secure.py @@ -92,12 +92,12 @@ class EESecureController(CementBaseController): if EEVariables.ee_platform_distro == 'Ubuntu': EEShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen " "{port} default_server ssl spdy;/\" " - "/etc/nginx/sites-available/22222.conf" + "/etc/nginx/sites-available/22222" .format(port=self.app.pargs.user_input)) if EEVariables.ee_platform_distro == 'debian': EEShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen " "{port} default_server ssl;/\" " - "/etc/nginx/sites-available/22222.conf" + "/etc/nginx/sites-available/22222" .format(port=self.app.pargs.user_input)) Log.info(self, "Successfully port changed {port}" .format(port=self.app.pargs.user_input)) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 1ace9eb3..fdfecb6b 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -278,8 +278,8 @@ class EEStackController(CementBaseController): # 22222 port settings Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/sites-available/' - '22222.conf') - ee_nginx = open('/etc/nginx/sites-available/22222.conf', + '22222') + ee_nginx = open('/etc/nginx/sites-available/22222', encoding='utf-8', mode='w') self.app.render((data), '22222.mustache', out=ee_nginx) @@ -297,10 +297,10 @@ class EEStackController(CementBaseController): # Create Symbolic link for 22222 EEFileUtils.create_symlink(self, ['/etc/nginx/' 'sites-available/' - '22222.conf', + '22222', '/etc/nginx/' 'sites-enabled/' - '22222.conf']) + '22222']) # Create log and cert folder and softlinks if not os.path.exists('{0}22222/logs' .format(EEVariables.ee_webroot)): @@ -1052,17 +1052,17 @@ class EEStackController(CementBaseController): Log.debug(self, 'Writting the nginx configuration for ' 'RoundCubemail') - ee_rc = open('/etc/nginx/sites-available/webmail.conf', + ee_rc = open('/etc/nginx/sites-available/webmail', encoding='utf-8', mode='w') self.app.render((data), 'virtualconf.mustache', out=ee_rc) ee_rc.close() - # Create Symbolic link for webmail.conf + # Create Symbolic link for webmail EEFileUtils.create_symlink(self, ['/etc/nginx/sites-available' - '/webmail.conf', + '/webmail', '/etc/nginx/sites-enabled/' - 'webmail.conf']) + 'webmail']) # Create log folder and softlinks if not os.path.exists('{0}roundcubemail/logs' .format(EEVariables.ee_webroot)): From 577fbfd4594a63114698fcf124af20bdb5fc3327 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 12 Feb 2015 16:07:37 +0530 Subject: [PATCH 07/18] Fixed some packages not removing during ee remove --- ee/cli/plugins/stack.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index fdfecb6b..2243b60c 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -1365,7 +1365,7 @@ class EEStackController(CementBaseController): .format(EEVariables.ee_webroot)] if self.app.pargs.adminer: Log.debug(self, "Removing package variable of Adminer ") - packages = packages + ['{0}22222/htdocs/db/Adminer' + packages = packages + ['{0}22222/htdocs/db/adminer' .format(EEVariables.ee_webroot)] if self.app.pargs.utils: Log.debug(self, "Removing package variable of utils ") @@ -1373,12 +1373,12 @@ class EEStackController(CementBaseController): .format(EEVariables.ee_webroot), '{0}22222/htdocs/cache/opcache' .format(EEVariables.ee_webroot), - '{0}22222/htdocs/cache/Nginx/' + '{0}22222/htdocs/cache/nginx/' 'clean.php'.format(EEVariables.ee_webroot), - '{0}22222/htdocs/cache/Memcache' + '{0}22222/htdocs/cache/memcache' .format(EEVariables.ee_webroot), '/usr/bin/pt-query-advisor', - '{0}22222/htdocs/db/Anemometer' + '{0}22222/htdocs/db/anemometer' .format(EEVariables.ee_webroot)] if len(apt_packages): From 478504092b2809083ca632b208ba258e4f6844ee Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 12 Feb 2015 16:15:07 +0530 Subject: [PATCH 08/18] Fixed Git message in MySQL --- ee/cli/plugins/stack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 2243b60c..56535fb1 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -503,7 +503,7 @@ class EEStackController(CementBaseController): "performance_schema = 0\" " "/etc/mysql/my.cnf") - EEGit.add(self, ["/etc/mysql"], msg="Adding Nginx into Git") + EEGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git") EEService.reload_service(self, 'mysql') if set(EEVariables.ee_mail).issubset(set(apt_packages)): From 057d1f9a51f0e7464aed89839863afbe2d4fa5cd Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 12 Feb 2015 17:02:06 +0530 Subject: [PATCH 09/18] restricted passwords from logging --- ee/cli/plugins/site.py | 4 ++-- ee/cli/plugins/site_functions.py | 4 +++- ee/core/logging.py | 6 ++++-- ee/core/mysql.py | 7 +++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index 81f698f4..142ed2e8 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -475,9 +475,9 @@ class EESiteCreateController(CementBaseController): if data['wp']: Log.info(self, Log.ENDC + "WordPress admin user :" - " {0}".format(ee_wp_creds['wp_user'])) + " {0}".format(ee_wp_creds['wp_user']), log=False) Log.info(self, Log.ENDC + "WordPress admin user password : {0}" - .format(ee_wp_creds['wp_pass'])) + .format(ee_wp_creds['wp_pass']), log=False) display_cache_settings(self, data) addNewSite(self, ee_www_domain, stype, cache, ee_site_webroot) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index fc13aec8..379f9d89 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -117,11 +117,13 @@ def setupdatabase(self, data): # Create MySQL User Log.debug(self, "Creating user {0}".format(ee_db_username)) + Log.debug(self, "create user {0}@{1} identified by ''" + .format(ee_db_username, ee_mysql_grant_host)) EEMysql.execute(self, "create user {0}@{1} identified by '{2}'" .format(ee_db_username, ee_mysql_grant_host, ee_db_password), - errormsg="Cannot setup database user") + errormsg="Cannot setup database user", log=False) # Grant permission Log.debug(self, "Setting up user privileges") diff --git a/ee/core/logging.py b/ee/core/logging.py index a02d47c6..0cea61d9 100644 --- a/ee/core/logging.py +++ b/ee/core/logging.py @@ -23,12 +23,14 @@ class Log: self.app.log.error(Log.FAIL + msg + Log.ENDC) self.app.close(1) - def info(self, msg, end='\n'): + def info(self, msg, end='\n', log=True): """ Logs info messages into log file """ + print(Log.OKBLUE + msg + Log.ENDC, end=end) - self.app.log.info(Log.OKBLUE + msg + Log.ENDC) + if log: + self.app.log.info(Log.OKBLUE + msg + Log.ENDC) def warn(self, msg): """ diff --git a/ee/core/mysql.py b/ee/core/mysql.py index d288dab8..c40b2bfd 100644 --- a/ee/core/mysql.py +++ b/ee/core/mysql.py @@ -9,7 +9,7 @@ from ee.core.logging import Log class EEMysql(): """Method for MySQL connection""" - def execute(self, statement, errormsg=''): + def execute(self, statement, errormsg='', log=True): """Get login details from ~/.my.cnf & Execute MySQL query""" config = configparser.RawConfigParser() cnfpath = expanduser("~")+"/.my.cnf" @@ -43,7 +43,10 @@ class EEMysql(): .format(e)) try: - Log.debug(self, "Executing MySQL statement: {0}".format(statement)) + if log: + Log.debug(self, "Executing MySQL statement: {0}" + .format(statement)) + cur.execute(statement) except Exception as e: cur.close() From 4cb8f3616e8e54a8ec098e3925a131c622bd9e20 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 12 Feb 2015 17:16:03 +0530 Subject: [PATCH 10/18] restricted secure command from password logging --- ee/cli/plugins/secure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/cli/plugins/secure.py b/ee/cli/plugins/secure.py index 359d8513..0fd9a0ef 100644 --- a/ee/cli/plugins/secure.py +++ b/ee/cli/plugins/secure.py @@ -68,10 +68,10 @@ class EESecureController(CementBaseController): password=self.app.pargs.user_pass)) Log.info(self, "Successfully changed HTTP authentication" " username to : {username}" - .format(username=self.app.pargs.user_input)) + .format(username=self.app.pargs.user_input), log=False) Log.info(self, "Successfully changed HTTP authentication" " password to : {password}" - .format(password=self.app.pargs.user_pass)) + .format(password=self.app.pargs.user_pass), log=False) @expose(hide=True) def secure_port(self): From a462bf872bc5293a913258bf6fda66aedee23647 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 12 Feb 2015 17:16:24 +0530 Subject: [PATCH 11/18] Updated install script --- install | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/install b/install index b7801795..c884d879 100644 --- a/install +++ b/install @@ -5,6 +5,7 @@ # to update current EasyEngine from 2.x to 3.x old_ee_version="2.2.3" +new_ee_version="3.0.1" branch=$1 # Define echo function @@ -196,9 +197,27 @@ function update_to_ee3() } +function update_to_ee_latest() +{ + ee_lib_echo "Updating Nginx configuration" + if [ -f /etc/nginx/ee-nginx.conf ]; then + sed -i "s/X-Powered-By.*/X-Powered-By \"EasyEngine $new_ee_version\";/" /etc/nginx/nginx.conf &>> /dev/null + elif [ -f /etc/nginx/nginx.conf ]; then + sed -i "s/X-Powered-By.*/X-Powered-By \"EasyEngine $new_ee_version\";/" /etc/nginx/nginx.conf &>> /dev/null + fi +} + function git_init() { - # Do git intialisation on EasyEngine configuration + # Do git intialisation on EasyEngine adn Nginx configuration + if [ -d /etc/nginx ];then + cd /etc/nginx + if [ ! -d /etc/nginx/.git ]; then + git init > /dev/null + fi + git add . + git commit -am "Updated Nginx" > /dev/null + fi cd /etc/ee if [ ! -d /etc/ee/.git ]; then git init > /dev/null @@ -282,6 +301,13 @@ elif [ ! -f /usr/local/bin/ee ]; then install_ee3 | tee -ai $EE_INSTALL_LOG git_init | tee -ai $EE_INSTALL_LOG else - ee_lib_echo_fail "EasyEngine 3 allready installed on your system" | tee -ai $EE_INSTALL_LOG + ee -v 2>&1 | grep $new_ee_version &>> /dev/null + if [[ $? -ne 0 ]];then + update_to_ee_latest | tee -ai $EE_INSTALL_LOG + install_ee3 | tee -ai $EE_INSTALL_LOG + git_init | tee -ai $EE_INSTALL_LOG + service nginx reload &>> /dev/null + fi + ee_lib_echo_fail "You allready have EasyEngine $new_ee_version" | tee -ai $EE_INSTALL_LOG exit 1 fi From 2ca21919f67368f6df7a7d95edc38cb628b5b8ad Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 12 Feb 2015 17:21:03 +0530 Subject: [PATCH 12/18] Minor update --- ee/cli/plugins/secure.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ee/cli/plugins/secure.py b/ee/cli/plugins/secure.py index ab593188..d29ac091 100644 --- a/ee/cli/plugins/secure.py +++ b/ee/cli/plugins/secure.py @@ -60,12 +60,17 @@ class EESecureController(CementBaseController): self.app.pargs.user_pass = password if password == "": self.app.pargs.user_pass = passwd + Log.debug(self, "printf username:" + "$(openssl passwd -crypt " + "password 2> /dev/null)\n\"" + "> /etc/nginx/htpasswd-ee 2>/dev/null") EEShellExec.cmd_exec(self, "printf \"{username}:" "$(openssl passwd -crypt " "{password} 2> /dev/null)\n\"" "> /etc/nginx/htpasswd-ee 2>/dev/null" .format(username=self.app.pargs.user_input, - password=self.app.pargs.user_pass)) + password=self.app.pargs.user_pass), + log=False) Log.info(self, "Successfully changed HTTP authentication" " username to : {username}" .format(username=self.app.pargs.user_input), log=False) From 2c1226ac7be4c61030c85897757600ac0ee9f33a Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 12 Feb 2015 17:22:50 +0530 Subject: [PATCH 13/18] Improved script --- install | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/install b/install index c884d879..44601dc8 100644 --- a/install +++ b/install @@ -303,10 +303,13 @@ elif [ ! -f /usr/local/bin/ee ]; then else ee -v 2>&1 | grep $new_ee_version &>> /dev/null if [[ $? -ne 0 ]];then - update_to_ee_latest | tee -ai $EE_INSTALL_LOG - install_ee3 | tee -ai $EE_INSTALL_LOG - git_init | tee -ai $EE_INSTALL_LOG - service nginx reload &>> /dev/null + read -p "Update EasyEngine to $new_ee_version (y/n): " ee_ans + if [ "$ee_ans" = "y" ] || [ "$ee_ans" = "Y" ]; then + update_to_ee_latest | tee -ai $EE_INSTALL_LOG + install_ee3 | tee -ai $EE_INSTALL_LOG + git_init | tee -ai $EE_INSTALL_LOG + service nginx reload &>> /dev/null + fi fi ee_lib_echo_fail "You allready have EasyEngine $new_ee_version" | tee -ai $EE_INSTALL_LOG exit 1 From c1e22c55e1459a67cf8763d9fe8c34ab1b7b5b3b Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 12 Feb 2015 17:29:47 +0530 Subject: [PATCH 14/18] Changed Version to 3.0.1 --- ee/core/variables.py | 2 +- install | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ee/core/variables.py b/ee/core/variables.py index dfd820a2..24b3c269 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -12,7 +12,7 @@ class EEVariables(): """Intialization of core variables""" # EasyEngine version - ee_version = "3.0.0" + ee_version = "3.0.1" # EasyEngine packages versions ee_wp_cli = "0.18.0" diff --git a/install b/install index 44601dc8..663c7c09 100644 --- a/install +++ b/install @@ -151,7 +151,7 @@ function install_ee3() rm -rf /tmp/easyengine &>> /dev/null # Clone EE 3.0 Python branch - ee_lib_echo "Cloning EasyEngine 3.0" + ee_lib_echo "Cloning EasyEngine 3" if [ "$branch" = "" ]; then branch=stable fi @@ -159,7 +159,7 @@ function install_ee3() git clone -b $branch https://github.com/rtCamp/easyengine.git /tmp/easyengine --quiet > /dev/null || ee_lib_error "Unable to clone EasyEngine, exit status" 1 cd /tmp/easyengine - ee_lib_echo "Installing EasyEngine 3.0" + ee_lib_echo "Installing EasyEngine 3" python3 setup.py install || ee_lib_error "Unable to install EasyEngine 3.0, exit status " 1 } @@ -167,7 +167,7 @@ function install_ee3() function update_to_ee3() { # Preserve old configuration - ee_lib_echo "Updating EasyEngine 3.0 configuration" + ee_lib_echo "Updating EasyEngine 3 configuration" grant_host=$(grep grant-host /etc/easyengine/ee.conf | awk '{ print $3 }') db_name=$(grep db-name /etc/easyengine/ee.conf | awk '{ print $3 }') @@ -310,7 +310,8 @@ else git_init | tee -ai $EE_INSTALL_LOG service nginx reload &>> /dev/null fi + else + ee_lib_echo_fail "You allready have EasyEngine $new_ee_version" | tee -ai $EE_INSTALL_LOG fi - ee_lib_echo_fail "You allready have EasyEngine $new_ee_version" | tee -ai $EE_INSTALL_LOG exit 1 fi From 080891f9b6b87f171423640413b60947bd0b2c77 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 12 Feb 2015 17:39:49 +0530 Subject: [PATCH 15/18] Fixed dependency packages not installing during update --- install | 1 + 1 file changed, 1 insertion(+) diff --git a/install b/install index 663c7c09..5d293836 100644 --- a/install +++ b/install @@ -305,6 +305,7 @@ else if [[ $? -ne 0 ]];then read -p "Update EasyEngine to $new_ee_version (y/n): " ee_ans if [ "$ee_ans" = "y" ] || [ "$ee_ans" = "Y" ]; then + install_dep | tee -ai $EE_INSTALL_LOG update_to_ee_latest | tee -ai $EE_INSTALL_LOG install_ee3 | tee -ai $EE_INSTALL_LOG git_init | tee -ai $EE_INSTALL_LOG From 12ec205d49d1a3295091b3f55fe552469d55508d Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 12 Feb 2015 17:43:11 +0530 Subject: [PATCH 16/18] Fixed X-Powered-By header not updating --- install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install b/install index 5d293836..93b68812 100644 --- a/install +++ b/install @@ -169,6 +169,10 @@ function update_to_ee3() # Preserve old configuration ee_lib_echo "Updating EasyEngine 3 configuration" + if [ -f /etc/nginx/nginx.conf ]; then + sed -i "s/X-Powered-By.*/X-Powered-By \"EasyEngine $new_ee_version\";/" /etc/nginx/nginx.conf &>> /dev/null + fi + grant_host=$(grep grant-host /etc/easyengine/ee.conf | awk '{ print $3 }') db_name=$(grep db-name /etc/easyengine/ee.conf | awk '{ print $3 }') db_user=$(grep db-name /etc/easyengine/ee.conf | awk '{ print $3 }') From 56ceb97c204c60558a272f440f688ef0988fe835 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 12 Feb 2015 18:40:13 +0530 Subject: [PATCH 17/18] minor update to install locales --- install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install b/install index 93b68812..956a473a 100644 --- a/install +++ b/install @@ -44,6 +44,8 @@ function install_dep() apt-get -y install graphviz python-software-properties python3 python3-apt python3-setuptools python3-dev sqlite3 git || ee_lib_error "Unable to pre depedencies, exit status " 1 fi + # Generating Locale + locale-gen en } function sync_db() From c7ba0fa130926877d7e75405030b2fa8e4c8dd57 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 12 Feb 2015 18:40:50 +0530 Subject: [PATCH 18/18] minor update to install locales --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 956a473a..336a37aa 100644 --- a/install +++ b/install @@ -45,7 +45,7 @@ function install_dep() fi # Generating Locale - locale-gen en + locale-gen en &>> /dev/null } function sync_db()