Commits

Zhang Huangbin committed 9eeae20

Don't enable Awstats and Cluebringer webui on openSUSE with PGSQL backend.

  • Participants
  • Parent commits d166249

Comments (0)

Files changed (4)

iRedMail/functions/awstats.sh

 EOF
 
     if [ X"${DISTRO}" == X"SUSE" ]; then
-        perl -pi -e 's#(</VirtualHost>)#Alias /awstats/icon "$ENV{'AWSTATS_ICON_DIR'}/"\n${1}#' ${HTTPD_SSL_CONF}
-        perl -pi -e 's#(</VirtualHost>)#Alias /awstats/js "$ENV{'AWSTATS_JS_DIR'}/"\n${1}#' ${HTTPD_SSL_CONF}
-        perl -pi -e 's#(</VirtualHost>)#Alias /awstats/css "$ENV{'AWSTATS_CSS_DIR'}/"\n${1}#' ${HTTPD_SSL_CONF}
+        perl -pi -e 's#(</VirtualHost>)#Alias /awstats/icon "$ENV{AWSTATS_ICON_DIR}/"\n${1}#' ${HTTPD_SSL_CONF}
+        perl -pi -e 's#(</VirtualHost>)#Alias /awstats/js "$ENV{AWSTATS_JS_DIR}/"\n${1}#' ${HTTPD_SSL_CONF}
+        perl -pi -e 's#(</VirtualHost>)#Alias /awstats/css "$ENV{AWSTATS_CSS_DIR}/"\n${1}#' ${HTTPD_SSL_CONF}
+
+        if [ X"${BACKEND}" == X'PGSQL' ]; then
+            # Don't enable Awstats since we don't have Apache module mod_auth_pgsql
+            backup_file ${AWSTATS_HTTPD_CONF}
+            rm ${AWSTATS_HTTPD_CONF} &>/dev/null
+        fi
     fi
 
     # Make Awstats can be accessed via HTTPS.

iRedMail/functions/cluebringer.sh

         perl -pi -e 's/^(DB_Type=).*/${1}mysql/' ${CLUEBRINGER_CONF}
         perl -pi -e 's/^(DB_Host=).*/${1}$ENV{MYSQL_SERVER}/' ${CLUEBRINGER_CONF}
         perl -pi -e 's/^(DB_Port=).*/${1}$ENV{MYSQL_SERVER_PORT}/' ${CLUEBRINGER_CONF}
+
     elif [ X"${BACKEND}" == X"PGSQL" ]; then
-        perl -pi -e 's/^(#*)(DSN=DBI:Pg:).*/${2}host=$ENV{PGSQL_SERVER};database=$ENV{CLUEBRINGER_DB_NAME};user=$ENV{CLUEBRINGER_DB_USER};password=$ENV{CLUEBRINGER_DB_PASSWD}/' ${CLUEBRINGER_CONF}
+        # Comment out all default DSN settings
+        perl -pi -e 's/^(DSN=.*)/#${1}/g' ${CLUEBRINGER_CONF}
+        perl -pi -e 's/^(Username=.*)/#${1}/g' ${CLUEBRINGER_CONF}
+        perl -pi -e 's/^(Password=.*)/#${1}/g' ${CLUEBRINGER_CONF}
 
-        perl -pi -e 's/^(DB_Type=).*/${1}pgsql/' ${CLUEBRINGER_CONF}
-        perl -pi -e 's/^(DB_Host=).*/${1}$ENV{PGSQL_SERVER}/' ${CLUEBRINGER_CONF}
-        perl -pi -e 's/^(DB_Port=).*/${1}$ENV{PGSQL_SERVER_PORT}/' ${CLUEBRINGER_CONF}
-
-        if [ X"${DISTRO}" == X'FREEBSD' ]; then
-            # Comment out all default DSN settings
-            perl -pi -e 's/^(DSN=.*)/#${1}/g' ${CLUEBRINGER_CONF}
-            perl -pi -e 's/^(Username=.*)/#${1}/g' ${CLUEBRINGER_CONF}
-            perl -pi -e 's/^(Password=.*)/#${1}/g' ${CLUEBRINGER_CONF}
-
-            # Enable Pg
-            perl -pi -e 's#^(.database.)$#${1}\nDSN=DBI:Pg:host=$ENV{PGSQL_SERVER};database=$ENV{CLUEBRINGER_DB_NAME};user=$ENV{CLUEBRINGER_DB_USER};password=$ENV{CLUEBRINGER_DB_PASSWD}#' ${CLUEBRINGER_CONF}
-        fi
+        perl -pi -e 's#^(.database.)$#${1}\nDSN=DBI:Pg:host=$ENV{PGSQL_SERVER};database=$ENV{CLUEBRINGER_DB_NAME};user=$ENV{CLUEBRINGER_DB_USER};password=$ENV{CLUEBRINGER_DB_PASSWD}#' ${CLUEBRINGER_CONF}
     fi
 
     # Database
 </Directory>
 EOF
 
+    if [ X"${DISTRO}" == X'SUSE' -a X"${BACKEND}" == X'PGSQL' ]; then
+        # Don't enable Cluebringer webui since we don't have Apache module mod_auth_pgsql
+        backup_file ${CLUEBRINGER_HTTPD_CONF}
+        rm ${CLUEBRINGER_HTTPD_CONF} &>/dev/null
+        backup_file ${CLUEBRINGER_HTTPD_CONF}
+    fi
     echo 'export status_cluebringer_webui_config="DONE"' >> ${STATUS_FILE}
 }

