diff --git a/dapostinstall.sh b/dapostinstall.sh index 329ed4a..a113039 100755 --- a/dapostinstall.sh +++ b/dapostinstall.sh @@ -16,6 +16,7 @@ DEFAULT_NS1=dns3.hitme.net.pl DEFAULT_NS2=dns4.hitme.net.pl SSH_PORT=10022 REDIS_VERSION=8 +HOSTNAME_SSL=1 SETUP_TXT="$DADIR/conf/setup.txt" PLUGIN_ARCHIVE_DIR="$DAPOSTINSTALL_DIR/plugins" BRANDING_DIR="$DAPOSTINSTALL_DIR/branding" @@ -50,11 +51,9 @@ configure_custombuild_php() { release_var="php${idx}_release" release="${!release_var}" da build set "php${idx}_release" "$release" - if [[ "$release" != "no" ]]; then - da build set "php${idx}_mode" "php-fpm" - fi done + da build set "php1_mode" "php-fpm" da build php da build rewrite_confs } @@ -134,6 +133,11 @@ install_local_plugins() { } request_directadmin_certificate() { + if [[ "$HOSTNAME_SSL" == "0" ]]; then + echo "HOSTNAME_SSL=0 - pomijam certyfikat Let's Encrypt dla hostname DirectAdmin" + return 0 + fi + echo "Instalacja certyfikatu Let's Encrypt dla hostname DirectAdmin" if ! "$DADIR/scripts/letsencrypt.sh" server_cert; then diff --git a/tests/quality_checks.sh b/tests/quality_checks.sh index 0b5eaec..f040f98 100644 --- a/tests/quality_checks.sh +++ b/tests/quality_checks.sh @@ -103,6 +103,7 @@ assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^DEFAULT_NS1=dns3\.hitme\.net assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^DEFAULT_NS2=dns4\.hitme\.net\.pl$' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^SSH_PORT=10022$' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^REDIS_VERSION=8$' +assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^HOSTNAME_SSL=1$' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^PLUGIN_ARCHIVE_DIR="\$DAPOSTINSTALL_DIR/plugins"$' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^BRANDING_DIR="\$DAPOSTINSTALL_DIR/branding"$' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^DA_TEMPLATES_ARCHIVE="\$BRANDING_DIR/da_templates\.tar"$' @@ -110,6 +111,9 @@ assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^DA_BRANDING_ARCHIVE="\$BRAND assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^php1_release=' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^php2_release=' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^php9_release=' +assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build set "php1_mode" "php-fpm"' +assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'php\$?\{?idx\}?_mode' +assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'php[2-9]_mode' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^ioncube=yes$' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^zend=yes$' assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^opcache=yes$' @@ -143,7 +147,8 @@ assert_file_contains "$ROOT_DIR/dapostinstall.sh" '^configure_custombuild_php\(\ assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'release_var="php\$\{idx\}_release"' assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'release="\$\{!release_var\}"' assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build set "php\$\{idx\}_release" "\$release"' -assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build set "php\$\{idx\}_mode" "php-fpm"' +assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build set "php1_mode" "php-fpm"' +assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'da build set "php\$\{idx\}_mode"' assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build php' assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'da build rewrite_confs' assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'eximconf_release' @@ -175,6 +180,8 @@ assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'Jaka skorke ustawic' assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'Wybierz tryb instalacji' assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" "s/evolution/enhanced" assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'request_directadmin_certificate\(\)' +assert_file_contains "$ROOT_DIR/dapostinstall.sh" '\[\[ "\$HOSTNAME_SSL" == "0" \]\]' +assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'HOSTNAME_SSL=0 - pomijam certyfikat' assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'letsencrypt\.sh" server_cert' assert_file_contains "$ROOT_DIR/dapostinstall.sh" 'Nie udalo sie wystawic certyfikatu DirectAdmin' assert_file_not_contains "$ROOT_DIR/dapostinstall.sh" 'request_single "\$da_hostname" 4096'