Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted the offline_checkDependencies function and unified logic in offline_checkPrerequisites function #99

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions install_functions/installMain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function main() {
bucket="packages-dev.wazuh.com"
repository="${devrepo}"
;;

"-fd"|"--force-install-dashboard")
force=1
shift 1
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions install_functions/installVariables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=()
44 changes: 16 additions & 28 deletions install_functions/wazuh-offline-installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -120,5 +108,5 @@ function offline_importGPGKey() {
fi
eval "chmod 644 ${offline_files_path}/GPG-KEY-WAZUH ${debug}"
fi

}
Loading