diff --git a/unattended_installer/install_functions/dashboard.sh b/unattended_installer/install_functions/dashboard.sh index 2e22db640a..c4ddca66a1 100644 --- a/unattended_installer/install_functions/dashboard.sh +++ b/unattended_installer/install_functions/dashboard.sh @@ -216,32 +216,3 @@ function dashboard_install() { fi } - -function dashboard_installReportDependencies() { - - # Flags that indicates that is an optional installation. - optional_installation=1 - report_dependencies=1 - - installCommon_checkChromium - - if [ "${sys_type}" == "yum" ]; then - dashboard_dependencies+=( nss xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc fontconfig freetype ) - installCommon_yumInstallList "${dashboard_dependencies[@]}" - - # In RHEL cases, remove the CentOS repositories configuration - if [ "${centos_repos_configured}" == 1 ]; then - installCommon_removeCentOSrepositories - fi - - elif [ "${sys_type}" == "apt-get" ]; then - dashboard_dependencies+=( libnss3-dev fonts-liberation libfontconfig1 ) - installCommon_aptInstallList "${dashboard_dependencies[@]}" - fi - - if [ "${pdf_warning}" == 1 ]; then - common_logger -w "Wazuh dashboard dependencies skipped. PDF report generation may not work." - fi - optional_installation=0 - -} diff --git a/unattended_installer/install_functions/installCommon.sh b/unattended_installer/install_functions/installCommon.sh index b5873bfc51..b49e13e7b6 100644 --- a/unattended_installer/install_functions/installCommon.sh +++ b/unattended_installer/install_functions/installCommon.sh @@ -134,7 +134,8 @@ function installCommon_aptInstallList(){ common_logger "Installing $dep." installCommon_aptInstall "${dep}" if [ "${install_result}" != 0 ]; then - installCommon_checkOptionalInstallation + common_logger -e "Cannot install dependency: ${dep}." + exit 1 fi done fi @@ -173,20 +174,6 @@ function installCommon_changePasswordApi() { } -function installCommon_checkOptionalInstallation() { - - if [ "${optional_installation}" != 1 ]; then - common_logger -e "Cannot install dependency: ${dep}." - exit 1 - else - common_logger -w "Cannot install optional dependency: ${dep}." - if [ "${report_dependencies}" == 1 ]; then - pdf_warning=1 - fi - fi - -} - function installCommon_createCertificates() { if [ -n "${AIO}" ]; then @@ -292,37 +279,7 @@ function installCommon_changePasswords() { } -function installCommon_checkChromium() { - - if [ "${sys_type}" == "yum" ]; then - if (! yum list installed 2>/dev/null | grep -q -E ^"google-chrome-stable"\\.) && (! yum list installed 2>/dev/null | grep -q -E ^"chromium"\\.); then - if [ "${DIST_NAME}" == "amzn" ]; then - installCommon_installChrome - elif [[ "${DIST_NAME}" == "centos" ]] && [[ "${DIST_VER}" == "7" ]]; then - installCommon_installChrome - elif [[ "${DIST_NAME}" == "rhel" ]] && [[ "${DIST_VER}" == "8" || "${DIST_VER}" == "9" ]]; then - installCommon_configureCentOSRepositories - dashboard_dependencies=(chromium) - else - dashboard_dependencies=(chromium) - fi - fi - - elif [ "${sys_type}" == "apt-get" ]; then - if (! apt list --installed 2>/dev/null | grep -q -E ^"google-chrome-stable"\/) && (! apt list --installed 2>/dev/null | grep -q -E ^"chromium-browser"\/); then - - # Report generation doesn't work with Chromium in Ubuntu 22 and Ubuntu 20 - if [[ "${DIST_NAME}" == "ubuntu" ]] && [[ "${DIST_VER}" == "22" || "${DIST_VER}" == "20" || "${DIST_VER}" == "18" ]]; then - installCommon_installChrome - else - dashboard_dependencies=(chromium-browser) - fi - fi - fi - -} - -# Adds the CentOS repository to install the dashboard dependencies. +# Adds the CentOS repository to install lsof. function installCommon_configureCentOSRepositories() { centos_repos_configured=1 @@ -390,8 +347,16 @@ function installCommon_installCheckDependencies() { if [ "${sys_type}" == "yum" ]; then dependencies=( systemd grep tar coreutils sed procps-ng gawk lsof curl openssl ) + if [[ "${DIST_NAME}" == "rhel" ]] && [[ "${DIST_VER}" == "8" || "${DIST_VER}" == "9" ]]; then + installCommon_configureCentOSRepositories + fi installCommon_yumInstallList "${dependencies[@]}" + # In RHEL cases, remove the CentOS repositories configuration + if [ "${centos_repos_configured}" == 1 ]; then + installCommon_removeCentOSrepositories + fi + elif [ "${sys_type}" == "apt-get" ]; then eval "apt-get update -q ${debug}" dependencies=( systemd grep tar coreutils sed procps gawk lsof curl openssl ) @@ -400,32 +365,6 @@ function installCommon_installCheckDependencies() { } -function installCommon_installChrome() { - - dep="chrome" - common_logger "Installing ${dep}." - - if [ "${sys_type}" == "yum" ]; then - chrome_package="/tmp/wazuh-install-files/chrome.rpm" - common_curl -so "${chrome_package}" https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm --max-time 100 --retry 5 --retry-delay 5 --fail - eval "yum install ${chrome_package} -y ${debug}" - - if [ "${PIPESTATUS[0]}" != 0 ]; then - installCommon_checkOptionalInstallation - fi - - elif [ "${sys_type}" == "apt-get" ]; then - chrome_package="/tmp/wazuh-install-files/chrome.deb" - common_curl -so "${chrome_package}" https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb --max-time 100 --retry 5 --retry-delay 5 --fail - installCommon_aptInstall "${chrome_package}" - - if [ "${install_result}" != 0 ]; then - installCommon_checkOptionalInstallation - fi - fi - -} - function installCommon_installPrerequisites() { if [ "${sys_type}" == "yum" ]; then @@ -576,7 +515,7 @@ function installCommon_restoreWazuhrepo() { } function installCommon_removeCentOSrepositories() { - + eval "rm -f ${centos_repo} ${debug}" eval "rm -f ${centos_key} ${debug}" eval "yum clean all ${debug}" @@ -765,7 +704,8 @@ function installCommon_yumInstallList(){ eval "echo \${yum_output} ${debug}" if [ "${yum_code}" != 0 ]; then - installCommon_checkOptionalInstallation + common_logger -e "Cannot install dependency: ${dep}." + exit 1 fi done fi diff --git a/unattended_installer/install_functions/installMain.sh b/unattended_installer/install_functions/installMain.sh index 9cd6f4a213..1539bfc648 100755 --- a/unattended_installer/install_functions/installMain.sh +++ b/unattended_installer/install_functions/installMain.sh @@ -217,10 +217,6 @@ function main() { common_checkSystem - if [ -z "${uninstall}" ]; then - installCommon_installCheckDependencies - fi - if [ -z "${download}" ]; then check_dist fi @@ -321,7 +317,6 @@ function main() { if [ -n "${dashboard}" ]; then common_logger "--- Wazuh dashboard ----" - dashboard_installReportDependencies dashboard_install dashboard_configure installCommon_startService "wazuh-dashboard" @@ -361,7 +356,6 @@ function main() { filebeat_configure installCommon_startService "filebeat" common_logger "--- Wazuh dashboard ---" - dashboard_installReportDependencies dashboard_install dashboard_configure installCommon_startService "wazuh-dashboard"