iRedMail/functions/packages.sh

     # RC script ready in early stage.
 
     if [ X"${DISTRO}" == X"RHEL" ]; then
-        ALL_PKGS="${ALL_PKGS} python-ldap${PKG_ARCH} python-psycopg2${PKG_ARCH}"
+        [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} python-ldap${PKG_ARCH} MySQL-python${PKG_ARCH}"
+        [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} MySQL-python${PKG_ARCH}"
+        [ X"${BACKEND}" == X'PGSQL' ] && ALL_PKGS="${ALL_PKGS} python-psycopg2${PKG_ARCH}"
+
     elif [ X"${DISTRO}" == X"SUSE" ]; then
-        ALL_PKGS="${ALL_PKGS} python-ldap"
+        [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} python-ldap python-mysql"
+        [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} python-mysql"
+        [ X"${BACKEND}" == X'PGSQL' ] && ALL_PKGS="${ALL_PKGS} python-psycopg2"
+
     elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
-        ALL_PKGS="${ALL_PKGS} python-ldap python-psycopg2 python-mysqldb"
+        [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} python-ldap python-mysqldb"
+        [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} python-mysqldb"
+        [ X"${BACKEND}" == X'PGSQL' ] && ALL_PKGS="${ALL_PKGS} python-psycopg2"
+
     elif [ X"${DISTRO}" == X'GENTOO' ]; then
-        ALL_PKGS="${ALL_PKGS} python-ldap"
+        [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} python-ldap mysql-python"
+        [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} mysql-python"
+        [ X"${BACKEND}" == X'PGSQL' ] && ALL_PKGS="${ALL_PKGS} psycopg"
+
     elif [ X"${DISTRO}" == X'OPENBSD' ]; then
         [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} py-ldap py-mysql"
         [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} py-mysql"
     # iRedAdmin.
     # Force install all dependence to help customers install iRedAdmin-Pro.
     if [ X"${DISTRO}" == X"RHEL" ]; then
-        ALL_PKGS="${ALL_PKGS} python-jinja2${PKG_ARCH} python-webpy.noarch MySQL-python${PKG_ARCH} mod_wsgi${PKG_ARCH}"
+        ALL_PKGS="${ALL_PKGS} python-jinja2${PKG_ARCH} python-webpy.noarch mod_wsgi${PKG_ARCH}"
 
     elif [ X"${DISTRO}" == X"SUSE" ]; then
-        ALL_PKGS="${ALL_PKGS} apache2-mod_wsgi python-jinja2 python-mysql python-xml"
+        ALL_PKGS="${ALL_PKGS} apache2-mod_wsgi python-jinja2 python-xml"
 
         # openSUSE-12.1: Web.py will be installed locally with command 'easy_install'.
         [ X"${DISTRO_CODENAME}" == X'asparagus' ] && ALL_PKGS="${ALL_PKGS} python-distribute"
         [ X"${DISTRO_CODENAME}" == X'mantis' ] && ALL_PKGS="${ALL_PKGS} python-web.py"
 
     elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
-        ALL_PKGS="${ALL_PKGS} libapache2-mod-wsgi python-mysqldb python-jinja2 python-netifaces python-webpy"
+        ALL_PKGS="${ALL_PKGS} libapache2-mod-wsgi python-jinja2 python-netifaces python-webpy"
     elif [ X"${DISTRO}" == X'GENTOO' ]; then
-        ALL_PKGS="${ALL_PKGS} jinja webpy mysql-python mod_wsgi"
+        ALL_PKGS="${ALL_PKGS} jinja webpy mod_wsgi"
 
         gentoo_add_use_flags 'dev-python/jinja' 'examples i18n vim-syntax'
         # Don't use python-3

iRedMail/functions/system_accounts.sh

         groupadd ${IREDADMIN_HTTPD_GROUP} 2>/dev/null
         useradd -m -d ${IREDADMIN_HOME_DIR} -s ${SHELL_NOLOGIN} -g ${IREDADMIN_HTTPD_GROUP} ${IREDADMIN_HTTPD_USER} 2>/dev/null
     elif [ X"${DISTRO}" == X"SUSE" ]; then
-        groupadd ${IREDADMIN_HTTPD_GROUP}
+        groupadd ${IREDADMIN_HTTPD_GROUP} &>/dev/null
         useradd -m -d ${IREDADMIN_HOME_DIR} -s ${SHELL_NOLOGIN} -g ${IREDADMIN_HTTPD_GROUP} ${IREDADMIN_HTTPD_USER} 2>/dev/null
     else
         useradd -m -d ${IREDADMIN_HOME_DIR} -s ${SHELL_NOLOGIN} ${IREDADMIN_HTTPD_GROUP}
         groupadd ${IREDAPD_DAEMON_GROUP}
         useradd -m -d ${IREDAPD_HOME_DIR} -s ${SHELL_NOLOGIN} -g ${IREDAPD_DAEMON_GROUP} ${IREDAPD_DAEMON_USER} 2>/dev/null
     elif [ X"${DISTRO}" == X"SUSE" ]; then
-        groupadd ${IREDAPD_DAEMON_GROUP}
+        groupadd ${IREDAPD_DAEMON_GROUP} &>/dev/null
         useradd -m -d ${IREDAPD_HOME_DIR} -s ${SHELL_NOLOGIN} -g ${IREDAPD_DAEMON_GROUP} ${IREDAPD_DAEMON_USER} 2>/dev/null
     else
         useradd -m -d ${IREDAPD_HOME_DIR} -s ${SHELL_NOLOGIN} -c "iRedAPD daemon user" ${IREDAPD_DAEMON_USER}