diff --git a/CHANGELOG.md b/CHANGELOG.md index 853148f..f16cf6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ### Changed +- Deleted the offline_checkDependencies function and unified logic in offline_checkPrerequisites function. ([#99](https://github.com/wazuh/wazuh-installation-assistant/pull/99)) - Add input for wazuh installation assistant reference in workflows. ([#98](https://github.com/wazuh/wazuh-installation-assistant/pull/98)) - Create GHA workflow to build Wazuh Installation Assistant files. ([#77](https://github.com/wazuh/wazuh-installation-assistant/pull/77)) - Installation assistant distributed test rework and migration. ([#60](https://github.com/wazuh/wazuh-installation-assistant/pull/60)) diff --git a/install_functions/installMain.sh b/install_functions/installMain.sh index bc5a8a8..1e27b85 100755 --- a/install_functions/installMain.sh +++ b/install_functions/installMain.sh @@ -123,7 +123,7 @@ function main() { bucket="packages-dev.wazuh.com" repository="${devrepo}" ;; - + "-fd"|"--force-install-dashboard") force=1 shift 1 @@ -257,7 +257,7 @@ function main() { if [ -z "${uninstall}" ] && [ -z "${offline_install}" ]; then installCommon_installCheckDependencies elif [ -n "${offline_install}" ]; then - offline_checkDependencies + offline_checkPrerequisites "wia_offline_dependencies" "${wia_offline_dependencies[@]}" fi common_checkInstalled diff --git a/install_functions/installVariables.sh b/install_functions/installVariables.sh index 2427ca4..2f1b7ab 100644 --- a/install_functions/installVariables.sh +++ b/install_functions/installVariables.sh @@ -72,4 +72,5 @@ readonly indexer_yum_dependencies=( coreutils ) readonly indexer_apt_dependencies=( debconf adduser procps gnupg apt-transport-https ) readonly dashboard_yum_dependencies=( libcap ) readonly dashboard_apt_dependencies=( debhelper tar curl libcap2-bin gnupg apt-transport-https ) +readonly wia_offline_dependencies=( curl tar gnupg openssl lsof ) wia_dependencies_installed=() diff --git a/install_functions/wazuh-offline-installation.sh b/install_functions/wazuh-offline-installation.sh index 5892202..86457f0 100644 --- a/install_functions/wazuh-offline-installation.sh +++ b/install_functions/wazuh-offline-installation.sh @@ -8,46 +8,34 @@ # License (version 2) as published by the FSF - Free Software # Foundation. -# Checks the necessary dependencies for the installation -function offline_checkDependencies() { - - dependencies=( curl tar gnupg openssl lsof ) - - common_logger "Checking installed dependencies for Offline installation." - for dep in "${dependencies[@]}"; do - if [ "${sys_type}" == "yum" ]; then - eval "yum list installed 2>/dev/null | grep -q -E ^"${dep}"\\." - elif [ "${sys_type}" == "apt-get" ]; then - eval "apt list --installed 2>/dev/null | grep -q -E ^"${dep}"\/" - fi - - if [ "${PIPESTATUS[0]}" != 0 ]; then - common_logger -e "${dep} is necessary for the offline installation." - exit 1 - fi - done - common_logger -d "Offline dependencies are installed." - -} - # Checks the necessary packages needed for a Wazuh component function offline_checkPrerequisites(){ - dependencies=("$@") - common_logger "Checking prerequisites for Offline installation." + dependencies=( "${@}" ) + if [ $1 == "wia_offline_dependencies" ]; then + dependencies=( "${@:2}" ) + common_logger "Checking dependencies for Wazuh installation assistant." + else + common_logger "Checking prerequisites for Offline installation." + fi + for dep in "${dependencies[@]}"; do if [ "${sys_type}" == "yum" ]; then eval "yum list installed 2>/dev/null | grep -q -E ^"${dep}"\\." elif [ "${sys_type}" == "apt-get" ]; then eval "apt list --installed 2>/dev/null | grep -q -E ^"${dep}"\/" fi - + if [ "${PIPESTATUS[0]}" != 0 ]; then common_logger -e "${dep} is necessary for the offline installation." exit 1 fi done - common_logger -d "Offline prerequisites are installed." + if [ $1 == "wia_offline_dependencies" ]; then + common_logger -d "Dependencies for Wazuh installation assistant are installed." + else + common_logger -d "Prerequisites for Offline installation are installed." + fi } # Checks the necessary files for the installation @@ -85,7 +73,7 @@ function offline_extractFiles() { "${offline_files_path}/wazuh-filebeat-*.tar.gz" "${offline_files_path}/wazuh-template.json" ) - + if [ "${sys_type}" == "apt-get" ]; then required_files+=("${offline_packages_path}/filebeat-oss-*.deb" "${offline_packages_path}/wazuh-dashboard_*.deb" "${offline_packages_path}/wazuh-indexer_*.deb" "${offline_packages_path}/wazuh-manager_*.deb") elif [ "${sys_type}" == "rpm" ]; then @@ -120,5 +108,5 @@ function offline_importGPGKey() { fi eval "chmod 644 ${offline_files_path}/GPG-KEY-WAZUH ${debug}" fi - + }