Skip to content

Commit

Permalink
Merge pull request #2790 from wazuh/enhancement/2688-support-al-2023
Browse files Browse the repository at this point in the history
Added support for AL2023 in WIA
  • Loading branch information
teddytpc1 authored Jan 25, 2024
2 parents 4790424 + 2f8704e commit 0bdc5d8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 21 deletions.
15 changes: 15 additions & 0 deletions unattended_installer/install_functions/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ function check_dist() {
[ "${DIST_VER}" != "2018.03" ]; then
notsupported=1
fi
if [ "${DIST_VER}" -eq "2023" ]; then
checks_specialDepsAL2023
fi
fi

if [ "${DIST_NAME}" == "ubuntu" ]; then
Expand Down Expand Up @@ -344,6 +347,18 @@ function checks_previousCertificate() {
fi
}

# Manages the special dependencies in case of AL2023
function checks_specialDepsAL2023() {

# Change curl for curl-minimal
wia_yum_dependencies=( "${wia_yum_dependencies[@]/curl/curl-minimal}" )

# In containers, coreutils is replaced for coreutils-single
if [ -f "/.dockerenv" ]; then
wia_yum_dependencies=( "${wia_yum_dependencies[@]/coreutils/coreutils-single}" )
fi
}

function checks_specifications() {

cores=$(grep -c processor /proc/cpuinfo)
Expand Down
36 changes: 20 additions & 16 deletions unattended_installer/install_functions/installCommon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -812,14 +812,16 @@ function installCommon_yumRemoveWIADependencies(){
if [ "${#wia_dependencies_installed[@]}" -gt 0 ]; then
common_logger "--- Dependencies ---"
for dep in "${wia_dependencies_installed[@]}"; do
common_logger "Removing $dep."
yum_output=$(yum remove ${dep} -y 2>&1)
yum_code="${PIPESTATUS[0]}"

eval "echo \${yum_output} ${debug}"
if [ "${yum_code}" != 0 ]; then
common_logger -e "Cannot remove dependency: ${dep}."
exit 1
if [ "${dep}" != "systemd" ]; then
common_logger "Removing $dep."
yum_output=$(yum remove ${dep} -y 2>&1)
yum_code="${PIPESTATUS[0]}"

eval "echo \${yum_output} ${debug}"
if [ "${yum_code}" != 0 ]; then
common_logger -e "Cannot remove dependency: ${dep}."
exit 1
fi
fi
done
fi
Expand All @@ -831,14 +833,16 @@ function installCommon_aptRemoveWIADependencies(){
if [ "${#wia_dependencies_installed[@]}" -gt 0 ]; then
common_logger "--- Dependencies ----"
for dep in "${wia_dependencies_installed[@]}"; do
common_logger "Removing $dep."
apt_output=$(apt-get remove --purge ${dep} -y 2>&1)
apt_code="${PIPESTATUS[0]}"

eval "echo \${apt_output} ${debug}"
if [ "${apt_code}" != 0 ]; then
common_logger -e "Cannot remove dependency: ${dep}."
exit 1
if [ "${dep}" != "systemd" ]; then
common_logger "Removing $dep."
apt_output=$(apt-get remove --purge ${dep} -y 2>&1)
apt_code="${PIPESTATUS[0]}"

eval "echo \${apt_output} ${debug}"
if [ "${apt_code}" != 0 ]; then
common_logger -e "Cannot remove dependency: ${dep}."
exit 1
fi
fi
done
fi
Expand Down
8 changes: 4 additions & 4 deletions unattended_installer/install_functions/installMain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,16 @@ function main() {

common_checkSystem

if [ -z "${download}" ]; then
check_dist
fi

if [ -z "${uninstall}" ] && [ -z "${offline_install}" ]; then
installCommon_installCheckDependencies
elif [ -n "${offline_install}" ]; then
offline_checkDependencies
fi

if [ -z "${download}" ]; then
check_dist
fi

common_checkInstalled
checks_arguments
if [ -n "${uninstall}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion unattended_installer/install_functions/installVariables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ wazuh_aio_ports=( 9200 9300 1514 1515 1516 55000 "${http_port}")
readonly wazuh_indexer_ports=( 9200 9300 )
readonly wazuh_manager_ports=( 1514 1515 1516 55000 )
wazuh_dashboard_port="${http_port}"
readonly wia_yum_dependencies=( systemd grep tar coreutils sed procps-ng gawk lsof curl openssl )
wia_yum_dependencies=( systemd grep tar coreutils sed procps-ng gawk lsof curl openssl )
readonly wia_apt_dependencies=( systemd grep tar coreutils sed procps gawk lsof curl openssl )
readonly wazuh_yum_dependencies=( libcap )
readonly wazuh_apt_dependencies=( apt-transport-https libcap2-bin software-properties-common gnupg )
Expand Down

0 comments on commit 0bdc5d8

Please sign in to comment.