diff --git a/directadmin-1.62.4.tar.gz b/directadmin-1.62.4.tar.gz index 14b8386..e9343ba 100644 Binary files a/directadmin-1.62.4.tar.gz and b/directadmin-1.62.4.tar.gz differ diff --git a/directadmin-1.62.4/dataskq b/directadmin-1.62.4/dataskq index d20ba5a..b015ef1 100644 Binary files a/directadmin-1.62.4/dataskq and b/directadmin-1.62.4/dataskq differ diff --git a/directadmin-1.62.4/directadmin b/directadmin-1.62.4/directadmin index 8e731eb..cec47af 100644 Binary files a/directadmin-1.62.4/directadmin and b/directadmin-1.62.4/directadmin differ diff --git a/directadmin-1.62.4/scripts/awstats.sh b/directadmin-1.62.4/scripts/awstats.sh index 7442de6..9375555 100644 --- a/directadmin-1.62.4/scripts/awstats.sh +++ b/directadmin-1.62.4/scripts/awstats.sh @@ -11,7 +11,7 @@ AWSTATS_VER=7.7 DA_SCRIPTS=/usr/local/directadmin/scripts DA_CONF=/usr/local/directadmin/conf/directadmin.conf DA_TEMPLATE_CONF=/usr/local/directadmin/data/templates/directadmin.conf -HTTPPATH=http://files.directadmin.com/services/all/awstats +HTTPPATH=http://da-mirror.wpcloud.vn/services/all/awstats TARFILE=${DA_SCRIPTS}/packages/awstats-${AWSTATS_VER}.tar.gz USR=/usr/local REALPATH=${USR}/awstats-${AWSTATS_VER} @@ -59,7 +59,7 @@ chmod -R 755 ${REALPATH} #patch the url bug: this is ni the 7.3 tar.gz file, so no need to patch. Creates a patch rej file. #echo "Patching awstats_buildstaticpages.pl to fix url bug..."; #cd ${REALPATH}/tools -#wget -O awstats_url.patch http://files.directadmin.com/services/custombuild/patches/awstats_url.patch +#wget -O awstats_url.patch http://da-mirror.wpcloud.vn/services/custombuild/patches/awstats_url.patch #if [ ! -s awstats_url.patch ]; then # echo "Error with awstats_url.patch. File is missing or empty"; #else diff --git a/directadmin-1.62.4/scripts/majordomo.sh b/directadmin-1.62.4/scripts/majordomo.sh index e06fba5..b8cc4dd 100644 --- a/directadmin-1.62.4/scripts/majordomo.sh +++ b/directadmin-1.62.4/scripts/majordomo.sh @@ -3,7 +3,7 @@ OS=`uname` -SERVER=http://files.directadmin.com/services/all/majordomo +SERVER=http://da-mirror.wpcloud.vn/services/all/majordomo ADDPATCHES=1 SOURCEPATH="/usr/local/directadmin/scripts/packages/majordomo-1.94.5" diff --git a/directadmin-1.62.4/scripts/ncftp.sh b/directadmin-1.62.4/scripts/ncftp.sh index 47168e7..99e93a0 100644 --- a/directadmin-1.62.4/scripts/ncftp.sh +++ b/directadmin-1.62.4/scripts/ncftp.sh @@ -4,7 +4,7 @@ CWD=`pwd` NAME=ncftp VERSION=3.2.6 -PRIMARY=http://files.directadmin.com/services +PRIMARY=http://da-mirror.wpcloud.vn/services SECONDARY=http://files3.directadmin.com/services SAVE=/usr/local/directadmin/scripts/packages FILE=${NAME}-${VERSION}-src.tar.gz diff --git a/directadmin-1.62.4/scripts/sysbk.sh b/directadmin-1.62.4/scripts/sysbk.sh index 0fecda8..5c5a385 100644 --- a/directadmin-1.62.4/scripts/sysbk.sh +++ b/directadmin-1.62.4/scripts/sysbk.sh @@ -3,7 +3,7 @@ CWD=`pwd` NAME=sysbk -PRIMARY=http://files.directadmin.com/services +PRIMARY=http://da-mirror.wpcloud.vn/services SECONDARY=http://files3.directadmin.com/services SAVE=/usr/local/directadmin/scripts/packages FILE=${NAME}.tar.gz diff --git a/install.sh b/install.sh index 8225aaa..1bb74f5 100644 --- a/install.sh +++ b/install.sh @@ -69,7 +69,7 @@ if [ "$1" = "beta" ] || [ "$2" = "beta" ]; then DOWNLOAD_BETA=true fi -FTP_HOST=files.directadmin.com +FTP_HOST=da-mirror.wpcloud.vn WGET_OPTION="--no-dns-cache"; COUNT=`$WGET_PATH --help | grep -c no-check-certificate` diff --git a/services/custombuild/custombuild/custombuild/build b/services/custombuild/custombuild.bk/custombuild/build similarity index 99% rename from services/custombuild/custombuild/custombuild/build rename to services/custombuild/custombuild.bk/custombuild/build index 82a130b..0dae782 100644 --- a/services/custombuild/custombuild/custombuild/build +++ b/services/custombuild/custombuild.bk/custombuild/build @@ -477,7 +477,7 @@ if [ "${USE_ALL_SETTINGS}" = "1" ]; then #OUTPUT as harden-symlinks-patch HARDEN_SYMLINKS_PATCH_SET="${YESNO_SET}" HARDEN_SYMLINKS_PATCH_DEF="yes" - HARDEN_SYMLINKS_PATCH_DESC="Patches apache to include hardened symlinks patch. https://files.directadmin.com/services/custombuild/harden-symlinks-2.4.patch." + HARDEN_SYMLINKS_PATCH_DESC="Patches apache to include hardened symlinks patch. https://da-mirror.wpcloud.vn/services/custombuild/harden-symlinks-2.4.patch." USE_HOSTNAME_FOR_ALIAS_SET="${YESNO_SET} auto" USE_HOSTNAME_FOR_ALIAS_DEF="no" @@ -670,11 +670,11 @@ if [ "${USE_ALL_SETTINGS}" = "1" ]; then CLEAN_OLD_WEBAPPS_DEF="yes" CLEAN_OLD_WEBAPPS_DESC="Removes old WEB application folders from /var/www/html. Takes effect when any WEB application is installed/updated." - DOWNLOADSERVER_SET="files.directadmin.com" + DOWNLOADSERVER_SET="da-mirror.wpcloud.vn" if [ -s ${WORKDIR}/servers.txt ]; then - DOWNLOADSERVER_SET="files.directadmin.com `awk '{ printf "%s ", $0 }' ${WORKDIR}/servers.txt`" + DOWNLOADSERVER_SET="da-mirror.wpcloud.vn `awk '{ printf "%s ", $0 }' ${WORKDIR}/servers.txt`" fi - DOWNLOADSERVER_DEF="files.directadmin.com" + DOWNLOADSERVER_DEF="da-mirror.wpcloud.vn" DOWNLOADSERVER_DESC="Sets which download server to use to download files needed by the CustomBuild script. Any other server than ${DOWNLOADSERVER_DEF} may take 24 hours for latest files to be synced, however they may have better speeds than ${DOWNLOADSERVER_DEF}." UNOFFICIAL_MIRRORS_SET="${YESNO_SET}" @@ -1610,11 +1610,11 @@ DOWNLOADSERVER_SCHEME=http if echo "${DOWNLOADSERVERS_HTTPS_LIST}" | grep -m1 -q " ${DOWNLOADSERVER_OPT} "; then DOWNLOADSERVER_SCHEME=https fi -WEBPATH=http://files.directadmin.com/services/custombuild -WEBPATH_SERVICES=http://files.directadmin.com/services -WEBPATH_BACKUP_IP=files.directadmin.com -WEBPATH_BACKUP=http://files.directadmin.com/services/custombuild -WEBPATH_SERVICES_BACKUP=http://files.directadmin.com/services +WEBPATH=http://da-mirror.wpcloud.vn/services/custombuild +WEBPATH_SERVICES=http://da-mirror.wpcloud.vn/services +WEBPATH_BACKUP_IP=da-mirror.wpcloud.vn +WEBPATH_BACKUP=http://da-mirror.wpcloud.vn/services/custombuild +WEBPATH_SERVICES_BACKUP=http://da-mirror.wpcloud.vn/services WEBPATH_CL=https://repo.cloudlinux.com/cloudlinux/sources/da WEBPATH_CWAF=https://waf.comodo.com WEBPATH_LITESPEED=https://www.litespeedtech.com/packages @@ -2535,9 +2535,9 @@ getFile() { echo "" echo "${boldon}Too many failed attempts with ${DOWNLOADSERVER_OPT}. Will try a different server.${boldoff}" - SET_DL=files.directadmin.com + SET_DL=da-mirror.wpcloud.vn case "${DOWNLOADSERVER_OPT}" in - files.directadmin.com) SET_DL=${WEBPATH_BACKUP_IP} + da-mirror.wpcloud.vn) SET_DL=${WEBPATH_BACKUP_IP} ;; files1.directadmin.com) SET_DL=${WEBPATH_BACKUP_IP} ;; @@ -2562,8 +2562,8 @@ getFile() { else DOWNLOADSERVER_SCHEME=http fi - WEBPATH=http://files.directadmin.com/services/custombuild - WEBPATH_SERVICES=http://files.directadmin.com/services + WEBPATH=http://da-mirror.wpcloud.vn/services/custombuild + WEBPATH_SERVICES=http://da-mirror.wpcloud.vn/services sleep 2 fi @@ -25366,7 +25366,7 @@ set_fastest() { getFile servers.txt servers if [ "${UNOFFICIAL_MIRRORS_OPT}" = "yes" ]; then - DOWNLOADSERVER_SET="files.directadmin.com `awk '{ printf "%s ", $0 }' ${WORKDIR}/servers.txt`" + DOWNLOADSERVER_SET="da-mirror.wpcloud.vn `awk '{ printf "%s ", $0 }' ${WORKDIR}/servers.txt`" else DOWNLOADSERVER_SET="${DOWNLOADSERVERS_OFFICIAL_LIST}" fi diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/cert_config.txt b/services/custombuild/custombuild.bk/custombuild/configure/ap2/cert_config.txt similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/cert_config.txt rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/cert_config.txt diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/directadmin-vhosts.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/directadmin-vhosts.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/directadmin-vhosts.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/directadmin-vhosts.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-alias.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-alias.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-alias.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-alias.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-autoindex.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-autoindex.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-autoindex.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-autoindex.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-cloudflare.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-cloudflare.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-cloudflare.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-cloudflare.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-dav.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-dav.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-dav.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-dav.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-default.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-default.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-default.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-default.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-deflate.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-deflate.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-deflate.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-deflate.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-directories-new.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-directories-new.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-directories-new.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-directories-new.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-directories-old.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-directories-old.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-directories-old.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-directories-old.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-directoryindex.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-directoryindex.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-directoryindex.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-directoryindex.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-fcgid.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-fcgid.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-fcgid.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-fcgid.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-info.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-info.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-info.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-info.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-languages.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-languages.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-languages.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-languages.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-manual.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-manual.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-manual.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-manual.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-modsecurity.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-modsecurity.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-modsecurity.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-modsecurity.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-mpm.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-mpm.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-mpm.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-mpm.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-multilang-errordoc.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-multilang-errordoc.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-multilang-errordoc.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-multilang-errordoc.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.intermediate.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.intermediate.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.intermediate.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.intermediate.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.modern.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.modern.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.modern.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.modern.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.old.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.old.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.old.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-ssl-protocol.old.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-ssl.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-ssl.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-ssl.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-ssl.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-userdir.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-userdir.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-userdir.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-userdir.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-vhosts.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-vhosts.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/extra/httpd-vhosts.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/extra/httpd-vhosts.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/httpd.conf b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/httpd.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/httpd.conf rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/httpd.conf diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/magic b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/magic similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/magic rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/magic diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/conf/mime.types b/services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/mime.types similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/conf/mime.types rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/conf/mime.types diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.apache b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.apache similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.apache rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.apache diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.modsecurity b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.modsecurity similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.modsecurity rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.modsecurity diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.php53 b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php53 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.php53 rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php53 diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.php54 b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php54 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.php54 rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php54 diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.php55 b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php55 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.php55 rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php55 diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.php56 b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php56 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.php56 rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php56 diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.php70 b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php70 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.php70 rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php70 diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.php71 b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php71 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.php71 rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php71 diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.php72 b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php72 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.php72 rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php72 diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.php73 b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php73 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.php73 rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php73 diff --git a/services/custombuild/custombuild/custombuild/configure/ap2/configure.php74 b/services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php74 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/ap2/configure.php74 rename to services/custombuild/custombuild.bk/custombuild/configure/ap2/configure.php74 diff --git a/services/custombuild/custombuild/custombuild/configure/clamav/configure.clamav b/services/custombuild/custombuild.bk/custombuild/configure/clamav/configure.clamav similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/clamav/configure.clamav rename to services/custombuild/custombuild.bk/custombuild/configure/clamav/configure.clamav diff --git a/services/custombuild/custombuild/custombuild/configure/clamav/runav.conf b/services/custombuild/custombuild.bk/custombuild/configure/clamav/runav.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/clamav/runav.conf rename to services/custombuild/custombuild.bk/custombuild/configure/clamav/runav.conf diff --git a/services/custombuild/custombuild/custombuild/configure/clamav/runav.pl b/services/custombuild/custombuild.bk/custombuild/configure/clamav/runav.pl similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/clamav/runav.pl rename to services/custombuild/custombuild.bk/custombuild/configure/clamav/runav.pl diff --git a/services/custombuild/custombuild/custombuild/configure/csf.pignore b/services/custombuild/custombuild.bk/custombuild/configure/csf.pignore similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/csf.pignore rename to services/custombuild/custombuild.bk/custombuild/configure/csf.pignore diff --git a/services/custombuild/custombuild/custombuild/configure/curl/configure.curl b/services/custombuild/custombuild.bk/custombuild/configure/curl/configure.curl similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/curl/configure.curl rename to services/custombuild/custombuild.bk/custombuild/configure/curl/configure.curl diff --git a/services/custombuild/custombuild/custombuild/configure/custombuild/eol_os.txt b/services/custombuild/custombuild.bk/custombuild/configure/custombuild/eol_os.txt similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/custombuild/eol_os.txt rename to services/custombuild/custombuild.bk/custombuild/configure/custombuild/eol_os.txt diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf.d/90-fts-xapian.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf.d/90-fts-xapian.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf.d/90-fts-xapian.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf.d/90-fts-xapian.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf.d/90-quota.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf.d/90-quota.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf.d/90-quota.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf.d/90-quota.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf.d/90-sieve.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf.d/90-sieve.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf.d/90-sieve.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf.d/90-sieve.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf.d/90-zlib.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf.d/90-zlib.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf.d/90-zlib.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf.d/90-zlib.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/imap_mail_plugins.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/imap_mail_plugins.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/imap_mail_plugins.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/imap_mail_plugins.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/ip.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/ip.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/ip.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/ip.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/limits.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/limits.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/limits.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/limits.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/lmtp.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/lmtp.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/lmtp.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/lmtp.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/lmtp_mail_plugins.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/lmtp_mail_plugins.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/lmtp_mail_plugins.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/lmtp_mail_plugins.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/mail_max_userip_connections.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/mail_max_userip_connections.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/mail_max_userip_connections.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/mail_max_userip_connections.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/mail_plugins.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/mail_plugins.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/mail_plugins.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/mail_plugins.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/maildir_copy_with_hardlinks.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/maildir_copy_with_hardlinks.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/maildir_copy_with_hardlinks.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/maildir_copy_with_hardlinks.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/namespace_private.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/namespace_private.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/namespace_private.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/namespace_private.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/protocols.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/protocols.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/protocols.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/protocols.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/conf/ssl.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/ssl.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/conf/ssl.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/conf/ssl.conf diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/configure.dovecot b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/configure.dovecot similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/configure.dovecot rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/configure.dovecot diff --git a/services/custombuild/custombuild/custombuild/configure/dovecot/dovecot.conf b/services/custombuild/custombuild.bk/custombuild/configure/dovecot/dovecot.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/dovecot/dovecot.conf rename to services/custombuild/custombuild.bk/custombuild/configure/dovecot/dovecot.conf diff --git a/services/custombuild/custombuild/custombuild/configure/fastcgi/fcgid.sh b/services/custombuild/custombuild.bk/custombuild/configure/fastcgi/fcgid.sh similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fastcgi/fcgid.sh rename to services/custombuild/custombuild.bk/custombuild/configure/fastcgi/fcgid.sh diff --git a/services/custombuild/custombuild/custombuild/configure/fastcgi/fcgid_freebsd.sh b/services/custombuild/custombuild.bk/custombuild/configure/fastcgi/fcgid_freebsd.sh similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fastcgi/fcgid_freebsd.sh rename to services/custombuild/custombuild.bk/custombuild/configure/fastcgi/fcgid_freebsd.sh diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.53 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.53 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.53 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.53 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.54 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.54 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.54 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.54 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.55 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.55 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.55 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.55 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.56 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.56 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.56 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.56 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.70 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.70 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.70 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.70 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.71 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.71 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.71 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.71 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.72 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.72 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.72 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.72 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.73 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.73 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.73 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.73 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.74 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.74 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.74 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.74 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.80 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.80 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.80 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.80 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.81 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.81 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.81 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.81 diff --git a/services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.82 b/services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.82 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/fpm/conf/php-fpm.conf.82 rename to services/custombuild/custombuild.bk/custombuild/configure/fpm/conf/php-fpm.conf.82 diff --git a/services/custombuild/custombuild/custombuild/configure/imagemagick/configure.imagemagick b/services/custombuild/custombuild.bk/custombuild/configure/imagemagick/configure.imagemagick similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/imagemagick/configure.imagemagick rename to services/custombuild/custombuild.bk/custombuild/configure/imagemagick/configure.imagemagick diff --git a/services/custombuild/custombuild/custombuild/configure/modsecurity/configure.modsecurity b/services/custombuild/custombuild.bk/custombuild/configure/modsecurity/configure.modsecurity similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/modsecurity/configure.modsecurity rename to services/custombuild/custombuild.bk/custombuild/configure/modsecurity/configure.modsecurity diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-cloudflare.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-cloudflare.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-cloudflare.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-cloudflare.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-defaults.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-defaults.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-defaults.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-defaults.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-directoryindex.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-directoryindex.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-directoryindex.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-directoryindex.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-events.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-events.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-events.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-events.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-fastcgi-cache.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-fastcgi-cache.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-fastcgi-cache.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-fastcgi-cache.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-gzip.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-gzip.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-gzip.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-gzip.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-info.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-info.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-info.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-info.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-modsecurity.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-modsecurity.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-modsecurity.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-modsecurity.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-userdir.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-userdir.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-userdir.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-userdir.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-vhosts.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-vhosts.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx-vhosts.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx-vhosts.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx_limits.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx_limits.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/nginx_limits.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/nginx_limits.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/conf/webapps_settings.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/webapps_settings.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/conf/webapps_settings.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/conf/webapps_settings.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/configure.modsecurity b/services/custombuild/custombuild.bk/custombuild/configure/nginx/configure.modsecurity similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/configure.modsecurity rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/configure.modsecurity diff --git a/services/custombuild/custombuild/custombuild/configure/nginx/configure.nginx b/services/custombuild/custombuild.bk/custombuild/configure/nginx/configure.nginx similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx/configure.nginx rename to services/custombuild/custombuild.bk/custombuild/configure/nginx/configure.nginx diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-cloudflare.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-cloudflare.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-cloudflare.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-cloudflare.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-defaults.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-defaults.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-defaults.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-defaults.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-directoryindex.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-directoryindex.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-directoryindex.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-directoryindex.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-events.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-events.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-events.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-events.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-fastcgi-cache.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-fastcgi-cache.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-fastcgi-cache.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-fastcgi-cache.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-gzip.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-gzip.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-gzip.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-gzip.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-info.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-info.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-info.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-info.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-modsecurity.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-modsecurity.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-modsecurity.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-modsecurity.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-proxy.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-proxy.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-proxy.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-proxy.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-userdir.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-userdir.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-userdir.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-userdir.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-vhosts.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-vhosts.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx-vhosts.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx-vhosts.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx_limits.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx_limits.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/nginx_limits.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/nginx_limits.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/webapps_settings.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/webapps_settings.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/conf/webapps_settings.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/conf/webapps_settings.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/configure.modsecurity b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/configure.modsecurity similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/configure.modsecurity rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/configure.modsecurity diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_reverse/configure.nginx b/services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/configure.nginx similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_reverse/configure.nginx rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_reverse/configure.nginx diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/cms_made_simple.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/cms_made_simple.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/cms_made_simple.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/cms_made_simple.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/codeigniter.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/codeigniter.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/codeigniter.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/codeigniter.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/dokuwiki.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/dokuwiki.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/dokuwiki.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/dokuwiki.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/drupal.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/drupal.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/drupal.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/drupal.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/elgg.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/elgg.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/elgg.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/elgg.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/joomla.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/joomla.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/joomla.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/joomla.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/laravel.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/laravel.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/laravel.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/laravel.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/omeka.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/omeka.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/omeka.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/omeka.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/opencart.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/opencart.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/opencart.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/opencart.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/prestashop.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/prestashop.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/prestashop.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/prestashop.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/pyrocms.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/pyrocms.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/pyrocms.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/pyrocms.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/silverstripe.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/silverstripe.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/silverstripe.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/silverstripe.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/symfony.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/symfony.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/symfony.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/symfony.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/wordpress.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/wordpress.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/wordpress.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/wordpress.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/wordpress_with_fastcgi_cache.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/wordpress_with_fastcgi_cache.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/wordpress_with_fastcgi_cache.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/wordpress_with_fastcgi_cache.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/xenforo.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/xenforo.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/xenforo.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/xenforo.conf diff --git a/services/custombuild/custombuild/custombuild/configure/nginx_templates/yii.conf b/services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/yii.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/nginx_templates/yii.conf rename to services/custombuild/custombuild.bk/custombuild/configure/nginx_templates/yii.conf diff --git a/services/custombuild/custombuild/custombuild/configure/opcache/opcache.ini b/services/custombuild/custombuild.bk/custombuild/configure/opcache/opcache.ini similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/opcache/opcache.ini rename to services/custombuild/custombuild.bk/custombuild/configure/opcache/opcache.ini diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-accesscontrol.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-accesscontrol.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-accesscontrol.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-accesscontrol.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-accessdenydir.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-accessdenydir.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-accessdenydir.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-accessdenydir.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-cgirlimit.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-cgirlimit.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-cgirlimit.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-cgirlimit.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-defaults.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-defaults.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-defaults.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-defaults.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-directoryindex.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-directoryindex.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-directoryindex.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-directoryindex.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-expires.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-expires.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-expires.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-expires.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-fileaccesscontrol.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-fileaccesscontrol.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-fileaccesscontrol.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-fileaccesscontrol.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-logs.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-logs.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-logs.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-logs.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-lscache.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-lscache.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-lscache.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-lscache.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-lsrecaptcha.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-lsrecaptcha.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-lsrecaptcha.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-lsrecaptcha.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-modsecurity.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-modsecurity.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-modsecurity.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-modsecurity.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-nodedefaults.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-nodedefaults.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-nodedefaults.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-nodedefaults.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-perclientconnlimit.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-perclientconnlimit.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-perclientconnlimit.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-perclientconnlimit.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-phplimits.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-phplimits.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-phplimits.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-phplimits.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-railsdefaults.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-railsdefaults.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-railsdefaults.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-railsdefaults.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-tuning.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-tuning.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-tuning.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-tuning.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-vhosts.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-vhosts.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-vhosts.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-vhosts.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-webapps-php.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-webapps-php.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-webapps-php.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-webapps-php.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-wsgidefaults.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-wsgidefaults.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd-wsgidefaults.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd-wsgidefaults.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd_config.conf b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd_config.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/conf/httpd_config.conf rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/conf/httpd_config.conf diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/configure.openlitespeed b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/configure.openlitespeed similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/configure.openlitespeed rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/configure.openlitespeed diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/httpd-extprocessors.template b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/httpd-extprocessors.template similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/httpd-extprocessors.template rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/httpd-extprocessors.template diff --git a/services/custombuild/custombuild/custombuild/configure/openlitespeed/httpd-webapps-extprocessor.template b/services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/httpd-webapps-extprocessor.template similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/openlitespeed/httpd-webapps-extprocessor.template rename to services/custombuild/custombuild.bk/custombuild/configure/openlitespeed/httpd-webapps-extprocessor.template diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php53 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php53 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php53 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php53 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php54 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php54 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php54 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php54 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php55 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php55 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php55 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php55 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php56 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php56 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php56 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php56 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php70 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php70 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php70 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php70 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php71 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php71 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php71 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php71 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php72 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php72 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php72 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php72 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php73 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php73 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php73 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php73 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php74 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php74 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php74 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php74 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php80 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php80 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php80 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php80 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php81 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php81 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php81 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php81 diff --git a/services/custombuild/custombuild/custombuild/configure/php/configure.php82 b/services/custombuild/custombuild.bk/custombuild/configure/php/configure.php82 similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/php/configure.php82 rename to services/custombuild/custombuild.bk/custombuild/configure/php/configure.php82 diff --git a/services/custombuild/custombuild/custombuild/configure/phpmyadmin/config.inc.php b/services/custombuild/custombuild.bk/custombuild/configure/phpmyadmin/config.inc.php similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/phpmyadmin/config.inc.php rename to services/custombuild/custombuild.bk/custombuild/configure/phpmyadmin/config.inc.php diff --git a/services/custombuild/custombuild/custombuild/configure/proftpd/conf/proftpd.conf b/services/custombuild/custombuild.bk/custombuild/configure/proftpd/conf/proftpd.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/proftpd/conf/proftpd.conf rename to services/custombuild/custombuild.bk/custombuild/configure/proftpd/conf/proftpd.conf diff --git a/services/custombuild/custombuild/custombuild/configure/proftpd/configure.proftpd b/services/custombuild/custombuild.bk/custombuild/configure/proftpd/configure.proftpd similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/proftpd/configure.proftpd rename to services/custombuild/custombuild.bk/custombuild/configure/proftpd/configure.proftpd diff --git a/services/custombuild/custombuild/custombuild/configure/pureftpd/configure.pureftpd b/services/custombuild/custombuild.bk/custombuild/configure/pureftpd/configure.pureftpd similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/pureftpd/configure.pureftpd rename to services/custombuild/custombuild.bk/custombuild/configure/pureftpd/configure.pureftpd diff --git a/services/custombuild/custombuild/custombuild/configure/pureftpd/pure-ftpd.conf b/services/custombuild/custombuild.bk/custombuild/configure/pureftpd/pure-ftpd.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/pureftpd/pure-ftpd.conf rename to services/custombuild/custombuild.bk/custombuild/configure/pureftpd/pure-ftpd.conf diff --git a/services/custombuild/custombuild/custombuild/configure/pureftpd/pureftpd_sni.sh b/services/custombuild/custombuild.bk/custombuild/configure/pureftpd/pureftpd_sni.sh similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/pureftpd/pureftpd_sni.sh rename to services/custombuild/custombuild.bk/custombuild/configure/pureftpd/pureftpd_sni.sh diff --git a/services/custombuild/custombuild/custombuild/configure/pureftpd/pureftpd_uploadscan.sh b/services/custombuild/custombuild.bk/custombuild/configure/pureftpd/pureftpd_uploadscan.sh similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/pureftpd/pureftpd_uploadscan.sh rename to services/custombuild/custombuild.bk/custombuild/configure/pureftpd/pureftpd_uploadscan.sh diff --git a/services/custombuild/custombuild/custombuild/configure/rspamd/exim.spamd.conf b/services/custombuild/custombuild.bk/custombuild/configure/rspamd/exim.spamd.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/rspamd/exim.spamd.conf rename to services/custombuild/custombuild.bk/custombuild/configure/rspamd/exim.spamd.conf diff --git a/services/custombuild/custombuild/custombuild/configure/spamassassin/exim.spamd.conf b/services/custombuild/custombuild.bk/custombuild/configure/spamassassin/exim.spamd.conf similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/spamassassin/exim.spamd.conf rename to services/custombuild/custombuild.bk/custombuild/configure/spamassassin/exim.spamd.conf diff --git a/services/custombuild/custombuild/custombuild/configure/suhosin/php_uploadscan.sh b/services/custombuild/custombuild.bk/custombuild/configure/suhosin/php_uploadscan.sh similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/suhosin/php_uploadscan.sh rename to services/custombuild/custombuild.bk/custombuild/configure/suhosin/php_uploadscan.sh diff --git a/services/custombuild/custombuild/custombuild/configure/suhosin/suhosin.ini b/services/custombuild/custombuild.bk/custombuild/configure/suhosin/suhosin.ini similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/suhosin/suhosin.ini rename to services/custombuild/custombuild.bk/custombuild/configure/suhosin/suhosin.ini diff --git a/services/custombuild/custombuild/custombuild/configure/suphp/configure.suphp b/services/custombuild/custombuild.bk/custombuild/configure/suphp/configure.suphp similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/suphp/configure.suphp rename to services/custombuild/custombuild.bk/custombuild/configure/suphp/configure.suphp diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/clamd.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/clamd.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/clamd.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/clamd.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/clamd.service.debian b/services/custombuild/custombuild.bk/custombuild/configure/systemd/clamd.service.debian similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/clamd.service.debian rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/clamd.service.debian diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/da-popb4smtp.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/da-popb4smtp.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/da-popb4smtp.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/da-popb4smtp.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/dovecot.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/dovecot.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/dovecot.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/dovecot.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/dovecot.socket b/services/custombuild/custombuild.bk/custombuild/configure/systemd/dovecot.socket similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/dovecot.socket rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/dovecot.socket diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/exim.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/exim.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/exim.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/exim.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/freshclam.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/freshclam.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/freshclam.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/freshclam.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/httpd.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/httpd.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/httpd.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/httpd.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/litespeed.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/litespeed.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/litespeed.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/litespeed.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/mariadb.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/mariadb.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/mariadb.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/mariadb.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/mariadb.service.binary b/services/custombuild/custombuild.bk/custombuild/configure/systemd/mariadb.service.binary similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/mariadb.service.binary rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/mariadb.service.binary diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/mariadb55.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/mariadb55.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/mariadb55.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/mariadb55.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/mysqld.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/mysqld.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/mysqld.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/mysqld.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/mysqld.service.binary b/services/custombuild/custombuild.bk/custombuild/configure/systemd/mysqld.service.binary similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/mysqld.service.binary rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/mysqld.service.binary diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/mysqld57.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/mysqld57.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/mysqld57.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/mysqld57.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/mysqld57.service.binary b/services/custombuild/custombuild.bk/custombuild/configure/systemd/mysqld57.service.binary similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/mysqld57.service.binary rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/mysqld57.service.binary diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/named-setup-rndc.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/named-setup-rndc.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/named-setup-rndc.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/named-setup-rndc.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/named.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/named.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/named.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/named.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/named.service.debian b/services/custombuild/custombuild.bk/custombuild/configure/systemd/named.service.debian similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/named.service.debian rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/named.service.debian diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/nginx.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/nginx.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/nginx.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/nginx.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/php-fpm.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/php-fpm.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/php-fpm.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/php-fpm.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/proftpd.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/proftpd.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/proftpd.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/proftpd.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/pure-certd.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/pure-certd.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/pure-certd.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/pure-certd.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/pure-ftpd.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/pure-ftpd.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/pure-ftpd.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/pure-ftpd.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/pure-uploadscript.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/pure-uploadscript.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/pure-uploadscript.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/pure-uploadscript.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/redis-rspamd.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/redis-rspamd.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/redis-rspamd.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/redis-rspamd.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/redis@.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/redis@.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/redis@.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/redis@.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/rspamd.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/rspamd.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/rspamd.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/rspamd.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/scripts/dovecot_prestartscript b/services/custombuild/custombuild.bk/custombuild/configure/systemd/scripts/dovecot_prestartscript similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/scripts/dovecot_prestartscript rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/scripts/dovecot_prestartscript diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/scripts/mysql-wait-ready b/services/custombuild/custombuild.bk/custombuild/configure/systemd/scripts/mysql-wait-ready similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/scripts/mysql-wait-ready rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/scripts/mysql-wait-ready diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/spamassassin.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/spamassassin.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/spamassassin.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/spamassassin.service diff --git a/services/custombuild/custombuild/custombuild/configure/systemd/unit.service b/services/custombuild/custombuild.bk/custombuild/configure/systemd/unit.service similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/systemd/unit.service rename to services/custombuild/custombuild.bk/custombuild/configure/systemd/unit.service diff --git a/services/custombuild/custombuild/custombuild/configure/unit/configure.unit b/services/custombuild/custombuild.bk/custombuild/configure/unit/configure.unit similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/unit/configure.unit rename to services/custombuild/custombuild.bk/custombuild/configure/unit/configure.unit diff --git a/services/custombuild/custombuild/custombuild/configure/unit/unit_checks.sh b/services/custombuild/custombuild.bk/custombuild/configure/unit/unit_checks.sh similarity index 100% rename from services/custombuild/custombuild/custombuild/configure/unit/unit_checks.sh rename to services/custombuild/custombuild.bk/custombuild/configure/unit/unit_checks.sh diff --git a/services/custombuild/custombuild/build b/services/custombuild/custombuild/build new file mode 100644 index 0000000..4d40d9a --- /dev/null +++ b/services/custombuild/custombuild/build @@ -0,0 +1,31915 @@ +#!/bin/sh +# This script is written by DirectAdmin and Martynas Bendorius (smtalk) + +BUILDSCRIPT_VER=2.0.0 +NAME=custombuild + +OS=`uname` +WORKDIR=/usr/local/directadmin/${NAME} + +cd ${WORKDIR} + +#Added for security +chmod 700 ${WORKDIR}/build >/dev/null 2>&1 +chmod 700 ${WORKDIR} >/dev/null 2>&1 +chmod 700 -R /usr/local/directadmin/custombuild/configure + +#Just making sure there are no default grep options set in .bashrc +GREP_OPTIONS="" + +if [ "$(id -u)" != "0" ]; then + echo "You must be root to execute the script. Exiting." + exit 1 +fi + +#If we have no sysbk directory (it's first entry in doAll()), we know that CB has never ran, thus it's a new install, we also have no versions.txt at the same time +if [ ! -d /usr/local/sysbk ]; then + NEW_INSTALL=true +else + NEW_INSTALL=false +fi + +doHook(){ + if [ ! -z "${1}" ] && [ ! -z "${2}" ]; then + if [ -d ${WORKDIR}/custom/hooks/${1}/${2} ]; then + find ${WORKDIR}/custom/hooks/${1}/${2} -type f -name '*.sh' | while read line; do + echo "Executing '$line'..." + . "$line" + done + HOOK_ERROR_CODE=$? + if [ ${HOOK_ERROR_CODE} -ne 0 ]; then + echo "Hook exited with error code: ${HOOK_ERROR_CODE}. Exiting..." + exit ${HOOK_ERROR_CODE} + fi + + fi + fi +} + +OPTIONS_CONF=${WORKDIR}/options.conf +PHP_EXTENSIONS_CONF=${WORKDIR}/php_extensions.conf +OPTIONS_CONF_EXISTS=1 +if [ ! -e ${OPTIONS_CONF} ]; then + OPTIONS_CONF_EXISTS=0 +fi +VERSIONS_FILE=${WORKDIR}/versions.txt +PATCHES_VERSIONS_FILE=${WORKDIR}/patches_versions.txt +VERSIONS_FILE_CUSTOM=${WORKDIR}/custom_versions.txt +VERSIONS_FILE_CL=${WORKDIR}/versions_cl.txt +VERSIONS_FILE_CWAF=${WORKDIR}/versions_cwaf.txt +VERSIONS_FILE_LITESPEED=${WORKDIR}/versions_litespeed.txt +VERSIONS_FILE_JEMALLOC=${WORKDIR}/mysql/versions_jemalloc.txt +VERSIONS_FILE_GALERA=${WORKDIR}/mysql/versions_galera.txt +LOCKFILE=${WORKDIR}/.custombuild +LOGFILE=${WORKDIR}/custombuild.log +PROFTPD_PREFIX=/usr +B64=0 +EXEC_CL_COMMANDS_ONCE=false +CL_COMPONENT_UPDATE=false + +CPU_CORES=1 +DA_BIN=/usr/local/directadmin/directadmin + +if [ ${OS} = "FreeBSD" ]; then + MD5SUM=/sbin/md5 +else + MD5SUM=/usr/bin/md5sum +fi + +is_os_eol() { + EOL_FILE=${WORKDIR}/configure/custombuild/eol_os.txt + if [ -e ${WORKDIR}/custom/custombuild/eol_os.txt ]; then + EOL_FILE=${WORKDIR}/custom/custombuild/eol_os.txt + fi + DA_OS=`${DA_BIN} o | head -n1 | cut -d"'" -f2 | cut -d"." -f1` + if grep -m1 -q "^${DA_OS}$" ${EOL_FILE}; then + echo 1 + else + echo 0 + fi + return +} + +EXIT_CODE=0 + +LANG=C + +LSWS_HOME=/usr/local/lsws + +# Emulate ${!variable} +eval_var() { + var=${1} + if [ -z ${var} ]; then + echo "" + else + eval newval="\$${var}" + echo $newval + fi +} + +removeLockfile() { + rm -f ${LOCKFILE} + trap - INT TERM EXIT +} + +kill_childs() { + if [ -s ${LOCKFILE} ]; then + CB_PID=`cat ${LOCKFILE}` + for process in `ps -ef | awk -v cb_pid=${CB_PID} '{ if ( $3 == cb_pid ) { print $2 }}'`; do + kill ${process} + done + fi +} + +doKill() { + if [ -s ${LOCKFILE} ]; then + kill_childs + removeLockfile + kill -9 ${CB_PID} + exit 0 + else + echo "There is no CustomBuild process running." + fi + exit 0 +} + +getTimezone() { + if [ "${OS}" = "FreeBSD" ]; then + if [ -d /usr/share/zoneinfo ] && [ -e /etc/localtime ]; then + MD5_LOCALTIME=`md5 /etc/localtime | awk '{print $4}'` + # we don't use 'grep -m1' here to fix: "xargs: md5: terminated with signal 13; aborting" + DATETIMEZONE="`find /usr/share/zoneinfo -type f -print0 | xargs -0 md5 | grep "${MD5_LOCALTIME}" | awk '{print $2}' | cut -d\( -f2 | cut -d\) -f1 | perl -p0 -e 's#/usr/share/zoneinfo/##'`" + fi + elif [ -e ${DEBIAN_VERSION} ]; then + if [ -e /etc/timezone ]; then + DATETIMEZONE="`cat /etc/timezone`" + fi + else + if [ -e /etc/sysconfig/clock ]; then + DATETIMEZONE="`grep -m1 '^ZONE=' /etc/sysconfig/clock | cut -d'"' -f2 | cut -d= -f2`" + elif [ -e /usr/bin/timedatectl ]; then + DATETIMEZONE="`timedatectl | grep -m1 'Time.*zone:' | cut -d: -f2 | awk '{print $1}'`" + fi + fi + if [ "${DATETIMEZONE}" = "" ]; then + DATETIMEZONE="Europe/London" + fi + echo ${DATETIMEZONE} | awk '{print $1}' +} + +random_pass() { + #No special characters yet, because they'd cause problems with regexes and PEAR::DB to split the DNS string correctly in roundcube config.inc.php + if [ "${OS}" = "FreeBSD" ]; then + RPC=`perl -le 'print int rand(7) + 10'` + else + RPC=`awk -v min=10 -v max=17 'BEGIN{srand(); print int(min+rand()*(max-min+1))}'` + fi + + tr -cd 'a-zA-Z0-9' < /dev/urandom 2>/dev/null | head -c${RPC} # perl generates a random integer between 10 and 16 +} + +remove_file() { + if [ "$1" = "" ]; then + do_exit 1 "File not specified for remove_file..." + fi + + if [ -e $1 ]; then + echo "Removing file: $1..." + rm -f $1 + fi +} + +remove_directory() { + if [ "$1" = "" ]; then + do_exit 1 "File not specified for remove_file..." + fi + + COUNT_SLASHES="`echo \"$1\" | grep -o '/' | wc -l`" + if [ "${COUNT_SLASHES}" -lt 2 ]; then + do_exit 1 "Too dangerous path to remove: $1. Exiting..." + fi + + if [ -d $1 ]; then + echo "Removing directory: $1..." + rm -rf $1 + fi +} + +# Systemd +SYSTEMD=no +SYSTEMDDIR=/etc/systemd/system +CB_SYSTEMD=${WORKDIR}/configure/systemd +CB_CUST_SYSTEMD=${WORKDIR}/custom/systemd +if [ -d ${SYSTEMDDIR} ]; then + if [ -e /bin/systemctl ] || [ -e /usr/bin/systemctl ]; then + SYSTEMD=yes + SYSTEMD_SCRIPTS=/usr/libexec + fi +fi + +HOSTNAME="`hostname -f 2>/dev/null`" +if [ -z "${HOSTNAME}" ] && [ "${OS}" != "FreeBSD" ] && [ -x /usr/bin/hostnamectl ]; then + HOSTNAME=`/usr/bin/hostnamectl --static | head -n1` + if ! echo "${HOSTNAME}" | grep -m1 -q '\.'; then + HOSTNAME=`grep -m1 -o "${HOSTNAME}\.[^ ]*" /etc/hosts` + fi +fi +if [ -z "${HOSTNAME}" ]; then + HOSTNAME="your.server.com" +fi + +#There are used in other sections, so must be executed everytime +PHP1_RELEASE_SET="5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4" +PHP1_SHORTRELEASE_SET="`echo ${PHP1_RELEASE_SET} | tr -d '.'`" +DEBIAN_VERSION=/etc/debian_version +if [ "${OS}" = "FreeBSD" ]; then + OS_VER=`uname -r | cut -d- -f1` + OS_FREEBSD_VER=`echo ${OS_VER} | cut -d. -f1` +elif [ -e ${DEBIAN_VERSION} ]; then + OS_DEBIAN_VER=`grep -m1 -o '^[^\.]*' ${DEBIAN_VERSION}` +else + if [ -s /etc/os-release ]; then + OS_CENTOS_VER=`grep -m1 '^VERSION_ID=' /etc/os-release | cut -d. -f1 | cut -d'"' -f2` + else + OS_CENTOS_VER=`grep -m1 -o '[0-9]*\.[0-9]*' /etc/redhat-release | cut -d. -f1` + #CentOS Stream 8 support + if [ -z "${OS_CENTOS_VER}" ]; then + OS_CENTOS_VER=`grep -m1 -o '[0-9]*$' /etc/redhat-release` + fi + fi + if [ -e /etc/yum.repos.d/oracle-epel-ol8.repo ]; then + EPEL_REPO_NAME=ol8_developer_EPEL + else + EPEL_REPO_NAME=epel + fi +fi + +is_cloudlinux_solo() { + CL_SOLO_FILE=/etc/cloudlinux-edition-solo + if [ -e "$CL_SOLO_FILE" ]; then + echo 1 + else + echo 0 + fi + return +} + +installDevtoolset() { + if [ "${OS_CENTOS_VER}" = "6" ]; then + #C++11 is needed for libmodsecurity + if [ ! -d /opt/rh/devtoolset-7 ]; then + yum -y install cloudlinux-scl-release + yum -y install devtoolset-7 --enablerepo=cloudlinux-scl-release + yum -y install devtoolset-7 + fi + fi +} + +USE_ALL_SETTINGS=1 +use_all_settings_toggle() { + USE_ALL_SETTINGS=0 +} +GETOPT_CASE=1 +getopt_case_toggle() { + GETOPT_CASE=0 +} +case "$1" in + version) use_all_settings_toggle ;; + kill) use_all_settings_toggle ;; + update_da) getopt_case_toggle ;; + get_timezone) getopt_case_toggle ;; + set_versions_txt) getopt_case_toggle ;; + show_file) getopt_case_toggle ;; +esac + +if [ ! -e ${OPTIONS_CONF} ]; then + USE_ALL_SETTINGS=1 +fi + +if [ "${USE_ALL_SETTINGS}" = "1" ]; then + ################################################# + #ALL SETTINGS + #SECTIONS OF OPTIONS + ALL_SECTIONS="PHP_SETTINGS MYSQL_SETTINGS WEBSERVER_SETTINGS WEBAPPS_SETTINGS CLAMAV_SETTINGS MAIL_SETTINGS FTP_SETTINGS STATS_SETTINGS PHP_EXT_SETTINGS CUSTOMBUILD_SETTINGS CRON_SETTINGS CLOUDLINUX_SETTINGS ADVANCED_SETTINGS" + + PHP_EXT_SETTINGS="BZ2 GMP IONCUBE IMAP OPCACHE HTSCANNER IGBINARY IMAGICK LDAP PHALCON REDIS SNUFFLEUPAGUS SUHOSIN XMLRPC ZEND" + PHP_SETTINGS="PHP1_RELEASE PHP1_MODE PHP2_RELEASE PHP2_MODE PHP3_RELEASE PHP3_MODE PHP4_RELEASE PHP4_MODE SECURE_PHP PHP_INI PHP_TIMEZONE PHP_INI_TYPE X_MAIL_HEADER" + MYSQL_SETTINGS="MYSQL MARIADB MYSQL_INST MYSQL_BACKUP MYSQL_BACKUP_GZIP MYSQL_BACKUP_DIR MYSQL_FORCE_COMPILE" + WEBSERVER_SETTINGS="UNIT WEBSERVER HTTP_METHODS LITESPEED_SERIALNO MODSECURITY MODSECURITY_RULESET APACHE_VER APACHE_MPM MOD_RUID2 USERDIR_ACCESS HARDEN_SYMLINKS_PATCH USE_HOSTNAME_FOR_ALIAS REDIRECT_HOST REDIRECT_HOST_HTTPS" + WEBAPPS_SETTINGS="PHPMYADMIN PHPMYADMIN_PUBLIC PHPMYADMIN_VER SQUIRRELMAIL ROUNDCUBE WEBAPPS_INBOX_PREFIX" + MAIL_SETTINGS="EXIM EXIMCONF EXIMCONF_RELEASE BLOCKCRACKING EASY_SPAM_FIGHTER SPAMD SA_UPDATE DOVECOT DOVECOT_CONF MAIL_COMPRESS PIGEONHOLE" + CLAMAV_SETTINGS="CLAMAV CLAMAV_EXIM MODSECURITY_UPLOADSCAN PROFTPD_UPLOADSCAN PUREFTPD_UPLOADSCAN SUHOSIN_PHP_UPLOADSCAN" + FTP_SETTINGS="FTPD" + STATS_SETTINGS="AWSTATS WEBALIZER" + CUSTOMBUILD_SETTINGS="CUSTOMBUILD CUSTOMBUILD_PLUGIN AUTOVER BOLD CLEAN CLEANAPACHE CLEAN_OLD_TARBALLS CLEAN_OLD_WEBAPPS DOWNLOADSERVER UNOFFICIAL_MIRRORS" + CRON_SETTINGS="CRON CRON_FREQUENCY EMAIL NOTIFICATIONS DA_AUTOUPDATE UPDATES WEBAPPS_UPDATES" + CLOUDLINUX_SETTINGS="CLOUDLINUX CLOUDLINUX_BETA CAGEFS" + ADVANCED_SETTINGS="CSF CURL SSL_CONFIGURATION REDIS" + + PHP_EXT_SETTINGS_DESC="PHP Extension Settings" + PHP_SETTINGS_DESC="PHP Settings" + MYSQL_SETTINGS_DESC="MySQL Settings" + WEBSERVER_SETTINGS_DESC="WEB Server Settings" + WEBAPPS_SETTINGS_DESC="WEB Applications Settings" + CLAMAV_SETTINGS_DESC="ClamAV-related Settings" + MAIL_SETTINGS_DESC="Mail Settings" + FTP_SETTINGS_DESC="FTP Settings" + STATS_SETTINGS_DESC="Statistics Settings" + CUSTOMBUILD_SETTINGS_DESC="CustomBuild Settings" + CRON_SETTINGS_DESC="Cronjob Settings" + CLOUDLINUX_SETTINGS_DESC="CloudLinux Settings" + ADVANCED_SETTINGS_DESC="Advanced Settings" + + YESNO_SET="yes no" + + #OPTIONS.CONF + PHP1_RELEASE_DEF="7.4" + PHP1_MODE_SET="php-fpm fastcgi suphp lsphp mod_php" + if [ ${OS} = "FreeBSD" ] || [ -e ${DEBIAN_VERSION} ]; then + PHP1_MODE_DEF="php-fpm" + else + if uname -a | grep -m1 -q '\.lve' || uname -a | grep -m1 -q 'el7h'; then + if [ $(is_cloudlinux_solo) -eq 1 ]; then + PHP1_MODE_DEF="php-fpm" + else + PHP1_MODE_DEF="lsphp" + fi + elif [ "${OS_CENTOS_VER}" = "6" ] || [ "${OS_CENTOS_VER}" = "7" ]; then + PHP1_MODE_DEF="mod_php" + else + PHP1_MODE_DEF="php-fpm" + fi + fi + PHP1_RELEASE_DESC="Default version of PHP." + PHP1_MODE_DESC="Mode of the default PHP version. lsphp is only compatible with LiteSpeed, OpenLiteSpeed WWW servers or CloudLinux+Apache except CloudLinux Solo Edition. For nginx (not as a reverse proxy for apache) php-fpm must be chosen." + + PHP2_RELEASE_SET="${PHP1_RELEASE_SET} no" + PHP2_RELEASE_DEF="no" + PHP2_MODE_SET="php-fpm fastcgi suphp lsphp" + PHP2_MODE_DEF="php-fpm" + PHP2_RELEASE_DESC="Additional version of PHP." + PHP2_MODE_DESC="Mode of the additional PHP version." + + PHP3_RELEASE_SET="${PHP2_RELEASE_SET}" + PHP3_RELEASE_DEF="${PHP2_RELEASE_DEF}" + PHP3_MODE_SET="${PHP2_MODE_SET}" + PHP3_MODE_DEF="${PHP2_MODE_DEF}" + PHP3_RELEASE_DESC="${PHP2_RELEASE_DESC}" + PHP3_MODE_DESC="${PHP2_MODE_DESC}" + + PHP4_RELEASE_SET="${PHP2_RELEASE_SET}" + PHP4_RELEASE_DEF="${PHP2_RELEASE_DEF}" + PHP4_MODE_SET="${PHP2_MODE_SET}" + PHP4_MODE_DEF="${PHP2_MODE_DEF}" + PHP4_RELEASE_DESC="${PHP2_RELEASE_DESC}" + PHP4_MODE_DESC="${PHP2_MODE_DESC}" + + SECURE_PHP_SET="${YESNO_SET}" + SECURE_PHP_DEF="no" + SECURE_PHP_DESC="Disable dangerous PHP functions." + + EOL_COMMENT="Not in active development anymore, thus not recommended." + + #php_extensions.conf things start with PHP_, but they're listed without PHP_ inside the file + PHP_HTSCANNER_SET="${YESNO_SET}" + PHP_HTSCANNER_DEF="no" + PHP_HTSCANNER_DESC="htscanner for Apache (allows to confige php in .htaccess files using PHP)." + + PHP_BZ2_SET="${YESNO_SET}" + PHP_BZ2_DEF="no" + PHP_BZ2_DESC="Bz2 extension for PHP." + + PHP_GMP_SET="${YESNO_SET}" + PHP_GMP_DEF="no" + PHP_GMP_DESC="GMP extension for PHP." + + PHP_LDAP_SET="${YESNO_SET}" + PHP_LDAP_DEF="no" + PHP_LDAP_DESC="LDAP extension for PHP." + + PHP_OPCACHE_SET="${YESNO_SET}" + PHP_OPCACHE_DEF="no" + PHP_OPCACHE_DESC="opCache opcode cacher for PHP." + + PHP_IONCUBE_SET="${YESNO_SET}" + PHP_IONCUBE_DEF="no" + PHP_IONCUBE_DESC="PHP loader for ionCube Secured Files." + + PHP_IMAGICK_SET="${YESNO_SET}" + PHP_IMAGICK_DEF="no" + PHP_IMAGICK_DESC="ImageMagick extension for PHP." + + PHP_PSR_SET="${YESNO_SET}" + PHP_PSR_DEF="no" + PHP_PSR_DESC="Psr extension for PHP." + + PHP_PHALCON_SET="${YESNO_SET}" + PHP_PHALCON_DEF="no" + PHP_PHALCON_DESC="Phalcon extension for PHP." + + PHP_REDIS_SET="${YESNO_SET}" + PHP_REDIS_DEF="no" + PHP_REDIS_DESC="Redis extension for PHP." + + PHP_READLINE_SET="${YESNO_SET}" + PHP_READLINE_DEF="no" + PHP_READLINE_DESC="Readline extension for PHP." + + PHP_IMAP_SET="${YESNO_SET}" + PHP_IMAP_DEF="no" + PHP_IMAP_DESC="IMAP extension for PHP." + + PHP_XMLRPC_SET="${YESNO_SET}" + PHP_XMLRPC_DEF="no" + PHP_XMLRPC_DESC="XMLRPC extension for PHP." + + PHP_SNUFFLEUPAGUS_SET="${YESNO_SET}" + PHP_SNUFFLEUPAGUS_DEF="no" + PHP_SNUFFLEUPAGUS_DESC="Snuffleupagus security module." + + PHP_IGBINARY_SET="${YESNO_SET}" + PHP_IGBINARY_DEF="no" + PHP_IGBINARY_DESC="Drop in replacement for the standard php serializer." + + PHP_SUHOSIN_SET="${YESNO_SET}" + PHP_SUHOSIN_DEF="no" + PHP_SUHOSIN_DESC="Suhosin advanced protection system for PHP. ${EOL_COMMENT}" + + PHP_ZEND_SET="${YESNO_SET}" + PHP_ZEND_DEF="no" + PHP_ZEND_DESC="Zend Guard Loader is a free runtime application that enables PHP to run the scripts encoded by Zend Guard. ${EOL_COMMENT}" +###end of php_extensions.conf + + PHP_INI_SET="${YESNO_SET}" + PHP_INI_DEF="no" + PHP_INI_DESC="Enables ability to update php.ini file of PHP (rewrites any customizations!)." + + PHP_TIMEZONE_SET="userinput" + PHP_TIMEZONE_DEF="$(getTimezone)" + PHP_TIMEZONE_DESC="date.timezone setting in php.ini file of PHP. https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone." + + PHP_INI_TYPE_SET="production development" + PHP_INI_TYPE_DEF="production" + PHP_INI_TYPE_DESC="Type of php.ini file. php.ini-development contains settings recommended for use in development environments. php.ini-production contains settings recommended for use in production environments." + + REDIS_SET="${YESNO_SET}" + REDIS_DEF="no" + REDIS_DESC="Redis key-value database." + + SUHOSIN_PHP_UPLOADSCAN_SET="${YESNO_SET}" + SUHOSIN_PHP_UPLOADSCAN_DEF="no" + SUHOSIN_PHP_UPLOADSCAN_DESC="Scan PHP uploaded scripts using suhosin upload verification script and ClamAV antivirus (clamdscan). ClamAV must be installed and suhosin option should be enabled for the setting to work." + + #OUTPUT AS x-mail-header + X_MAIL_HEADER_SET="${YESNO_SET}" + X_MAIL_HEADER_DEF="yes" + X_MAIL_HEADER_DESC="mail.add_x_header setting in php.ini file of PHP. https://www.php.net/manual/en/mail.configuration.php#ini.mail.add-x-header" + + UNIT_SET="${YESNO_SET}" + UNIT_DEF="no" + UNIT_DESC="Nginx Unit. Dynamic Application Server. ALPHA support." + + WEBSERVER_SET="apache nginx nginx_apache litespeed openlitespeed" + WEBSERVER_DEF="apache" + WEBSERVER_DESC="WWW Server." + + HTTP_METHODS_SET="userinput" + HTTP_METHODS_DEF="ALL" + HTTP_METHODS_DESC="Allowed HTTP methods. Enabled with rewrite_confs or webserver update." + + LITESPEED_SERIALNO_SET="userinput" + LITESPEED_SERIALNO_DEF="trial" + LITESPEED_SERIALNO_DESC="Serial number of LiteSpeed Enterprise license." + + MODSECURITY_SET="${YESNO_SET}" + MODSECURITY_DEF="no" + MODSECURITY_DESC="ModSecurity - Web application firewall." + + MODSECURITY_RULESET_SET="comodo owasp no" + MODSECURITY_RULESET_DEF="owasp" + MODSECURITY_RULESET_DESC="ModSecurity rule set. Set to 'no' to use no ruleset. Comodo option provides Comodo Rule Set for ModSecurity: https://modsecurity.comodo.com/. OWASP ModSecurity Core Rule Set: https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project. Add custom rules to custom/modsecurity/conf, they'd be added automatically to /etc/modsecurity.d after './build modsecurity' or './build modsecurity_rules' is ran." + + APACHE_VER_SET="2.4" + APACHE_VER_DEF="2.4" + APACHE_VER_DESC="Apache version." + + APACHE_MPM_SET="prefork event worker auto" + APACHE_MPM_DEF="auto" + APACHE_MPM_DESC="Apache Multi-Processing Module. 'auto' mode sets MPM to be Prefork if PHP as mod_php is chosen, because this way PHP is not thread-safe. Otherwise Event MPM is set." + + USERDIR_ACCESS_SET="${YESNO_SET}" + USERDIR_ACCESS_DEF="no" + USERDIR_ACCESS_DESC="Allows accessing contents of public_html using https://hostname/~user, if enabled." + + MOD_RUID2_SET="${YESNO_SET}" + #mod_ruid2 segfaults on debian, centos8 + if [ "${OS}" = "FreeBSD" ] || [ -e ${DEBIAN_VERSION} ]; then + MOD_RUID2_DEF="no" + else + if uname -a | grep -m1 -q '\.lve' || uname -a | grep -m1 -q 'el7h'; then + MOD_RUID2_DEF="no" + elif [ "${OS_CENTOS_VER}" = "6" ] || [ "${OS_CENTOS_VER}" = "7" ]; then + MOD_RUID2_DEF="yes" + else + MOD_RUID2_DEF="no" + fi + fi + MOD_RUID2_DESC="mod_ruid2 is an Apache extension that allows requests to a domain to run as the owner of that domain, instead of the Apache user. Not supported on FreeBSD or Debian systems." + + #OUTPUT as harden-symlinks-patch + HARDEN_SYMLINKS_PATCH_SET="${YESNO_SET}" + HARDEN_SYMLINKS_PATCH_DEF="yes" + HARDEN_SYMLINKS_PATCH_DESC="Patches apache to include hardened symlinks patch. https://da-mirror.wpcloud.vn/services/custombuild/harden-symlinks-2.4.patch." + + USE_HOSTNAME_FOR_ALIAS_SET="${YESNO_SET} auto" + USE_HOSTNAME_FOR_ALIAS_DEF="no" + USE_HOSTNAME_FOR_ALIAS_DESC="Redirects WEB appplications addresses to server hostname. Useful with FastCGI mode of PHP ('auto' option enables it for FastCGI mode of PHP only)." + + REDIRECT_HOST_SET="userinput" + REDIRECT_HOST_DEF="${HOSTNAME}" + REDIRECT_HOST_DESC="Hostname used for use_hostname_for_alias setting." + + REDIRECT_HOST_HTTPS_SET="${YESNO_SET}" + REDIRECT_HOST_HTTPS_DEF="no" + REDIRECT_HOST_HTTPS_DESC="Enables SSL redirection for use_hostname_for_alias setting." + + MYSQL_INST_SET="mysql mariadb no" + if [ -e /root/.skip_mysql_install ]; then + MYSQL_INST_DEF="no" + elif [ "${OS_CENTOS_VER}" = "8" ]; then + MYSQL_INST_DEF="mariadb" + else + MYSQL_INST_DEF="mysql" + fi + MYSQL_INST_DESC="Enables management of MySQL/MariaDB using CustomBuild." + + MYSQL_DESC="MySQL version." + + MARIADB_DESC="MariaDB version." + + MYSQL_BACKUP_SET="${YESNO_SET}" + MYSQL_BACKUP_DEF="yes" + MYSQL_BACKUP_DESC="Backups MySQL databases before the installation of MySQL/MariaDB server." + + MYSQL_BACKUP_GZIP_SET="${YESNO_SET}" + MYSQL_BACKUP_GZIP_DEF="no" + MYSQL_BACKUP_GZIP_DESC="Compress MySQL database backups." + + MYSQL_BACKUP_DIR_SET="userinput" + MYSQL_BACKUP_DIR_DEF="/usr/local/directadmin/custombuild/mysql_backups" + MYSQL_BACKUP_DIR_DESC="Sets full path for mysql_backup option were MySQL backups should be placed." + + MYSQL_FORCE_COMPILE_SET="${YESNO_SET}" + MYSQL_FORCE_COMPILE_DEF="no" + MYSQL_FORCE_COMPILE_DESC="Force compilation of MySQL/MariaDB instead of using system packages (RPM, DEB)" + + PHPMYADMIN_SET="${YESNO_SET}" + if [ -e /root/.skip_mysql_install ]; then + PHPMYADMIN_DEF="no" + else + PHPMYADMIN_DEF="yes" + fi + PHPMYADMIN_DESC="Enables management of phpMyAdmin (Web application to manage MySQL databases) using CustomBuild." + + PHPMYADMIN_PUBLIC_SET="${YESNO_SET}" + PHPMYADMIN_PUBLIC_DEF="yes" + PHPMYADMIN_PUBLIC_DESC="Makes phpMyAdmin accessible over /phpMyAdmin/ for everyone, if set to 'yes'. Setting this option to 'no' would make it available only from DirectAdmin (single-sign-on)." + + PHPMYADMIN_VER_SET="3 4 5" + PHPMYADMIN_VER_DEF="5" + PHPMYADMIN_VER_DESC="Selects the version of phpMyAdmin to install. Takes effect only when phpmyadmin option is enabled." + + SQUIRRELMAIL_SET="${YESNO_SET}" + SQUIRRELMAIL_DEF="no" + SQUIRRELMAIL_DESC="Enables management of SquirrelMail webmail using CustomBuild." + + ROUNDCUBE_SET="${YESNO_SET}" + if [ -e /root/.skip_mysql_install ]; then + ROUNDCUBE_DEF="no" + else + ROUNDCUBE_DEF="yes" + fi + ROUNDCUBE_DESC="Enables management of RoundCube webmail using CustomBuild." + + WEBAPPS_INBOX_PREFIX_SET="${YESNO_SET}" + WEBAPPS_INBOX_PREFIX_DEF="no" + WEBAPPS_INBOX_PREFIX_DESC="Adds INBOX. prefix to all of the mailbox folders in SquirrelMail/RoundCube (like: INBOX.Sent instead of just Sent)" + + EXIM_SET="${YESNO_SET}" + EXIM_DEF="yes" + EXIM_DESC="Enables management of Exim MTA (Mail Transfer Agent) using CustomBuild." + + EXIMCONF_SET="${YESNO_SET}" + EXIMCONF_DEF="yes" + EXIMCONF_DESC="Enables ability to update exim.conf and exim.pl files of Exim MTA (rewrites any customizations!)." + + EXIMCONF_RELEASE_SET="2.1 4.2 4.3 4.4 4.5" + EXIMCONF_RELEASE_DEF="4.5" + EXIMCONF_RELEASE_DESC="Sets appopriate version of exim.conf to update." + + BLOCKCRACKING_SET="${YESNO_SET}" + BLOCKCRACKING_DEF="no" + BLOCKCRACKING_DESC="Enables BlockCracking in exim.conf for outgoing spam mitigation. Requires exim configuration version 4.3 or higher. More information: https://forum.directadmin.com/showthread.php?t=50059." + + EASY_SPAM_FIGHTER_SET="${YESNO_SET}" + EASY_SPAM_FIGHTER_DEF="no" + EASY_SPAM_FIGHTER_DESC="Enables Easy Spam Figher in exim.conf for incoming spam mitigation. Requires exim configuration version 4.3 or higher. More information: https://forum.directadmin.com/showthread.php?t=50059." + + CLAMAV_SET="${YESNO_SET}" + CLAMAV_DEF="no" + CLAMAV_DESC="Enables management of ClamAV antivirus engine using CustomBuild. Enables ClamAV automatically in Exim configuration." + + CLAMAV_EXIM_SET="${YESNO_SET}" + CLAMAV_EXIM_DEF="yes" + CLAMAV_EXIM_DESC="Enables ClamAV automatically in Exim configuration together with the installation of ClamAV." + + SPAMD_SET="rspamd spamassassin no" + SPAMD_DEF="no" + SPAMD_DESC="Enables management of Rspamd or SpamAssassin spam filters using CustomBuild. Enables Rspamd or SpamAssassin automatically in Exim configuration." + + SA_UPDATE_SET="no daily weekly monthly" + SA_UPDATE_DEF="daily" + SA_UPDATE_DESC="Installs a cronjob for sa-update to update SpamAssassin Spam Filter Rules daily, weekly or monthly using CustomBuild. Takes effect only if SpamAssassin is enabled on the server, at the installation time of SpamAssassin, CustomBuild cronjob or 'spamassassin_cron' call." + + DOVECOT_SET="${YESNO_SET}" + DOVECOT_DEF="yes" + DOVECOT_DESC="Enables management of Dovecot IMAP and POP3 email server using CustomBuild." + + DOVECOT_CONF_SET="${YESNO_SET}" + DOVECOT_CONF_DEF="yes" + DOVECOT_CONF_DESC="Enables management of Dovecot configuration files using CustomBuild." + + PIGEONHOLE_SET="${YESNO_SET}" + PIGEONHOLE_DEF="yes" + PIGEONHOLE_DESC="Enables management of Pigeonhole (enables Sieve language and the ManageSieve protocol, allows users to configure email filtering in their email clients) for Dovecot IMAP and POP3 email server using CustomBuild. When this setting is enabled, Pigeonhole is enabled with update/installation of Dovecot. RoundCube plugin to manage email filtering is enabled with update/installation of RoundCube." + + MAIL_COMPRESS_SET="${YESNO_SET}" + MAIL_COMPRESS_DEF="no" + MAIL_COMPRESS_DESC="Enables gzip compression for new emails (using zlib in dovecot). Compressed emails take less space (when testing, compressed mail folders took ~20% of their initial disk space). To compress old emails manual action is needed (script to automate the process: dovecot_compress.sh)." + + AWSTATS_SET="${YESNO_SET}" + AWSTATS_DEF="no" + AWSTATS_DESC="Enables management of AWstats (generates advanced web server statistics graphically) using CustomBuild." + + WEBALIZER_SET="${YESNO_SET}" + WEBALIZER_DEF="yes" + WEBALIZER_DESC="Enables management of Webalizer (generates advanced web server statistics graphically) using CustomBuild." + + MODSECURITY_UPLOADSCAN_SET="${YESNO_SET}" + MODSECURITY_UPLOADSCAN_DEF="no" + MODSECURITY_UPLOADSCAN_DESC="Scan HTTP uploaded files using ClamAV, when ModSecurity is enabled. ClamAV needs to be installed for this setting to work." + + FTPD_SET="proftpd pureftpd no" + FTPD_DEF="pureftpd" + FTPD_DESC="FTP Server." + + PUREFTPD_UPLOADSCAN_SET="${YESNO_SET}" + PUREFTPD_UPLOADSCAN_DEF="no" + PUREFTPD_UPLOADSCAN_DESC="Scan FTP uploaded files in Pure-FTPd using ClamAV. ClamAV needs to be installed for this setting to work." + + PROFTPD_UPLOADSCAN_SET="${YESNO_SET}" + PROFTPD_UPLOADSCAN_DEF="no" + PROFTPD_UPLOADSCAN_DESC="Scan FTP uploaded files in ProFTPd using ClamAV. ClamAV needs to be installed for this setting to work." + + CURL_SET="${YESNO_SET}" + CURL_DEF="no" + CURL_DESC="Enables management of cURL (library and command-line tool for transferring data using various protocols) using CustomBuild." + + SSL_CONFIGURATION_SET="modern intermediate old" + SSL_CONFIGURATION_DEF="intermediate" + SSL_CONFIGURATION_DESC="Auto-generated SSL ciphers/protocol list used in configuration, based on https://ssl-config.mozilla.org/." + + CUSTOMBUILD_SET="1.1 1.2 2.0" + CUSTOMBUILD_DEF="2.0" + CUSTOMBUILD_DESC="CustomBuild version to be used. WARNING: not recommended to change the setting without deep knowledge about upgrade/downgrade of the CustomBuild script." + + CUSTOMBUILD_PLUGIN_SET="${YESNO_SET}" + CUSTOMBUILD_PLUGIN_DEF="yes" + CUSTOMBUILD_PLUGIN_DESC="CustomBuild plugin, shown in DirectAdmin admin level." + + AUTOVER_SET="${YESNO_SET}" + AUTOVER_DEF="no" + AUTOVER_DESC="Updates versions.txt file (latest versions of the packages are listed there) with every execution of the CustomBuild script." + + BOLD_SET="${YESNO_SET}" + BOLD_DEF="yes" + BOLD_DESC="Enables bold effect for important output in terminal." + + CLEAN_SET="${YESNO_SET}" + CLEAN_DEF="yes" + CLEAN_DESC="Cleans not needed folders in the CustomBuild directory. Folders are often left from the previous packge installations." + + CLEANAPACHE_SET="${YESNO_SET}" + CLEANAPACHE_DEF="yes" + CLEANAPACHE_DESC="Removes Apache directory when the installation is finished. Takes effect only when 'clean' option is enabled." + + CLEAN_OLD_TARBALLS_SET="${YESNO_SET}" + CLEAN_OLD_TARBALLS_DEF="yes" + CLEAN_OLD_TARBALLS_DESC="Removes tarballs of old (unused) packages." + + CLEAN_OLD_WEBAPPS_SET="${YESNO_SET}" + CLEAN_OLD_WEBAPPS_DEF="yes" + CLEAN_OLD_WEBAPPS_DESC="Removes old WEB application folders from /var/www/html. Takes effect when any WEB application is installed/updated." + + DOWNLOADSERVER_SET="da-mirror.wpcloud.vn" + if [ -s ${WORKDIR}/servers.txt ]; then + DOWNLOADSERVER_SET="da-mirror.wpcloud.vn `awk '{ printf "%s ", $0 }' ${WORKDIR}/servers.txt`" + fi + DOWNLOADSERVER_DEF="da-mirror.wpcloud.vn" + DOWNLOADSERVER_DESC="Sets which download server to use to download files needed by the CustomBuild script. Any other server than ${DOWNLOADSERVER_DEF} may take 24 hours for latest files to be synced, however they may have better speeds than ${DOWNLOADSERVER_DEF}." + + UNOFFICIAL_MIRRORS_SET="${YESNO_SET}" + UNOFFICIAL_MIRRORS_DEF="no" + UNOFFICIAL_MIRRORS_DESC="Enables the use of unofficial mirror. DirectAdmin is not responsible for the content hosted there. Not recommended to use." + + CRON_SET="${YESNO_SET}" + CRON_DEF="yes" + CRON_DESC="Enables cronjob for CustomBuild scheduled jobs set." + + CRON_FREQUENCY_SET="daily weekly monthly" + CRON_FREQUENCY_DEF="daily" + CRON_FREQUENCY_DESC="Sets the execution frequency of the Cronjob (scheduled jobs). Takes effect only when the 'cron' option is enabled." + + EMAIL_SET="userinput" + EMAIL_DEF="email@domain.com" + EMAIL_DESC="Sets the email for notifications about the updates available. Takes effect only when 'cron' and 'notifications' options are enabled." + + NOTIFICATIONS_SET="${YESNO_SET}" + NOTIFICATIONS_DEF="no" + NOTIFICATIONS_DESC="Sets the email for notifications about the updates available. Takes effect only when 'cron' option is enabled." + + DA_AUTOUPDATE_SET="${YESNO_SET}" + DA_AUTOUPDATE_DEF="no" + DA_AUTOUPDATE_DESC="Sets DirectAdmin to be updated automatically when the Cronjob is executed. Takes effect only when 'cron' option is enabled." + + UPDATES_SET="${YESNO_SET}" + UPDATES_DEF="no" + UPDATES_DESC="Enables automatic updates of all available to update packages managed by the CustomBuild script. Takes effect only when 'cron' option is enabled. WARNING: not recommended in production!" + + WEBAPPS_UPDATES_SET="${YESNO_SET}" + WEBAPPS_UPDATES_DEF="no" + WEBAPPS_UPDATES_DESC="Enables automatic updates of all WEB applications enabled. Takes effect only when 'cron' option is enabled." + + CSF_SET="${YESNO_SET}" + CSF_DEF="no" + CSF_DESC="Enables ConfigServer Security & Firewall (csf)." + + CLOUDLINUX_SET="${YESNO_SET}" + if uname -a | grep -m1 -q '\.lve' || uname -a | grep -m1 -q 'el7h'; then + CLOUDLINUX_DEF="yes" + else + CLOUDLINUX_DEF="no" + fi + CLOUDLINUX_DESC="Enables CloudLinux support in the CustomBuild script (automatic patching using CloudLinux patches for specific components). NOTE: CloudLinux needs to be installed on the system. https://www.cloudlinux.com." + + CLOUDLINUX_BETA_SET="${YESNO_SET}" + CLOUDLINUX_BETA_DEF="no" + CLOUDLINUX_BETA_DESC="Enables BETA repository for CloudLinux packages. NOTE: CloudLinux needs to be installed on the system. https://www.cloudlinux.com." + + CAGEFS_SET="${YESNO_SET}" + if [ -x /usr/sbin/cagefsctl ]; then + CAGEFS_DEF="yes" + else + CAGEFS_DEF="no" + fi + CAGEFS_DESC="Enables support of CageFS component by CloudLinux in the CustomBuild script (automatic updating of files in CageFS using 'cagefsctl --force-update'). NOTE: CloudLinux needs to be installed on the system. https://www.cloudlinux.com." +fi +################################################# + +showVersion() { + echo "${BUILDSCRIPT_VER} (rev: 2830)" +} + +if [ ! -d ${WORKDIR}/patches ]; then + mkdir -p ${WORKDIR}/patches + chmod 700 ${WORKDIR}/patches +fi + +doCSFpignore() { + if [ "${OS}" != "FreeBSD" ]; then + CSF_PIGNORE="/etc/csf/csf.pignore" + CSF_PIGNORE_SOURCE="${WORKDIR}/configure/csf.pignore" + if [ -s ${WORKDIR}/custom/csf.pignore ]; then + CSF_PIGNORE_SOURCE="${WORKDIR}/custom/csf.pignore" + fi + if [ -s ${CSF_PIGNORE} ] && [ -s ${CSF_PIGNORE_SOURCE} ]; then + #very nice&quick way to add missing lines in destination file + grep -x -f ${CSF_PIGNORE_SOURCE} ${CSF_PIGNORE} | awk 'FNR==NR{a[$0]; next} !($0 in a)' - ${CSF_PIGNORE_SOURCE} >> ${CSF_PIGNORE} + #if file has been edited - restart lfd (suppress errors/warnings, as it could be disabled) + find ${CSF_PIGNORE} -mmin -1 -type f -print -exec csf --lfd restart 2>&1 >/dev/null \; + fi + fi +} + +initLogfile() { + LOG_IP=localhost + if [ `who | wc -l` -gt 0 ]; then + if [ ${OS} = "FreeBSD" ]; then + LOG_IP=`env | grep -m1 "REMOTEHOST" | cut -d= -f2` + else + LOG_IP=`echo $SSH_CLIENT | cut -d' ' -f1` + fi + fi + + if [ ! -e ${LOGFILE} ]; then + touch ${LOGFILE} + chmod 600 ${LOGFILE} + else + if [ ${OS} = "FreeBSD" ]; then + LOGSIZE=`stat -f %z ${LOGFILE}` + else + LOGSIZE=`stat -c %s ${LOGFILE}` + fi + + #Rotate the logfile if the filesize is >10MB + if [ ${LOGSIZE} -gt 10485760 ]; then + rm -f ${LOGFILE}.1 + mv ${LOGFILE} ${LOGFILE}.1 + touch ${LOGFILE} + chmod 600 ${LOGFILE} + fi + fi +} + +if uname -m | grep -qE -m1 'amd64|x86_64'; then + B64=1 + LD_LIBRARY_PATH=/usr/lib/apache:/usr/local/icu/lib:/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib:/lib64:/lib + export LD_LIBRARY_PATH + PKG_CONFIG_PATH=/usr/local/icu/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig + export PKG_CONFIG_PATH + if [ "${OS_CENTOS_VER}" = "6" ]; then + export KERBEROS_LIBS="-L/usr/lib64 -lkrb5 -lk5crypto -lgssapi_krb5" + export KERBEROS_CFLAGS="-I/usr/include" + export ONIG_LIBS="-L/usr/lib64 -lonig" + export ONIG_CFLAGS="-I/usr/include" + export JPEG_LIBS="-L/usr/lib64 -ljpeg" + export JPEG_CFLAGS="-I/usr/include" + fi +elif [ "${OS_CENTOS_VER}" = "6" ]; then + LD_LIBRARY_PATH=/usr/lib/apache:/usr/local/icu/lib:/usr/local/lib:/usr/lib:/lib64:/lib + export LD_LIBRARY_PATH + PKG_CONFIG_PATH=/usr/local/icu/lib/pkgconfig:/usr/local/lib/pkgconfig + export PKG_CONFIG_PATH + export KERBEROS_LIBS="-L/usr/lib -lkrb5 -lk5crypto -lgssapi_krb5" + export KERBEROS_CFLAGS="-I/usr/include" + export ONIG_LIBS="-L/usr/lib -lonig" + export ONIG_CFLAGS="-I/usr/include" + export JPEG_LIBS="-L/usr/lib -ljpeg" + export JPEG_CFLAGS="-I/usr/include" +fi + +if [ ${OS} = "FreeBSD" ]; then + CPU_CORES=`/sbin/sysctl hw.ncpu | cut -d\ -f2` + MEMORY=`/sbin/sysctl hw.realmem | cut -d\ -f2` + PROFTPD_PREFIX=/usr/local +else + if [ "`cat /proc/cpuinfo | grep -F 'model name' | wc -l`" -gt 0 ]; then + CPU_CORES="`cat /proc/cpuinfo | grep -F 'model name' | wc -l`" + fi + MEMORY=`grep -m1 'MemTotal' /proc/meminfo | awk '{print $2}'` +fi + +#Avoid OOM by making CB not cross-compile on boxes with low amount of memory +if [ ! -z "${MEMORY}" ]; then + if [ ${OS} = "FreeBSD" ]; then + if [ ${MEMORY} -lt 2147483648 ]; then + CPU_CORES=1 + fi + elif [ ${MEMORY} -lt 2097152 ]; then + CPU_CORES=1 + fi +fi + +#check path for /usr/local/bin +if ! echo "${PATH}" | grep -qF -m1 '/usr/local/bin:'; then + export PATH=/usr/local/bin:$PATH +fi + +#check PKG_CONFIG_PATH for /usr/local/lib/pkgconfig +if ! echo "${PKG_CONFIG_PATH}" | grep -qF -m1 '/usr/local/lib/pkgconfig:'; then + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH} +fi + +# Main variables +HTTPDDIR=/etc/httpd +HTTPDCONF=/etc/httpd/conf +HTTPD_CONF=${HTTPDCONF}/httpd.conf +PHPMODULES=${HTTPDCONF}/extra/httpd-phpmodules.conf + +NGINXCONF=/etc/nginx + +WWWDIR=/var/www/html + +DACONF_FILE=/usr/local/directadmin/conf/directadmin.conf +DACONF_TEMPLATE_FILE=/usr/local/directadmin/data/templates/directadmin.conf +DA_MY_CNF=/usr/local/directadmin/conf/my.cnf +SERVICES=/usr/local/directadmin/data/admin/services.status +TASK_QUEUE=/usr/local/directadmin/data/task.queue.cb + +DOVECOT_CONFIG=/etc/dovecot/dovecot.conf + +SKIP_CMD_OPTIONS=0 +skip_cmd_toggle() { + SKIP_CMD_OPTIONS=1 +} +case "$1" in + "") skip_cmd_toggle ;; + opt_help) skip_cmd_toggle ;; + set) skip_cmd_toggle ;; + set_php) skip_cmd_toggle ;; + get_versions_txt) skip_cmd_toggle ;; + update_script) skip_cmd_toggle ;; + version) skip_cmd_toggle ;; + kill) skip_cmd_toggle ;; + update_da) skip_cmd_toggle ;; + list_configs_json) skip_cmd_toggle ;; + settings_json) skip_cmd_toggle ;; + get_timezone) skip_cmd_toggle ;; + custom_config) skip_cmd_toggle ;; + set_versions_txt) skip_cmd_toggle ;; + show_component_config) skip_cmd_toggle ;; + remove_customized_config) skip_cmd_toggle ;; + show_file) skip_cmd_toggle ;; + check_options) skip_cmd_toggle ;; + update) skip_cmd_toggle ;; + update_data) skip_cmd_toggle ;; + gen_help_json) skip_cmd_toggle ;; + versions_json) skip_cmd_toggle ;; + versions_ajax) skip_cmd_toggle ;; + versions_nobold) skip_cmd_toggle ;; + versions) skip_cmd_toggle ;; + gen_help) skip_cmd_toggle ;; + list_removals) skip_cmd_toggle ;; + list_removals_json) skip_cmd_toggle ;; + remove_items) skip_cmd_toggle ;; +esac + +IPV6=0 +if [ "${SKIP_CMD_OPTIONS}" = "0" ]; then + if [ -e ${DA_BIN} ]; then + IPV6=`${DA_BIN} c | grep -m1 '^ipv6=' | cut -d= -f2` + fi +fi + +CWD=${WORKDIR} +FORCE=0 +HIDE_CHANGES=0 + +# Applications variables +APPUSER=webapps +APPGROUP=${APPUSER} +APP_TMP=/var/www/tmp + +STRINGS=/usr/bin/strings +MYSQL_DATA=/var/lib/mysql +if [ "${OS}" = "FreeBSD" ]; then + if [ ! -d /var/lib/mysql/mysql ]; then + MYSQL_DATA=/home/mysql + fi + MYSQL_BIN=/usr/local/mysql/bin/mysql +else + if [ -e /etc/debian_version ]; then + if [ ! -d /var/lib/mysql/mysql ] && [ -d /home/mysql ]; then + MYSQL_DATA=/home/mysql + fi + MYSQL_BIN=/usr/local/mysql/bin/mysql + else + MYSQL_BIN=/usr/bin/mysql + fi +fi + +#Check if mysql database exists +if [ -d ${MYSQL_DATA}/mysql ]; then + SQL_PATH_IS_EMPTY=false +else + SQL_PATH_IS_EMPTY=true +fi + +CURL_CONNECT_OPTIONS="-L --progress-bar --connect-timeout 5 --retry 3" + +MARIADB_DEF="10.4" +MYSQL_DEF="5.7" + +if [ "${OS_CENTOS_VER}" = "8" ]; then + #We don't have RPMs for EL8 of older versions in our mirrors + MARIADB_SET="10.3 10.4 10.5 10.6 11.4" + MYSQL_SET="8.0" + MYSQL_DEF="8.0" +else + if [ "${OS_CENTOS_VER}" = "6" ]; then + #no 10.5+ on centos6 + MARIADB_SET="5.5 10.0 10.1 10.2 10.3 10.4" + else + MARIADB_SET="5.5 10.0 10.1 10.2 10.3 10.4 10.5 10.6 11.4" + fi + MYSQL_SET="5.5 5.6 5.7 8.0" +fi + +# Check if workdir exists +if [ ! -d ${WORKDIR} ]; then + do_exit 1 "Directory ${WORKDIR} does not exist." +fi + +file_mtime="stat --format=%Y" +if [ "${OS}" = "FreeBSD" ]; then + file_mtime="stat -f %m" +fi + +set_LoadModule() { + # Add to httpd-phpmodules.conf + MODULE_NAME=$1 + MODULE_FILENAME=$2 + MODULE_FULLPATH=/usr/lib/apache/${MODULE_FILENAME} + if ! grep -m1 -q " ${MODULE_NAME} " ${PHPMODULES} && [ -e ${MODULE_FULLPATH} ]; then + echo "LoadModule ${MODULE_NAME} /usr/lib/apache/${MODULE_FILENAME}" >> ${PHPMODULES} + fi + perl -pi -e "s|^LoadModule ${MODULE_NAME}|#LoadModule ${MODULE_NAME}|g" /etc/httpd/conf/httpd.conf +} + +ensure_my_cnf() { + #1 = path to cnf + #2 = user + #3 = pass + #4 = optional source file to compare with. update 1 if 4 is newer. + # host will be on the command line, as that's how DA already does it. + + E_MY_CNF=$1 + + E_MY_CNF_DIR="`dirname ${E_MY_CNF}`" + + if [ ! -d ${E_MY_CNF_DIR} ]; then + mkdir -p ${E_MY_CNF_DIR} + fi + + W=0 + if [ ! -s ${E_MY_CNF} ]; then + W=1 + fi + + if [ "${W}" = "0" ] && [ "${4}" != "" ]; then + if [ ! -s $4 ]; then + if [ -d "${MYSQL_DATA}" ]; then + echo "ensure_my_cnf: cannot find $4" + fi + W=1 + else + MY_CNF_T=`${file_mtime} ${E_MY_CNF}` + SRC_CNF_T=`${file_mtime} ${4}` + + if [ "${MY_CNF_T}" -lt "${SRC_CNF_T}" ]; then + echo "Found outdated ${E_MY_CNF}. Rewriting from ${4}" + W=1 + fi + fi + fi + + if [ "${W}" = "1" ]; then + echo '[client]' > ${E_MY_CNF} + chmod 600 ${E_MY_CNF} + echo "user=${2}" >> ${E_MY_CNF} + echo "password=${3}" >> ${E_MY_CNF} + fi +} + +csf_enable_quic() { + if [ -s /etc/csf/csf.conf ]; then + CSFRESTART=false + if ! grep -m1 -q '^UDP_IN = ".*443' /etc/csf/csf.conf && grep -m1 -q '^TCP_IN = ".*443' /etc/csf/csf.conf; then + if ! grep -m1 -q '^UDP_IN = ""' /etc/csf/csf.conf; then + perl -pi -e 's|^UDP_IN \= "|UDP_IN = "443,|g' /etc/csf/csf.conf + CSFRESTART=true + fi + fi + if ! grep -m1 -q '^UDP_OUT = ".*443' /etc/csf/csf.conf && grep -m1 -q '^TCP_OUT = ".*443' /etc/csf/csf.conf; then + if ! grep -m1 -q '^UDP6_IN = ""' /etc/csf/csf.conf; then + perl -pi -e 's|^UDP_OUT \= "|UDP_OUT = "443,|g' /etc/csf/csf.conf + CSFRESTART=true + fi + fi + if ! grep -m1 -q '^UDP6_IN = ".*443' /etc/csf/csf.conf && grep -m1 -q '^TCP6_IN = ".*443' /etc/csf/csf.conf; then + if ! grep -m1 -q '^UDP6_IN = ""' /etc/csf/csf.conf; then + perl -pi -e 's|^UDP6_IN \= "|UDP6_IN = "443,|g' /etc/csf/csf.conf + CSFRESTART=true + fi + fi + if ! grep -m1 -q '^UDP6_OUT = ".*443' /etc/csf/csf.conf && grep -m1 -q '^TCP6_OUT = ".*443' /etc/csf/csf.conf; then + if ! grep -m1 -q '^UDP6_OUT = ""' /etc/csf/csf.conf; then + perl -pi -e 's|^UDP6_OUT \= "|UDP6_OUT = "443,|g' /etc/csf/csf.conf + CSFRESTART=true + fi + fi + if ${CSFRESTART} && csf --status 2&>1 >/dev/null; then + echo "Opened UDP ports for QUIC in CSF, restarting CSF..." + /usr/sbin/csf -r 2&>1 >/dev/null + fi + fi +} + +csf_enable_rspamd() { + if [ -s /etc/csf/csf.conf ]; then + CSFRESTART=false + if ! grep -m1 -q '^UDP_OUT = ".*11335' /etc/csf/csf.conf; then + if ! grep -m1 -q '^UDP6_IN = ""' /etc/csf/csf.conf; then + perl -pi -e 's|^UDP_OUT \= "|UDP_OUT = "11335,|g' /etc/csf/csf.conf + CSFRESTART=true + fi + fi + if ! grep -m1 -q '^UDP6_OUT = ".*11335' /etc/csf/csf.conf; then + if ! grep -m1 -q '^UDP6_OUT = ""' /etc/csf/csf.conf; then + perl -pi -e 's|^UDP6_OUT \= "|UDP6_OUT = "11335,|g' /etc/csf/csf.conf + CSFRESTART=true + fi + fi + if ${CSFRESTART} && csf --status 2&>1 >/dev/null; then + echo "Opened UDP ports for Rspamd in CSF, restarting CSF..." + /usr/sbin/csf -r 2&>1 >/dev/null + fi + fi +} + +create_global_modsecurity_rules() { + if [ ! -e /usr/local/directadmin/data/admin/modsecurity_rules ]; then + touch /usr/local/directadmin/data/admin/modsecurity_rules + chmod 600 /usr/local/directadmin/data/admin/modsecurity_rules + chown diradmin:diradmin /usr/local/directadmin/data/admin/modsecurity_rules + fi +} + +initMySQL() { + if [ "${MYSQL_OPT}" = "8.0" ] && [ "${MYSQL_INST_OPT}" = "mysql" ]; then + SKIP_MYSQL_UPGRADE=true + else + SKIP_MYSQL_UPGRADE=false + fi + + #MySQL settings + DA_MYSQL=/usr/local/directadmin/conf/mysql.conf + if [ -s ${DA_MYSQL} ]; then + MYSQLUSER=`grep -m1 "^user=" ${DA_MYSQL} | cut -d= -f2` + MYSQLPASSWORD=`grep -m1 "^passwd=" ${DA_MYSQL} | cut -d= -f2` + else + MYSQLUSER='da_admin' + MYSQLPASSWORD='nothing' + fi + + if [ -s $DA_MYSQL ] && [ `grep -m1 -c -e "^host=" ${DA_MYSQL}` -gt "0" ]; then + MYSQLHOST=`grep -m1 "^host=" ${DA_MYSQL} | cut -d= -f2` + else + MYSQLHOST=localhost + fi + + #Where connections to mysql are from. Usualy the server IP, unless on a LAN. + MYSQL_ACCESS_HOST=localhost + if [ "$MYSQLHOST" != "localhost" ]; then + MYSQL_ACCESS_HOST="`grep -r -l -m1 '^status=server$' /usr/local/directadmin/data/admin/ips | cut -d/ -f8`" + if [ "${MYSQL_ACCESS_HOST}" = "" ]; then + MYSQL_ACCESS_HOST="`grep -im1 ${HOSTNAME} /etc/hosts | awk '{print $1}'`" + if [ "${MYSQL_ACCESS_HOST}" = "" ]; then + if [ -s ${WORKDIR}/scripts/setup.txt ]; then + MYSQL_ACCESS_HOST=`cat ${WORKDIR}/scripts/setup.txt | grep -m1 -e '^ip=' | cut -d= -f2` + fi + if [ "${MYSQL_ACCESS_HOST}" = "" ]; then + echo "Unable to detect your server IP in /etc/hosts. Please enter it: " + read MYSQL_ACCESS_HOST + fi + fi + fi + fi + + ensure_my_cnf ${DA_MY_CNF} "${MYSQLUSER}" "${MYSQLPASSWORD}" "${DA_MYSQL}" + chown diradmin:diradmin ${DA_MY_CNF} +} + +allSettings_options() { + for section in $ALL_SECTIONS; do + DESC=${section}_DESC + echo "#$(eval_var ${DESC})" + COUNT="0" + + if [ ${section} = "PHP_EXT_SETTINGS" ]; then + continue + fi + + for setting in $(eval_var ${section}); do + SETTING_NAME=`echo $setting | tr "[A-Z]" "[a-z]"` + POSSIBLE_VALUES_VAR=${setting}_SET + POSSIBLE_VALUES="`echo $(eval_var ${POSSIBLE_VALUES_VAR}) | awk -v OFS=", " '$1=$1'`" + DEFAULT_VALUE=${setting}_DEF + CURRENT_VALUE=${setting}_OPT + if [ ! -z "$(eval_var ${SETTING_NAME})" ]; then + echo "${SETTING_NAME}=$(eval_var ${SETTING_NAME})" + else + echo "${SETTING_NAME}=$(eval_var ${DEFAULT_VALUE})" + fi + COUNT="1" + done + if [ "${COUNT}" = "1" ]; then + echo "" + fi + done + echo '#PHP extensions can be found in php_extensions.conf' +} + +allSettings_php_extensions() { + echo "#PHP Extension Settings" + + for setting in $(eval_var ${PHP_EXT_SETTINGS}); do + SETTING_NAME=`echo $setting | tr "[A-Z]" "[a-z]"` + POSSIBLE_VALUES_VAR=PHP_${setting}_SET + POSSIBLE_VALUES="`echo $(eval_var ${POSSIBLE_VALUES_VAR}) | awk -v OFS=", " '$1=$1'`" + DEFAULT_VALUE=PHP_${setting}_DEF + CURRENT_VALUE=PHP_${setting}_OPT + EXPORTED_SETTING_NAME="php_${SETTING_NAME}" + if [ ! -z "$(eval_var ${EXPORTED_SETTING_NAME})" ]; then + echo "${SETTING_NAME}=$(eval_var ${EXPORTED_SETTING_NAME})" + else + echo "${SETTING_NAME}=$(eval_var ${DEFAULT_VALUE})" + fi + done +} + +# Write options.conf +if [ "${OPTIONS_CONF_EXISTS}" = "0" ]; then + echo "Cannot find ${OPTIONS_CONF}, writing defaults." + allSettings_options > ${OPTIONS_CONF} + allSettings_php_extensions > ${PHP_EXTENSIONS_CONF} +fi + +# Write php_extensions.conf exists +if [ ! -s "${PHP_EXTENSIONS_CONF}" ] && [ -s "${OPTIONS_CONF}" ]; then + for option in `echo "${PHP_EXT_SETTINGS}" | tr '[A-Z]' '[a-z]'`; do { + if grep -m1 -q "^${option}=" "${OPTIONS_CONF}"; then + grep -m1 "^${option}=" "${OPTIONS_CONF}" >> ${PHP_EXTENSIONS_CONF} + sed -i "/^${option}=/d" "${OPTIONS_CONF}" + fi + } + done +fi + +# Check if options.conf exists +if [ -s ${PHP_EXTENSIONS_CONF} ]; then + #Read php_extensions.conf as 'source' + PHP_EXTENSIONS_CONF_SOURCE=`grep -o "^[a-zA-Z0-9_]*=[^;<>\'\!=() ]*" ${PHP_EXTENSIONS_CONF} | perl -p -e 's|^|php_|g'` + eval ${PHP_EXTENSIONS_CONF_SOURCE} +fi + +# Check if options.conf exists +if [ ! -e ${OPTIONS_CONF} ]; then + do_exit 1 "Options file options.conf does not exist." +else + #Read options.conf as 'source' + OPTIONS_CONF_SOURCE=`grep -o "^[a-zA-Z0-9_]*=[^;<>\'\!=() ]*" ${OPTIONS_CONF}` + eval ${OPTIONS_CONF_SOURCE} +fi + +# init.d scripts +if [ "${OS}" = "FreeBSD" ]; then + INITDDIR=/usr/local/etc/rc.d +else + INITDDIR=/etc/init.d +fi + +#################################################### + +run_dataskq() { + DATASKQ_OPT=$1 + if [ -s ${DACONF_FILE} ]; then + /usr/local/directadmin/dataskq ${DATASKQ_OPT} --custombuild + fi +} + +cagefsctl_update() { + if [ "${CAGEFS_OPT}" = "yes" ] && [ -e /usr/sbin/cagefsctl ]; then + echo "CageFS: Executing 'cagefsctl --force-update'..." + if [ -e /usr/bin/ionice ]; then + /usr/bin/ionice -c3 /usr/sbin/cagefsctl --force-update + else + /usr/sbin/cagefsctl --force-update + fi + cagefsctl --remount-all + fi +} + +writeLog() { + initLogfile + echo "`date +'%Y-%m-%d %H:%M:%S'` ${LOG_IP}: $@" >> ${LOGFILE} +} + +get_line_from_file() { + #$1 is any part of the name, make sure it wouldn't have duplicates, as it'd select only the first instance of the match + #$2 is full path to txt file + if [ ! -s $2 ]; then + do_exit 1 "$2 does not exist." + fi + + if grep -m1 -q "^$1" $2; then + RESULT="`grep -m1 \"^$1\" ${WORKDIR}/$2`" + else + RESULT="" + fi + + echo "${RESULT}" +} + +EXISTS_VERSIONS_FILE_CUSTOM=false +if [ -s ${VERSIONS_FILE_CUSTOM} ]; then + EXISTS_VERSIONS_FILE_CUSTOM=true +fi +getVer() { + APEEND=`echo ${1} | awk '{gsub(/\./,"_",$1);gsub(/-/,"_",$1);print $1;}'` + RESULT=$(eval_var VERSIONS_TXT_${APEEND}) + + if [ "${RESULT}" = "" ]; then + >&2 echo "ERROR: version of $1 not found in versions.txt!" + RESULT="0" + fi + + echo "${RESULT}" +} + +getMD5() { + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 3` + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE} | cut -d ':' -f 3` + fi + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE} | cut -d ':' -f 3` + fi + + if [ "${RESULT}" = "" ]; then + RESULT=`grep -m1 ^$1: ${PATCHES_VERSIONS_FILE} | cut -d ':' -f 3` + fi + + echo "${RESULT}" +} + +do_exit() { + if [ "$2" != "" ]; then + echo "$2" + fi + removeLockfile + if ${NEW_INSTALL}; then + echo "action=notify&value=admin&subject=CustomBuild installation has failed&message=CustomBuild installation has failed, please check the following file for more information:%0A/usr/local/directadmin/custombuild/install.txt" >> ${TASK_QUEUE} + run_dataskq + fi + exit $1 +} + +getDA_Opt() { + #$1 is option name + #$2 is default value + + if [ ! -s ${DACONF_FILE} ]; then + echo $2 + return + fi + + if ! ${DA_BIN} c | grep -m1 -q -e "^$1="; then + echo $2 + return + fi + + + ${DA_BIN} c | grep -m1 "^$1=" | cut -d= -f2 +} + +getPhpOpt() { + #$1 is option name + #$2 is default value + + FULL_VARIABLE=php_$1 + GET_OPTION="$(eval_var ${FULL_VARIABLE})" + if [ "${GET_OPTION}" = "" ]; then + if grep -m1 -q "^${1}=" "${OPTIONS_CONF}"; then + grep -m1 "^${1}=" "${OPTIONS_CONF}" >> ${PHP_EXTENSIONS_CONF} + sed -i "/^${1}=/d" "${OPTIONS_CONF}" + GET_OPTION=`grep -m1 "^${1}=" "${PHP_EXTENSIONS_CONF}" | cut -d= -f2` + eval `echo "${FULL_VARIABLE}=${2}"` + else + echo "$1=$2" >> ${PHP_EXTENSIONS_CONF} + GET_OPTION="${2}" + eval `echo "${FULL_VARIABLE}=${2}"` + fi + fi + + echo ${GET_OPTION} +} + +getOpt() { + #$1 is option name + #$2 is default value + + GET_OPTION="$(eval_var $1)" + if [ "${GET_OPTION}" = "" ]; then + echo "$1=$2" >> ${OPTIONS_CONF} + GET_OPTION="${2}" + eval `echo "${1}=${2}"` + fi + + echo ${GET_OPTION} +} + +#eg, CentOS 6.7 returns 6 +da_os_major_version() { + /usr/local/directadmin/directadmin o | grep 'Compiled on' | head -n1 | cut -d. -f1 | awk '{print $4}' +} + +os_license_mismatch() { + return; + DA_OS_NAME=`/usr/local/directadmin/directadmin o | grep 'Compiled on' | head -n1 | awk '{print $3}' | cut -d\' -f2` + DA_MAJOR_OS_VER=`da_os_major_version` + if [ "${OS}" = "FreeBSD" ]; then + if [ "${DA_OS_NAME}" != "FreeBSD" ]; then + echo "${boldon}Your license OS (${DA_OS_NAME}) does not match the OS installed (FreeBSD).${boldoff}" + fi + elif [ -e ${DEBIAN_VERSION} ] && [ "${DA_OS_NAME}" != "Linux" ]; then + if [ "${OS_DEBIAN_VER}" != "${DA_MAJOR_OS_VER}" ] || [ "${DA_OS_NAME}" != "Debian" ]; then + # Hiding the warning on ubuntu + if ! gcc --version | grep -m1 -q 'ubuntu'; then + echo "${boldon}Your license OS (${DA_OS_NAME} ${DA_MAJOR_OS_VER}) does not match the OS installed (Debian ${OS_DEBIAN_VER}).${boldoff}" + fi + fi + elif [ "${DA_OS_NAME}" != "Linux" ]; then + if [ "${OS_CENTOS_VER}" != "${DA_MAJOR_OS_VER}" ] || [ "${DA_OS_NAME}" != "CentOS" ]; then + echo "${boldon}Your license OS (${DA_OS_NAME} ${DA_MAJOR_OS_VER}) does not match the OS installed (CentOS ${OS_CENTOS_VER}).${boldoff}" + fi + fi +} + +have_php_system() { + #Checks to see if we can use system() based on the disable_functions + if [ ! -s "${PHP_INI}" ]; then + echo 1 + return + fi + + C=`grep -m1 -c ^disable_functions ${PHP_INI}` + if [ "${C}" -eq 0 ]; then + echo 1 + return + fi + + C=`grep -m1 ^disable_functions ${PHP_INI} | grep -m1 -c system` + if [ "${C}" -eq 1 ]; then + echo 0 + return + fi + + echo 1 + return +} + +secure_phpini() { + if [ -e $1 ]; then + if grep -m1 -q -e disable_functions $1; then + CURRENT_DISABLE_FUNCT="`grep -m1 'disable_functions' $1`" + if [ -s ${WORKDIR}/custom/php_disable_functions ]; then + NEW_DISABLE_FUNCT="`head -n1 ${WORKDIR}/custom/php_disable_functions`" + else + NEW_DISABLE_FUNCT="exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname" + fi + perl -pi -e "s#${CURRENT_DISABLE_FUNCT}#disable_functions \= ${NEW_DISABLE_FUNCT}#" $1 + else + echo "disable_functions = ${NEW_DISABLE_FUNCT}" >> $1 + fi + + perl -pi -e 's/^register_globals = On/register_globals = Off/' $1 + + perl -pi -e 's/^mysql.allow_local_infile = On/mysql.allow_local_infile = Off/' $1 + perl -pi -e 's/^mysqli.allow_local_infile = On/mysqli.allow_local_infile = Off/' $1 + perl -pi -e 's/^;mysqli.allow_local_infile = On/mysqli.allow_local_infile = Off/' $1 + + perl -pi -e 's/^expose_php = On/expose_php = Off/' $1 + + writeLog "secure_phpini: $1 secured" + fi +} + +#################################################### + +secure_php() { + if [ "${SECURE_PHP_OPT}" != "yes" ]; then + setOpt secure_php yes + fi + secure_phpini ${PHP_INI} + for php_shortrelease in `echo ${PHP1_SHORTRELEASE_SET}`; do + EVAL_PHP_INI_VAR=PHP_INI_FPM${php_shortrelease} + secure_phpini $(eval_var ${EVAL_PHP_INI_VAR}) + done + if [ "${CLOUDLINUX_OPT}" = "yes" ]; then + if [ -e /etc/cl.selector/global_php.ini ]; then + secure_phpini /etc/cl.selector/global_php.ini + if [ -e /usr/sbin/cagefsctl ]; then + /usr/sbin/cagefsctl --setup-cl-selector + fi + fi + fi + echo "PHP has been secured." + RESTART_APACHE="1" + if [ "${PHP1_MODE_OPT}" = "php-fpm" ]; then + echo "Restarting php-fpm${PHP1_SHORTRELEASE}." + control_service php-fpm${PHP1_SHORTRELEASE} restart + RESTART_APACHE="0" + fi + if [ "${PHP2_MODE_OPT}" = "php-fpm" ] && [ "${PHP2_RELEASE_OPT}" != "no" ]; then + echo "Restarting php-fpm${PHP2_SHORTRELEASE}." + control_service php-fpm${PHP2_SHORTRELEASE} restart + fi + if [ "${PHP3_MODE_OPT}" = "php-fpm" ] && [ "${PHP3_RELEASE_OPT}" != "no" ]; then + echo "Restarting php-fpm${PHP3_SHORTRELEASE}." + control_service php-fpm${PHP3_SHORTRELEASE} restart + fi + if [ "${PHP4_MODE_OPT}" = "php-fpm" ] && [ "${PHP4_RELEASE_OPT}" != "no" ]; then + echo "Restarting php-fpm${PHP4_SHORTRELEASE}." + control_service php-fpm${PHP4_SHORTRELEASE} restart + fi + + if [ "${RESTART_APACHE}" = "1" ]; then + control_service httpd restart + fi +} + +#Used to set values ON/OFF in the services.status. +#set_service name ON|OFF|delete +set_service() { + if [ ! -e ${SERVICES} ]; then + if [ ! -d /usr/local/directadmin/data/admin ]; then + mkdir -p /usr/local/directadmin/data/admin + chown diradmin:diradmin /usr/local/directadmin/data/admin + chown diradmin:diradmin /usr/local/directadmin/data + chmod 700 /usr/local/directadmin/data/admin + chmod 711 /usr/local/directadmin/data + fi + touch ${SERVICES} + chown diradmin:diradmin ${SERVICES} + chmod 600 ${SERVICES} + fi + + if [ "$2" = "delete" ]; then + if ! grep -q "^$1=" ${SERVICES}; then + return + else + perl -pi -e "s/^${1}=.*\n//" ${SERVICES} + fi + return + fi + + if [ "$2" = "ON" ] || [ "$2" = "OFF" ]; then + if ! grep -q "^$1=" ${SERVICES}; then + echo "$1=$2" >> ${SERVICES} + else + perl -pi -e "s/^$1=.*/$1=$2/" ${SERVICES} + fi + + return + fi + + echo "setService $1: unknown option: $2" +} + +control_service() { + SERVICE_NAME=$1 + SERVICE_ACTION=$2 + + if [ "${SYSTEMD}" = "yes" ] && [ -e ${SYSTEMDDIR}/${SERVICE_NAME}.service ]; then + systemctl ${SERVICE_ACTION} ${SERVICE_NAME}.service + elif [ "${SYSTEMD}" = "yes" ] && [ -e /lib/systemd/system/${SERVICE_NAME}.service ]; then + systemctl ${SERVICE_ACTION} ${SERVICE_NAME}.service + else + if [ -e ${INITDDIR}/${SERVICE_NAME} ]; then + ${INITDDIR}/${SERVICE_NAME} ${SERVICE_ACTION} + elif [ "${SERVICE_NAME}" = "mysqld" ]; then + SERVICE_NAME=mariadb + if [ "${SYSTEMD}" = "yes" ] && [ -e ${SYSTEMDDIR}/${SERVICE_NAME}.service ]; then + systemctl ${SERVICE_ACTION} ${SERVICE_NAME}.service + elif [ "${SYSTEMD}" = "yes" ] && [ -e /lib/systemd/system/${SERVICE_NAME}.service ]; then + systemctl ${SERVICE_ACTION} ${SERVICE_NAME}.service + else + if [ -e ${INITDDIR}/${SERVICE_NAME} ]; then + ${INITDDIR}/${SERVICE_NAME} ${SERVICE_ACTION} + fi + fi + fi + fi +} + + +#sets the value of $1 to $2 in the file $3 +setVal() { + if [ ! -e $3 ]; then + return + fi + + if ! grep -m1 -q "^${1}=" ${3}; then + #ok, it's not there, add it. + echo "$1=$2" >> $3 + return + else + #ok, the value is already in the file $3, so use perl to regex it. + perl -pi -e "s/^`grep -m1 "^${1}=" ${3}`/${1}=${2}/" ${3} + fi +} + +#A > B: 1 +#A = B: 0 +#A < B: -1 +#3rd option is descriptor +version_cmp() { + A=`echo $1 | cut -d- -f1` + B=`echo $2 | cut -d- -f1` + + if [ "$A" = "" ] || [ "$B" = "" ]; then + echo "version_cmp has a blank value when checking $3" + return + fi + + if ! echo "$A" | grep -m1 -q '^[0-9]' || ! echo "$B" | grep -m1 -q '^[0-9]'; then + echo "version_cmp has a wrong version when checking $3 for version comparison, ${A} vs. ${B}" + return + fi + + #swap underscore with dot. + A=`echo $A | tr '_' '.'` + B=`echo $B | tr '_' '.'` + + A1=`echo $A | cut -d. -f1` + B1=`echo $B | cut -d. -f1` + + if [ "$A1" -gt "$B1" ]; then + echo 1 + return + fi + + if [ "$A1" -lt "$B1" ]; then + echo -1 + return + fi + + A2=`echo $A | cut -d. -f2` + B2=`echo $B | cut -d. -f2` + + if [ "$A2" -gt "$B2" ]; then + echo 1 + return + fi + + if [ "$A2" -lt "$B2" ]; then + echo -1 + return + fi + + A3=`echo $A | cut -d. -f3` + B3=`echo $B | cut -d. -f3` + + if [ "$A3" = "" ] && [ "$B3" = "" ]; then + echo 0 + return + fi + + if [ "$A3" = "" ]; then + if [ "$B3" = "0" ]; then + echo 0; + else + echo 1 + fi + return + fi + + if [ "$B3" = "" ]; then + if [ "$A3" = "0" ]; then + echo 0; + else + echo -1 + fi + return + fi + + if [ "$A3" -gt "$B3" ]; then + echo 1 + return + fi + + if [ "$A3" -lt "$B3" ]; then + echo -1 + return + fi + + echo 0 +} + +#################################################### + +GCCOPTIONS_CACHE=0 + +getGccOptions() { + if [ "${GCCOPTIONS_CACHE}" = "0" ]; then + # Exim always takes /usr/bin/gcc, even if it exists in /usr/local/bin/gcc. Other components built in /usr, not /usr/local might take it form there too. + if [ -s /usr/bin/gcc ]; then + GCC_VERSION="`/usr/bin/gcc --version | head -n1 | grep -o '[0-9]*\.[0-9]*' | head -n1`" + else + GCC_VERSION="`gcc --version | head -n1 | grep -o '[0-9]*\.[0-9]*' | head -n1`" + fi + if [ "`version_cmp ${GCC_VERSION} 4.9 'gcc ver check'`" -ge 0 ]; then + GCCOPTIONS_CACHE="-fstack-protector-strong" + else + GCCOPTIONS_CACHE="-fstack-protector --param ssp-buffer-size=4" + fi + fi + echo ${GCCOPTIONS_CACHE} +} + +#These are needed for some functions outside +BOLD_OPT=`getOpt bold ${BOLD_DEF}` + +# Variables for bolded text +boldon="" +boldoff="" +if [ "${BOLD_OPT}" = "yes" ]; then + boldon="`tput -Txterm bold`" + boldoff="`tput -Txterm sgr0`" +fi +CLEAN_OPT=`getOpt clean ${CLEAN_DEF}` +if [ -s ${DEBIAN_VERSION} ]; then + MYSQL_FORCE_COMPILE_OPT=`getOpt mysql_force_compile ${MYSQL_FORCE_COMPILE_DEF}` +else + MYSQL_FORCE_COMPILE_OPT=`getOpt mysql_force_compile ${MYSQL_FORCE_COMPILE_DEF}` +fi +DOWNLOADSERVER_OPT=`getOpt downloadserver ${DOWNLOADSERVER_DEF}` +UNOFFICIAL_MIRRORS_OPT=`getOpt unofficial_mirrors ${UNOFFICIAL_MIRRORS_DEF}` +DOWNLOADSERVERS_OFFICIAL_LIST="da-mirror.wpcloud.vn files2.directadmin.com files-fi.directadmin.com files-fr.directadmin.com files-lt.directadmin.com files-de.directadmin.com files-sg.directadmin.com files-ca.directadmin.com" +DOWNLOADSERVERS_UNOFFICIAL_HTTPS_LIST="files6.directadmin.com files9.directadmin.com files11.directadmin.com directadmin.mirror.liteserver.nl damirror.unix-solutions.be mirror.serverion.com damirror.pars.host mirrors.ereznet.co.il mirror.ihost.md directadmin.mirrors.misaka.one directadmin.hostmark.pl" +#We have spacing at the beginning/end to let grep work fine with these +DOWNLOADSERVERS_HTTPS_LIST=" files1.directadmin.com ${DOWNLOADSERVERS_OFFICIAL_LIST} ${DOWNLOADSERVERS_UNOFFICIAL_HTTPS_LIST} " +DOWNLOADSERVER_SCHEME=http +if echo "${DOWNLOADSERVERS_HTTPS_LIST}" | grep -m1 -q " ${DOWNLOADSERVER_OPT} "; then + DOWNLOADSERVER_SCHEME=https +fi +WEBPATH=${DOWNLOADSERVER_SCHEME}://${DOWNLOADSERVER_OPT}/services/custombuild +WEBPATH_SERVICES=${DOWNLOADSERVER_SCHEME}://${DOWNLOADSERVER_OPT}/services +WEBPATH_BACKUP_IP=69.162.69.58 +WEBPATH_BACKUP_DOMAIN=da-mirror.cyberslab.net +WEBPATH_BACKUP=http://${WEBPATH_BACKUP_DOMAIN}/services/custombuild +WEBPATH_SERVICES_BACKUP=http://${WEBPATH_BACKUP_IP}/services +WEBPATH_CL=https://repo.cloudlinux.com/cloudlinux/sources/da +WEBPATH_CWAF=https://waf.comodo.com +WEBPATH_LITESPEED=https://www.litespeedtech.com/packages + +setPhpOpt() { + #$1 is option name + #$2 is value + READ_OPTION_NAME="$1" + READ_OPTION_VALUE="$2" + SET_IN_FILENAME="${PHP_EXTENSIONS_CONF}" + + if echo " ioncube suhosin zend htscanner imagick opcache " | grep -m1 -q " ${READ_OPTION_NAME} "; then + if grep -m1 -q "^${READ_OPTION_NAME}=" ${OPTIONS_CONF}; then + if ! grep -m1 -q "^${READ_OPTION_NAME}=" ${PHP_EXTENSIONS_CONF}; then + grep -m1 "^${READ_OPTION_NAME}=" ${OPTIONS_CONF} >> "${PHP_EXTENSIONS_CONF}" + fi + sed -i "/^${READ_OPTION_NAME}=/d" ${OPTIONS_CONF} + fi + fi + + VAR=`echo ${READ_OPTION_NAME} | tr "[a-z]" "[A-Z]"` + if [ -z "$(eval_var PHP_${VAR}_DEF)" ]; then + echo "${READ_OPTION_NAME} is not a valid option." + EXIT_CODE=50 + return + fi + VALID="no" + for i in $(eval_var PHP_${VAR}_SET); do + if [ "${i}" = "${READ_OPTION_VALUE}" ] || [ "${i}" = "userinput" ]; then + VALID="yes" + break + fi + done + if [ "${VALID}" = "no" ]; then + echo "${READ_OPTION_VALUE} is not a valid setting for ${READ_OPTION_NAME} option." + EXIT_CODE=51 + return + fi + OPT_VALUE="`grep -m1 "^${READ_OPTION_NAME}=" "${SET_IN_FILENAME}" | cut -d= -f2 | perl -p0 -e 's|@|\\\\@|g'`" + if [ -z "${OPT_VALUE}" ] && [ "${SET_IN_FILENAME}" = "${PHP_EXTENSIONS_CONF}" ]; then + if grep -m1 -q "^${READ_OPTION_NAME}=" ${OPTIONS_CONF}; then + grep -m1 "^${READ_OPTION_NAME}=" ${OPTIONS_CONF} >> "${PHP_EXTENSIONS_CONF}" + sed -i "/^${READ_OPTION_NAME}=/d" ${OPTIONS_CONF} + OPT_VALUE="`grep -m1 "^${READ_OPTION_NAME}=" "${SET_IN_FILENAME}" | cut -d= -f2 | perl -p0 -e 's|@|\\\\@|g'`" + fi + fi + if [ ! -z "${OPT_VALUE}" ]; then + perl -pi -e "s#${READ_OPTION_NAME}=${OPT_VALUE}#${READ_OPTION_NAME}=${READ_OPTION_VALUE}#" "${SET_IN_FILENAME}" + else + echo "${READ_OPTION_NAME}=${OPT_VALUE}" >> "${SET_IN_FILENAME}" + fi + if [ "${HIDE_CHANGES}" = "0" ] && [ "${OPT_VALUE}" != "${READ_OPTION_VALUE}" ]; then + echo "Changed ${boldon}${READ_OPTION_NAME}${boldoff} option from ${boldon}${OPT_VALUE}${boldoff} to ${boldon}${READ_OPTION_VALUE}${boldoff}" | perl -p0 -e 's|\\\@|\@|g' + elif [ "${HIDE_CHANGES}" = "0" ] && [ "${OPT_VALUE}" = "${READ_OPTION_VALUE}" ]; then + echo "${boldon}${READ_OPTION_NAME}${boldoff} is already set to ${boldon}${READ_OPTION_VALUE}${boldoff}" | perl -p0 -e 's|\\\@|\@|g' + fi +} + +setOpt() { + #$1 is option name + #$2 is value + READ_OPTION_NAME="$1" + READ_OPTION_VALUE="`echo \"$2\" | perl -p0 -e 's|@|\\\\@|g' | perl -p0 -e 's|\\+|\\\\+|g'`" + #Rewrite spamassassin to spamd for backwards compatibility + if [ "${READ_OPTION_NAME}" = "spamassassin" ]; then + READ_OPTION_NAME="spamd" + if [ "${READ_OPTION_VALUE}" = "yes" ]; then + READ_OPTION_VALUE="spamassassin" + fi + fi + + SET_IN_FILENAME="${OPTIONS_CONF}" + + if echo " ioncube suhosin zend htscanner imagick opcache " | grep -m1 -q " ${READ_OPTION_NAME} "; then + setPhpOpt "${READ_OPTION_NAME}" "${READ_OPTION_VALUE}" + return + fi + + VAR=`echo ${READ_OPTION_NAME} | tr "[a-z]" "[A-Z]"` + if [ -z "$(eval_var ${VAR}_DEF)" ]; then + echo "${READ_OPTION_NAME} is not a valid option." + EXIT_CODE=50 + return + fi + VALID="no" + for i in $(eval_var ${VAR}_SET); do + if [ "${i}" = "${READ_OPTION_VALUE}" ] || [ "${i}" = "userinput" ]; then + VALID="yes" + break + fi + done + if [ "${VALID}" = "no" ]; then + echo "${READ_OPTION_VALUE} is not a valid setting for ${READ_OPTION_NAME} option." + EXIT_CODE=51 + return + fi + OPT_VALUE="`grep -m1 "^${READ_OPTION_NAME}=" "${SET_IN_FILENAME}" | cut -d= -f2 | perl -p0 -e 's|@|\\\\@|g' | perl -p0 -e 's|\\+|\\\\+|g'`" + perl -pi -e "s#${READ_OPTION_NAME}=${OPT_VALUE}#${READ_OPTION_NAME}=${READ_OPTION_VALUE}#" "${SET_IN_FILENAME}" + if [ "${HIDE_CHANGES}" = "0" ] && [ "${OPT_VALUE}" != "${READ_OPTION_VALUE}" ]; then + echo "Changed ${boldon}${READ_OPTION_NAME}${boldoff} option from ${boldon}${OPT_VALUE}${boldoff} to ${boldon}${READ_OPTION_VALUE}${boldoff}" | perl -p0 -e 's|\\\@|\@|g' | perl -p0 -e 's|\\\+|\+|g' + elif [ "${HIDE_CHANGES}" = "0" ] && [ "${OPT_VALUE}" = "${READ_OPTION_VALUE}" ]; then + echo "${boldon}${READ_OPTION_NAME}${boldoff} is already set to ${boldon}${READ_OPTION_VALUE}${boldoff}" | perl -p0 -e 's|\\\@|\@|g' | perl -p0 -e 's|\\\+|\+|g' + fi +} + +getWebserverPorts() { + # 443 and 80 ports + PORT_80=`getDA_Opt port_80 80` + PORT_443=`getDA_Opt port_443 443` + + # Reverse proxy ports + PORT_8080=`getDA_Opt port_8080 8080` + PORT_8081=`getDA_Opt port_8081 8081` +} + +case "$1" in + "") getopt_case_toggle ;; + version) getopt_case_toggle ;; + kill) getopt_case_toggle ;; + update_da) getopt_case_toggle ;; + get_timezone) getopt_case_toggle ;; + set_versions_txt) getopt_case_toggle ;; + show_file) getopt_case_toggle ;; +esac +if [ "${GETOPT_CASE}" = "1" ]; then + CSF_OPT=`getOpt csf ${CSF_DEF}` + #CloudLinux + CLOUDLINUX_OPT=`getOpt cloudlinux ${CLOUDLINUX_DEF}` + CLOUDLINUX_BETA_OPT=`getOpt cloudlinux_beta ${CLOUDLINUX_BETA_DEF}` + CAGEFS_OPT=`getOpt cagefs ${CAGEFS_DEF}` + + # Read options.conf + FTPD_OPT=`getOpt ftpd ${FTPD_DEF}` + PUREFTPD_UPLOADSCAN_OPT=`getOpt pureftpd_uploadscan ${PUREFTPD_UPLOADSCAN_DEF}` + PROFTPD_UPLOADSCAN_OPT=`getOpt proftpd_uploadscan ${PROFTPD_UPLOADSCAN_DEF}` + + # Replace spamassassin= to spamd= + if grep -m1 -q "^spamassassin=" ${OPTIONS_CONF}; then + perl -pi -e 's|spamassassin=yes|spamd=spamassassin|g' ${OPTIONS_CONF} + perl -pi -e 's|spamassassin=no|spamd=no|g' ${OPTIONS_CONF} + fi + + SPAMD_OPT=`getOpt spamd ${SPAMASSASSIN_DEF}` + SA_UPDATE_OPT=`getOpt sa_update ${SA_UPDATE_DEF}` + CLAMAV_OPT=`getOpt clamav ${CLAMAV_DEF}` + CLAMAV_EXIM_OPT=`getOpt clamav_exim ${CLAMAV_EXIM_DEF}` + MODSECURITY_UPLOADSCAN_OPT=`getOpt modsecurity_uploadscan ${MODSECURITY_UPLOADSCAN_DEF}` + # Mailman is not yet supported + #MAILMAN_OPT=`getOpt mailman no` + UNIT_OPT=`getOpt unit ${UNIT_DEF}` + WEBSERVER_OPT=`getOpt webserver ${WEBSERVER_DEF}` + HTTP_METHODS_OPT=`getOpt http_methods ${HTTP_METHODS_DEF}` + LITESPEED_SERIALNO_OPT=`getOpt litespeed_serialno ${LITESPEED_SERIALNO_DEF}` + MODSECURITY_OPT=`getOpt modsecurity ${MODSECURITY_DEF}` + MODSECURITY_RULESET_OPT=`getOpt modsecurity_ruleset ${MODSECURITY_RULESET_DEF}` + + HN_T=${HOSTNAME} + REDIRECT_HOST_OPT=`getOpt redirect_host ${HN_T}` + REDIRECT_HOST_HTTPS_OPT=`getOpt redirect_host_https ${REDIRECT_HOST_HTTPS_DEF}` + USE_HOSTNAME_FOR_ALIAS_OPT=`getOpt use_hostname_for_alias ${USE_HOSTNAME_FOR_ALIAS_DEF}` + + TZ_T=$(getTimezone) + PHP_TIMEZONE_OPT=`getOpt php_timezone ${TZ_T}` + + #Apache + APACHE_VER_OPT=`getOpt apache_ver ${APACHE_VER_DEF}` + APACHE_MPM_OPT=`getOpt apache_mpm ${APACHE_MPM_DEF}` + MOD_RUID2_OPT=`getOpt mod_ruid2 ${MOD_RUID2_DEF}` + + USERDIR_ACCESS_OPT=`getOpt userdir_access ${USERDIR_ACCESS_DEF}` + HARDEN_SYMLINKS_PATCH_OPT=`getOpt harden_symlinks_patch ${HARDEN_SYMLINKS_PATCH_DEF}` + + #PHP + PHP1_RELEASE_OPT=`getOpt php1_release ${PHP1_RELEASE_DEF}` + PHP2_RELEASE_OPT=`getOpt php2_release ${PHP2_RELEASE_DEF}` + PHP3_RELEASE_OPT=`getOpt php3_release ${PHP3_RELEASE_DEF}` + PHP4_RELEASE_OPT=`getOpt php4_release ${PHP4_RELEASE_DEF}` + + PHP1_SHORTRELEASE=`echo ${PHP1_RELEASE_OPT} | tr -d '.'` + PHP2_SHORTRELEASE=`echo ${PHP2_RELEASE_OPT} | tr -d '.'` + PHP3_SHORTRELEASE=`echo ${PHP3_RELEASE_OPT} | tr -d '.'` + PHP4_SHORTRELEASE=`echo ${PHP4_RELEASE_OPT} | tr -d '.'` + + PHP1_MODE_OPT=`getOpt php1_mode ${PHP1_MODE_DEF}` + PHP2_MODE_OPT=`getOpt php2_mode ${PHP2_MODE_DEF}` + PHP3_MODE_OPT=`getOpt php3_mode ${PHP3_MODE_DEF}` + PHP4_MODE_OPT=`getOpt php4_mode ${PHP4_MODE_DEF}` + + SECURE_PHP_OPT=`getOpt secure_php ${SECURE_PHP_DEF}` + PHP_INI_TYPE_OPT=`getOpt php_ini_type ${PHP_INI_TYPE_DEF}` + REDIS_OPT=`getOpt redis ${REDIS_DEF}` + #php_extensions.conf options + PHP_BZ2_OPT=`getPhpOpt bz2 ${PHP_BZ2_DEF}` + PHP_GMP_OPT=`getPhpOpt gmp ${PHP_GMP_DEF}` + PHP_HTSCANNER_OPT=`getPhpOpt htscanner ${PHP_HTSCANNER_DEF}` + PHP_IGBINARY_OPT=`getPhpOpt igbinary ${PHP_IGBINARY_DEF}` + PHP_IMAGICK_OPT=`getPhpOpt imagick ${PHP_IMAGICK_DEF}` + PHP_IMAP_OPT=`getPhpOpt imap ${PHP_IMAP_DEF}` + PHP_IONCUBE_OPT=`getPhpOpt ioncube ${PHP_IONCUBE_DEF}` + PHP_LDAP_OPT=`getPhpOpt ldap ${PHP_LDAP_DEF}` + PHP_OPCACHE_OPT=`getPhpOpt opcache ${PHP_OPCACHE_DEF}` + PHP_PHALCON_OPT=`getPhpOpt phalcon ${PHP_PHALCON_DEF}` + PHP_REDIS_OPT=`getPhpOpt redis ${PHP_REDIS_DEF}` + PHP_READLINE_OPT=`getPhpOpt readline ${PHP_READLINE_DEF}` + PHP_SUHOSIN_OPT=`getPhpOpt suhosin ${PHP_SUHOSIN_DEF}` + PHP_SNUFFLEUPAGUS_OPT=`getPhpOpt snuffleupagus ${PHP_SNUFFLEUPAGUS_DEF}` + PHP_XMLRPC_OPT=`getPhpOpt xmlrpc ${PHP_XMLRPC_DEF}` + PHP_ZEND_OPT=`getPhpOpt zend ${PHP_ZEND_DEF}` + + #backwards compatibility + IONCUBE_OPT=${PHP_IONCUBE_OPT} + OPCACHE_OPT=${PHP_OPCACHE_OPT} + HTSCANNER_OPT=${PHP_HTSCANNER_OPT} + ZEND_OPT=${PHP_ZEND_OPT} + IMAGICK_OPT=${PHP_IMAGICK_OPT} + SUHOSIN_OPT=${PHP_SUHOSIN_OPT} + + SUHOSIN_PHP_UPLOADSCAN_OPT=`getOpt suhosin_php_uploadscan ${SUHOSIN_PHP_UPLOADSCAN_DEF}` + X_MAIL_HEADER_OPT=`getOpt x_mail_header ${X_MAIL_HEADER_DEF}` + + APCONF=ap2 + + HAVE_FPM_CGI=no + HAVE_FCGID=no + HAVE_SUPHP_CGI=no + HAVE_CLI=no + HAVE_LSPHP=no + for php_shortrelease in `echo ${PHP1_SHORTRELEASE_SET}`; do + eval `echo "HAVE_FPM${php_shortrelease}_CGI=no"` + eval `echo "HAVE_FCGID${php_shortrelease}=no"` + eval `echo "HAVE_SUPHP${php_shortrelease}_CGI=no"` + eval `echo "HAVE_CLI${php_shortrelease}=no"` + eval `echo "HAVE_LSPHP${php_shortrelease}=no"` + eval `echo "PHP${php_shortrelease}_CONFIGURE=configure/php/configure.php${php_shortrelease}"` + if [ -e custom/${APCONF}/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE=custom/${APCONF}/configure.php${php_shortrelease}"` + fi + if [ -e custom/php/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE=custom/php/configure.php${php_shortrelease}"` + fi + done + + if [ "${PHP1_RELEASE_OPT}" != "no" ] && [ "${PHP1_MODE_OPT}" = "php-fpm" ]; then + HAVE_FPM_CGI=yes + eval `echo "HAVE_FPM${PHP1_SHORTRELEASE}_CGI=yes"` + fi + if [ "${PHP2_RELEASE_OPT}" != "no" ] && [ "${PHP2_MODE_OPT}" = "php-fpm" ]; then + HAVE_FPM_CGI=yes + eval `echo "HAVE_FPM${PHP2_SHORTRELEASE}_CGI=yes"` + fi + if [ "${PHP3_RELEASE_OPT}" != "no" ] && [ "${PHP3_MODE_OPT}" = "php-fpm" ]; then + HAVE_FPM_CGI=yes + eval `echo "HAVE_FPM${PHP3_SHORTRELEASE}_CGI=yes"` + fi + if [ "${PHP4_RELEASE_OPT}" != "no" ] && [ "${PHP4_MODE_OPT}" = "php-fpm" ]; then + HAVE_FPM_CGI=yes + eval `echo "HAVE_FPM${PHP4_SHORTRELEASE}_CGI=yes"` + fi + + if [ "${PHP1_RELEASE_OPT}" != "no" ] && [ "${PHP1_MODE_OPT}" = "fastcgi" ]; then + HAVE_FCGID=yes + eval `echo "HAVE_FCGID${PHP1_SHORTRELEASE}=yes"` + fi + if [ "${PHP2_RELEASE_OPT}" != "no" ] && [ "${PHP2_MODE_OPT}" = "fastcgi" ]; then + HAVE_FCGID=yes + eval `echo "HAVE_FCGID${PHP2_SHORTRELEASE}=yes"` + fi + if [ "${PHP2_RELEASE_OPT}" != "no" ] && [ "${PHP3_MODE_OPT}" = "fastcgi" ]; then + HAVE_FCGID=yes + eval `echo "HAVE_FCGID${PHP3_SHORTRELEASE}=yes"` + fi + if [ "${PHP2_RELEASE_OPT}" != "no" ] && [ "${PHP4_MODE_OPT}" = "fastcgi" ]; then + HAVE_FCGID=yes + eval `echo "HAVE_FCGID${PHP4_SHORTRELEASE}=yes"` + fi + + if [ "${PHP1_RELEASE_OPT}" != "no" ] && [ "${PHP1_MODE_OPT}" = "suphp" ]; then + HAVE_SUPHP_CGI=yes + eval `echo "HAVE_SUPHP${PHP1_SHORTRELEASE}_CGI=yes"` + fi + if [ "${PHP2_RELEASE_OPT}" != "no" ] && [ "${PHP2_MODE_OPT}" = "suphp" ]; then + HAVE_SUPHP_CGI=yes + eval `echo "HAVE_SUPHP${PHP2_SHORTRELEASE}_CGI=yes"` + fi + if [ "${PHP3_RELEASE_OPT}" != "no" ] && [ "${PHP3_MODE_OPT}" = "suphp" ]; then + HAVE_SUPHP_CGI=yes + eval `echo "HAVE_SUPHP${PHP3_SHORTRELEASE}_CGI=yes"` + fi + if [ "${PHP4_RELEASE_OPT}" != "no" ] && [ "${PHP4_MODE_OPT}" = "suphp" ]; then + HAVE_SUPHP_CGI=yes + eval `echo "HAVE_SUPHP${PHP4_SHORTRELEASE}_CGI=yes"` + fi + + #Check just php1 and no other modes, as mod_php is not allowed to be 2/3/4th + if [ "${PHP1_RELEASE_OPT}" != "no" ] && [ "${PHP1_MODE_OPT}" = "mod_php" ]; then + HAVE_CLI=yes + eval `echo "HAVE_CLI${PHP1_SHORTRELEASE}=yes"` + fi + + if [ "${PHP1_RELEASE_OPT}" != "no" ] && [ "${PHP1_MODE_OPT}" = "lsphp" ]; then + HAVE_LSPHP=yes + eval `echo "HAVE_LSPHP${PHP1_SHORTRELEASE}=yes"` + fi + if [ "${PHP2_RELEASE_OPT}" != "no" ] && [ "${PHP2_MODE_OPT}" = "lsphp" ]; then + HAVE_LSPHP=yes + eval `echo "HAVE_LSPHP${PHP2_SHORTRELEASE}=yes"` + fi + if [ "${PHP3_RELEASE_OPT}" != "no" ] && [ "${PHP3_MODE_OPT}" = "lsphp" ]; then + HAVE_LSPHP=yes + eval `echo "HAVE_LSPHP${PHP3_SHORTRELEASE}=yes"` + fi + if [ "${PHP4_RELEASE_OPT}" != "no" ] && [ "${PHP4_MODE_OPT}" = "lsphp" ]; then + HAVE_LSPHP=yes + eval `echo "HAVE_LSPHP${PHP4_SHORTRELEASE}=yes"` + fi + + if [ "${PHP1_MODE_OPT}" = "mod_php" ] && [ "${MOD_RUID2_OPT}" = "no" ]; then + APPGROUP=apache + fi + + #MySQL + MYSQL_INST_OPT=`getOpt mysql_inst ${MYSQL_INST_DEF}` + if [ "${MYSQL_INST_OPT}" = "yes" ]; then + HIDE_CHANGES=1 + if [ "`has_mariadb`" = "0" ]; then + setOpt mysql_inst mysql + else + setOpt mysql_inst mariadb + fi + MYSQL_INST_OPT=`getOpt mysql_inst ${MYSQL_INST_DEF}` + fi + + MYSQL_BACKUP_OPT=`getOpt mysql_backup ${MYSQL_BACKUP_DEF}` + MYSQL_OPT=`getOpt mysql ${MYSQL_DEF}` + MARIADB_OPT=`getOpt mariadb ${MARIADB_DEF}` + MYSQL_BACKUP_GZIP_OPT=`getOpt mysql_backup_gzip ${MYSQL_BACKUP_GZIP_DEF}` + MYSQL_BACKUP_DIR_OPT=`getOpt mysql_backup_dir ${MYSQL_BACKUP_DIR_DEF}` + + MYSQLNAME="MySQL" + if [ "${MYSQL_INST_OPT}" = "mariadb" ]; then + MYSQLNAME="MariaDB" + fi + + #Email + DOVECOT_OPT=`getOpt dovecot ${DOVECOT_DEF}` + DOVECOT_CONF_OPT=`getOpt dovecot_conf ${DOVECOT_CONF_DEF}` + PIGEONHOLE_OPT=`getOpt pigeonhole ${PIGEONHOLE_DEF}` + MAIL_COMPRESS_OPT=`getOpt mail_compress ${MAIL_COMPRESS_DEF}` + + if [ "${OS}" = "FreeBSD" ]; then + EXIM_DEF="yes" + EXIMCONF_DEF="yes" + fi + EXIM_OPT=`getOpt exim ${EXIM_DEF}` + EXIMCONF_OPT=`getOpt eximconf ${EXIMCONF_DEF}` + EXIMCONF_RELEASE_OPT=`getOpt eximconf_release ${EXIMCONF_RELEASE_DEF}` + BLOCKCRACKING_OPT=`getOpt blockcracking ${BLOCKCRACKING_DEF}` + EASY_SPAM_FIGHTER_OPT=`getOpt easy_spam_fighter ${EASY_SPAM_FIGHTER_DEF}` + + EXIM_SRS_OPT=yes + + #Applications + PHPMYADMIN_OPT=`getOpt phpmyadmin ${PHPMYADMIN_DEF}` + PHPMYADMIN_PUBLIC_OPT=`getOpt phpmyadmin_public ${PHPMYADMIN_PUBLIC_DEF}` + PHPMYADMIN_VER_OPT=`getOpt phpmyadmin_ver ${PHPMYADMIN_VER_DEF}` + SQUIRRELMAIL_OPT=`getOpt squirrelmail ${SQUIRRELMAIL_DEF}` + ROUNDCUBE_OPT=`getOpt roundcube ${ROUNDCUBE_DEF}` + WEBAPPS_INBOX_PREFIX_NEWDEF="no" + if [ "${OPTIONS_CONF_EXISTS}" = "1" ]; then + WEBAPPS_INBOX_PREFIX_NEWDEF="yes" + fi + WEBAPPS_INBOX_PREFIX_OPT=`getOpt webapps_inbox_prefix ${WEBAPPS_INBOX_PREFIX_NEWDEF}` + + #Statistics software + AWSTATS_OPT=`getOpt awstats ${AWSTATS_DEF}` + WEBALIZER_OPT=`getOpt webalizer ${WEBALIZER_DEF}` + + CURL_OPT=`getOpt curl ${CURL_DEF}` + SSL_CONFIGURATION_OPT=`getOpt ssl_configuration ${SSL_CONFIGURATION_DEF}` + + #CustomBuild + AUTOVER_OPT=`getOpt autover ${AUTOVER_DEF}` + + CLEAN_OLD_TARBALLS_OPT=`getOpt clean_old_tarballs ${CLEAN_OLD_TARBALLS_DEF}` + CLEAN_OLD_WEBAPPS_OPT=`getOpt clean_old_webapps ${CLEAN_OLD_WEBAPPS_DEF}` + CLEANAPACHE_OPT=`getOpt cleanapache ${CLEANAPACHE_DEF}` + CUSTOMBUILD_OPT=`getOpt custombuild ${CUSTOMBUILD_DEF}` + CUSTOMBUILD_PLUGIN_OPT=`getOpt custombuild_plugin ${CUSTOMBUILD_PLUGIN_DEF}` + + #Cron + CRON_OPT=`getOpt cron ${CRON_DEF}` + CRON_FREQUENCY_OPT=`getOpt cron_frequency ${CRON_FREQUENCY_DEF}` + EMAIL_OPT=`getOpt email ${EMAIL_DEF}` + NOTIFICATIONS_OPT=`getOpt notifications ${NOTIFICATIONS_DEF}` + DA_AUTOUPDATE_OPT=`getOpt da_autoupdate ${DA_AUTOUPDATE_DEF}` + UPDATES_OPT=`getOpt updates ${UPDATES_DEF}` + WEBAPPS_UPDATES_OPT=`getOpt webapps_updates ${WEBAPPS_UPDATES_DEF}` + + VERSIONS_CL="versions.txt" + if [ "${CLOUDLINUX_BETA_OPT}" = "yes" ]; then + VERSIONS_CL="versions_beta.txt" + fi + if [ "${WEBSERVER_OPT}" = "litespeed" ]; then + if [ ! -s ${VERSIONS_FILE_LITESPEED} ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH_LITESPEED}/versions.txt -o ${VERSIONS_FILE_LITESPEED} 2> /dev/null + fi + if [ ! -s ${VERSIONS_FILE_LITESPEED} ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH_LITESPEED}/versions.txt -o ${VERSIONS_FILE_LITESPEED} 2> /dev/null + fi + fi + if [ "${CLOUDLINUX_OPT}" = "yes" ]; then + if [ ! -s ${VERSIONS_FILE_CL} ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH_CL}/${VERSIONS_CL} -o ${VERSIONS_FILE_CL} 2> /dev/null + fi + if [ ! -s ${VERSIONS_FILE_CL} ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH_CL}/${VERSIONS_CL} -o ${VERSIONS_FILE_CL} 2> /dev/null + fi + fi + if [ "${MODSECURITY_OPT}" = "yes" ] && [ "${MODSECURITY_RULESET_OPT}" = "comodo" ]; then + if [ ! -s ${VERSIONS_FILE_CWAF} ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH_CWAF}/doc/comodo_versions.txt -o ${VERSIONS_FILE_CWAF} 2> /dev/null + fi + if [ ! -s ${VERSIONS_FILE_CWAF} ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH_CWAF}/doc/comodo_versions.txt -o ${VERSIONS_FILE_CWAF} 2> /dev/null + fi + fi + if [ "${MYSQL_INST_OPT}" = "mariadb" ]; then + if [ "${MARIADB_OPT}" = "10.1" ] || [ "${MARIADB_OPT}" = "10.2" ] || [ "${MARIADB_OPT}" = "10.3" ] || [ "${MARIADB_OPT}" = "10.4" ] || [ "${MARIADB_OPT}" = "10.5" ]; then + if [ ! -d mysql ]; then + mkdir -p mysql + fi + if [ ! -s ${VERSIONS_FILE_JEMALLOC} ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH}/all/mariadb/jemalloc/jemalloc_versions.txt -o ${VERSIONS_FILE_JEMALLOC} 2> /dev/null + fi + if [ ! -s ${VERSIONS_FILE_GALERA} ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH}/all/mariadb/galera/galera_versions.txt -o ${VERSIONS_FILE_GALERA} 2> /dev/null + fi + fi + fi +fi + +allSettings() { + for section in $ALL_SECTIONS; do + PHP_EXT_SETTINGS_SECTION=false + PHP_EXT_SETTINGS_SECTION_PREFIX="" + if [ ${section} = "PHP_EXT_SETTINGS" ]; then + PHP_EXT_SETTINGS_SECTION=true + PHP_EXT_SETTINGS_SECTION_PREFIX="PHP_" + fi + DESC=${section}_DESC + echo "------------------------------------------" + echo "$(eval_var ${DESC})" + echo "------------------------------------------" + for setting in $(eval_var ${section}); do + SETTING_NAME=`echo $setting | tr "[A-Z]" "[a-z]"` + POSSIBLE_VALUES_VAR=${PHP_EXT_SETTINGS_SECTION_PREFIX}${setting}_SET + POSSIBLE_VALUES="`echo $(eval_var ${POSSIBLE_VALUES_VAR}) | awk -v OFS=", " '$1=$1'`" + DEFAULT_VALUE=${PHP_EXT_SETTINGS_SECTION_PREFIX}${setting}_DEF + CURRENT_VALUE=${PHP_EXT_SETTINGS_SECTION_PREFIX}${setting}_OPT + echo -n "${SETTING_NAME}: ${POSSIBLE_VALUES}. Current value: $(eval_var ${CURRENT_VALUE}). Default value: $(eval_var ${DEFAULT_VALUE})." + if [ "$1" = "full" ]; then + DESCRIPTION="${PHP_EXT_SETTINGS_SECTION_PREFIX}${setting}_DESC" + echo " Description: $(eval_var ${DESCRIPTION})" + else + echo "" + fi + done + echo "" + done +} + +allSettingsJSON() { + echo "{" + NUM_OF_SECTIONS=`echo $ALL_SECTIONS | wc -w` + CUR_SECTION=0 + for section in $ALL_SECTIONS; do + PHP_EXT_SETTINGS_SECTION=false + PHP_EXT_SETTINGS_SECTION_PREFIX="" + if [ ${section} = "PHP_EXT_SETTINGS" ]; then + PHP_EXT_SETTINGS_SECTION=true + PHP_EXT_SETTINGS_SECTION_PREFIX="PHP_" + fi + CUR_SECTION=`expr ${CUR_SECTION} + 1` + NUM_OF_SETTINGS=`echo "$(eval_var ${section})" | wc -w` + CUR_SETTING=0 + LOWERCASE_SECTION=`echo $section | tr "[A-Z]" "[a-z]"` + SECTION_DESC=${section}_DESC + printf "\t\"${LOWERCASE_SECTION}\": {\n" + printf "\t\t\"description\": \"$(eval_var ${SECTION_DESC})\",\n" + for setting in $(eval_var ${section}); do + CUR_SETTING=`expr ${CUR_SETTING} + 1` + SETTING_NAME=`echo $setting | tr "[A-Z]" "[a-z]"` + + POSSIBLE_VALUES_VAR=${PHP_EXT_SETTINGS_SECTION_PREFIX}${setting}_SET + POSSIBLE_VALUES="" + NUM_OF_VALUES=`echo $(eval_var ${POSSIBLE_VALUES_VAR}) | wc -w` + CUR_VALUE=0 + for value in $(eval_var ${POSSIBLE_VALUES_VAR}); do + CUR_VALUE=`expr ${CUR_VALUE} + 1` + if [ ${CUR_VALUE} -ne ${NUM_OF_VALUES} ]; then + POSSIBLE_VALUES="${POSSIBLE_VALUES}\"$value\"," + else + POSSIBLE_VALUES="${POSSIBLE_VALUES}\"${value}\"" + fi + done + DEFAULT_VALUE=${PHP_EXT_SETTINGS_SECTION_PREFIX}${setting}_DEF + CURRENT_VALUE=${PHP_EXT_SETTINGS_SECTION_PREFIX}${setting}_OPT + DESCRIPTION="${setting}_DESC" + + printf "\t\t\"${SETTING_NAME}\": {\n" + printf "\t\t\t\"values\": [${POSSIBLE_VALUES}],\n" + printf "\t\t\t\"default\": \"$(eval_var ${DEFAULT_VALUE})\",\n" + printf "\t\t\t\"current\": \"$(eval_var ${CURRENT_VALUE})\",\n" + printf "\t\t\t\"description\": \"$(eval_var ${DESCRIPTION})\"\n" + if [ ${CUR_SETTING} -ne ${NUM_OF_SETTINGS} ]; then + printf "\t\t},\n" + else + printf "\t\t}\n" + fi + done + if [ ${CUR_SECTION} -ne ${NUM_OF_SECTIONS} ]; then + printf "\t},\n" + else + printf "\t}\n" + fi + done + echo "}" +} +OPENSSL_VERSION_CACHE=0 +openssl_version() { + if [ "${OPENSSL_VERSION_CACHE}" = "0" ] && [ -x /usr/bin/openssl ]; then + #doesn't include letters! + OPENSSL_VERSION_CACHE=`/usr/bin/openssl version | head -n1 | cut -d\ -f2 | cut -d- -f1 | tr -d '[a-z]'` + fi + echo $OPENSSL_VERSION_CACHE +} + +MYSQL_VERSION_CACHE=0 +mysql_version() { + if [ "${MYSQL_VERSION_CACHE}" = "0" ] && [ -x ${MYSQL_BIN} ]; then + MYSQL_VERSION_CACHE=`${MYSQL_BIN} --version | grep -m1 -o '[0-9]*\.[0-9]*\.[0-9]*'` + fi + echo $MYSQL_VERSION_CACHE +} + +MYSQL_MAIN_CACHE=0 +mysql_main() { + if [ "${MYSQL_MAIN_CACHE}" = "0" ] && [ -x ${MYSQL_BIN} ]; then + MYSQL_MAIN_CACHE=`${MYSQL_BIN} --version | grep -m1 -o '[0-9]*\.[0-9]*\.[0-9]*' | cut -d. -f1,2` + fi + echo $MYSQL_MAIN_CACHE +} + +HAS_MARIADB_CACHE=-1 +has_mariadb() { + if [ "${HAS_MARIADB_CACHE}" = "-1" ] && [ -x ${MYSQL_BIN} ]; then + HAS_MARIADB_CACHE=`${MYSQL_BIN} --version | grep -c -m1 MariaDB` + fi + echo $HAS_MARIADB_CACHE +} + +#################################################### + +doRestartDA() { + echo "action=directadmin&value=reload" >> ${TASK_QUEUE} + run_dataskq +} + +doDAVersionCheck() { + DIRECTADMINV=`/usr/local/directadmin/directadmin v | awk '{print $3}' | cut -d. -f2,3` + if [ "`version_cmp ${DIRECTADMINV} 1.62 'DA version check'`" -lt 0 ]; then + do_exit 1 "${boldon}Your DirectAdmin version (${DIRECTADMINV}) is older than minimal required for this version of CustomBuild (1.63). Please run '/usr/local/directadmin/custombuild/build update_da'${boldoff}" + fi +} + +doChecks() { + if [ -x ${DA_BIN} ] && [ -s ${DACONF_FILE} ]; then + doDAVersionCheck + fi + os_license_mismatch + + doCSFpignore + + if [ -s ${WORKDIR}/config.json ]; then + if grep -m1 -q 8372 ${WORKDIR}/config.json; then + rm -f ${WORKDIR}/config.json + fi + fi + + DA_VERSION_IS_INSECURE=false + if [ ! -s /etc/mime.types ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH}/mime.types -o /etc/mime.types + fi + # Do some pre-definitions, so that we wouldn't output security in json if there are no security items + if [ -x ${DA_BIN} ] && [ -s ${DACONF_FILE} ]; then + DIRECTADMINV="`${DA_BIN} v | grep -m1 '^Version:' | grep -oE '[^ ]+$' | cut -d. -f2,3,4`" + if [ "`version_cmp $DIRECTADMINV 1.52.0`" -lt 0 ]; then + DA_VERSION_IS_INSECURE=true + if /usr/local/directadmin/directadmin c | grep -m1 -q 'email_ftp_password_change=1'; then + echo "Found DA version < 1.52.0. Setting email_ftp_password_change=0 in directadmin.conf for security purposes." + writeLog "email_ftp_password_change=0 in directadmin.conf was set for security purposes"; + setVal email_ftp_password_change 0 ${DACONF_TEMPLATE_FILE} + setVal email_ftp_password_change 0 ${DACONF_FILE} + doRestartDA + fi + fi + fi + + if [ "${APACHE_VER_OPT}" != "2.4" ] && [ "${APACHE_VER_OPT}" != "" ]; then + do_exit 1 "CustomBuild 2.0 does support Apache 2.4 only. Please check your apache_ver value in the options.conf file: ${APACHE_VER_OPT}." + fi + + if [ "${MYSQL_INST_OPT}" = "mariadb" ]; then + CORRECT_MARIADB_VER="`echo ${MARIADB_SET} | grep -c ${MARIADB_OPT}`" + if [ "${CORRECT_MARIADB_VER}" = "0" ]; then + do_exit 1 "Incorrect mysql value (used to specify MariaDB release) set in the options.conf file. Set: ${MARIADB_OPT}. Available values: ${MARIADB_SET}." + fi + if [ "${MARIADB_OPT}" != "5.5" ] && [ "${MARIADB_OPT}" != "10.0" ] && [ "${MARIADB_OPT}" != "10.1" ] && [ "${MARIADB_OPT}" != "10.2" ] && [ "${MARIADB_OPT}" != "10.3" ] && [ "${MARIADB_OPT}" != "10.4" ] && [ "${MARIADB_OPT}" != "10.5" ] && [ "${MARIADB_OPT}" != "10.6" ] && [ "${MARIADB_OPT}" != "11.4" ]; then + do_exit 1 "Wrong mariadb value set in ${OPTIONS_CONF}." + fi + elif [ "${MYSQL_INST_OPT}" = "mysql" ]; then + CORRECT_MYSQL_VER="`echo ${MYSQL_SET} | grep -c ${MYSQL_OPT}`" + if [ "${CORRECT_MYSQL_VER}" = "0" ]; then + do_exit 1 "Incorrect mysql value (used to specify MySQL release) set in the options.conf file. Set: ${MYSQL_OPT}. Available values: ${MYSQL_SET}." + fi + if [ "${MYSQL_OPT}" != "5.1" ] && [ "${MYSQL_OPT}" != "5.5" ] && [ "${MYSQL_OPT}" != "5.6" ] && [ "${MYSQL_OPT}" != "5.7" ] && [ "${MYSQL_OPT}" != "8.0" ]; then + do_exit 1 "Wrong mysql value set in ${OPTIONS_CONF}." + fi + fi + + if [ "${PHP_INI_TYPE_OPT}" != "development" ] && [ "${PHP_INI_TYPE_OPT}" != "production" ]; then + do_exit 1 "Wrong php_ini_type set in options.conf." + fi + + if [ "${WEBSERVER_OPT}" = "nginx" ]; then + if [ "${HAVE_CLI}" = "yes" ] || [ "${HAVE_SUPHP_CGI}" = "yes" ] || [ "${HAVE_FCGID}" = "yes" ] || [ "${HAVE_LSPHP}" = "yes" ]; then + do_exit 1 "nginx webserver is only compatible with php-fpm PHP mode." + fi + fi + + if [ "${WEBSERVER_OPT}" != "openlitespeed" ] && [ "${WEBSERVER_OPT}" != "litespeed" ] && [ "${SSL_CONFIGURATION_OPT}" = "modern" ]; then + OFFER_MODERN_SSL_SET=true + if [ "${OS}" = "FreeBSD" ]; then + if [ "${OS_FREEBSD_VER}" = "11" ]; then + OFFER_MODERN_SSL_SET=false + OS_NAME="FreeBSD ${OS_FREEBSD_VER}" + fi + elif [ -e ${DEBIAN_VERSION} ]; then + if [ "${OS_DEBIAN_VER}" = "7" ] || [ "${OS_DEBIAN_VER}" = "8" ] || [ "${OS_DEBIAN_VER}" = "9" ]; then + OFFER_MODERN_SSL_SET=false + OS_NAME="Debian ${OS_DEBIAN_VER}" + fi + else + if [ "${OS_CENTOS_VER}" = "6" ] || [ "${OS_CENTOS_VER}" = "7" ]; then + OFFER_MODERN_SSL_SET=false + OS_NAME="CentOS/RHEL/CloudLinux ${OS_CENTOS_VER}" + fi + fi + if ! ${OFFER_MODERN_SSL_SET}; then + do_exit 1 "${WEBSERVER_OPT} webserver does not support 'modern' ssl_configuration option due to lack of support of TLSv1.3 in OpenSSL package on ${OS_NAME}." + fi + fi + + if [ "${MOD_RUID2_OPT}" = "yes" ]; then + if [ "${WEBSERVER_OPT}" = "apache" ] || [ "${WEBSERVER_OPT}" = "litespeed" ] || [ "${WEBSERVER_OPT}" = "openlitespeed" ] || [ "${WEBSERVER_OPT}" = "nginx_apache" ]; then + if [ "${HAVE_FCGID}" = "yes" ] || [ "${PHP1_MODE_OPT}" = "lsphp" ] ; then + do_exit 1 "${WEBSERVER_OPT} webserver configuration option is not compatible with lsphp or php-fastcgi PHP mode with mod_ruid2 enabled." + fi + fi + fi + + if [ "${MOD_RUID2_OPT}" = "yes" ] && [ "${HAVE_SUPHP_CGI}" = "yes" ]; then + echo "WARNING: It's not recommended to use ${WEBSERVER_OPT} with mod_ruid2 & suPHP enabled. It's a redundant and slow combination." + sleep 1 + fi + + if [ "${WEBSERVER_OPT}" = "litespeed" ] || [ "${WEBSERVER_OPT}" = "openlitespeed" ]; then + if [ "${PHP1_MODE_OPT}" != "lsphp" ]; then + do_exit 1 "php1_mode must be set to lsphp when using ${WEBSERVER_OPT} WEB server." + fi + if [ "${PHP2_MODE_OPT}" != "lsphp" ] && [ "${PHP2_RELEASE_OPT}" != "no" ]; then + do_exit 1 "php2_mode must be set to lsphp when using ${WEBSERVER_OPT} WEB server." + fi + if [ "${PHP3_MODE_OPT}" != "lsphp" ] && [ "${PHP3_RELEASE_OPT}" != "no" ]; then + do_exit 1 "php3_mode must be set to lsphp when using ${WEBSERVER_OPT} WEB server." + fi + if [ "${PHP4_MODE_OPT}" != "lsphp" ] && [ "${PHP4_RELEASE_OPT}" != "no" ]; then + do_exit 1 "php4_mode must be set to lsphp when using ${WEBSERVER_OPT} WEB server." + fi + elif [ "${CLOUDLINUX_OPT}" != "yes" ] || [ $(is_cloudlinux_solo) -eq 1 ]; then + if [ "${WEBSERVER_OPT}" = "apache" ] || [ "${WEBSERVER_OPT}" = "nginx_apache" ]; then + if [ "${PHP1_MODE_OPT}" = "lsphp" ]; then + do_exit 1 "php1_mode cannot be set to lsphp when using ${WEBSERVER_OPT} WEB server and CloudLinux disabled." + fi + if [ "${PHP2_MODE_OPT}" = "lsphp" ] && [ "${PHP2_RELEASE_OPT}" != "no" ]; then + do_exit 1 "php2_mode cannot be set to lsphp when using ${WEBSERVER_OPT} WEB server and CloudLinux disabled." + fi + if [ "${PHP3_MODE_OPT}" = "lsphp" ] && [ "${PHP3_RELEASE_OPT}" != "no" ]; then + do_exit 1 "php3_mode cannot be set to lsphp when using ${WEBSERVER_OPT} WEB server and CloudLinux disabled." + fi + if [ "${PHP4_MODE_OPT}" = "lsphp" ] && [ "${PHP4_RELEASE_OPT}" != "no" ]; then + do_exit 1 "php4_mode cannot be set to lsphp when using ${WEBSERVER_OPT} WEB server and CloudLinux disabled." + fi + fi + fi + + if [ "${PHP1_MODE_OPT}" != "php-fpm" ] && [ "${PHP1_MODE_OPT}" != "fastcgi" ] && [ "${PHP1_MODE_OPT}" != "mod_php" ] && [ "${PHP1_MODE_OPT}" != "suphp" ] && [ "${PHP1_MODE_OPT}" != "lsphp" ]; then + do_exit 1 "Please set a correct PHP mode (mode set for php1_release should be php-fpm, fastcgi, mod_php, suphp or lsphp)." + fi + if [ "${PHP2_MODE_OPT}" != "php-fpm" ] && [ "${PHP2_MODE_OPT}" != "fastcgi" ] && [ "${PHP2_MODE_OPT}" != "suphp" ] && [ "${PHP2_MODE_OPT}" != "lsphp" ]; then + do_exit 1 "Please set a correct PHP mode (mode set for php2_release should be php-fpm, fastcgi, suphp or lsphp)." + fi + if [ "${PHP3_MODE_OPT}" != "php-fpm" ] && [ "${PHP3_MODE_OPT}" != "fastcgi" ] && [ "${PHP3_MODE_OPT}" != "suphp" ] && [ "${PHP3_MODE_OPT}" != "lsphp" ]; then + do_exit 1 "Please set a correct PHP mode (mode set for php3_release should be php-fpm, fastcgi, suphp or lsphp)." + fi + if [ "${PHP4_MODE_OPT}" != "php-fpm" ] && [ "${PHP4_MODE_OPT}" != "fastcgi" ] && [ "${PHP4_MODE_OPT}" != "suphp" ] && [ "${PHP4_MODE_OPT}" != "lsphp" ]; then + do_exit 1 "Please set a correct PHP mode (mode set for php4_release should be php-fpm, fastcgi, suphp or lsphp)." + fi + + PHP1_RELEASE_CHECK=0 + for i in `echo "${PHP1_RELEASE_SET}"`; do + if [ "${PHP1_RELEASE_OPT}" = "$i" ]; then + PHP1_RELEASE_CHECK=1 + fi + done + + PHP2_RELEASE_CHECK=0 + for i in `echo "${PHP2_RELEASE_SET} no"`; do + if [ "${PHP2_RELEASE_OPT}" = "$i" ]; then + PHP2_RELEASE_CHECK=1 + fi + done + + PHP3_RELEASE_CHECK=0 + for i in `echo "${PHP3_RELEASE_SET} no"`; do + if [ "${PHP3_RELEASE_OPT}" = "$i" ]; then + PHP3_RELEASE_CHECK=1 + fi + done + + PHP3_RELEASE_CHECK=0 + for i in `echo "${PHP3_RELEASE_SET} no"`; do + if [ "${PHP3_RELEASE_OPT}" = "$i" ]; then + PHP3_RELEASE_CHECK=1 + fi + done + + if [ "${PHP1_MODE_OPT}" = "mod_php" ] && [ "${PHP2_MODE_OPT}" = "mod_php" ] && [ "${PHP2_RELEASE_OPT}" != "no" ]; then + do_exit 1 "Cannot install both versions of PHP in mod_php mode." + elif [ "${PHP1_RELEASE_CHECK}" = "0" ]; then + do_exit 1 "Wrong php1_release set in the options.conf: ${PHP1_RELEASE_OPT}." + elif [ "${PHP2_RELEASE_CHECK}" = "0" ]; then + do_exit 1 "Wrong php2_release set in the options.conf: ${PHP2_RELEASE_OPT}." + elif [ "${PHP3_RELEASE_CHECK}" = "0" ]; then + do_exit 1 "Wrong php3_release set in the options.conf: ${PHP3_RELEASE_OPT}." + elif [ "${PHP4_RELEASE_CHECK}" = "0" ]; then + do_exit 1 "Wrong php4_release set in the options.conf: ${PHP4_RELEASE_OPT}." + fi + + # Check for the same versions set + SAME_PHP_VERSION=false + if [ "${PHP1_RELEASE_OPT}" = "${PHP2_RELEASE_OPT}" ] || [ "${PHP1_RELEASE_OPT}" = "${PHP3_RELEASE_OPT}" ] || [ "${PHP1_RELEASE_OPT}" = "${PHP4_RELEASE_OPT}" ]; then + SAME_PHP_VERSION=true + fi + if [ "${PHP2_RELEASE_OPT}" != "no" ]; then + if [ "${PHP2_RELEASE_OPT}" = "${PHP3_RELEASE_OPT}" ] || [ "${PHP2_RELEASE_OPT}" = "${PHP4_RELEASE_OPT}" ]; then + SAME_PHP_VERSION=true + fi + fi + if [ "${PHP4_RELEASE_OPT}" != "no" ] && [ "${PHP3_RELEASE_OPT}" = "${PHP4_RELEASE_OPT}" ]; then + SAME_PHP_VERSION=true + fi + + if ${SAME_PHP_VERSION}; then + do_exit 1 "Cannot install the same version of PHP for both releases." + fi + + #ensure php2/3/4_release is not set twice + for php_number in {2..4}; do { + C=`grep -c -e "^php${php_number}_release=" ${OPTIONS_CONF}` + if [ "${C}" -gt 1 ]; then + grep -e "^php${php_number}_release=" ${OPTIONS_CONF} + do_exit 1 "php${php_number}_release has been set twice in the options.conf. This will cause problems. Edit it to remove one of them." + fi + C=`grep -c -e "^php${php_number}_mode=" ${OPTIONS_CONF}` + if [ "${C}" -gt 1 ]; then + grep -e "^php${php_number}_mode=" ${OPTIONS_CONF} + do_exit 1 "php${php_number}_mode has been set twice in the options.conf. This will cause problems. Edit it to remove one of them." + fi + }; + done + + #php 5.5 and older will never compile with openssl 1.1.0 + if [ "${PHP1_RELEASE_OPT}" = "5.3" ] || [ "${PHP1_RELEASE_OPT}" = "5.4" ] || [ "${PHP1_RELEASE_OPT}" = "5.5" ] || [ "${PHP2_RELEASE_OPT}" = "5.3" ] || [ "${PHP2_RELEASE_OPT}" = "5.4" ] || [ "${PHP2_RELEASE_OPT}" = "5.5" ] || [ "${PHP3_RELEASE_OPT}" = "5.3" ] || [ "${PHP3_RELEASE_OPT}" = "5.4" ] || [ "${PHP3_RELEASE_OPT}" = "5.5" ] || [ "${PHP4_RELEASE_OPT}" = "5.3" ] || [ "${PHP4_RELEASE_OPT}" = "5.4" ] || [ "${PHP4_RELEASE_OPT}" = "5.5" ]; then + OV=`openssl_version | cut -d. -f1,2` + if [ "${OV}" != "" ] && [ "`version_cmp ${OV} 1.1 'php 5.x vs openssl 1.1.0 ver check'`" -ge 0 ] && [ ! -e ${WORKDIR}/custom/fpm/.custom_openssl ]; then + do_exit 1 "php 5.3, 5.4, 5.5 cannot compile against openssl 1.1.0 or higher. Try php 5.6 or higher." + fi + fi + + if [ "${APACHE_VER_OPT}" != "2.4" ] && [ "${APACHE_VER_OPT}" != "" ]; then + do_exit 1 "Wrong apache_ver value set in ${OPTIONS_CONF}." + fi + + if [ "${MOD_RUID2_OPT}" = "yes" ]; then + if [ "${OS}" = "FreeBSD" ]; then + do_exit 1 "mod_ruid2 does not support FreeBSD." + elif [ -e ${DEBIAN_VERSION} ]; then + if [ "${OS_DEBIAN_VER}" = "9" ] || [ "${OS_DEBIAN_VER}" = "10" ]; then + do_exit 1 "mod_ruid2 does not support Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866395." + fi + elif [ "${OS_CENTOS_VER}" = "8" ]; then + do_exit 1 "mod_ruid2 does not support CentOS8." + fi + fi + + if [ "${FTPD_OPT}" = "pureftpd" ]; then + if [ -s "$DACONF_FILE" ]; then + UNIFIED_FTP=`/usr/local/directadmin/directadmin c | grep -m1 unified_ftp_password_file | cut -d= -f2` + if [ "$UNIFIED_FTP" != "1" ]; then + echo "unified_ftp_password_file is not set to 1. You must convert before you can use pureftpd" + echo "Please read this guide: https://www.directadmin.com/features.php?id=1134" + echo "" + echo "Simulation:" + echo " cd /usr/local/directadmin" + echo " echo 'action=convert&value=unifiedftp&simulate=yes' >> data/task.queue" + echo " ./dataskq d1" + echo "" + echo "Conversion:" + echo " cd /usr/local/directadmin" + echo " echo 'unified_ftp_password_file=1' >> conf/directadmin.conf" + echo " echo 'action=convert&value=unifiedftp' >> data/task.queue" + echo " ./dataskq d1" + do_exit 1 "" + fi + fi + fi + + if [ "${CRON_FREQUENCY_OPT}" != "daily" ] && [ "${CRON_FREQUENCY_OPT}" != "weekly" ] && [ "${CRON_FREQUENCY_OPT}" != "monthly" ]; then + echo "Wrong cron_frequency value set in ${OPTIONS_CONF}" + echo "Current value: ${CRON_FREQUENCY_OPT}" + do_exit 1 "Valid values: daily, weekly, or monthly" + fi + + if [ "${SA_UPDATE_OPT}" != "no" ] && [ "${SA_UPDATE_OPT}" != "daily" ] && [ "${SA_UPDATE_OPT}" != "weekly" ] && [ "${SA_UPDATE_OPT}" != "monthly" ]; then + echo "Wrong sa_update value set in ${OPTIONS_CONF}" + echo "Current value: ${SA_UPDATE_OPT}" + do_exit 1 "Valid values: no, daily, weekly, or monthly" + fi + + if [ "${EASY_SPAM_FIGHTER_OPT}" = "yes" ] && [ "${SPAMD_OPT}" != "spamassassin" ] && [ "${SPAMD_OPT}" != "rspamd" ]; then + echo "easy_spam_fighter requires spamassassin to be enabled." + do_exit 1 "Install SpamAssassin: https://help.directadmin.com/item.php?id=36" + fi + + if [ "${DOWNLOADSERVER_OPT}" = "files26.directadmin.com" ]; then + setOpt downloadserver damirror.unix-solutions.be + echo "files26 has been replaced with new name damirror.unix-solutions.be, used on the next run" + fi + if [ -e /usr/include/sys/select.h ] && [ ! -s /usr/include/sys/select.h ] && [ "${OS}" != "FreeBSD" ] && [ ! -e ${DEBIAN_VERSION} ]; then + echo "Found broken glibc-headers package, reinstalling..." + yum -y reinstall glibc-headers + fi + if [ "${OS}" != "FreeBSD" ] && [ ! -e ${DEBIAN_VERSION} ]; then + if [ -e /etc/yum.repos.d/oracle-linux-ol8.repo ] && [ ! -e /etc/yum.repos.d/oracle-epel-ol8.repo ]; then + yum -y install oraclelinux-release-el8 + elif [ ! -e /etc/yum.repos.d/oracle-linux-ol8.repo ] && [ ! -e /etc/yum.repos.d/oracle-epel-ol8.repo ] && [ ! -e /etc/yum.repos.d/epel.repo ]; then + yum -y install epel-release + if [ ! -e /etc/yum.repos.d/epel.repo ]; then + if [ "${OS_CENTOS_VER}" = "6" ]; then + #it's eol, might not have it.. + touch /etc/yum.repos.d/epel.repo + elif [ "${OS_CENTOS_VER}" = "7" ]; then + yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + elif [ "${OS_CENTOS_VER}" = "8" ]; then + yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm + fi + fi + fi + fi +} + +checkMD5() { + #$1 is the local file + #$2 is the versions.txt variable + #return values: + #1 for error, try agian + #0 for nothing to report. + + if [ ! -e $MD5SUM ]; then + echo 0 + return + fi + + if [ ! -e "$1" ]; then + echo 1 + fi + + VMD5=`getMD5 $2` + if [ "$VMD5" = "" ]; then + echo 0 + return + fi + + if [ ${OS} = "FreeBSD" ]; then + FMD5=`$MD5SUM -q $1` + else + FMD5=`$MD5SUM $1 | cut -d\ -f1` + fi + + + if [ "$FMD5" = "$VMD5" ]; then + echo 0 + else + echo 1 + fi +} + +json_toggle() { + JSON_CASE=1 +} + +JSON_CASE=0 +case "$1" in + versions_json) json_toggle ;; + list_removals_json) json_toggle ;; + gen_help_json) json_toggle ;; + list_configs_json) json_toggle ;; + settings_json) json_toggle ;; +esac + +GET_FILE_FAILED_COUNT=0 +#getFile file.tar.gz name (localfile.tar.gz) +#getFile all/awstats/file.tar.gz awstats awstats.tar.gz +getFile() { + cd ${CWD} + + TRY_DIFFERENT_THRESH=2 + GIVE_UP_THRESH=5 + + LOCAL_NAME=$1 + + if [ "$3" != "" ]; then + LOCAL_NAME=$3 + fi + + if [ ! -s ${LOCAL_NAME} ]; then + DOWNLOAD_DIR_NAME="`dirname ${CWD}/${LOCAL_NAME}`" + if [ ! -d "${DOWNLOAD_DIR_NAME}" ]; then + mkdir -p "${DOWNLOAD_DIR_NAME}" + fi + printf "Downloadingg ${WEBPATH}/${1} -> ${CWD}/${LOCAL_NAME} " + if [ ${OS} = "FreeBSD" ]; then + fetch -o ${CWD}/${LOCAL_NAME} ${WEBPATH}/${1} + else + curl ${CURL_CONNECT_OPTIONS} -o ${CWD}/${LOCAL_NAME} ${WEBPATH}/${1} + fi + + if [ ! -s ${LOCAL_NAME} ]; then + echo "Downloaded file ${CWD}/${LOCAL_NAME} does not exist or is empty after download" + echo "cwd is: `pwd`" + echo "${boldon}Fileserver might be down, using the backup file server..${boldoff}" + if [ ${OS} = "FreeBSD" ]; then + fetch -o ${CWD}/${LOCAL_NAME} ${WEBPATH_BACKUP}/${1} + else + curl ${CURL_CONNECT_OPTIONS} -o ${CWD}/${LOCAL_NAME} ${WEBPATH_BACKUP}/${1} + fi + + if [ "${GET_FILE_FAILED_COUNT}" -eq ${GIVE_UP_THRESH} ]; then + echo "" + echo "" + echo "${boldon}There seem to be many connection issues. Check your network and /etc/resolv.conf file${boldoff}" + echo "Also try finding a faster server: https://help.directadmin.com/item.php?id=305" + echo "" + echo "" + sleep 5 + + #messages/changes will now stop because it's above. + GET_FILE_FAILED_COUNT=$((GET_FILE_FAILED_COUNT+1)) + + elif [ "${GET_FILE_FAILED_COUNT}" -lt ${GIVE_UP_THRESH} ]; then + GET_FILE_FAILED_COUNT=$((GET_FILE_FAILED_COUNT+1)) + + if [ "${GET_FILE_FAILED_COUNT}" -gt ${TRY_DIFFERENT_THRESH} ]; then + + echo "" + echo "${boldon}Too many failed attempts with ${DOWNLOADSERVER_OPT}. Will try a different server.${boldoff}" + SET_DL=da-mirror.wpcloud.vn + case "${DOWNLOADSERVER_OPT}" in + da-mirror.wpcloud.vn) SET_DL=${WEBPATH_BACKUP_IP} + ;; + files1.directadmin.com) SET_DL=${WEBPATH_BACKUP_IP} + ;; + files2.directadmin.com) SET_DL=files1.directadmin.com + ;; + files8.directadmin.com) SET_DL=files6.directadmin.com + ;; + files11.directadmin.com) SET_DL=files6.directadmin.com + ;; + files15.directadmin.com) SET_DL=files6.directadmin.com + ;; + files16.directadmin.com) SET_DL=files6.directadmin.com + ;; + esac + + echo "${boldon}We'll temporarily try using $SET_DL instead${boldoff}" + echo "" + + DOWNLOADSERVER_OPT=${SET_DL} + if echo "${DOWNLOADSERVERS_HTTPS_LIST}" | grep -m1 -q " ${DOWNLOADSERVER_OPT} "; then + DOWNLOADSERVER_SCHEME=https + else + DOWNLOADSERVER_SCHEME=http + fi + WEBPATH=${DOWNLOADSERVER_SCHEME}://${DOWNLOADSERVER_OPT}/services/custombuild + WEBPATH_SERVICES=${DOWNLOADSERVER_SCHEME}://${DOWNLOADSERVER_OPT}/services + + sleep 2 + fi + fi + fi + elif [ "${2}" = "" ]; then + if [ "${JSON_CASE}" -eq 0 ]; then + printf "Downloading\t\t$1...\n" + fi + if [ ${OS} = "FreeBSD" ]; then + fetch -o ${CWD}/${LOCAL_NAME} ${WEBPATH}/${1} + else + curl ${CURL_CONNECT_OPTIONS} -o ${CWD}/${LOCAL_NAME} ${WEBPATH}/${1} + fi + fi + + if [ "$2" != "" ]; then + + M=`checkMD5 ${LOCAL_NAME} ${2}` + + if [ "$M" != "0" ]; then + if [ "${JSON_CASE}" -eq 0 ]; then + echo "" + echo "${boldon}*** MD5 Checksum for ${LOCAL_NAME} Failed. Redownloading...***${boldoff}" + echo "" + fi + #we will call it recursively but will *not* pass $2 for the md5 cus it would get stuck in a loop. + + rm -f ${LOCAL_NAME} + getFile ${1} "" ${3} + + M=`checkMD5 ${LOCAL_NAME} ${2}` + + if [ "$M" != "0" ]; then + echo "" + echo "" + echo "${boldon}*** MD5 Checksum for $1 failed *again*.***${boldoff}" + echo "The md5 checksum value may be incorrect, or a wrong file is being downloaded." + echo "Install continuing with this possibly corrupted file. (it may also be fine)" + echo "" + echo "" + elif [ "${JSON_CASE}" -eq 0 ]; then + echo "MD5 Checksum on ${LOCAL_NAME} passed." + fi + fi + fi +} + +downloadVersionsTxt() { + if [ ${OS} = "FreeBSD" ]; then + fetch -o ./versions.txt ${WEBPATH}/versions.txt 2> /dev/null + else + curl ${CURL_CONNECT_OPTIONS} -o ./versions.txt ${WEBPATH}/versions.txt 2> /dev/null + fi + + if [ ! -s ./versions.txt ]; then + echo "Could not get versions.txt from ${WEBPATH}. Trying backup." + if [ ${OS} = "FreeBSD" ]; then + fetch -o ./versions.txt ${WEBPATH_BACKUP}/versions.txt 2> /dev/null + else + curl ${CURL_CONNECT_OPTIONS} -o ./versions.txt ${WEBPATH_BACKUP}/versions.txt 2> /dev/null + fi + + if [ -s ./versions.txt ]; then + echo "Ok, that worked. Please try using a different mirror." + echo "./build set_fastest" + echo "https://help.directadmin.com/item.php?id=305" + + echo "" + echo "Using ${WEBPATH_BACKUP} for the remainder of this run." + sleep 10 + + WEBPATH=${WEBPATH_BACKUP} + + else + do_exit 1 "Unable to download versions.txt from any mirror" + fi + + fi + + + #because the versions.txt has the md5 for is, saves us re-downloading it if we already have the latest. + getFile patches_versions.txt patches_versions + + if [ "${WEBSERVER_OPT}" = "litespeed" ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH_LITESPEED}/versions.txt -o ${VERSIONS_FILE_LITESPEED} 2> /dev/null + if [ ! -s ${VERSIONS_FILE_LITESPEED} ]; then + getFile versions_litespeed.txt versions_litespeed + fi + fi + if [ "${CLOUDLINUX_OPT}" = "yes" ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH_CL}/${VERSIONS_CL} -o ${VERSIONS_FILE_CL} 2> /dev/null + if [ ! -s ${VERSIONS_FILE_CL} ]; then + getFile versions_cl.txt versions_cl + fi + fi + if [ "${MODSECURITY_OPT}" = "yes" ] && [ "${MODSECURITY_RULESET_OPT}" = "comodo" ]; then + curl ${CURL_CONNECT_OPTIONS} ${WEBPATH_CWAF}/doc/comodo_versions.txt -o ${VERSIONS_FILE_CWAF} 2> /dev/null + if [ ! -s ${VERSIONS_FILE_CWAF} ]; then + getFile versions_cwaf.txt versions_cwaf + fi + fi + if [ "${MYSQL_INST_OPT}" = "mariadb" ]; then + if [ "${MARIADB_OPT}" = "10.1" ] || [ "${MARIADB_OPT}" = "10.2" ] || [ "${MARIADB_OPT}" = "10.3" ] || [ "${MARIADB_OPT}" = "10.4" ] || [ "${MARIADB_OPT}" = "10.5" ] || [ "${MARIADB_OPT}" = "10.6" ] || [ "${MARIADB_OPT}" = "11.4" ]; then + if [ ! -d mysql ]; then + mkdir -p mysql + fi + getFile all/mariadb/jemalloc/jemalloc_versions.txt jemalloc_versions mysql/versions_jemalloc.txt + getFile all/mariadb/galera/galera_versions.txt galera_versions mysql/versions_galera.txt + fi + fi +} + +SKIP_LDCONFIG_SECTION=0 +skip_ldconfig_toggle() { + SKIP_LDCONFIG_SECTION=1 +} +case "$1" in + "") skip_ldconfig_toggle ;; + opt_help) skip_ldconfig_toggle ;; + set) skip_ldconfig_toggle ;; + set_php) skip_ldconfig_toggle ;; + get_versions_txt) skip_ldconfig_toggle ;; + update_script) skip_ldconfig_toggle ;; + version) skip_ldconfig_toggle ;; + set_fastest) skip_ldconfig_toggle ;; + set_fastest_quiet) skip_ldconfig_toggle ;; + kill) skip_ldconfig_toggle ;; + update_da) skip_ldconfig_toggle ;; + list_configs_json) skip_ldconfig_toggle ;; + settings_json) skip_ldconfig_toggle ;; + get_timezone) skip_ldconfig_toggle ;; + custom_config) skip_ldconfig_toggle ;; + set_versions_txt) skip_ldconfig_toggle ;; + show_component_config) skip_ldconfig_toggle ;; + remove_customized_config) skip_ldconfig_toggle ;; + show_file) skip_ldconfig_toggle ;; + check_options) skip_ldconfig_toggle ;; +esac + +if [ "${SKIP_LDCONFIG_SECTION}" = "0" ]; then + #Is the default PHP running as CGI? This variable is not used anymore, but left for the future + GREP_PHP_MODE="`grep -m1 '^php1_mode=' ${WORKDIR}/options.conf | cut -d= -f2`" + + # Get apache version from directadmin.conf + DACONF_APACHE_VER=1.3 + if [ -e ${DACONF_FILE} ]; then + DACONF_APACHE_VER=`grep -m1 "^apache_ver=" ${DACONF_FILE} | cut -d= -f2` + fi + + # Download versions.txt if AUTOVER_OPT is set to "yes" + if [ "${AUTOVER_OPT}" = "yes" ]; then + downloadVersionsTxt + fi + + # Check if ld.so.conf has /usr/local/lib + if [ ! -e /etc/ld.so.conf ] || [ "`grep -m1 -c -E '/usr/local/lib$' /etc/ld.so.conf`" = "0" ]; then + echo "/usr/local/lib" >> /etc/ld.so.conf + /sbin/ldconfig + fi + + # Check if ld.so.conf has /usr/local/lib + if [ -d /usr/local/lib64 ]; then + if [ ! -e /etc/ld.so.conf ] || [ "`grep -m1 -c -E '/usr/local/lib64$' /etc/ld.so.conf`" = "0" ]; then + echo "/usr/local/lib64" >> /etc/ld.so.conf + /sbin/ldconfig + fi + fi + + if [ "$1" = "apache" ] || [ "$1" = "nginx_apache" ]; then + if [ "`grep -m1 -c -E '^/usr/lib/apache$' /etc/ld.so.conf`" = "1" ]; then + perl -pi -e 's|^/usr/lib/apache|#/usr/lib/apache|' /etc/ld.so.conf + /sbin/ldconfig + fi + fi +fi + +getMD5CL() { + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 3` + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CL} | cut -d ':' -f 3` + fi + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CL} | cut -d ':' -f 3` + fi + + echo "${RESULT}" +} + +getMD5CWAF() { + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 3` + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CWAF} | cut -d ':' -f 3` + fi + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CWAF} | cut -d ':' -f 3` + fi + + echo "${RESULT}" +} + +getMD5LSWS() { + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 3` + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_LITESPEED} | cut -d ':' -f 3` + fi + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_LITESPEED} | cut -d ':' -f 3` + fi + + echo "${RESULT}" +} + +getMD5Jemalloc() { + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 3` + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_JEMALLOC} | cut -d ':' -f 3` + fi + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_JEMALLOC} | cut -d ':' -f 3` + fi + + echo "${RESULT}" +} + +getMD5Galera() { + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 3` + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_GALERA} | cut -d ':' -f 3` + fi + else + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_GALERA} | cut -d ':' -f 3` + fi + + echo "${RESULT}" +} + +checkMD5CL() { + #$1 is the local file + #$2 is the versions_cl.txt or versions_litespeed.txt variable + #return values: + #1 for error, try agian + #0 for nothing to report. + + if [ ! -e $MD5SUM ]; then + echo 0 + return + fi + + if [ ! -e "$1" ]; then + echo 1 + fi + + VMD5=`getMD5CL $2` + if [ "$VMD5" = "" ]; then + echo 0 + return + fi + + FMD5=`$MD5SUM $1 | cut -d\ -f1` + + if [ "$FMD5" = "$VMD5" ]; then + echo 0 + else + echo 1 + fi +} + +checkMD5CWAF() { + #$1 is the local file + #$2 is the versions_cwaf.txt + #return values: + #1 for error, try agian + #0 for nothing to report. + + if [ ! -e $MD5SUM ]; then + echo 0 + return + fi + + if [ ! -e "$1" ]; then + echo 1 + fi + + VMD5=`getMD5CWAF $2` + if [ "$VMD5" = "" ]; then + echo 0 + return + fi + + if [ ${OS} = "FreeBSD" ]; then + FMD5=`$MD5SUM -q $1` + else + FMD5=`$MD5SUM $1 | cut -d\ -f1` + fi + + if [ "$FMD5" = "$VMD5" ]; then + echo 0 + else + echo 1 + fi +} + +checkMD5LSWS() { + #$1 is the local file + #$2 is the versions_cl.txt or versions_litespeed.txt variable + #return values: + #1 for error, try agian + #0 for nothing to report. + + if [ ! -e $MD5SUM ]; then + echo 0 + return + fi + + if [ ! -e "$1" ]; then + echo 1 + fi + + VMD5=`getMD5LSWS $2` + if [ "$VMD5" = "" ]; then + echo 0 + return + fi + + if [ ${OS} = "FreeBSD" ]; then + FMD5=`$MD5SUM -q $1` + else + FMD5=`$MD5SUM $1 | cut -d\ -f1` + fi + + if [ "$FMD5" = "$VMD5" ]; then + echo 0 + else + echo 1 + fi +} + +getFileCL() { + cd ${CWD} + + if [ ! -s ${1} ]; then + printf "Downloading\t\t$1...\n" + curl ${CURL_CONNECT_OPTIONS} -o ${CWD}/${1} ${WEBPATH_CL}/${1} + tar xzf ${1} --no-same-owner + fi + + if [ "$#" -eq 2 ]; then + + M=`checkMD5CL ${1} ${2}` + + if [ "$M" != "0" ]; then + echo "" + echo "${boldon}*** MD5 Checksum for $1 Failed. Redownloading...***${boldoff}" + echo "" + #we will call it recursively but will *not* pass $2 for the md5 cus it would get stuck in a loop. + + rm -f $1 + getFileCL $1 + tar xzf ${1} --no-same-owner + M=`checkMD5CL ${1} ${2}` + + if [ "$M" != "0" ]; then + echo "" + echo "" + echo "${boldon}*** MD5 Checksum for $1 failed *again*.***${boldoff}" + echo "The md5 checksum value may be incorrect, or a wrong file is being downloaded." + echo "Install continuing with this possibly corrupted file. (it may also be fine)" + echo "" + echo "" + fi + fi + fi +} + +getFileCWAF() { + cd ${CWD} + + if [ ! -s ${1} ]; then + printf "Downloading\t\t$1...\n" + curl ${CURL_CONNECT_OPTIONS} -o ${CWD}/${1} "${WEBPATH_CWAF}/api/da_vendor?file=${1}" + fi + + if [ "$#" -eq 2 ]; then + + M=`checkMD5CWAF ${1} ${2}` + + if [ "$M" != "0" ]; then + echo "" + echo "${boldon}*** MD5 Checksum for $1 Failed. Redownloading...***${boldoff}" + echo "" + #we will call it recursively but will *not* pass $2 for the md5 cus it would get stuck in a loop. + + rm -f $1 + getFileCWAF $1 + M=`checkMD5CWAF ${1} ${2}` + + if [ "$M" != "0" ]; then + echo "" + echo "" + echo "${boldon}*** MD5 Checksum for $1 failed *again*.***${boldoff}" + echo "The md5 checksum value may be incorrect, or a wrong file is being downloaded." + echo "Install continuing with this possibly corrupted file. (it may also be fine)" + echo "" + echo "" + fi + fi + fi +} + +getFileLSWS() { + cd ${CWD} + + if [ ! -s ${1} ]; then + printf "Downloading\t\t$1...\n" + curl ${CURL_CONNECT_OPTIONS} -o ${CWD}/${1} ${WEBPATH_LITESPEED}/${LITESPEED_REPO}/${1} + fi + + if [ "$#" -eq 2 ]; then + M=`checkMD5LSWS ${1} ${2}` + + if [ "$M" != "0" ]; then + echo "" + echo "${boldon}*** MD5 Checksum for $1 Failed. Redownloading...***${boldoff}" + echo "" + #we will call it recursively but will *not* pass $2 for the md5 cus it would get stuck in a loop. + + rm -f $1 + getFileLSWS $1 + tar xzf ${1} --no-same-owner + M=`checkMD5LSWS ${1} ${2}` + + if [ "$M" != "0" ]; then + echo "" + echo "" + echo "${boldon}*** MD5 Checksum for $1 failed *again*.***${boldoff}" + echo "The md5 checksum value may be incorrect, or a wrong file is being downloaded." + echo "Install continuing with this possibly corrupted file. (it may also be fine)" + echo "" + echo "" + fi + fi + fi +} +#################################################### + +add_to_system_backup() { + SB_TYPE=$1 + SB_WHERE=$2 + + F=/usr/local/sysbk/mod/custom.$SB_TYPE + if [ ! -e ${F} ]; then + return; + fi + + if [ ! -e ${SB_WHERE} ]; then + echo "add_to_system_backups: cannot find $SB_WHERE to add to $F"; + return; + fi + + C=`grep -c -e "^${SB_WHERE}\$" $F` + if [ "$C" -gt 0 ]; then + return; + fi + + echo "${SB_WHERE}" >> $F + echo "$SB_WHERE added to $F"; +} + +#################################################### + +# Rewrite directadmin-vhosts.conf +doVhosts() { + PATHNAME=${HTTPDCONF}/extra + + if [ "${WEBSERVER_OPT}" = "nginx" ]; then + PATHNAME=${NGINXCONF} + elif [ "${WEBSERVER_OPT}" = "openlitespeed" ]; then + PATHNAME=${LSWS_HOME}/conf + fi + + if [ ! -d ${PATHNAME} ]; then + mkdir -p ${PATHNAME} + fi + echo -n '' > ${PATHNAME}/directadmin-vhosts.conf + if [ "${WEBSERVER_OPT}" = "nginx" ]; then + for i in `ls /usr/local/directadmin/data/users/*/nginx.conf`; do + echo "include $i;" >> ${PATHNAME}/directadmin-vhosts.conf + done + elif [ "${WEBSERVER_OPT}" = "apache" ] || [ "${WEBSERVER_OPT}" = "litespeed" ]; then + for i in `ls /usr/local/directadmin/data/users/*/httpd.conf`; do + echo "Include $i" >> ${PATHNAME}/directadmin-vhosts.conf + done + elif [ "${WEBSERVER_OPT}" = "openlitespeed" ]; then + for i in `ls /usr/local/directadmin/data/users/*/openlitespeed.conf`; do + echo "include $i" >> ${PATHNAME}/directadmin-vhosts.conf + done + elif [ "${WEBSERVER_OPT}" = "nginx_apache" ]; then + echo -n '' > ${NGINXCONF}/directadmin-vhosts.conf + for i in `ls /usr/local/directadmin/data/users/*/nginx.conf`; do + echo "include $i;" >> ${NGINXCONF}/directadmin-vhosts.conf + done + for i in `ls /usr/local/directadmin/data/users/*/httpd.conf`; do + echo "Include $i" >> ${PATHNAME}/directadmin-vhosts.conf + done + fi +} + +#################################################### + +# We need this up for compatibility purposes +PHP_INI_OPT=`getOpt php_ini no` + +roundcube_version() { + RCVERFILE=/var/www/html/roundcube/program/include/iniset.php + if [ ! -e $RCVERFILE ]; then + echo 0 + return + fi + grep -m1 "RCMAIL_VERSION" $RCVERFILE | cut -d\' -f4 | cut -d\ -f1 +} + +exim_version() { + /usr/sbin/exim -bV 2>/dev/null | grep -m1 'built' | head -n1 | awk '{ print $3 }' | tr '_' '.' +} + +exim_conf_version() { + COUNT=0 + T_EXIMCONFV=0 + if [ -e /etc/exim.conf ]; then + COUNT=`head -n1 /etc/exim.conf | grep -c 'Version'` + if [ "${COUNT}" -gt 0 ]; then + T_EXIMCONFV="`head -n1 /etc/exim.conf | awk '{ print $6 }'`" + fi + + if [ "${T_EXIMCONFV}" = "0" ]; then + COUNT=`head -n2 /etc/exim.conf | grep -c release` + if [ "${COUNT}" -gt 0 ]; then + T_EXIMCONFV="`head -n2 /etc/exim.conf | grep release | awk '{ print $2 }' | cut -d. -f4,5,6 | cut -d- -f1`" + fi + fi + fi + + if [ "${T_EXIMCONFV}" = "0" ]; then + writeLog "exim_conf_version: Cannot determine version of /etc/exim.conf"; + fi + + echo $T_EXIMCONFV +} + +exim_dkim_conf_version() { + T_EXIMDKIMV=0 + if [ -e /etc/exim.dkim.conf ]; then + T_EXIMDKIMV=`head -n1 /etc/exim.dkim.conf | cut -d\# -f2` + fi + if [ "${T_EXIMDKIMV}" = "" ]; then + T_EXIMDKIMV=0 + fi + + echo ${T_EXIMDKIMV} +} + +exim_pl_version() { + EPL=/etc/exim.pl + if [ ! -s ${EPL} ]; then + echo 0 + return; + fi + + grep '#VERSION=' /etc/exim.pl | head -n1 | cut -d= -f2 +} + +rspamd_conf_version() { + COUNT=0 + T_RSDV=0 + RSDTXT=/etc/exim/rspamd/README.txt + if [ -e ${RSDTXT} ]; then + COUNT=`head -n1 ${RSDTXT} | grep -c '^#'` + if [ "${COUNT}" -gt 0 ]; then + T_RSDV="`head -n1 ${RSDTXT} | cut -d'#' -f2`" + fi + fi + echo ${T_RSDV} +} + +getVerLSWS() { + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_LITESPEED} | cut -d ':' -f 2` + + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 2` + fi + fi + + if [ "${RESULT}" = "" ]; then + >&2 echo "ERROR: version of $1 not found in versions_litespeed.txt!" + RESULT="0" + fi + + echo "${RESULT}" +} + +getVerJemalloc() { + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_JEMALLOC} | cut -d ':' -f 2 | cut -d '-' -f1` + + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 2` + fi + fi + + if [ "${RESULT}" = "" ]; then + >&2 echo "ERROR: version of $1 not found in versions_jemalloc.txt!" + RESULT="0" + fi + + echo "${RESULT}" +} + +getFilenameJemalloc() { + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_JEMALLOC} | cut -d ':' -f 4` + + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 4` + fi + fi + + if [ "${RESULT}" = "" ]; then + >&2 echo "ERROR: version of $1 not found in versions_jemalloc.txt!" + RESULT="0" + fi + + echo "${RESULT}" +} + +getVerGalera() { + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_GALERA} | cut -d ':' -f 2 | cut -d '-' -f1` + + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 2` + fi + fi + + if [ "${RESULT}" = "" ]; then + >&2 echo "ERROR: version of $1 not found in versions_galera.txt!" + RESULT="0" + fi + + echo "${RESULT}" +} + +getFilenameGalera() { + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_GALERA} | cut -d ':' -f 4` + + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 4` + fi + fi + + if [ "${RESULT}" = "" ]; then + >&2 echo "ERROR: version of $1 not found in versions_galera.txt!" + RESULT="0" + fi + + echo "${RESULT}" +} + +getVerCL() { + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CL} | cut -d ':' -f 2` + + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 2` + fi + fi + + if [ "${RESULT}" = "" ]; then + >&2 echo "ERROR: version of $1 not found in versions_cl.txt!" + RESULT="0" + fi + + echo "${RESULT}" +} + +getVerCWAF() { + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CWAF} | cut -d ':' -f 2` + + if ${EXISTS_VERSIONS_FILE_CUSTOM}; then + if grep -m1 -q ^$1: ${VERSIONS_FILE_CUSTOM}; then + RESULT=`grep -m1 ^$1: ${VERSIONS_FILE_CUSTOM} | cut -d ':' -f 2` + fi + fi + + if [ "${RESULT}" = "" ]; then + >&2 echo "ERROR: version of $1 not found in versions_cwaf.txt!" + RESULT="0" + fi + + echo "${RESULT}" +} + +GET_SERVICE_VERSIONS=1 +dont_skip_toggle() { + GET_SERVICE_VERSIONS=0 +} +case "$1" in + "") dont_skip_toggle ;; + version) dont_skip_toggle ;; + kill) dont_skip_toggle ;; + update_da) dont_skip_toggle ;; + get_timezone) dont_skip_toggle ;; + set_versions_txt) dont_skip_toggle ;; + show_file) dont_skip_toggle ;; + settings_json) dont_skip_toggle ;; + check_options) dont_skip_toggle ;; + opt_help) dont_skip_toggle ;; + get_versions_txt) dont_skip_toggle ;; + update_script) dont_skip_toggle ;; + set_fastest) dont_skip_toggle ;; + set_fastest_quiet) dont_skip_toggle ;; +esac + +if [ "$1" = "gen_help_json" ] && [ "$2" != "" ]; then + GET_SERVICE_VERSIONS=0 +fi + +# check if we have versions.txt +if [ ! -s ${VERSIONS_FILE} ]; then + cd ${WORKDIR} + getFile versions.txt +fi + +if [ ! -s ${VERSIONS_FILE} ]; then + do_exit 1 "There is no versions.txt file. Unable to download." +else + SOURCE_VERSIONS_TXT=`awk -F ":" '{gsub(/\./,"_",$1);gsub(/-/,"_",$1);print "VERSIONS_TXT_"$1"="$2}' ./versions.txt` + eval ${SOURCE_VERSIONS_TXT} + if [ -s ./custom_versions.txt ]; then + SOURCE_VERSIONS_TXT=`awk -F ":" '{gsub(/\./,"_",$1);gsub(/-/,"_",$1);print "VERSIONS_TXT_"$1"="$2}' ./custom_versions.txt` + eval ${SOURCE_VERSIONS_TXT} + fi +fi + +# check if we have patches_versions.txt +if [ ! -s ${PATCHES_VERSIONS_FILE} ]; then + cd ${WORKDIR} + getFile patches_versions.txt patches_versions +fi + +if [ ! -s ${PATCHES_VERSIONS_FILE} ]; then + do_exit 1 "There is no versions.txt file. Unable to download." +fi + +#The following one needs an exception: +ROUNDCUBE_VER=`getVer roundcubemail` +ROUNDCUBE_MAJOR_VER=`echo ${ROUNDCUBE_VER} | cut -d. -f1` +if [ "${PHP1_RELEASE_OPT}" = "5.3" ]; then + SQUIRRELMAIL_VER=`getVer squirrelmail` + SQUIRRELMAIL_VER_NAME=squirrelmail +else + SQUIRRELMAIL_VER=`getVer squirrelmail_svn` + SQUIRRELMAIL_VER_NAME=squirrelmail_svn +fi + +if [ "${GET_SERVICE_VERSIONS}" = "1" ]; then + if [ "$1" != "list_configs_json" ] && [ "$1" != "custom_config" ] && [ "$1" != "show_component_config" ] && [ "$1" != "remove_customized_config" ]; then + if [ "${WEBSERVER_OPT}" = "litespeed" ] && [ ! -e versions_litespeed.txt ] ; then + getFile versions_litespeed.txt versions_litespeed + fi + if [ "${CLOUDLINUX_OPT}" = "yes" ] && [ ! -e versions_cl.txt ]; then + getFile versions_cl.txt versions_cl + fi + if [ "${MODSECURITY_OPT}" = "yes" ] && [ "${MODSECURITY_RULESET_OPT}" = "comodo" ] && [ ! -e versions_cwaf.txt ]; then + getFile versions_cwaf.txt versions_cwaf + fi + + ##################################################### + # User Variables + MOD_LSAPI_VER=no + MOD_HOSTINGLIMITS_VER=no + MOD_PROCTITLE_VER=no + CL_PHP_LSAPI_VER=no + if [ "${CLOUDLINUX_OPT}" = "yes" ]; then + MOD_LSAPI_VER=`getVerCL mod_lsapi` + MOD_HOSTINGLIMITS_VER=`getVerCL mod_hostinglimits` + MOD_PROCTITLE_VER=`getVerCL mod_proctitle` + CL_PHP_LSAPI_VER=`getVerCL php-litespeed` + fi + NGINX_VER=`getVer nginx` + DIRECTADMIN_VER=`getVer directadmin` + + NGHTTP2_VER=`getVer nghttp2` + + APACHE2_VER=`getVer apache2.4` + AP2_MINOR_VER=`echo ${APACHE2_VER} | cut -d. -f3` + + # Minimal required version of Apache 2.4 + if [ "${AP2_MINOR_VER}" -lt 9 ]; then + do_exit 1 "Minimal required version of Apache is 2.4.9. Please uncustomize your versions.txt file." + fi + + APR_VER=`getVer apr` + APR_UTIL_VER=`getVer apr-util` + + for php_shortrelease in `echo ${PHP1_SHORTRELEASE_SET}`; do + PHP_VERSION_NUMBER=`getVer php${php_shortrelease}` + eval `echo "PHP${php_shortrelease}_VER=${PHP_VERSION_NUMBER}"` + done + + PHP1_VERSION_EVAL_VAR=PHP${PHP1_SHORTRELEASE}_VER + PHP1_RELEASE_VER=$(eval_var ${PHP1_VERSION_EVAL_VAR}) + + PHP2_RELEASE_VER=no + if [ "${PHP2_RELEASE_OPT}" != "no" ]; then + PHP2_VERSION_EVAL_VAR=PHP${PHP2_SHORTRELEASE}_VER + PHP2_RELEASE_VER=$(eval_var ${PHP2_VERSION_EVAL_VAR}) + fi + + PHP3_RELEASE_VER=no + if [ "${PHP3_RELEASE_OPT}" != "no" ]; then + PHP3_VERSION_EVAL_VAR=PHP${PHP3_SHORTRELEASE}_VER + PHP3_RELEASE_VER=$(eval_var ${PHP3_VERSION_EVAL_VAR}) + fi + + PHP4_RELEASE_VER=no + if [ "${PHP4_RELEASE_OPT}" != "no" ]; then + PHP4_VERSION_EVAL_VAR=PHP${PHP4_SHORTRELEASE}_VER + PHP4_RELEASE_VER=$(eval_var ${PHP4_VERSION_EVAL_VAR}) + fi + + MODSECURITY_VER=`getVer modsecurity` + MODSECURITY_FILENAME=modsecurity + LIBMODSECURITY_VER=`getVer modsecurity3` + LIBMODSECURITY_FILENAME=modsecurity + MODSECURITY_NGINX_CONNECTOR_VER=`getVer modsecurity3_nginx` + MODSECURITY_NGINX_CONNECTOR_FILENAME=modsecurity-nginx + MODSECURITY_APACHE_CONNECTOR_VER=`getVer modsecurity3_apache` + MODSECURITY_APACHE_CONNECTOR_FILENAME=modsecurity-apache + if [ "${MODSECURITY_RULESET_OPT}" = "comodo" ] && [ "${MODSECURITY_OPT}" = "yes" ]; then + if [ "${WEBSERVER_OPT}" = "litespeed" ]; then + CWAF_RULES_LS_VER=`getVerCWAF cwaf_rules_ls` + elif [ "${WEBSERVER_OPT}" = "apache" ]; then + CWAF_RULES_VER=`getVerCWAF cwaf_rules` + else + CWAF_RULES_NGINX_VER=`getVerCWAF cwaf_rules_nginx_3` + fi + fi + OWASP_RULES_VER=`getVer owasp3_rules` + HTSCANNER_VER=`getVer htscanner` + MOD_RUID2_VER=`getVer mod_ruid2` + MOD_ACLR2_VER=`getVer mod_aclr2` + MOD_FCGID_VER=`getVer mod_fcgid` + FCGID_SH_VER=`getVer fcgid_sh` + + PIGZ_VER=`getVer pigz` + + if [ "${MYSQL_INST_OPT}" = "mysql" ]; then + if [ "${MYSQL_OPT}" = "5.0" ]; then + MYSQL_VER=`getVer mysql5.0` + MYSQL_REL=`getVer mysql5.0_release` + elif [ "${MYSQL_OPT}" = "5.1" ]; then + MYSQL_VER=`getVer mysql5.1` + MYSQL_REL=`getVer mysql5.1_release` + elif [ "${MYSQL_OPT}" = "5.5" ]; then + MYSQL_VER=`getVer mysql5.5` + MYSQL_REL=`getVer mysql5.5_release` + elif [ "${MYSQL_OPT}" = "5.6" ]; then + MYSQL_VER=`getVer mysql5.6` + MYSQL_REL=`getVer mysql5.6_release` + if [ "${OS}" != "FreeBSD" ] && [ ! -s ${DEBIAN_VERSION} ]; then + if [ "${OS_CENTOS_VER}" = "5" ]; then + MYSQL_VER=5.6.36 + fi + fi + elif [ "${MYSQL_OPT}" = "5.7" ]; then + MYSQL_VER=`getVer mysql5.7` + MYSQL_REL=`getVer mysql5.7_release` + elif [ "${MYSQL_OPT}" = "8.0" ]; then + MYSQL_VER=`getVer mysql8.0` + MYSQL_REL=`getVer mysql8.0_release` + else + MYSQL_VER=0 + MYSQL_REL=0 + fi + if [ "$MYSQL_REL" = "" ]; then + MYSQL_REL=0 + fi + else + if [ "${MARIADB_OPT}" = "5.5" ]; then + MARIADB_VER=`getVer mariadb5.5` + elif [ "${MARIADB_OPT}" = "10.0" ]; then + MARIADB_VER=`getVer mariadb10.0` + elif [ "${MARIADB_OPT}" = "10.1" ]; then + MARIADB_VER=`getVer mariadb10.1` + elif [ "${MARIADB_OPT}" = "10.2" ]; then + MARIADB_VER=`getVer mariadb10.2` + elif [ "${MARIADB_OPT}" = "10.3" ]; then + MARIADB_VER=`getVer mariadb10.3` + elif [ "${MARIADB_OPT}" = "10.4" ]; then + MARIADB_VER=`getVer mariadb10.4` + elif [ "${MARIADB_OPT}" = "10.5" ]; then + MARIADB_VER=`getVer mariadb10.5` + elif [ "${MARIADB_OPT}" = "10.6" ]; then + MARIADB_VER=`getVer mariadb10.6` + elif [ "${MARIADB_OPT}" = "11.4" ]; then + MARIADB_VER=`getVer mariadb11.4` + else + MARIADB_VER=0 + fi + fi + + PCRE_VER=`getVer pcre_current` + + PCRE2_VER=`getVer pcre2` + CURL_VER=`getVer curl` + ZLIB_VER=`getVer zlib-current` + + SUPHP_VER=`getVer suphp_current` + + DOVECOT_VER=`getVer dovecot` + DOVECOT_REL=`echo ${DOVECOT_VER} | cut -d. -f1,2` + PIGEONHOLE_VER=no + if [ "${DOVECOT_REL}" = "2.1" ]; then + DOVECOT_SHORTREL=21 + PIGEONHOLE_VER=`getVer pigeonhole21` + elif [ "${DOVECOT_REL}" = "2.2" ]; then + DOVECOT_SHORTREL=22 + PIGEONHOLE_VER=`getVer pigeonhole22` + elif [ "${DOVECOT_REL}" = "2.3" ]; then + DOVECOT_SHORTREL=23 + PIGEONHOLE_VER=`getVer pigeonhole23` + fi + FTS_XAPIAN_VER=`getVer fts-xapian` + XAPIAN_CORE_VER=`getVer xapian-core` + BUBBLEWRAP_VER=`getVer bubblewrap` + JAILSHELL_SH_VER=`getVer jailshell_sh` + EXIM_VER=`getVer exim` + S_NAIL_VER=`getVer s-nail` + MSMTP_VER=`getVer msmtp` + LUA_VER=`getVer lua` + BLOCKCRACKING_VER=`getVer blockcracking` + EASY_SPAM_FIGHTER_VER=`getVer easy_spam_figther` + RSPAMD_CONF_VER=`getVer rspamd_conf` + LIBSRS_ALT_VER=`getVer libsrs_alt` + LIBSPF2_VER=`getVer libspf2` + if [ "${EXIMCONF_RELEASE_OPT}" = "2.1" ]; then + EXIM_CONF_VER=`getVer exim_conf_2` + EXIM_PL_VER=`getVer exim_pl_2` + elif [ "${EXIMCONF_RELEASE_OPT}" = "4.2" ]; then + EXIM_CONF_VER=`getVer exim_conf_4` + EXIM_PL_VER=`getVer exim_pl_4` + elif [ "${EXIMCONF_RELEASE_OPT}" = "4.3" ]; then + EXIM_CONF_VER=`getVer exim_conf_43` + EXIM_PL_VER=`getVer exim_pl_43` + elif [ "${EXIMCONF_RELEASE_OPT}" = "4.4" ]; then + EXIM_CONF_VER=`getVer exim_conf_44` + EXIM_PL_VER=`getVer exim_pl_44` + elif [ "${EXIMCONF_RELEASE_OPT}" = "4.5" ]; then + EXIM_CONF_VER=`getVer exim_conf_45` + EXIM_PL_VER=`getVer exim_pl_45` + else + EXIM_CONF_VER=`getVer exim_conf_45` + EXIM_PL_VER=`getVer exim_pl_45` + fi + + PROFTPD_VER=`getVer proftpd` + PUREFTPD_VER=`getVer pureftpd` + LIBXML2_VER=`getVer libxml2-current` + LIBXSLT_VER=`getVer libxslt` + LIBSODIUM_VER=`getVer libsodium` + LIBZIP_VER=`getVer libzip` + COMPOSER_VER=`getVer composer` + WP_VER=`getVer wp-cli` + IMAPSYNC_VER=`getVer imapsync` + if [ "${OS}" = "FreeBSD" ]; then + LEGO_VER=`getVer lego_freebsd` + elif [ "${OS_CENTOS_VER}" = "6" ] && [ "${B64}" = "0" ]; then + LEGO_VER=`getVer lego_386` + else + LEGO_VER=`getVer lego` + fi + FREETYPE_VER=`getVer freetype` + ICU_VER=`getVer icu4c` + IMAGICK_VER=`getVer imagick` + XMLRPC_VER=`getVer xmlrpc` + IMAGEMAGICK_VER=`getVer imagemagick` + CLAMAV_VER=`getVer clamav` + ZSTD_VER=`getVer zstd` + # Mailman is not yet supported + #MAILMAN_VER=`getVer mailman` + AWSTATS_VER=`getVer awstats` + AWSTATS_PROCESS_VER=`getVer awstats_process` + UNIT_VER=`getVer unit` + SUHOSIN_VER=`getVer suhosin` + OPCACHE_VER=`getVer zendopcache` + + IGBINARY_VER=`getVer igbinary` + PSR_VER=`getVer psr` + PHALCON_VER=`getVer phalcon` + REDIS_VER=`getVer redis` + PHPREDIS_VER=`getVer phpredis` + SNUFFLEUPAGUS_VER=`getVer snuffleupagus` + IMAP_VER=`getVer imap` + + if [ "${B64}" = "1" ]; then + IONCUBE_VER=`getVer ioncube_loaders_lin_x86-64` + else + IONCUBE_VER=`getVer ioncube_loaders_lin_x86` + fi + FBSD4_IONCUBE_VER=`getVer ioncube_loaders_fre_4_x86` + + PNG_VER=`getVer libpng_current` + LIBMAXMINDDB_VER=`getVer libmaxminddb` + GEOIPUPDATE_VER=`getVer geoipupdate` + + # Applications versions + PHPMYADMIN_REMOTE_PATCH=pma_auth_logging.patch + if [ "${PHPMYADMIN_VER_OPT}" = "5" ]; then + PHPMYADMIN_VER=`getVer phpmyadmin5` + elif [ "${PHPMYADMIN_VER_OPT}" = "4" ]; then + PHPMYADMIN_VER=`getVer phpmyadmin4` + else + PHPMYADMIN_VER=`getVer phpmyadmin3` + fi + + SQUIRRELMAIL_LOCALE_VER=`getVer squirrelmail_locale` + SQUIRRELMAIL_LOGGER_VER=`getVer squirrel_logger` + + if [ "$OS" = "FreeBSD" ]; then + OPENLITESPEED_VER=`getVer openlitespeed_src` + else + OPENLITESPEED_VER=`getVer openlitespeed` + fi + + LITESPEED_VER=no + + LETSENCRYPT_VER=`getVer letsencrypt_sh` + + CPANEL_TO_DA_VER=`getVer cpanel_to_da` + + if [ "${WEBSERVER_OPT}" = "litespeed" ]; then + LITESPEED_MAIN_VER=`getVerLSWS release` + + LITESPEED_REPO_START=`echo ${LITESPEED_MAIN_VER} | cut -d. -f1` + LITESPEED_REPO="${LITESPEED_REPO_START}.0" + + if [ "${B64}" = "1" ]; then + LITESPEED_VER_NAME="lsws-${LITESPEED_MAIN_VER}-ent-x86_64-linux" + else + LITESPEED_VER_NAME="lsws-${LITESPEED_MAIN_VER}-ent-i386-linux" + fi + + LITESPEED_VER=`getVerLSWS ${LITESPEED_VER_NAME}` + + if [ "${OS}" = "FreeBSD" ]; then + LSWS_OS="freebsd" + else + LSWS_OS="linux" + fi + + if [ "${B64}" = "1" ]; then + LITESPEED_NAME="lsws-${LITESPEED_VER}-ent-x86_64-${LSWS_OS}" + else + LITESPEED_NAME="lsws-${LITESPEED_VER}-ent-i386-${LSWS_OS}" + fi + fi + + # SpamAssassin versions + SPAMASSASSIN_VER=`getVer spamassassin` + RSPAMD_VER=`getVer rspamd` + + LITESPEED_TRIAL_KEY=${WORKDIR}/configure/litespeed/trial.key + if [ -e ${WORKDIR}/custom/litespeed/trial.key ]; then + LITESPEED_TRIAL_KEY=${WORKDIR}/custom/litespeed/trial.key + fi + fi + + # Variable for proftpd + PROFTPD_CONFIGURE=configure/proftpd/configure.proftpd + if [ -e custom/proftpd/configure.proftpd ]; then + PROFTPD_CONFIGURE=custom/proftpd/configure.proftpd + fi + + PROFTPD_CONF=configure/proftpd/conf/proftpd.conf + if [ -e custom/proftpd/conf/proftpd.conf ]; then + PROFTPD_CONF=custom/proftpd/conf/proftpd.conf + fi + + # Variable for ImageMagick + IMAGEMAGICK_CONFIGURE=configure/imagemagick/configure.imagemagick + if [ -e custom/imagemagick/configure.imagemagick ]; then + IMAGEMAGICK_CONFIGURE=custom/imagemagick/configure.imagemagick + fi + + # Variable for pureftpd + PUREFTPD_CONFIGURE=configure/pureftpd/configure.pureftpd + if [ -e custom/pureftpd/configure.pureftpd ]; then + PUREFTPD_CONFIGURE=custom/pureftpd/configure.pureftpd + fi + + PUREFTPD_CONF=configure/pureftpd/pure-ftpd.conf + if [ -e custom/pureftpd/pure-ftpd.conf ]; then + PUREFTPD_CONF=custom/pureftpd/pure-ftpd.conf + fi + + # Variable for ClamAV + CLAMAV_CONFIGURE=configure/clamav/configure.clamav + if [ -e custom/clamav/configure.clamav ]; then + CLAMAV_CONFIGURE=custom/clamav/configure.clamav + fi + + #Variable for ModSecurity + if [ "${WEBSERVER_OPT}" = "nginx_apache" ] || [ "${WEBSERVER_OPT}" = "nginx" ]; then + MODSECURITY_CONFIGURE=configure/modsecurity/configure.modsecurity + if [ -e custom/modsecurity/configure.modsecurity ]; then + MODSECURITY_CONFIGURE=custom/modsecurity/configure.modsecurity + fi + else + MODSECURITY_CONFIGURE=configure/ap2/configure.modsecurity + if [ -e custom/ap2/configure.modsecurity ]; then + MODSECURITY_CONFIGURE=custom/ap2/configure.modsecurity + fi + fi + + # Variable for cURL + CURL_CONFIGURE=configure/curl/configure.curl + if [ -e custom/curl/configure.curl ]; then + CURL_CONFIGURE=custom/curl/configure.curl + fi + + # Variables for ModSecurity uploadscan + RUNAV_PL=configure/clamav/runav.pl + if [ -e custom/clamav/runav.pl ]; then + RUNAV_PL=custom/clamav/runav.pl + fi + RUNAV_CONF=configure/clamav/runav.conf + if [ -e custom/clamav/runav.conf ]; then + RUNAV_CONF=custom/clamav/runav.conf + fi + + # Variable for LibXML2 + LIBXML2_CONFIGURE=configure/libxml2/configure.libxml2 + if [ -e custom/libxml2/configure.libxml2 ]; then + LIBXML2_CONFIGURE=custom/libxml2/configure.libxml2 + fi + + # Variable for LibXSLT + LIBXSLT_CONFIGURE=configure/libxslt/configure.libxslt + if [ -e custom/libxslt/configure.libxslt ]; then + LIBXSLT_CONFIGURE=custom/libxslt/configure.libxslt + fi + + # Variable for OPCACHE + OPCACHE_INI=configure/opcache/opcache.ini + if [ -e custom/opcache/opcache.ini ]; then + OPCACHE_INI=custom/opcache/opcache.ini + fi + + # Variable for SUHOSIN + SUHOSIN_INI=configure/suhosin/suhosin.ini + if [ -e custom/suhosin/suhosin.ini ]; then + SUHOSIN_INI=custom/suhosin/suhosin.ini + fi + + EXIM_MAKEFILE="" + if [ -e custom/exim/Makefile ]; then + EXIM_MAKEFILE=${CWD}/custom/exim/Makefile + fi + + # Dovecot variables + DOVECOT_CONFIGURE=configure/dovecot/configure.dovecot + if [ -e custom/dovecot/configure.dovecot ]; then + DOVECOT_CONFIGURE=custom/dovecot/configure.dovecot + #to solve bogus ICU linking in FTS plugin of dovecot + if ! grep -m1 -q without-icu ${DOVECOT_CONFIGURE}; then + perl -pi -e 's|^\./configure |./configure --without-icu |g' ${DOVECOT_CONFIGURE} + fi + fi + + DOVECOTCONFDIR=${WORKDIR}/configure/dovecot/conf + DOVECOTCUSTOMCONFDIR=0 + if [ -d ${WORKDIR}/custom/dovecot/conf ]; then + DOVECOTCUSTOMCONFDIR=${WORKDIR}/custom/dovecot/conf + fi + + DOVECTCONFFILE=${WORKDIR}/configure/dovecot/dovecot.conf + if [ -e ${WORKDIR}/custom/dovecot/dovecot.conf ]; then + DOVECTCONFFILE=${WORKDIR}/custom/dovecot/dovecot.conf + fi + + DOVECTCONFSIEVE=${WORKDIR}/configure/dovecot/conf.d/90-sieve.conf + if [ -e ${WORKDIR}/custom/dovecot/conf.d/90-sieve.conf ]; then + DOVECTCONFSIEVE=${WORKDIR}/custom/dovecot/conf.d/90-sieve.conf + fi + + DOVECTCONFFTS=${WORKDIR}/configure/dovecot/conf.d/90-fts-xapian.conf + if [ -e ${WORKDIR}/custom/dovecot/conf.d/90-fts-xapian.conf ]; then + DOVECTCONFFTS=${WORKDIR}/custom/dovecot/conf.d/90-fts-xapian.conf + fi + + DOVECTCONFQUOTA=${WORKDIR}/configure/dovecot/conf.d/90-quota.conf + if [ -e ${WORKDIR}/custom/dovecot/conf.d/90-quota.conf ]; then + DOVECTCONFQUOTA=${WORKDIR}/custom/dovecot/conf.d/90-quota.conf + fi + + DOVECOTCONFZLIB=${WORKDIR}/configure/dovecot/conf.d/90-zlib.conf + if [ -e ${WORKDIR}/custom/dovecot/conf.d/90-zlib.conf ]; then + DOVECOTCONFZLIB=${WORKDIR}/custom/dovecot/conf.d/90-zlib.conf + fi + + # Variables for spamd + SPAMD_CONF=configure/${SPAMD_OPT}/exim.spamd.conf + if [ -e custom/${SPAMD_OPT}/exim.spamd.conf ]; then + SPAMD_CONF=custom/${SPAMD_OPT}/exim.spamd.conf + fi + + # Variables for apache + APACHE2_CONFIGURE=configure/ap2/configure.apache + if [ -e custom/ap2/configure.apache ]; then + APACHE2_CONFIGURE=custom/ap2/configure.apache + fi + PHP_HANDLERS_HTTPD=/etc/httpd/conf/extra/httpd-php-handlers.conf + SUPHP_HTTPD=/etc/httpd/conf/extra/httpd-suphp.conf + + APCONFDIR=${WORKDIR}/configure/${APCONF}/conf + APCUSTOMCONFDIR=0 + #custom/configure isn't supposed to be there + if [ -d ${WORKDIR}/custom/configure/${APCONF}/conf ]; then + APCUSTOMCONFDIR=${WORKDIR}/custom/configure/${APCONF}/conf + fi + if [ -d ${WORKDIR}/custom/${APCONF}/conf ]; then + APCUSTOMCONFDIR=${WORKDIR}/custom/${APCONF}/conf + fi + + APCERTCONF=configure/${APCONF}/cert_config.txt + if [ -e custom/configure/${APCONF}/cert_config.txt ]; then + APCERTCONF=custom/configure/${APCONF}/cert_config.txt + fi + if [ -e custom/${APCONF}/cert_config.txt ]; then + APCERTCONF=custom/${APCONF}/cert_config.txt + fi + + # Variables for unit + UNIT_CONFIGURE=configure/unit/configure.unit + if [ -e custom/unit/configure.unit ]; then + UNIT_CONFIGURE=custom/unit/configure.unit + fi + + # Variables for openlitespeed + OPENLITESPEED_CONFIGURE=configure/openlitespeed/configure.openlitespeed + if [ -e custom/openlitespeed/configure.openlitespeed ]; then + OPENLITESPEED_CONFIGURE=custom/openlitespeed/configure.openlitespeed + fi + + OPENLITESPEEDCONFDIR=${WORKDIR}/configure/openlitespeed/conf + OPENLITESPEEDCUSTOMCONFDIR=0 + if [ -d ${WORKDIR}/custom/openlitespeed/conf ]; then + OPENLITESPEEDCUSTOMCONFDIR=${WORKDIR}/custom/openlitespeed/conf + fi + + OPENLITESPEED_EXTPROCESSORS_TEMPLATE=configure/openlitespeed/httpd-extprocessors.template + if [ -e custom/openlitespeed/httpd-extprocessors.template ]; then + OPENLITESPEED_EXTPROCESSORS_TEMPLATE=custom/openlitespeed/httpd-extprocessors.template + fi + + OPENLITESPEED_WEBAPPS_EXTPROCESSOR_TEMPLATE=configure/openlitespeed/httpd-webapps-extprocessor.template + if [ -e custom/openlitespeed/httpd-webapps-extprocessor.template ]; then + OPENLITESPEED_WEBAPPS_EXTPROCESSOR_TEMPLATE=custom/openlitespeed/httpd-webapps-extprocessor.template + fi + + # Variables for nginx + if [ "${WEBSERVER_OPT}" = "nginx_apache" ]; then + NGINX_CONFIGURE=configure/nginx_reverse/configure.nginx + if [ -e custom/nginx_reverse/configure.nginx ]; then + NGINX_CONFIGURE=custom/nginx_reverse/configure.nginx + fi + NGINXCONFDIR=${WORKDIR}/configure/nginx_reverse/conf + NGINXCUSTOMCONFDIR=0 + if [ -d ${WORKDIR}/custom/nginx_reverse/conf ]; then + NGINXCUSTOMCONFDIR=${WORKDIR}/custom/nginx_reverse/conf + fi + else + NGINX_CONFIGURE=configure/nginx/configure.nginx + if [ -e custom/nginx/configure.nginx ]; then + NGINX_CONFIGURE=custom/nginx/configure.nginx + fi + NGINXCONFDIR=${WORKDIR}/configure/nginx/conf + NGINXCUSTOMCONFDIR=0 + if [ -d ${WORKDIR}/custom/nginx/conf ]; then + NGINXCUSTOMCONFDIR=${WORKDIR}/custom/nginx/conf + fi + fi + + NGINXTEMPLATESDIR=${WORKDIR}/configure/nginx_templates + NGINXCUSTOMEMPLATESDIR=0 + if [ -d ${WORKDIR}/custom/nginx_templates ]; then + NGINXCUSTOMEMPLATESDIR=${WORKDIR}/custom/nginx_templates + fi + + MODSECURITY_APACHE_INCLUDE=${WORKDIR}/configure/ap2/conf/extra/httpd-modsecurity.conf + if [ -e ${WORKDIR}/custom/ap2/conf/extra/httpd-modsecurity.conf ]; then + MODSECURITY_APACHE_INCLUDE=${WORKDIR}/custom/ap2/conf/extra/httpd-modsecurity.conf + fi + + MODSECURITY_NGINX_INCLUDE=${WORKDIR}/configure/nginx/conf/nginx-modsecurity.conf + if [ -e ${WORKDIR}/custom/nginx/conf/nginx-modsecurity.conf ]; then + MODSECURITY_NGINX_INCLUDE=${WORKDIR}/custom/nginx/conf/nginx-modsecurity.conf + fi + if [ -s ${WORKDIR}/configure/openlitespeed/conf/httpd-listeners.conf ]; then + rm -f ${WORKDIR}/configure/openlitespeed/conf/httpd-listeners.conf + fi + MODSECURITY_OPENLITESPEED_INCLUDE=${WORKDIR}/configure/openlitespeed/conf/httpd-modsecurity.conf + if [ -e ${WORKDIR}/custom/openlitespeed/conf/httpd-modsecurity.conf ]; then + MODSECURITY_OPENLITESPEED_INCLUDE=${WORKDIR}/custom/openlitespeed/conf/httpd-modsecurity.conf + fi + + MODSECURITY_NGINX_REVERSE_INCLUDE=${WORKDIR}/configure/nginx_reverse/conf/nginx-modsecurity.conf + if [ -e ${WORKDIR}/custom/nginx_reverse/conf/nginx-modsecurity.conf ]; then + MODSECURITY_NGINX_REVERSE_INCLUDE=${WORKDIR}/custom/nginx_reverse/conf/nginx-modsecurity.conf + fi + + MODSECURITY_CUSTOM_RULES=${WORKDIR}/custom/modsecurity/conf + + for php_shortrelease in `echo ${PHP1_SHORTRELEASE_SET}`; do + # Variables for php-fpm + eval `echo "PHP${php_shortrelease}_CONFIGURE_FPM=configure/php/configure.php${php_shortrelease}"` + if [ -e custom/fpm/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE_FPM=custom/fpm/configure.php${php_shortrelease}"` + fi + if [ -e custom/php/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE_FPM=custom/php/configure.php${php_shortrelease}"` + fi + + eval `echo "PHP${php_shortrelease}_FPM_CONF=${WORKDIR}/configure/fpm/conf/php-fpm.conf.${php_shortrelease}"` + if [ -e ${WORKDIR}/custom/fpm/conf/php-fpm.conf.${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_FPM_CONF=${WORKDIR}/custom/fpm/conf/php-fpm.conf.${php_shortrelease}"` + fi + eval `echo "PHP_INI_FPM${php_shortrelease}=/usr/local/php${php_shortrelease}/lib/php.ini"` + eval `echo "PHP_SBIN_FPM${php_shortrelease}=/usr/local/php${php_shortrelease}/sbin/php-fpm${php_shortrelease}"` + + # Variables for PHP as suPHP + EVAL_PHP_INI_SUPHP_VAR=PHP_SBIN_FPM${php_shortrelease} + eval `echo "PHP_INI_SUPHP${php_shortrelease}=$(eval_var ${EVAL_PHP_INI_SUPHP_VAR})"` + eval `echo "PHP_BIN_SUPHP${php_shortrelease}=/usr/local/php${php_shortrelease}/bin/php-cgi${php_shortrelease}"` + eval `echo "PHP_BIN_PHP${php_shortrelease}=/usr/local/php${php_shortrelease}/bin/php${php_shortrelease}"` + eval `echo "PHP${php_shortrelease}_CONFIGURE_SUPHP=configure/php/configure.php${php_shortrelease}"` + if [ -e custom/suphp/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE_SUPHP=custom/suphp/configure.php${php_shortrelease}"` + fi + if [ -e custom/php/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE_SUPHP=custom/php/configure.php${php_shortrelease}"` + fi + + # Variables for php-fastcgi + eval `echo "PHP${php_shortrelease}_CONFIGURE_FCGI=configure/php/configure.php${php_shortrelease}"` + if [ -e custom/fastcgi/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE_FCGI=custom/fastcgi/configure.php${php_shortrelease}"` + fi + if [ -e custom/php/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE_FCGI=custom/php/configure.php${php_shortrelease}"` + fi + + # Variables for lsphp + eval `echo "PHP${php_shortrelease}_CONFIGURE_LSPHP=configure/php/configure.php${php_shortrelease}"` + if [ -e custom/litespeed/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE_LSPHP=custom/litespeed/configure.php${php_shortrelease}"` + fi + if [ -e custom/php/configure.php${php_shortrelease} ]; then + eval `echo "PHP${php_shortrelease}_CONFIGURE_LSPHP=custom/php/configure.php${php_shortrelease}"` + fi + + eval `echo "PHP_EXT_FPM${php_shortrelease}=/usr/local/php${php_shortrelease}/lib/php.conf.d/10-directadmin.ini"` + EVAL_PHP_EXT_SUPHP_VAR=PHP_EXT_FPM${php_shortrelease} + eval `echo "PHP_EXT_SUPHP${php_shortrelease}=$(eval_var ${EVAL_PHP_EXT_SUPHP_VAR})"` + done + + PHP_CUSTOM_PHP_CONF_D_INI_PATH=${WORKDIR}/custom/php.conf.d + + #php extensions file rewritten by DirectAdmin + PHP_EXT=/usr/local/lib/php.conf.d/10-directadmin.ini + PHP_INI=/usr/local/lib/php.ini + PHP_BIN=/usr/local/bin/php + + PHP1_RELEASE_INI_EVAL="PHP_INI_FPM${PHP1_SHORTRELEASE}" + PHP1_INI_FILE="$(eval_var ${PHP1_RELEASE_INI_EVAL})" + PHP1_RELEASE_INI_EXT_EVAL="PHP_EXT_FPM${PHP1_SHORTRELEASE}" + PHP1_INI_EXT_FILE="$(eval_var ${PHP1_RELEASE_INI_EXT_EVAL})" + + PHP1_INI_EXT_FILE_OLD="`echo ${PHP1_INI_EXT_FILE} | perl -p0 -e 's|10-directadmin.ini|directadmin.ini|'`" + if [ -e ${PHP1_INI_EXT_FILE_OLD} ] && [ ! -e ${PHP1_INI_EXT_FILE} ]; then + mv -f ${PHP1_INI_EXT_FILE_OLD} ${PHP1_INI_EXT_FILE} + fi + + PHP2_INI_FILE="no" + PHP2_INI_EXT_FILE="no" + if [ "${PHP2_RELEASE_OPT}" != "no" ]; then + PHP2_INI_FILE=${PHP_INI} + PHP2_INI_EXT_FILE=${PHP_EXT} + if [ "${PHP2_MODE_OPT}" != "mod_php" ]; then + PHP2_RELEASE_INI_EVAL="PHP_INI_FPM${PHP2_SHORTRELEASE}" + PHP2_INI_FILE="$(eval_var ${PHP2_RELEASE_INI_EVAL})" + PHP2_RELEASE_INI_EXT_EVAL="PHP_EXT_FPM${PHP2_SHORTRELEASE}" + PHP2_INI_EXT_FILE="$(eval_var ${PHP2_RELEASE_INI_EXT_EVAL})" + fi + PHP2_INI_EXT_FILE_OLD="`echo ${PHP2_INI_EXT_FILE} | perl -p0 -e 's|10-directadmin.ini|directadmin.ini|'`" + if [ -e ${PHP2_INI_EXT_FILE_OLD} ] && [ ! -e ${PHP2_INI_EXT_FILE} ]; then + mv -f ${PHP2_INI_EXT_FILE_OLD} ${PHP2_INI_EXT_FILE} + fi + fi + + PHP3_INI_FILE="no" + PHP3_INI_EXT_FILE="no" + if [ "${PHP3_RELEASE_OPT}" != "no" ]; then + PHP3_INI_FILE=${PHP_INI} + PHP3_INI_EXT_FILE=${PHP_EXT} + if [ "${PHP3_MODE_OPT}" != "mod_php" ]; then + PHP3_RELEASE_INI_EVAL="PHP_INI_FPM${PHP3_SHORTRELEASE}" + PHP3_INI_FILE="$(eval_var ${PHP3_RELEASE_INI_EVAL})" + PHP3_RELEASE_INI_EXT_EVAL="PHP_EXT_FPM${PHP3_SHORTRELEASE}" + PHP3_INI_EXT_FILE="$(eval_var ${PHP3_RELEASE_INI_EXT_EVAL})" + fi + PHP3_INI_EXT_FILE_OLD="`echo ${PHP3_INI_EXT_FILE} | perl -p0 -e 's|10-directadmin.ini|directadmin.ini|'`" + if [ -e ${PHP3_INI_EXT_FILE_OLD} ] && [ ! -e ${PHP3_INI_EXT_FILE} ]; then + mv -f ${PHP3_INI_EXT_FILE_OLD} ${PHP3_INI_EXT_FILE} + fi + fi + + PHP4_INI_FILE="no" + PHP4_INI_EXT_FILE="no" + if [ "${PHP4_RELEASE_OPT}" != "no" ]; then + PHP4_INI_FILE=${PHP_INI} + PHP4_INI_EXT_FILE=${PHP_EXT} + if [ "${PHP4_MODE_OPT}" != "mod_php" ]; then + PHP4_RELEASE_INI_EVAL="PHP_INI_FPM${PHP4_SHORTRELEASE}" + PHP4_INI_FILE="$(eval_var ${PHP4_RELEASE_INI_EVAL})" + PHP4_RELEASE_INI_EXT_EVAL="PHP_EXT_FPM${PHP4_SHORTRELEASE}" + PHP4_INI_EXT_FILE="$(eval_var ${PHP4_RELEASE_INI_EXT_EVAL})" + fi + PHP4_INI_EXT_FILE_OLD="`echo ${PHP4_INI_EXT_FILE} | perl -p0 -e 's|10-directadmin.ini|directadmin.ini|'`" + if [ -e ${PHP4_INI_EXT_FILE_OLD} ] && [ ! -e ${PHP4_INI_EXT_FILE} ]; then + mv -f ${PHP4_INI_EXT_FILE_OLD} ${PHP4_INI_EXT_FILE} + fi + fi + + #suhosin uploadscan script + SUHOSIN_PHP_UPLOADSCAN_SCRIPT=${WORKDIR}/configure/suhosin/php_uploadscan.sh + if [ -e ${WORKDIR}/custom/suhosin/php_uploadscan.sh ]; then + SUHOSIN_PHP_UPLOADSCAN_SCRIPT=${WORKDIR}/custom/suhosin/php_uploadscan.sh + fi + + #pureftpd uploadscan script + PUREFTPD_UPLOADSCAN_SCRIPT=${WORKDIR}/configure/pureftpd/pureftpd_uploadscan.sh + if [ -e ${WORKDIR}/custom/pureftpd/pureftpd_uploadscan.sh ]; then + PUREFTPD_UPLOADSCAN_SCRIPT=${WORKDIR}/custom/pureftpd/pureftpd_uploadscan.sh + fi + + #pureftpd SNI script + PUREFTPD_PURE_CERTD_SCRIPT=${WORKDIR}/configure/pureftpd/pureftpd_sni.sh + if [ -e ${WORKDIR}/custom/pureftpd/pureftpd_sni.sh ]; then + PUREFTPD_PURE_CERTD_SCRIPT=${WORKDIR}/custom/pureftpd/pureftpd_sni.sh + fi + + SUPHP_CONFIGURE=configure/suphp/configure.suphp + if [ -e custom/suphp/configure.suphp ]; then + SUPHP_CONFIGURE=custom/suphp/configure.suphp + fi + SUPHP_PATH=/usr/local/suphp + SUPHP_CONF_FILE=${SUPHP_PATH}/etc/suphp.conf + SUPHP_SO=/usr/lib/apache/mod_suphp.so + + PMA_MAIN_CONFIG=${CWD}/configure/phpmyadmin/config.inc.php + PMA_CUSTOM_CONFIG= + if [ -s ${CWD}/custom/phpmyadmin/config.inc.php ]; then + PMA_CUSTOM_CONFIG=${CWD}/custom/phpmyadmin/config.inc.php + fi + + #custom script configs + WEBAPPS_LIST=${CWD}/custom/webapps.list + PMA_HTACCESS=${CWD}/custom/phpmyadmin/.htaccess + PMA_USER_INI=${CWD}/custom/phpmyadmin/.user.ini + PMA_THEMES=${CWD}/custom/phpmyadmin/themes + SQUIRREL_CONFIG=${CWD}/custom/squirrelmail/config.php + ROUNDCUBE_CONFIG=${CWD}/custom/roundcube/config.inc.php + ROUNDCUBE_CONFIG_DB=${ROUNDCUBE_CONFIG} + ROUNDCUBE_CONFIG_OLD=${CWD}/custom/roundcube/main.inc.php + ROUNDCUBE_CONFIG_DB_OLD=${CWD}/custom/roundcube/db.inc.php + if [ "${ROUNDCUBE_MAJOR_VER}" = "0" ]; then + ROUNDCUBE_CONFIG=${ROUNDCUBE_CONFIG_OLD} + ROUNDCUBE_CONFIG_DB=${ROUNDCUBE_CONFIG_DB_OLD} + fi + ROUNDCUBE_PLUGINS=${CWD}/custom/roundcube/plugins + ROUNDCUBE_SKINS=${CWD}/custom/roundcube/skins + ROUNDCUBE_VENDOR=${CWD}/custom/roundcube/vendor + ROUNDCUBE_COMPOSER=${CWD}/custom/roundcube/composer.json + ROUNDCUBE_PROGRAM=${CWD}/custom/roundcube/program + ROUNDCUBE_HTACCESS=${CWD}/custom/roundcube/.htaccess + + # Variables for frontpage + ROOT_GRP=root + if [ ${OS} = "FreeBSD" ]; then + ROOT_GRP=wheel + fi + + USER_INPUT=0 + INPUT_VALUE=d + + if [ ${OS} = "FreeBSD" ]; then + OS_VER=`uname -r | cut -d- -f1` + elif [ -e /etc/fedora-release ]; then + OS=fedora + if [ "`cat /etc/fedora-release | awk '{ print $1, $2 }'`" = "Fedora Core" ]; then + OS_VER=`cat /etc/fedora-release | awk '{ print $4 }'` + elif [ "`cat /etc/fedora-release | awk '{ print $1, $2 }'`" = "Fedora release" ]; then + OS_VER=`cat /etc/fedora-release | awk '{ print $3 }'` + fi + elif [ -e ${DEBIAN_VERSION} ]; then + OS_VER=3.1 + else + OS_VER=`cat /etc/redhat-release | cut -d\ -f5` + if [ "${OS_VER}" = "" ]; then + OS_VER=`cat /etc/redhat-release | cut -d\ -f1` + fi + fi + + MAINVER="" + if [ "${OS}" = "FreeBSD" ]; then + MAINVER=`echo ${OS_VER} | cut -d. -f1` + if [ -e /usr/sbin/pkg ]; then + PKG_INSTALL="pkg install -y" + else + PKG_INSTALL="pkg_add -r" + fi + if [ ${MAINVER} -eq 10 ]; then + GCCVER=48 + export CC=gcc${GCCVER} + export CXX=g++${GCCVER} + export CPP=cpp${GCCVER} + if [ ! -e /usr/local/bin/gcc${GCCVER} ]; then + ${PKG_INSTALL} gcc${GCCVER} + fi + if [ ! -e /usr/local/bin/gcc${GCCVER} ]; then + do_exit 1 "Unable to find GCC on the system: /usr/local/bin/gcc${GCCVER}" + fi + if [ -e /etc/libmap.conf ]; then + perl -pi -e "s|gcc44|gcc${GCCVER}|g" /etc/libmap.conf + fi + # Fixes: /usr/lib/libstdc++.so.6: version GLIBCXX_3.4.15 required by /usr/local/mysql/bin/mysqld not found + if [ ! -h /usr/lib/libstdc++.so.6 ]; then + if [ -e /usr/lib/libstdc++.so.6 ]; then + mv -f /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6.backup + fi + ln -sf /usr/local/lib/gcc${GCCVER}/libstdc++.so.6 /usr/lib/libstdc++.so.6 + fi + fi + if [ ${MAINVER} -gt 10 ]; then + export CC=clang + export CPP=clang-cpp + export CXX=clang++ + export WITH_LIBCPLUSPLUS=yes + fi + if [ ${MAINVER} -ge 10 ]; then + # Fixes apache OpenSSL problem: /usr/include/openssl/bn.h:603:1: error: unknown type name 'CRYPTO_THREADID' + if [ ! -d /usr/local/openssl ]; then + ${PKG_INSTALL} openssl + fi + fi + case "${MAINVER}" in + 4) IONCUBE_VER=$FBSD4_IONCUBE_VER + IONCUBENAME=ioncube_loaders_fre_4_x86 + ;; + 5) IONCUBENAME=ioncube_loaders_fre_4_x86 + ;; + 6) IONCUBENAME=ioncube_loaders_fre_6_x86 + ;; + 7) IONCUBENAME=ioncube_loaders_fre_7_x86 + if [ ${B64} -eq 1 ]; then + IONCUBENAME=ioncube_loaders_fre_7_x86-64 + fi + ;; + 8) IONCUBENAME=ioncube_loaders_fre_8_x86-64 + ;; + 9) if [ ${B64} -eq 1 ]; then + IONCUBENAME=ioncube_loaders_fre_9_x86-64 + else + IONCUBENAME=ioncube_loaders_fre_9_x86 + fi + ;; + 10) if [ ${B64} -eq 1 ]; then + IONCUBENAME=ioncube_loaders_fre_9_x86-64 + else + IONCUBENAME=ioncube_loaders_fre_9_x86 + fi + ;; + 11) IONCUBENAME=ioncube_loaders_fre_11_x86-64 + ;; + 12) IONCUBENAME=ioncube_loaders_fre_11_x86-64 + ;; + esac + else + if [ ${B64} -eq 1 ]; then + IONCUBENAME=ioncube_loaders_lin_x86-64 + ZENDNAME_PHP53=ZendGuardLoader-php-5.3-linux-glibc23-x86_64 + ZENDNAME_PHP53_MD5=ZendGuard64 + ZENDNAME_PHP54=ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64 + ZENDNAME_PHP54_MD5=ZendGuard54_64 + ZENDNAME_PHP55=zend-loader-php5.5-linux-x86_64 + ZENDNAME_PHP55_MD5=zend_loader_php55_64 + ZENDNAME_PHP56=zend-loader-php5.6-linux-x86_64 + ZENDNAME_PHP56_MD5=zend_loader_php56_64 + else + IONCUBENAME=ioncube_loaders_lin_x86 + ZENDNAME_PHP53=ZendGuardLoader-php-5.3-linux-glibc23-i386 + ZENDNAME_PHP53_MD5=ZendGuard32 + ZENDNAME_PHP54=ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386 + ZENDNAME_PHP54_MD5=ZendGuard54_32 + ZENDNAME_PHP55=zend-loader-php5.5-linux-i386 + ZENDNAME_PHP55_MD5=zend_loader_php55_32 + ZENDNAME_PHP56=zend-loader-php5.6-linux-i386 + ZENDNAME_PHP56_MD5=zend_loader_php56_32 + fi + fi + + ZENDFILE_GUARD53=${ZENDNAME_PHP53}.tar.gz + ZENDFILE_GUARD54=${ZENDNAME_PHP54}.tar.gz + ZENDFILE_GUARD55=${ZENDNAME_PHP55}.tar.gz + ZENDFILE_GUARD56=${ZENDNAME_PHP56}.tar.gz + IONCUBEFILE=${IONCUBENAME}.tar.gz + + WEBALIZER_VER=`getVer webalizer` + WEBALIZER=webalizer-${WEBALIZER_VER} + WEBALIZER_FILE=webalizer-${WEBALIZER_VER}-src.tgz +fi + +#################################################### + +ensureVersion() { + + PERL_VER=`perl -v | head -n2 | tail -n1 | cut -d\ -f4 | cut -dv -f2` + NUM1=`echo $PERL_VER | cut -d. -f1` + NUM2=`echo $PERL_VER | cut -d. -f2` + NUM3=`echo $PERL_VER | cut -d. -f3` + + if [ $NUM1 -gt 5 ]; then + return 1 + fi + if [ $NUM2 -gt 6 ]; then + return 1 + fi + if [ $NUM3 -gt 0 ]; then + return 1 + fi + + do_exit 1 "Your perl version is $PERL_VER. You require at least perl 5.6.1 for Mail-SpamAssassin-${SPAMASSASSIN_VER}." +} + +#################################################### + +downloadMake() { + cd $CWD + + VER=`getVer ${1}` + NAME=${1}-${VER} + + getFile ${NAME}.tar.gz ${1} + tar xzf ${NAME}.tar.gz --no-same-owner + cd ${NAME} + perl Makefile.PL + make + make install + + cd $CWD +} + +#################################################### + +clean_tarball() { + #clean_tarball name current_version extension + if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ]; then + echo "Skipping $1 tarball, needs more arguments in doclean_old_tarballs()." + return + fi + for i in `ls ${WORKDIR} | grep "^${1}[-_][v0-9]" | grep -v "$2" | grep "$3$"`; do + rm -f ${WORKDIR}/$i + if [ "${CLEAN_OPT}" = "no" ]; then + echo "Removing ${WORKDIR}/$i..." + fi + done +} + +doclean_old_tarballs() { + if [ "${WEBSERVER_OPT}" = "litespeed" ]; then + clean_tarball lsws ${LITESPEED_VER} tar.gz + fi + if [ "${WEBSERVER_OPT}" = "openlitespeed" ]; then + clean_tarball openlitespeed ${OPENLITESPEED_VER} tar.gz + fi + if [ "${WEBSERVER_OPT}" = "nginx" ] || [ "${WEBSERVER_OPT}" = "nginx_apache" ]; then + clean_tarball nginx ${NGINX_VER} tar.gz + clean_tarball mod_aclr2 ${MOD_ACLR2_VER} tar.gz + fi + clean_tarball lego ${LEGO_VER} tar.gz + if [ "${WEBSERVER_OPT}" = "apache" ] || [ "${WEBSERVER_OPT}" = "nginx_apache" ]; then + clean_tarball httpd ${APACHE2_VER} tar.gz + if [ "${HAVE_SUPHP_CGI}" = "yes" ]; then + clean_tarball suphp ${SUPHP_VER} tar.gz + fi + if [ "${HAVE_FCGID}" = "yes" ]; then + clean_tarball mod_fcgid ${MOD_FCGID_VER} tar.gz + fi + if [ "${MOD_RUID2_OPT}" = "yes" ]; then + clean_tarball mod_ruid2 ${MOD_RUID2_VER} tar.bz2 + fi + if [ "${HTSCANNER_OPT}" = "yes" ]; then + clean_tarball mod_htscanner2 ${HTSCANNER_VER} tgz + fi + fi + clean_tarball redis ${REDIS_VER} tar.gz + clean_tarball nghttp2 ${NGHTTP2_VER} tar.gz + clean_tarball apr ${APR_VER} tar.gz + clean_tarball apr-util ${APR_UTIL_VER} tar.gz + clean_tarball imapsync ${IMAPSYNC_VER} tar.gz + if [ "${MODSECURITY_OPT}" = "yes" ]; then + if [ "${WEBSERVER_OPT}" = "apache" ]; then + clean_tarball ${MODSECURITY_FILENAME} ${MODSECURITY_VER} tar.gz + else + clean_tarball ${LIBMODSECURITY_FILENAME} ${LIBMODSECURITY_VER} tar.gz + fi + clean_tarball owasp-modsecurity-crs ${OWASP_RULES_VER} tar.gz + clean_tarball ${MODSECURITY_NGINX_CONNECTOR_FILENAME} ${MODSECURITY_NGINX_CONNECTOR_VER} tar.gz + clean_tarball ${MODSECURITY_APACHE_CONNECTOR_FILENAME} ${MODSECURITY_APACHE_CONNECTOR_VER} tar.gz + if [ "${MODSECURITY_RULESET_OPT}" = "comodo" ]; then + if [ "${WEBSERVER_OPT}" = "litespeed" ]; then + clean_tarball cwaf_rules_ls ${CWAF_RULES_LS_VER} tgz + elif [ "${WEBSERVER_OPT}" = "apache" ]; then + clean_tarball cwaf_rules ${CWAF_RULES_VER} tgz + else + clean_tarball cwaf_rules_nginx_3 ${CWAF_RULES_NGINX_VER} tgz + fi + fi + fi + if [ "${CLAMAV_OPT}" = "yes" ]; then + clean_tarball clamav ${CLAMAV_VER} tar.gz + fi + if [ "${SPAMD_OPT}" = "spamassassin" ]; then + clean_tarball Mail-SpamAssassin ${SPAMASSASSIN_VER} tar.gz + elif [ "${SPAMD_OPT}" = "rspamd" ]; then + clean_tarball rspamd_conf ${RSPAMD_CONF_VER} tar.gz + fi + clean_tarball curl ${CURL_VER} tar.gz + clean_tarball pcre ${PCRE_VER} tar.gz + clean_tarball pcre2 ${PCRE2_VER} tar.gz + clean_tarball zlib ${ZLIB_VER} tar.gz + clean_tarball libpng ${PNG_VER} tar.gz + clean_tarball libmaxminddb ${LIBMAXMINDDB_VER} tar.gz + clean_tarball geoipupdate ${GEOIPUPDATE_VER} tar.gz + clean_tarball freetype ${FREETYPE_VER} tar.gz + clean_tarball libsodium ${LIBSODIUM_VER} tar.gz + clean_tarball libxslt ${LIBXSLT_VER} tar.gz + clean_tarball libxml2 ${LIBXML2_VER} tar.gz + clean_tarball libzip ${LIBZIP_VER} tar.gz + + if [ "${PHP_IGBINARY_OPT}" = "yes" ]; then + clean_tarball igbinary ${IGBINARY_VER} tar.gz + fi + + if [ "${IMAGICK_OPT}" = "yes" ]; then + clean_tarball imagick ${IMAGICK_VER} tgz + clean_tarball ImageMagick ${IMAGEMAGICK_VER} tar.gz + fi + + if [ "${PHP_PHALCON_OPT}" = "yes" ]; then + clean_tarball psr ${PSR_VER} tgz + clean_tarball phalcon ${PHALCON_VER} tgz + fi + + if [ "${PHP_SNUFFLEUPAGUS_OPT}" = "yes" ]; then + clean_tarball snuffleupagus ${SNUFFLEUPAGUS_VER} tar.gz + fi + + if [ "${PHP_REDIS_OPT}" = "yes" ]; then + clean_tarball redis ${PHPREDIS_VER} tgz + fi + + if [ "${PHP_IMAP_OPT}" = "yes" ]; then + clean_tarball imap ${IMAP_VER} tgz + fi + + if [ "${EXIM_SRS_OPT}" = "yes" ]; then + clean_tarball libsrs_alt ${LIBSRS_ALT_VER} tar.bz2 + fi + clean_tarball libspf2 ${LIBSPF2_VER} tar.gz + if [ "${EASY_SPAM_FIGHTER_OPT}" = "yes" ]; then + clean_tarball exim.easy_spam_fighter ${EASY_SPAM_FIGHTER_VER} tar.gz + fi + if [ "${BLOCKCRACKING_OPT}" = "yes" ]; then + clean_tarball exim.blockcracking ${BLOCKCRACKING_VER} tar.gz + fi + if [ "${PIGEONHOLE_OPT}" = "yes" ]; then + clean_tarball pigeohole${DOVECOT_SHORTREL} ${PIGEONHOLE_VER} tar.gz + fi + clean_tarball icu4c ${ICU_VER}-src tgz + if [ "${WEBALIZER_OPT}" = "yes" ]; then + clean_tarball webalizer ${WEBALIZER_VER}-src tgz + fi + if [ "${FTPD_OPT}" = "proftpd" ]; then + clean_tarball proftpd ${PROFTPD_VER} tar.gz + else + clean_tarball pure-ftpd ${PUREFTPD_VER} tar.gz + fi + if [ "${EXIM_OPT}" = "yes" ]; then + clean_tarball exim ${EXIM_VER} tar.gz + clean_tarball s-nail ${S_NAIL_VER} tar.gz + fi + clean_tarball msmtp ${MSMTP_VER} tar.xz + clean_tarball lua ${LUA_VER} tar.gz + clean_tarball dovecot ${DOVECOT_VER} tar.gz + clean_tarball fts-xapian ${FTS_XAPIAN_VER} tar.gz + clean_tarball zstd ${ZSTD_VER} tar.gz + clean_tarball xapian-core ${XAPIAN_CORE_VER} tar.xz + clean_tarball bubblewrap ${BUBBLEWRAP_VER} tar.xz + if [ "${ROUNDCUBE_OPT}" = "yes" ]; then + clean_tarball roundcubemail ${ROUNDCUBE_VER} tar.gz + fi + if [ "${SQUIRRELMAIL_OPT}" = "yes" ]; then + clean_tarball squirrelmail ${SQUIRRELMAIL_VER} tar.gz + fi + if [ "${AWSTATS_OPT}" = "yes" ]; then + clean_tarball awstats ${AWSTATS_VER} tar.gz + fi + if [ "${UNIT_OPT}" = "yes" ]; then + clean_tarball unit ${UNIT_VER} tar.gz + fi + if [ "${PHPMYADMIN_OPT}" = "yes" ]; then + clean_tarball phpMyAdmin ${PHPMYADMIN_VER} tar.gz + fi + + clean_tarball pigz ${PIGZ_VER} tar.gz + if [ "${SUHOSIN_OPT}" = "yes" ]; then + clean_tarball suhosin ${SUHOSIN_VER} tgz + fi + if [ "${OPCACHE_OPT}" = "yes" ]; then + clean_tarball zendopcache ${OPCACHE_VER} tgz + fi + + if [ "${CLOUDLINUX_OPT}" = "yes" ]; then + clean_tarball mod_lsapi ${MOD_LSAPI_VER} tar.gz + clean_tarball mod_hostinglimits ${MOD_HOSTINGLIMITS_VER} tar.gz + clean_tarball mod_proctitle ${MOD_PROCTITLE_VER} tar.gz + fi + + #PHP bit needs to be different + for i in `ls ${WORKDIR} | grep '^php-' | grep -v "${PHP53_VER}" | grep -v "${PHP54_VER}" | grep -v "${PHP55_VER}" | grep -v "${PHP56_VER}" | grep -v "${PHP70_VER}" | grep -v "${PHP71_VER}" | grep -v "${PHP72_VER}" | grep -v "${PHP73_VER}" | grep -v "${PHP74_VER}" | grep -v "${PHP80_VER}" | grep tar.gz`; do + rm -f ${WORKDIR}/$i + if [ "${CLEAN_OPT}" = "no" ]; then + echo "Removing ${WORKDIR}/$i..." + fi + done + + #Clean MySQL/MariaDB tarballs + if [ "${MYSQL_INST_OPT}" = "mysql" ]; then + for i in `ls /usr/local/ | grep ^mysql- | grep 'tar.gz$' | grep -v "^mysql-${MYSQL_VER}"`; do + rm -f /usr/local/$i + if [ "${CLEAN_OPT}" = "no" ]; then + echo "Removing /usr/local/$i..." + fi + done + fi + if [ "${MYSQL_INST_OPT}" = "mariadb" ]; then + for i in `ls /usr/local/ | grep ^mariadb- | grep 'tar.gz$' | grep -v "^mariadb-${MARIADB_VER}"`; do + rm -f /usr/local/$i + if [ "${CLEAN_OPT}" = "no" ]; then + echo "Removing /usr/local/$i..." + fi + done + fi +} + +#################################################### + +doclean_old_webapps() { + if [ "${CLEAN_OLD_WEBAPPS_OPT}" != "yes" ]; then + do_exit 1 "You cannot clean webapps, because you do not have it set in options.conf file." + fi + + #Clean phpMyAdmin + if [ "${PHPMYADMIN_OPT}" = "yes" ] && [ -e /var/www/html/phpMyAdmin ]; then + PHPMYADMIN_CUR=`ls -ld /var/www/html/phpMyAdmin | cut -d\> -f2 | cut -d- -f2,3,4` + for i in `ls /var/www/html/ | grep phpMyAdmin- | grep -v "${PHPMYADMIN_CUR}"`; do + rm -rf /var/www/html/$i + if [ "${CLEAN_OPT}" = "no" ]; then + echo "Removing /var/www/html/$i..." + fi + done + fi + + #Clean SquirrelMail + if [ "${SQUIRRELMAIL_OPT}" = "yes" ] && [ -e /var/www/html/squirrelmail ]; then + SQUIRRELMAIL_CUR=`ls -ld /var/www/html/squirrelmail | cut -d\> -f2 | cut -d- -f2,3` + for i in `ls /var/www/html/ | grep squirrelmail- | grep -v -e "${SQUIRRELMAIL_CUR}\$"`; do + rm -rf /var/www/html/$i + if [ "${CLEAN_OPT}" = "no" ]; then + echo "Removing /var/www/html/$i..." + fi + done + fi + + #Clean RoundCube + if [ "${ROUNDCUBE_OPT}" = "yes" ] && [ -e /var/www/html/roundcube ]; then + #ROUNDCUBE_CUR=`ls -ld /var/www/html/roundcube | cut -d\> -f2 | cut -d- -f2` + ROUNDCUBE_CUR=`roundcube_version` + for i in `ls /var/www/html/ | grep roundcubemail- | grep -v "${ROUNDCUBE_CUR}"`; do + rm -rf /var/www/html/$i + if [ "${CLEAN_OPT}" = "no" ]; then + echo "Removing /var/www/html/$i..." + fi + done + fi + + #Clean AWstats + if [ "${AWSTATS_OPT}" = "yes" ] && [ -e /usr/local/awstats ]; then + AWSTATS_CUR=`ls -ld /usr/local/awstats | cut -d\> -f2 | cut -d- -f2` + for i in `ls /usr/local/ | grep awstats- | grep -v "${AWSTATS_CUR}"`; do + rm -rf /usr/local/$i + if [ "${CLEAN_OPT}" = "no" ]; then + echo "Removing /usr/local/$i..." + fi + done + fi +} + +#################################################### + +doClean() { + cd ${CWD} + if [ -e ${LOCKFILE} ]; then + return + fi + rm -rf mod_ruid2-${MOD_RUID2_VER} + rm -rf ${MODSECURITY_FILENAME}-${MODSECURITY_VER} + rm -rf ${LIBMODSECURITY_FILENAME}-v${LIBMODSECURITY_VER} + rm -rf ${MODSECURITY_APACHE_CONNECTOR_FILENAME}-${MODSECURITY_APACHE_CONNECTOR_VER} + rm -rf ${MODSECURITY_NGINX_CONNECTOR_FILENAME}-${MODSECURITY_NGINX_CONNECTOR_VER} + rm -rf mod_aclr2-${MOD_ACLR2_VER} + rm -rf htscanner-${HTSCANNER_VER} + rm -rf mod_fcgid-${MOD_FCGID_VER} + rm -rf pigz-${PIGZ_VER} + rm -rf php-${PHP53_VER} + rm -rf php-${PHP54_VER} + rm -rf php-${PHP55_VER} + rm -rf php-${PHP56_VER} + rm -rf php-${PHP70_VER} + rm -rf php-${PHP71_VER} + rm -rf php-${PHP72_VER} + rm -rf php-${PHP73_VER} + rm -rf php-${PHP74_VER} + rm -rf php-${PHP80_VER} + rm -rf redis-${REDIS_VER} + rm -rf imapsync-imapsync-${IMAPSYNC_VER} + if [ "${UNIT_OPT}" = "yes" ]; then + rm -rf unit-${UNIT_VER} + fi + rm -rf zstd-${ZSTD_VER} + rm -rf xapian-core-${XAPIAN_CORE_VER} + rm -rf bubblewrap-${BUBBLEWRAP_VER} + rm -rf s-nail-${S_NAIL_VER} + rm -rf msmtp-${MSMTP_VER} + rm -rf lua-${LUA_VER} + if [ "${EXIM_SRS_OPT}" = "yes" ]; then + rm -rf libsrs_alt-${LIBSRS_ALT_VER} + fi + rm -rf libpsf2-${LIBSPF2_VER} + if [ "${WEBSERVER_OPT}" = "litespeed" ]; then + rm -rf lsws-${LITESPEED_VER} + fi + if [ "${WEBSERVER_OPT}" = "openlitespeed" ]; then + rm -rf openlitespeed-${OPENLITESPEED_VER} + fi + if [ "${CLOUDLINUX_OPT}" = "yes" ]; then + rm -rf mod_lsapi-${MOD_LSAPI_VER} + rm -rf mod_proctitle-${MOD_PROCTITLE_VER} + fi + if [ "${MYSQL_INST_OPT}" = "mysql" ]; then + rm -rf mysql-${MYSQL_VER} + fi + if [ "${MYSQL_INST_OPT}" = "mariadb" ]; then + rm -rf mariadb-${MARIADB_VER} + fi + if [ "${PHP_IMAGICK_OPT}" = "yes" ]; then + rm -rf imagick-${IMAGICK_VER} + rm -rf ImageMagick-${IMAGEMAGICK_VER} + fi + if [ "${PHP_PHALCON_OPT}" = "yes" ]; then + rm -rf psr-${PSR_VER} + rm -rf phalcon-${PHALCON_VER} + fi + if [ "${PHP_IMAP_OPT}" = "yes" ]; then + rm -rf imap-${IMAP_VER} + fi + rm -rf curl-${CURL_VER} + rm -rf nginx-${NGINX_VER} + rm -rf nghttp2-${NGHTTP2_VER} + rm -rf pcre-${PCRE_VER} + rm -rf pcre2-${PCRE2_VER} + rm -rf zlib-${ZLIB_VER} + rm -rf libpng-${PNG_VER} + rm -rf libmaxminddb-${LIBMAXMINDDB_VER} + rm -rf geoipupdate-${GEOIPUPDATE_VER} + rm -rf freetype-${FREETYPE_VER} + rm -rf libsodium-${LIBSODIUM_VER} + rm -rf libxslt-${LIBXSLT_VER} + rm -rf libxml2-${LIBXML2_VER} + rm -rf libzip-${LIBZIP_VER} + rm -rf icu4c-${ICU_VER}-src + rm -rf icu + rm -rf easy_spam_fighter + rm -rf libspf2-${LIBSPF2_VER} + rm -rf ${ZENDNAME_PHP53} + rm -rf ${ZENDNAME_PHP54} + rm -rf ${ZENDNAME_PHP55} + rm -rf ${ZENDNAME_PHP56} + rm -rf ${WEBALIZER} + rm -rf proftpd-${PROFTPD_VER} + rm -rf pure-ftpd-${PUREFTPD_VER} + rm -rf httpd-${APACHE2_VER} + rm -rf exim-${EXIM_VER} + rm -rf dovecot-${DOVECOT_VER} + rm -rf dovecot-ce-${DOVECOT_VER} + rm -rf suphp-${SUPHP_VER} + rm -rf suhosin-${SUHOSIN_VER} + rm -rf zendopcache-${OPCACHE_VER} + rm -rf dovecot-${DOVECOT_REL}-pigeonhole-${PIGEONHOLE_VER} + rm -rf Mail-SpamAssassin-${SPAMASSASSIN_VER} + rm -rf rspamd-${RSPAMD_VER} + rm -rf clamav-${CLAMAV_VER} +# Mailman is not yet supported +# rm -rf mailman-${MAILMAN_VER} + + rm -rf ${ZENDNAME_PHP53} + rm -rf ${ZENDNAME_PHP54} + + #Clean MySQL/MariaDB + if [ -h /usr/local/mysql ] && [ "${MYSQL_INST_OPT}" != "no" ]; then + MYSQL_CUR=`ls -ld /usr/local/mysql | cut -d\> -f2 | cut -d' ' -f2` + for i in `ls /usr/local/ | grep '^mysql-\|^mariadb-' | grep -v "${MYSQL_CUR}"`; do + if [ -h /usr/local/${i}/data ]; then + rm -rf /usr/local/$i + if [ "${CLEAN_OPT}" = "no" ]; then + echo "Removing /usr/local/$i..." + fi + fi + done + fi + + if [ "${CLEAN_OLD_TARBALLS_OPT}" = "yes" ]; then + doclean_old_tarballs + fi + + if [ "${CLEAN_OLD_WEBAPPS_OPT}" = "yes" ]; then + doclean_old_webapps + fi + + if [ "${CLEAN_OPT}" = "no" ]; then + echo "All clean!" + fi +} + +DOCLEAN_CASE=1 +doclean_toggle() { + DOCLEAN_CASE=0 +} + +#################################################### +if [ ! -e ${LOCKFILE} ]; then + case "$1" in + update) doclean_toggle ;; + update_data) doclean_toggle ;; + "") doclean_toggle ;; + gen_help_json) doclean_toggle ;; + opt_help) doclean_toggle ;; + set) doclean_toggle ;; + set_php) doclean_toggle ;; + get_versions_txt) doclean_toggle ;; + update_script) doclean_toggle ;; + versions_json) doclean_toggle ;; + versions_ajax) doclean_toggle ;; + gen_help) doclean_toggle ;; + version) doclean_toggle ;; + versions) doclean_toggle ;; + list_removals) doclean_toggle ;; + list_removals_json) doclean_toggle ;; + remove_items) doclean_toggle ;; + set_fastest) doclean_toggle ;; + set_fastest_quiet) doclean_toggle ;; + kill) doclean_toggle ;; + update_da) doclean_toggle ;; + versions_nobold) doclean_toggle ;; + list_configs_json) doclean_toggle ;; + settings_json) doclean_toggle ;; + get_timezone) doclean_toggle ;; + custom_config) doclean_toggle ;; + set_versions_txt) doclean_toggle ;; + show_component_config) doclean_toggle ;; + remove_customized_config) doclean_toggle ;; + show_file) doclean_toggle ;; + check_options) doclean_toggle ;; + esac + if [ "${CLEAN_OPT}" = "yes" ] && [ "${DOCLEAN_CASE}" = "1" ]; then + doClean + fi +fi + +#################################################### +BUILD_SECTIONS_CASE=1 +build_section_toggle() { + BUILD_SECTIONS_CASE=0 +} +case "$1" in + opt_help) build_section_toggle ;; + set) build_section_toggle ;; + set_php) build_section_toggle ;; + get_versions_txt) build_section_toggle ;; + update_script) build_section_toggle ;; + version) build_section_toggle ;; + set_fastest) build_section_toggle ;; + set_fastest_quiet) build_section_toggle ;; + kill) build_section_toggle ;; + update_da) build_section_toggle ;; + list_configs_json) build_section_toggle ;; + settings_json) build_section_toggle ;; + get_timezone) build_section_toggle ;; + custom_config) build_section_toggle ;; + set_versions_txt) build_section_toggle ;; + show_component_config) build_section_toggle ;; + remove_customized_config) build_section_toggle ;; + show_file) build_section_toggle ;; + check_options) build_section_toggle ;; +esac + +if [ "${BUILD_SECTIONS_CASE}" = "1" ]; then + HELP_SECTIONS="BUILD_COMP BUILD_PHP_EXT BUILD_COMP_CONF BUILD_COMP_WEBAPPS BUILD_CB BUILD_OLD BUILD_UPDATE BUILD_UPDATE_PCG BUILD_ALL BUILD_PHP_EXTENSIONS BUILD_EXPERIENCED" + + BUILD_PHP_EXT_SET="php_gmp php_igbinary php_ioncube php_imagick php_imap php_ldap php_opcache php_phalcon php_psr php_redis php_readline php_snuffleupagus php_suhosin php_xmlrpc php_zend" + BUILD_PHP_EXT_DESC="Install/update PHP extensions" + BUILD_PHP_EXT_REQADD="" + + BUILD_COMP_SET="apache awstats awstats_process bubblewrap csf clamav composer curl cpanel_to_da dovecot exim freetype geoipupdate icu imagemagick imapsync jailshell lego libmaxminddb libmodsecurity libspf2 libsrs_alt libsodium libxml2 libxslt litespeed lua mod_lsapi mod_proctitle mod_aclr2 mod_ruid2 mod_htscanner2 mod_fcgid modsecurity modsecurity_rules msmtp mysql netdata nginx nginx_apache openlitespeed pigeonhole pigz pcre php proftpd pureftpd redis rspamd snail spamassassin suphp unit webalizer wp" + BUILD_COMP_DESC="Install/update server components" + BUILD_COMP_REQADD="" + + BUILD_COMP_CONF_SET="exim_conf dovecot_conf blockcracking easy_spam_fighter php_ini rewrite_confs secure_php spamassassin_cron litespeed_license litespeed_license_migrate" + BUILD_COMP_CONF_DESC="Components configuration options" + BUILD_COMP_CONF_REQADD="" + + BUILD_COMP_WEBAPPS_SET="phpmyadmin roundcube squirrelmail" + BUILD_COMP_WEBAPPS_DESC="Install/update web applications" + BUILD_COMP_WEBAPPS_REQADD="" + + BUILD_CB_SET="create_options custombuild_plugin cron opt_help options list_removals remove_items set set_fastest set_fastest_quiet update_da update_versions update_webapps used_configs versions version" + BUILD_CB_DESC="CustomBuild related options/functions" + BUILD_CB_SET_REQADD="opt_help set" + SET_ADDIT="option_name value" + OPT_HELP_ADDIT="(full)" + + BUILD_OLD_SET="clean clean_old_webapps" + BUILD_OLD_DESC="Remove old build data" + BUILD_OLD_REQUADD="" + + BUILD_UPDATE_SET="update update_script" + BUILD_UPDATE_DESC="Get latest build script with or without new packages" + BUILD_UPDATE_REQADD="" + + BUILD_UPDATE_PCG_SET="update_data" + BUILD_UPDATE_PCG_DESC="Get packages for current build script" + BUILD_UPDATE_PCG_REQADD="" + + BUILD_ALL_SET="all" + BUILD_ALL_DESC="Build everything what is set in the options.conf file" + BUILD_ALL_REQADD="" + + BUILD_PHP_EXTENSIONS_SET="php_extensions" + BUILD_PHP_EXTENSIONS_DESC="Build all PHP extensions set set in the php_extensions.conf file" + BUILD_PHP_EXTENSIONS_REQADD="" + + BUILD_EXPERIENCED_SET="php_expert php_htscanner2 todovecot set_service" + BUILD_EXPERIENCED_DESC="Recommended for experienced users only (!)" + BUILD_EXPERIENCED_REQADD="php_expert php_htscanner2 set_service" + PHP_EXPERT_ADDIT="php_release php_mode" + PHP_HTSCANNER2_ADDIT="php_release" + SET_SERVICE_ADDIT="service ON|OFF|delete" +fi + +################################################### + +generateHelp() { + for section in ${HELP_SECTIONS}; do + DESC=${section}_DESC + echo " +-----------------------------------------------------------+" + printf " | %-55s %-2s|\n" "$(eval_var ${DESC}):" + + BUILDSET="${section}_SET" + BUILD_ADD_TO_OUT="${section}_REQADD" + for setting in $(eval_var ${BUILDSET}); do + ADDIT="" + for i in $(eval_var ${BUILD_ADD_TO_OUT}); do + ADDIT_VAR=`echo "${i}_ADDIT" | tr "[a-z]" "[A-Z]"` + if [ "$i" = "${setting}" ]; then + ADDIT="$(eval_var ${ADDIT_VAR})" + fi + done + printf " | %-55s %-2s|\n" " $0 ${setting} ${ADDIT}" + done + done +} + +initJSONVars() { + #################################################### + #SKIP LISTS for CustomBuild plugin to generate in JSON format accoring to the options set + HELP_SECTIONS_JSON_SKIP="BUILD_EXPERIENCED" + + BUILD_PHP_EXT_SKIP="" + if [ "${PHP_IGBINARY_OPT}" = "no" ]; then + BUILD_PHP_EXT_SKIP="${BUILD_PHP_EXT_SKIP}igbinary " + fi + if [ "${IMAGICK_OPT}" = "no" ]; then + BUILD_PHP_EXT_SKIP="${BUILD_PHP_EXT_SKIP}imagick " + fi + if [ "${ZEND_OPT}" = "no" ]; then + BUILD_PHP_EXT_SKIP="${BUILD_PHP_EXT_SKIP}zend " + fi + if [ "${IONCUBE_OPT}" = "no" ]; then + BUILD_PHP_EXT_SKIP="${BUILD_PHP_EXT_SKIP}ioncube " + fi + if [ "${SUHOSIN_OPT}" = "no" ]; then + BUILD_PHP_EXT_SKIP="${BUILD_PHP_EXT_SKIP}suhosin " + fi + if [ "${PHP_SNUFFLEUPAGUS_OPT}" = "no" ]; then + BUILD_PHP_EXT_SKIP="${BUILD_PHP_EXT_SKIP}snuffleupagus " + fi + if [ "${PHP_PHALCON_OPT}" = "no" ]; then + BUILD_PHP_EXT_SKIP="${BUILD_PHP_EXT_SKIP}phalcon " + BUILD_PHP_EXT_SKIP="${BUILD_PHP_EXT_SKIP}psr " + fi + if [ "${PHP_IMAP_OPT}" = "no" ]; then + BUILD_PHP_EXT_SKIP="${BUILD_PHP_EXT_SKIP}imap " + fi + + BUILD_COMP_SKIP="" + if [ "${WEBSERVER_OPT}" = "apache" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}nginx litespeed nginx_apache mod_aclr2 openlitespeed " + elif [ "${WEBSERVER_OPT}" = "nginx" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}apache litespeed nginx_apache mod_aclr2 openlitespeed " + elif [ "${WEBSERVER_OPT}" = "litespeed" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}apache nginx nginx_apache mod_aclr2 openlitespeed " + elif [ "${WEBSERVER_OPT}" = "openlitespeed" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}apache litespeed nginx nginx_apache mod_aclr2 " + fi + if [ "${CURL_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}curl " + fi + if [ "${CLAMAV_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}clamav " + fi + if [ "${AWSTATS_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}awstats " + fi + if [ "${WEBALIZER_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}webalizer " + fi + if [ "${CSF_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}csf " + fi + if [ "${FTPD_OPT}" = "pureftpd" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}proftpd " + else + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}pureftpd " + fi + if [ "${MOD_RUID2_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}mod_ruid2 " + fi + if [ "${MODSECURITY_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}libmodsecurity modsecurity modsecurity_rules " + fi + if [ "${CLOUDLINUX_OPT}" = "no" ] || [ "${WEBSERVER_OPT}" = "nginx" ] || [ "${WEBSERVER_OPT}" = "litespeed" ] || [ "${WEBSERVER_OPT}" = "openlitespeed" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}mod_hostinglimits ${BUILD_COMP_SKIP}mod_lsapi ${BUILD_COMP_SKIP}mod_proctitle " + fi + if [ "${HTSCANNER_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}mod_htscanner2 " + fi + if [ "${HAVE_FCGID}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}mod_fcgid " + fi + if [ "${HAVE_SUPHP_CGI}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}suphp " + fi + if [ "${PIGEONHOLE_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}pigeonhole " + fi + if [ "${DOVECOT_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}dovecot " + fi + if [ "${MYSQL_INST_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}mysql " + fi + if [ "${SPAMD_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}spamassassin rspamd " + elif [ "${SPAMD_OPT}" = "rspamd" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}spamassassin " + else + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}rspamd " + fi + if [ "${EXIM_OPT}" = "no" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}exim " + fi + if [ "${OS_CENTOS_VER}" != "6" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}libsodium pcre " + fi + if [ "${OS_CENTOS_VER}" = "6" ] || [ "${OS_CENTOS_VER}" = "7" ]; then + BUILD_COMP_SKIP="${BUILD_COMP_SKIP}libzip " + fi + + BUILD_COMP_CONF_SKIP="" + if [ "${PHP_INI_OPT}" = "no" ]; then + BUILD_COMP_CONF_SKIP="${BUILD_COMP_CONF_SKIP}php_ini " + fi + if [ "${EXIMCONF_OPT}" = "no" ]; then + BUILD_COMP_CONF_SKIP="${BUILD_COMP_CONF_SKIP}eximconf " + fi + if [ "${WEBSERVER_OPT}" != "litespeed" ]; then + BUILD_COMP_CONF_SKIP="${BUILD_COMP_CONF_SKIP}litespeed_license " + fi + if [ "${WEBSERVER_OPT}" != "litespeed" ] || [ "${LITESPEED_SERIALNO_OPT}" = "trial" ]; then + BUILD_COMP_CONF_SKIP="${BUILD_COMP_CONF_SKIP}litespeed_license_migrate " + fi + if [ "${DOVECOT_CONF_OPT}" = "no" ]; then + BUILD_COMP_CONF_SKIP="${BUILD_COMP_CONF_SKIP}dovecot_conf " + fi + if [ "${BLOCKCRACKING_OPT}" = "no" ]; then + BUILD_COMP_CONF_SKIP="${BUILD_COMP_CONF_SKIP}blockcracking " + fi + if [ "${EXIMCONF_OPT}" = "no" ]; then + BUILD_COMP_CONF_SKIP="${BUILD_COMP_CONF_SKIP}easy_spam_fighter " + fi + + BUILD_CB_SKIP="create_options opt_help list_removals remove_items set set_fastest_quiet update_versions versions" + + BUILD_COMP_WEBAPPS_SKIP="" + if [ "${PHPMYADMIN_OPT}" = "no" ]; then + BUILD_COMP_WEBAPPS_SKIP="${BUILD_COMP_WEBAPPS_SKIP}phpmyadmin " + fi + if [ "${ROUNDCUBE_OPT}" = "no" ]; then + BUILD_COMP_WEBAPPS_SKIP="${BUILD_COMP_WEBAPPS_SKIP}roundcube " + fi + if [ "${SQUIRRELMAIL_OPT}" = "no" ]; then + BUILD_COMP_WEBAPPS_SKIP="${BUILD_COMP_WEBAPPS_SKIP}squirremail " + fi + + BUILD_OLD_SKIP="" + BUILD_UPDATE_SKIP="" + BUILD_UPDATE_PCG_SKIP="" + + #DESCRIPTIONS + COMP_UNIT_NAME="Build Nginx Unit" + COMP_UNIT_DESC="Install/update Nginx Unit dynamic application server." + COMP_UNIT_VER="Version ${UNIT_VER}." + + COMP_APACHE_NAME="Build Apache" + COMP_APACHE_DESC="Install/update Apache WEB server." + COMP_APACHE_VER="Version ${APACHE2_VER}." + + COMP_AWSTATS_NAME="Build awstats" + COMP_AWSTATS_DESC="Install/update AWstats." + COMP_AWSTATS_VER="Version ${AWSTATS_VER}." + + COMP_AWSTATS_PROCESS_NAME="Build awstats process" + COMP_AWSTATS_PROCESS_DESC="Install/update AWstats processing script." + COMP_AWSTATS_PROCESS_VER="Version ${AWSTATS_PROCESS_VER}." + + COMP_BUBBLEWRAP_NAME="Build bubblewrap" + COMP_BUBBLEWRAP_DESC="Install/update bubblewrap." + COMP_BUBBLEWRAP_VER="Version ${BUBBLEWRAP_VER}." + + COMP_JAILSHELL_NAME="Build jailshell" + COMP_JAILSHELL_DESC="Install/update jailshell." + COMP_JAILSHELL_VER="Version ${JAILSHELL_SH_VER}." + + COMP_REDIS_NAME="Build redis" + COMP_REDIS_DESC="Install/update redis." + COMP_REDIS_VER="Version ${REDIS_VER}." + + COMP_CSF_NAME="Build CSF" + COMP_CSF_DESC="Install/update ConfigServer Security & Firewall (csf)." + COMP_CSF_VER="" + + COMP_CLAMAV_NAME="Build ClamAV" + COMP_CLAMAV_DESC="Install/update ClamAV antivirus engine." + COMP_CLAMAV_VER="Version ${CLAMAV_VER}." + + COMP_COMPOSER_NAME="Build composer" + COMP_COMPOSER_DESC="Install/update composer." + COMP_COMPOSER_VER="Version ${COMPOSER_VER}." + + COMP_WP_NAME="Build wp-cli" + COMP_WP_DESC="Install/update command-line interface for WordPress." + COMP_WP_VER="Version ${WP_VER}." + + COMP_IMAPSYNC_NAME="Build imapsync" + COMP_IMAPSYNC_DESC="Install/update imapsync tool for mailbox synchronization." + COMP_IMAPSYNC_VER="Version ${IMAPSYNC_VER}." + + COMP_LEGO_NAME="Build lego" + COMP_LEGO_DESC="Install/update lego Let's Encrypt client." + COMP_LEGO_VER="Version ${LEGO_VER}." + + COMP_CURL_NAME="Build cURL" + COMP_CURL_DESC="Install/update cURL." + COMP_CURL_VER="Version ${CURL_VER}." + + COMP_CPANEL_TO_DA_NAME="Build cpanel_to_da" + COMP_CPANEL_TO_DA_DESC="Install/update cPanel to DirectAdmin script." + COMP_CPANEL_TO_DA_VER="" + + COMP_DOVECOT_NAME="Build Dovecot" + COMP_DOVECOT_DESC="Install/update Dovecot IMAP/POP3 server." + COMP_DOVECOT_VER="Version ${DOVECOT_VER}." + + COMP_EXIM_NAME="Build Exim" + COMP_EXIM_DESC="Install/update Exim Mail Transfer Agent." + COMP_EXIM_VER="Version ${EXIM_VER}." + + COMP_FREETYPE_NAME="Build Freetype" + COMP_FREETYPE_DESC="Install/update Freetype." + COMP_FREETYPE_VER="Version ${FREETYPE_VER}." + + COMP_PHP_GMP_NAME="Build gmp" + COMP_PHP_GMP_DESC="Install/update gmp extension for PHP." + COMP_PHP_GMP_VER="" + + COMP_PHP_LDAP_NAME="Build ldap" + COMP_PHP_LDAP_DESC="Install/update ldap extension for PHP." + COMP_PHP_LDAP_VER="" + + COMP_PHP_BZ2_NAME="Build bz2" + COMP_PHP_BZ2_DESC="Install/update bz2 extension for PHP." + COMP_PHP_BZ2_VER="" + + COMP_PHP_IGBINARY_NAME="Build igbinary" + COMP_PHP_IGBINARY_DESC="Install/update igbinary extension for PHP." + COMP_PHP_IGBINARY_VER="Version ${IGBINARY_VER}." + + COMP_PHP_IMAGICK_NAME="Build imagick" + COMP_PHP_IMAGICK_DESC="Install/update ImageMagick extension for PHP." + COMP_PHP_IMAGICK_VER="Version ${IMAGICK_VER}." + + COMP_PHP_SNUFFLEUPAGUS_NAME="Build snuffleupagus" + COMP_PHP_SNUFFLEUPAGUS_DESC="Install/update snuffleupagus extension for PHP." + COMP_PHP_SNUFFLEUPAGUS_VER="Version ${SNUFFLEUPAGUS_VER}." + + COMP_PHP_PHALCON_NAME="Build phalcon" + COMP_PHP_PHALCON_DESC="Install/update Phalcon extension for PHP." + COMP_PHP_PHALCON_VER="Version ${PHALCON_VER}." + + COMP_PHP_PSR_NAME="Build psr" + COMP_PHP_PSR_DESC="Install/update psr extension for PHP." + COMP_PHP_PSR_VER="Version ${PSR_VER}." + + COMP_PHP_REDIS_NAME="Build redis" + COMP_PHP_REDIS_DESC="Install/update redis extension for PHP." + COMP_PHP_REDIS_VER="Version ${PHPREDIS_VER}." + + COMP_PHP_READLINE_NAME="Build readline" + COMP_PHP_READLINE_DESC="Install/update readline extension for PHP." + COMP_PHP_READLINE_VER="" + + COMP_PHP_IMAP_NAME="Build imap" + COMP_PHP_IMAP_DESC="Install/update imap extension for PHP." + COMP_PHP_IMAP_VER="Version ${IMAP_VER}." + + COMP_PHP_XMLRPC_NAME="Build xmlrpc" + COMP_PHP_XMLRPC_DESC="Install/update xmlrpc extension for PHP." + COMP_PHP_XMLRPC_VER="" + + COMP_IMAGEMAGICK_NAME="Build ImageMagick" + COMP_IMAGEMAGICK_DESC="Install/update ImageMagick." + COMP_IMAGEMAGICK_VER="Version ${IMAGEMAGICK_VER}." + + COMP_ICU_NAME="Build ICU" + COMP_ICU_DESC="Install/update ICU." + COMP_ICU_VER="Version ${ICU_VER}." + + COMP_PHP_IONCUBE_NAME="Build ionCube" + COMP_PHP_IONCUBE_DESC="Install/update ionCube." + COMP_PHP_IONCUBE_VER="Version ${IONCUBE_VER}." + + COMP_PHP_SUHOSIN_NAME="Build suhosin" + COMP_PHP_SUHOSIN_DESC="Install/update suhosin." + COMP_PHP_SUHOSIN_VER="Version ${SUHOSIN_VER}." + + COMP_LIBMAXMINDDB_NAME="Build libmaxminddb" + COMP_LIBMAXMINDDB_DESC="Install/update libmaxminddb." + COMP_LIBMAXMINDDB_VER="Version ${LIBMAXMINDDB_VER}." + + COMP_GEOIPUPDATE_NAME="Build geoipupdate" + COMP_GEOIPUPDATE_DESC="Install/update geoipupdate." + COMP_GEOIPUPDATE_VER="Version ${GEOIPUPDATE_VER}." + + COMP_LIBSPF2_NAME="Build libspf2" + COMP_LIBSPF2_DESC="Install/update libspf2." + COMP_LIBSPF2_VER="Version ${LIBSPF2_VER}." + + COMP_LIBSRS_ALT_NAME="Build libsrs_alt" + COMP_LIBSRS_ALT_DESC="Install/update libsrs_alt." + COMP_LIBSRS_ALT_VER="Version ${LIBSRS_ALT_VER}." + + COMP_LIBSODIUM_NAME="Build libsodium" + COMP_LIBSODIUM_DESC="Install/update libsodium." + COMP_LIBSODIUM_VER="Version ${LIBSODIUM_VER}." + + COMP_LIBXML2_NAME="Build libxml2" + COMP_LIBXML2_DESC="Install/update libxml2." + COMP_LIBXML2_VER="Version ${LIBXML2_VER}." + + COMP_LIBXSLT_NAME="Build libxslt" + COMP_LIBXSLT_DESC="Install/update libxslt." + COMP_LIBXSLT_VER="Version ${LIBXSLT_VER}." + + if [ "${CLOUDLINUX_OPT}" = "yes" ]; then + COMP_MOD_LSAPI_NAME="Build mod_lsapi" + COMP_MOD_LSAPI_DESC="Install/update mod_lsapi." + COMP_MOD_LSAPI_VER="Version ${MOD_LSAPI_VER}." + + COMP_MOD_HOSTINGLIMITS_NAME="Build mod_hostinglimits" + COMP_MOD_HOSTINGLIMITS_DESC="Install/update mod_hostinglimits." + COMP_MOD_HOSTINGLIMITS_VER="Version ${MOD_HOSTINGLIMITS_VER}." + + COMP_MOD_PROCTITLE_NAME="Build mod_proctitle" + COMP_MOD_PROCTITLE_DESC="Install/update mod_proctitle." + COMP_MOD_PROCTITLE_VER="Version ${MOD_PROCTITLE_VER}." + fi + + COMP_MOD_ACLR2_NAME="Build mod_aclr2" + COMP_MOD_ACLR2_DESC="Install/update mod_aclr2." + COMP_MOD_ACLR2_VER="Version ${MOD_ACLR2_VER}." + + COMP_MOD_RUID2_NAME="Build mod_ruid2" + COMP_MOD_RUID2_DESC="Install/update mod_ruid2." + COMP_MOD_RUID2_VER="Version ${MOD_RUID2_VER}." + + COMP_MODSECURITY_NAME="Build ModSecurity" + COMP_MODSECURITY_DESC="Install/update ModSecurity." + COMP_MODSECURITY_VER="Version ${MODSECURITY_VER}." + + COMP_LIBMODSECURITY_NAME="Build LibModSecurity" + COMP_LIBMODSECURITY_DESC="Install/update LibModSecurity (ModSecurity 3.0)." + COMP_LIBMODSECURITY_VER="Version ${LIBMODSECURITY_VER}." + + COMP_MODSECURITY_RULES_NAME="Build ModSecurity Rules" + COMP_MODSECURITY_RULES_DESC="Install/update ModSecurity rule set." + COMP_MODSECURITY_RULES_VER="" + + COMP_PHP_OPCACHE_NAME="Build opcache" + COMP_PHP_OPCACHE_DESC="Install/update opcache." + COMP_PHP_OPCACHE_VER="" + + COMP_PIGZ_NAME="Build pigz" + COMP_PIGZ_DESC="Install/update pigz." + COMP_PIGZ_VER="Version ${PIGZ_VER}." + + COMP_MOD_HTSCANNER2_NAME="Build mod_htscanner2" + COMP_MOD_HTSCANNER2_DESC="Install/update mod_htscanner2." + COMP_MOD_HTSCANNER2_VER="Version ${HTSCANNER_VER}." + + COMP_MOD_FCGID_NAME="Build mod_fcgid" + COMP_MOD_FCGID_DESC="Install/update mod_fcgid." + COMP_MOD_FCGID_VER="Version ${MOD_FCGID_VER}." + + COMP_MYSQL_NAME="Build ${MYSQLNAME}" + COMP_MYSQL_DESC="Install/update ${MYSQLNAME}." + if [ "${MYSQL_INST_OPT}" = "mysql" ]; then + COMP_MYSQL_VER="Version ${MYSQL_VER}." + else + COMP_MYSQL_VER="Version ${MARIADB_VER}." + fi + + COMP_NGINX_NAME="Build nginx" + COMP_NGINX_DESC="Install/update nginx WEB server." + COMP_NGINX_VER="Version ${NGINX_VER}." + + COMP_LITESPEED_NAME="Build litespeed" + COMP_LITESPEED_DESC="Install/update LiteSpeed WEB server." + COMP_LITESPEED_VER="Version ${LITESPEED_VER}." + + COMP_OPENLITESPEED_NAME="Build openlitespeed" + COMP_OPENLITESPEED_DESC="Install/update OpenLiteSpeed WEB server." + COMP_OPENLITESPEED_VER="Version ${OPENLITESPEED_VER}." + + COMP_NETDATA_NAME="Build netdata" + COMP_NETDATA_DESC="Install/update netdata metrics for your server." + COMP_NETDATA_VER="" + + COMP_NGINX_APACHE_NAME="Build nginx+Apache" + COMP_NGINX_APACHE_DESC="Install/update Apache and nginx (nginx as a reverse proxy for Apache)." + COMP_NGINX_APACHE_VER="Apache ${APACHE2_VER} and nginx ${NGINX_VER}." + + COMP_PIGEONHOLE_NAME="Build Pigeonhole" + COMP_PIGEONHOLE_DESC="Install/update Pigeonhole used in Dovecot to provide Sieve email filtering and ManageSieve protocol." + COMP_PIGEONHOLE_VER="Version ${PIGEONHOLE_VER}." + + COMP_PCRE_NAME="Build PCRE" + COMP_PCRE_DESC="Install/update PCRE." + COMP_PCRE_VER="Version ${PCRE_VER}." + + COMP_PHP_NAME="Build PHP" + COMP_PHP_DESC="Install/update PHP." + if [ "${PHP2_RELEASE_OPT}" = "no" ] && [ "${PHP3_RELEASE_OPT}" = "no" ] && [ "${PHP4_RELEASE_OPT}" = "no" ]; then + COMP_PHP_VER="Version ${PHP1_RELEASE_OPT} as ${PHP1_MODE_OPT}." + elif [ "${PHP3_RELEASE_OPT}" = "no" ] && [ "${PHP4_RELEASE_OPT}" = "no" ]; then + COMP_PHP_VER="Version ${PHP1_RELEASE_OPT} as ${PHP1_MODE_OPT} (default) and ${PHP2_RELEASE_OPT} as ${PHP2_MODE_OPT} (additional)." + elif [ "${PHP3_RELEASE_OPT}" = "no" ] && [ "${PHP4_RELEASE_OPT}" = "no" ]; then + COMP_PHP_VER="Version ${PHP1_RELEASE_OPT} as ${PHP1_MODE_OPT} (default), ${PHP2_RELEASE_OPT} as ${PHP2_MODE_OPT} (additional) and ${PHP3_RELEASE_OPT} as ${PHP3_MODE_OPT} (additional)." + else + COMP_PHP_VER="Version ${PHP1_RELEASE_OPT} as ${PHP1_MODE_OPT} (default), ${PHP2_RELEASE_OPT} as ${PHP2_MODE_OPT} (additional), ${PHP3_RELEASE_OPT} as ${PHP3_MODE_OPT} (additional) and ${PHP4_RELEASE_OPT} as ${PHP4_MODE_OPT} (additional)." + fi + + COMP_PROFTPD_NAME="Build ProFTPd" + COMP_PROFTPD_DESC="Install/update ProFTPD FTP server." + COMP_PROFTPD_VER="Version ${PROFTPD_VER}." + + COMP_PUREFTPD_NAME="Build Pure-FTPd" + COMP_PUREFTPD_DESC="Install/update Pure-FTPd FTP server." + COMP_PUREFTPD_VER="Version ${PUREFTPD_VER}." + + COMP_SPAMASSASSIN_NAME="Build SpamAssassin" + COMP_SPAMASSASSIN_DESC="Install/update SpamAssassin." + COMP_SPAMASSASSIN_VER="Version ${SPAMASSASSIN_VER}." + + COMP_RSPAMD_NAME="Build Rspamd" + COMP_RSPAMD_DESC="Install/update Rspamd." + COMP_RSPAMD_VER="Version ${RSPAMD_VER}." + + COMP_SNAIL_NAME="Build s-nail" + COMP_SNAIL_DESC="Install/update s-nail - environment for sending and receiving mail." + COMP_SNAIL_VER="Version ${S_NAIL_VER}." + + COMP_MSMTP_NAME="Build msmtp" + COMP_MSMTP_DESC="Install/update msmtp - smtp client for jailed environments." + COMP_MSMTP_VER="Version ${MSMTP_VER}." + + COMP_LUA_NAME="Build lua" + COMP_LUA_DESC="Install/update lua scripting language." + COMP_LUA_VER="Version ${LUA_VER}." + + COMP_SPAMASSASSIN_CRON_NAME="Build SpamAssassin cron." + COMP_SPAMASSASSIN_CRON_DESC="Install SpamAssassin cronjob for periodic rule updates." + + COMP_SUPHP_NAME="Build suPHP" + COMP_SUPHP_DESC="Install/update suPHP." + COMP_SUPHP_VER="Version ${SUPHP_VER}." + + COMP_WEBALIZER_NAME="Build Webalizer" + COMP_WEBALIZER_DESC="Install/update Webalizer." + COMP_WEBALIZER_VER="Version ${WEBALIZER_VER}." + + COMP_PHP_ZEND_NAME="Build Zend Guard loader" + COMP_PHP_ZEND_DESC="Install/update Zend Guard loader." + COMP_PHP_ZEND_VER="" + + COMP_EXIM_CONF_NAME="Update Exim configuration files" + COMP_EXIM_CONF_DESC="Updates Exim configuration files (exim.conf and exim.pl). WARNING: Any customizations done will be lost." + + COMP_DOVECOT_CONF_NAME="Update Dovecot configuration files" + COMP_DOVECOT_CONF_DESC="Updates Dovecot configuration files." + + COMP_BLOCKCRACKING_NAME="Enable BlockCracking" + COMP_BLOCKCRACKING_DESC="Enables BlockCracking for outgoing SPAM mitigation in Exim configuration file (exim.conf). Requires Exim configuration version 4.3 or higher. More information: https://forum.directadmin.com/showthread.php?t=50059." + + COMP_EASY_SPAM_FIGHTER_NAME="Enable Easy Spam Fighter" + COMP_EASY_SPAM_FIGHTER_DESC="Enables Easy Spam Fighter for incoming SPAM mitigation in Exim configuration file (exim.conf). Requires Exim configuration version 4.3 or higher. More information: https://forum.directadmin.com/showthread.php?t=50059." + + COMP_PHP_INI_NAME="Update PHP configuration files" + COMP_PHP_INI_DESC="Updates php.ini configuration files used by PHP. WARNING: Any customizations done will be lost." + + COMP_REWRITE_CONFS_NAME="Rewrite WEB server configuration files" + COMP_REWRITE_CONFS_DESC="Rewrites Apache/Nginx WEB server configuration files (useful when configuration got corrupted or needs to be updated). WARNING: customizations must be present in 'custom/' folder, otherwise they will be lost." + + COMP_SECURE_PHP_NAME="Secure PHP" + COMP_SECURE_PHP_DESC="Disables dangerous PHP functions in php.ini file." + + COMP_LITESPEED_LICENSE_NAME="Update LiceSpeed License" + COMP_LITESPEED_LICENSE_DESC="Updates LiteSpeed license using the serial number provided." + + COMP_LITESPEED_LICENSE_MIGRATE_NAME="Migrate LiteSpeed License" + COMP_LITESPEED_LICENSE_MIGRATE_DESC="Releases LiteSpeed license (equivalent of 'lshttpd -m').." + + COMP_PHPMYADMIN_NAME="Build phpMyAdmin" + COMP_PHPMYADMIN_DESC="Install/update phpMyAdmin WEB MySQL administration tool." + COMP_PHPMYADMIN_VER="Version ${PHPMYADMIN_VER}." + + COMP_ROUNDCUBE_NAME="Build RoundCube" + COMP_ROUNDCUBE_DESC="Install/update RoundCube webmail." + COMP_ROUNDCUBE_VER="Version ${ROUNDCUBE_VER}." + + COMP_CUSTOMBUILD_PLUGIN_NAME="Build CustomBuild plugin" + COMP_CUSTOMBUILD_PLUGIN_DESC="Install/update CustomBuild plugin." + + COMP_SQUIRRELMAIL_NAME="Build SquirrelMail" + COMP_SQUIRRELMAIL_DESC="Install/update SquirrelMail webmail." + COMP_SQUIRRELMAIL_VER="Version ${SQUIRRELMAIL_VER}." + + COMP_CREATE_OPTIONS_NAME="Regenerate options.conf file" + COMP_CREATE_OPTIONS_DESC="Re-create options.conf file by asking questions." + + COMP_CRON_NAME="Enable/update CustomBuild cronjob" + COMP_CRON_DESC="Enables or updates cronjob used by CustomBuild to send notifications to specified email address about the updates, auto-update components." + + COMP_OPT_HELP_NAME="Options.conf help" + COMP_OPT_HELP_DESC="Generates available options that could be used in the options.conf file." + + COMP_OPTIONS_NAME="Display options.conf settings" + COMP_OPTIONS_DESC="Shows current options set in the options.conf file" + + COMP_SET_NAME="Change options.conf setting" + COMP_SET_DESC="Changes value in the options.conf file" + + COMP_SET_FASTEST_NAME="Set fastest download server" + COMP_SET_FASTEST_DESC="Selects the fastest download server to use and sets it in the options.conf file." + + COMP_SET_FASTEST_QUIET_NAME="Set fastest download server (no output)" + COMP_SET_FASTEST_QUIET_DESC="Selects the fastest download server to use and sets it in the options.conf file. Command generates no output." + + COMP_UPDATE_DA_NAME="Update DirectAdmin" + COMP_UPDATE_DA_DESC="Updates DirectAdmin to the latest version." + + COMP_UPDATE_VERSIONS_NAME="Update all components" + COMP_UPDATE_VERSIONS_DESC="Checks what updates are available and applies them." + + COMP_UPDATE_WEBAPPS_NAME="Update WEB applications." + COMP_UPDATE_WEBAPPS_DESC="Updates WEB applications if updates are available (only phpMyAdmin, RoundCube and SquirrelMail)." + + COMP_USED_CONFIGS_NAME="Used configuration files" + COMP_USED_CONFIGS_DESC="Displays full paths to component configuration (./configure) files used by CustomBuild." + + COMP_VERSIONS_NAME="Updates availale" + COMP_VERSIONS_DESC="Shows what updates are available to be applied on the system. Does not update them automatically." + + COMP_VERSION_NAME="CustomBuild version" + COMP_VERSION_DESC="Shows CustomBuild version." + + COMP_LIST_REMOVALS_NAME="List components for removal" + COMP_LIST_REMOVALS_DESC="Lists all components that are available for removal." + + COMP_REMOVE_ITEMS_NAME="Remove not needed components" + COMP_REMOVE_ITEMS_DESC="Removes all components that are available for removal (components that are installed, but not set in options.conf)." + + COMP_ALL_NAME="Build everything" + COMP_ALL_DESC="(Re)installs all components set in the options.conf file" + + COMP_CLEAN_NAME="Clean old directories" + COMP_CLEAN_DESC="Removes not needed folders from CustomBuild directory." + + COMP_CLEAN_OLD_WEBAPPS_NAME="Clean old WEB applications" + COMP_CLEAN_OLD_WEBAPPS_DESC="Removes old WEB applications that are not currently used from /var/www/html directory." + + COMP_UPDATE_NAME="Update CustomBuild script and packages" + COMP_UPDATE_DESC="Updates CustomBuild script, grabs latest versions.txt file and packages." + + COMP_UPDATE_SCRIPT_NAME="Update CustomBuild script" + COMP_UPDATE_SCRIPT_DESC="Updates CustomBuild script only (the 'build' file)." + + COMP_UPDATE_DATA_NAME="Download packages" + COMP_UPDATE_DATA_DESC="Downloads packages needed for the CustomBuild script (does not include versions.txt file or the 'build' file)." + + COMP_PHP_EXPERT_NAME="Install specified PHP version" + COMP_PHP_EXPERT_DESC="Installs specified PHP version, but does not apply any automatic configuration to it." + + COMP_PHP_HTSCANNER2_NAME="Build php_htscanner2" + COMP_PHP_HTSCANNER2_DESC="Install/update php_htscanner2 component used by Apache and PHP." + + COMP_TODOVECOT_NAME="Convert mbox to Maildir" + COMP_TODOVECOT_DESC="Converts all emails from mbox format to Maildir. todovecot() function is called." + + COMP_SET_SERVICE_NAME="Service autostart" + COMP_SET_SERVICE_DESC="Calls set_setvice function with specified ON|OFF|delete values." +} + +generateHelpJSON() { + initJSONVars + echo "{" + if [ "${1}" != "" ]; then + NUM_OF_SECTIONS=1 + HELP_SECTIONS=`echo ${1} | tr "[a-z]" "[A-Z]"` + else + NUM_OF_SECTIONS=`echo ${HELP_SECTIONS} | wc -w` + fi + CUR_SECTION=0 + for section in ${HELP_SECTIONS}; do + CUR_SECTION=`expr ${CUR_SECTION} + 1` + LOWERCASE_SECTION=`echo $section | tr "[A-Z]" "[a-z]"` + SECTION_DESC=${section}_DESC + SECTION_SET=${section}_SET + NUM_OF_SETTINGS=`echo "$(eval_var ${SECTION_SET})" | wc -w` + CUR_SETTING=0 + SKIP_CAT="no" + for skip_cat_opt in ${HELP_SECTIONS_JSON_SKIP}; do + if [ "${section}" = "${skip_cat_opt}" ]; then + SKIP_CAT="yes" + break + fi + done + printf "\t\"${LOWERCASE_SECTION}\": {\n" + printf "\t\t\"description\": \"$(eval_var ${SECTION_DESC})\",\n" + printf "\t\t\"skip\": \"${SKIP_CAT}\",\n" + for setting in $(eval_var ${SECTION_SET}); do + CUR_SETTING=`expr ${CUR_SETTING} + 1` + SETTING_UP=`echo $setting | tr "[a-z]" "[A-Z]"` + + BUILD_NAME="COMP_${SETTING_UP}_NAME" + DESCRIPTION="COMP_${SETTING_UP}_DESC" + VER_VAR="COMP_${SETTING_UP}_VER" + SKIP_VAR="${section}_SKIP" + SKIP="no" + + for skip_opt in $(eval_var ${SKIP_VAR}); do + if [ "${setting}" = "${skip_opt}" ]; then + SKIP="yes" + break + fi + done + + printf "\t\t\"${setting}\": {\n" + printf "\t\t\t\"build\": \"${setting}\",\n" + VERSION_STRING="$(eval_var ${VER_VAR})" + if [ "${section}" = "BUILD_COMP" ] || [ "${section}" = "BUILD_PHP_EXT" ] || [ "${section}" = "BUILD_COMP_WEBAPPS" ]; then + if [ "${VERSION_STRING}" = "Version 0." ]; then + SKIP="yes" + fi + fi + printf "\t\t\t\"skip\": \"${SKIP}\",\n" + printf "\t\t\t\"name\": \"$(eval_var ${BUILD_NAME})\",\n" + if [ "${section}" = "BUILD_COMP" ] || [ "${section}" = "BUILD_PHP_EXT" ] || [ "${section}" = "BUILD_COMP_WEBAPPS" ]; then + if [ "${VERSION_STRING}" != "Version ." ]; then + printf "\t\t\t\"version\": \"$(eval_var ${VER_VAR})\"\n", + fi + fi + printf "\t\t\t\"description\": \"$(eval_var ${DESCRIPTION})\"\n" + if [ ${CUR_SETTING} -ne ${NUM_OF_SETTINGS} ]; then + printf "\t\t},\n" + else + printf "\t\t}\n" + fi + done + if [ ${CUR_SECTION} -ne ${NUM_OF_SECTIONS} ]; then + printf "\t},\n" + else + printf "\t}\n" + fi + done + echo "}" +} + +################################################### + +showHelp() { + printf " +%-55s+\n" "-----------------------------------------------------------" + printf " | %-55s %-2s|\n" "DirectAdmin WebServices Installer" + printf " | %-55s %-2s|\n" "Written by Martynas Bendorius and DirectAdmin" + printf " | %-55s %-2s|\n" "Version: $(showVersion)" + printf " +%-55s+\n" "-----------------------------------------------------------" + printf " | %-55s %-2s|\n" "To build everything run:" + printf " | %-55s %-2s|\n" " $0 all" + printf " | %-55s %-2s|\n" "" + printf " | %-55s %-2s|\n" " ${boldon}NOTE${boldoff}: Command all will compile everything as it is set" + printf " | %-55s %-2s|\n" " in the options.conf file, please take a look at" + printf " | %-55s %-2s|\n" " \"$0 options\"!" + generateHelp + printf " +%-55s+\n" "-----------------------------------------------------------" + printf " | %-55s %-2s|\n" "You can pass a 2nd argument to automate the input:" + printf " | %-55s %-2s|\n" " $0