Skip to content

Commit

Permalink
Merge branch 'master' into change/2879-installation-assistant-must-as…
Browse files Browse the repository at this point in the history
…k-for-confirmation-before-installing-dependencies
  • Loading branch information
davidcr01 committed Jun 17, 2024
2 parents 56a043e + 19a2bff commit b635412
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
16 changes: 12 additions & 4 deletions unattended_installer/common_functions/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ function common_checkInstalled() {
if [ "${sys_type}" == "yum" ]; then
eval "rpm -q wazuh-manager --quiet && wazuh_installed=1"
elif [ "${sys_type}" == "apt-get" ]; then
wazuh_installed=$(apt list --installed 2>/dev/null | grep wazuh-manager)
if dpkg -l wazuh-manager 2>/dev/null | grep -q -E '^ii\s'; then
wazuh_installed=1
fi
fi

if [ -d "/var/ossec" ]; then
Expand All @@ -103,7 +105,9 @@ function common_checkInstalled() {
eval "rpm -q wazuh-indexer --quiet && indexer_installed=1"

elif [ "${sys_type}" == "apt-get" ]; then
indexer_installed=$(apt list --installed 2>/dev/null | grep wazuh-indexer)
if dpkg -l wazuh-indexer 2>/dev/null | grep -q -E '^ii\s'; then
indexer_installed=1
fi
fi

if [ -d "/var/lib/wazuh-indexer/" ] || [ -d "/usr/share/wazuh-indexer" ] || [ -d "/etc/wazuh-indexer" ] || [ -f "${base_path}/search-guard-tlstool*" ]; then
Expand All @@ -114,7 +118,9 @@ function common_checkInstalled() {
if [ "${sys_type}" == "yum" ]; then
eval "rpm -q filebeat --quiet && filebeat_installed=1"
elif [ "${sys_type}" == "apt-get" ]; then
filebeat_installed=$(apt list --installed 2>/dev/null | grep filebeat)
if dpkg -l filebeat 2>/dev/null | grep -q -E '^ii\s'; then
filebeat_installed=1
fi
fi

if [ -d "/var/lib/filebeat/" ] || [ -d "/usr/share/filebeat" ] || [ -d "/etc/filebeat" ]; then
Expand All @@ -125,7 +131,9 @@ function common_checkInstalled() {
if [ "${sys_type}" == "yum" ]; then
eval "rpm -q wazuh-dashboard --quiet && dashboard_installed=1"
elif [ "${sys_type}" == "apt-get" ]; then
dashboard_installed=$(apt list --installed 2>/dev/null | grep wazuh-dashboard)
if dpkg -l wazuh-dashboard 2>/dev/null | grep -q -E '^ii\s'; then
dashboard_installed=1
fi
fi

if [ -d "/var/lib/wazuh-dashboard/" ] || [ -d "/usr/share/wazuh-dashboard" ] || [ -d "/etc/wazuh-dashboard" ] || [ -d "/run/wazuh-dashboard/" ]; then
Expand Down
4 changes: 2 additions & 2 deletions unattended_installer/install_functions/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@ function checks_firewall(){
eval "rpm -q firewalld --quiet && firewalld_installed=1"
eval "rpm -q ufw --quiet && ufw_installed=1"
elif [ "${sys_type}" == "apt-get" ]; then
if apt list --installed 2>/dev/null | grep -q -E ^"firewalld"\/; then
if dpkg -l "firewalld" 2>/dev/null | grep -q -E '^ii\s'; then
firewalld_installed=1
fi
if apt list --installed 2>/dev/null | grep -q -E ^"ufw"\/; then
if dpkg -l "ufw" 2>/dev/null | grep -q -E '^ii\s'; then
ufw_installed=1
fi
fi
Expand Down
8 changes: 4 additions & 4 deletions unattended_installer/install_functions/installCommon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ function installCommon_rollBack() {
elif [ "${sys_type}" == "apt-get" ]; then
common_checkAptLock
eval "apt-get remove --purge wazuh-manager -y ${debug}"
eval "apt list --installed 2>/dev/null | grep wazuh-manager"
eval "dpkg -l wazuh-manager 2>/dev/null | grep -E '^ii\s'"
fi

manager_installed=${PIPESTATUS[0]}
Expand Down Expand Up @@ -592,7 +592,7 @@ function installCommon_rollBack() {
elif [ "${sys_type}" == "apt-get" ]; then
common_checkAptLock
eval "apt-get remove --purge wazuh-indexer -y ${debug}"
eval "apt list --installed 2>/dev/null | grep wazuh-indexer"
eval "dpkg -l wazuh-indexer 2>/dev/null | grep -E '^ii\s'"
fi

indexer_installed=${PIPESTATUS[0]}
Expand Down Expand Up @@ -621,7 +621,7 @@ function installCommon_rollBack() {
elif [ "${sys_type}" == "apt-get" ]; then
common_checkAptLock
eval "apt-get remove --purge filebeat -y ${debug}"
eval "apt list --installed 2>/dev/null | grep filebeat"
eval "dpkg -l filebeat 2>/dev/null | grep -E '^ii\s'"
fi

filebeat_installed=${PIPESTATUS[0]}
Expand Down Expand Up @@ -650,7 +650,7 @@ function installCommon_rollBack() {
elif [ "${sys_type}" == "apt-get" ]; then
common_checkAptLock
eval "apt-get remove --purge wazuh-dashboard -y ${debug}"
eval "apt list --installed 2>/dev/null | grep wazuh-dashboard"
eval "dpkg -l wazuh-dashboard 2>/dev/null | grep -E '^ii\s'"
fi

dashboard_installed=${PIPESTATUS[0]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function offline_checkDependencies() {
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}"\/"
eval "dpkg -l "${dep}" 2>/dev/null | grep -q -E '^ii\s'"
fi

if [ "${PIPESTATUS[0]}" != 0 ]; then
Expand Down

0 comments on commit b635412

Please sign in to comment.