Zhang Huangbin avatar Zhang Huangbin committed 09ed780

Fix incorrect Cluebringer config on FreeBSD.
Detect existing packages under /var/db/pkg/[PKGNAME]/

Comments (0)

Files changed (2)

iRedMail/functions/cluebringer.sh

         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
     fi
 
     # Database

iRedMail/functions/packages_freebsd.sh

 OPTIONS_FILE_SET+=ASYNC_API
 EOF
 
-    # LDAP/MySQL/PGSQL client libraries and tools
-    #ALL_PORTS="${ALL_PORTS} net/openldap${WANT_OPENLDAP_VER}-client databases/mysql${WANT_MYSQL_VER}-client databases/postgresql${WANT_PGSQL_VER}-client"
-
-    # OpenLDAP v2.4. REQUIRED for LDAP backend.
+    # OpenLDAP. REQUIRED for LDAP backend.
     cat > /var/db/ports/openldap${WANT_OPENLDAP_VER}/options <<EOF
-OPTIONS_FILE_UNSET+=ACCESSLOG
+OPTIONS_FILE_SET+=ACCESSLOG
 OPTIONS_FILE_UNSET+=ACI
 OPTIONS_FILE_UNSET+=AUDITLOG
 OPTIONS_FILE_SET+=BDB
 OPTIONS_FILE_SET+=SASL
 OPTIONS_FILE_SET+=SEQMOD
 OPTIONS_FILE_UNSET+=SHELL
-OPTIONS_FILE_UNSET+=SLAPI
+OPTIONS_FILE_SET+=SLAPI
 OPTIONS_FILE_UNSET+=SLP
 OPTIONS_FILE_UNSET+=SMBPWD
 OPTIONS_FILE_UNSET+=SOCK
             status="\$status_fetch_port_$portname"
             if [ X"$(eval echo ${status})" != X"DONE" ]; then
                 ECHO_INFO "Fetching required distfiles for port: ${i}"
-                cd /usr/ports/${i} && make fetch-recursive
+                cd /usr/ports/${i} && make WITH_COMPAT=yes fetch-recursive
                 if [ X"$?" == X"0" ]; then
                     echo "export status_fetch_port_${portname}='DONE'" >> ${STATUS_FILE}
                 else
                     port_start_time="$(date +%s)"
 
                     # Compiling
-                    make clean && make install clean
+                    port_pkg_name="$(make -V PKGNAME)"
+                    if [ ! -d /var/db/pkg/${port_pkg_name} ]; then
+                        make clean
+                        make install clean
+                    else
+                        ECHO_INFO "[SKIP] Package was already installed (/var/db/pkg/${port_pkg_name})."
+                    fi
 
                     if [ X"$?" == X"0" ]; then
                         # Log used time
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.