Skip to content

Commit

Permalink
Get version when checking if componets are installed
Browse files Browse the repository at this point in the history
  • Loading branch information
DFolchA committed Nov 30, 2022
1 parent 343a835 commit c2f1334
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions unattended_installer/common_functions/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,39 +68,39 @@ function common_checkInstalled() {
dashboard_installed=""

if [ "${sys_type}" == "yum" ]; then
wazuh_installed=$(yum list installed 2>/dev/null | grep wazuh-manager)
wazuh_installed=$(yum list installed 2>/dev/null | grep wazuh-manager | sed 's/ */ /g'| cut -d' ' -f2 | sed "s/-.*//g")
elif [ "${sys_type}" == "apt-get" ]; then
wazuh_installed=$(apt list --installed 2>/dev/null | grep wazuh-manager)
wazuh_installed=$(apt list --installed 2>/dev/null | grep wazuh-manager | cut -d' ' -f2 | sed -e "s/-.*//")
fi

if [ -d "/var/ossec" ]; then
wazuh_remaining_files=1
fi

if [ "${sys_type}" == "yum" ]; then
indexer_installed=$(yum list installed 2>/dev/null | grep wazuh-indexer)
indexer_installed=$(yum list installed 2>/dev/null | grep wazuh-indexer | sed 's/ */ /g'| cut -d' ' -f2 | sed "s/-.*//g")
elif [ "${sys_type}" == "apt-get" ]; then
indexer_installed=$(apt list --installed 2>/dev/null | grep wazuh-indexer)
indexer_installed=$(apt list --installed 2>/dev/null | grep wazuh-indexer | cut -d' ' -f2 | sed -e "s/-.*//")
fi

if [ -d "/var/lib/wazuh-indexer/" ] || [ -d "/usr/share/wazuh-indexer" ] || [ -d "/etc/wazuh-indexer" ] || [ -f "${base_path}/search-guard-tlstool*" ]; then
indexer_remaining_files=1
fi

if [ "${sys_type}" == "yum" ]; then
filebeat_installed=$(yum list installed 2>/dev/null | grep filebeat)
filebeat_installed=$(yum list installed 2>/dev/null | grep filebeat | sed 's/ */ /g'| cut -d' ' -f2 | sed "s/-.*//g")
elif [ "${sys_type}" == "apt-get" ]; then
filebeat_installed=$(apt list --installed 2>/dev/null | grep filebeat)
filebeat_installed=$(apt list --installed 2>/dev/null | grep filebeat | cut -d' ' -f2 | sed -e "s/-.*//")
fi

if [ -d "/var/lib/filebeat/" ] || [ -d "/usr/share/filebeat" ] || [ -d "/etc/filebeat" ]; then
filebeat_remaining_files=1
fi

if [ "${sys_type}" == "yum" ]; then
dashboard_installed=$(yum list installed 2>/dev/null | grep wazuh-dashboard)
dashboard_installed=$(yum list installed 2>/dev/null | grep wazuh-dashboard | sed 's/ */ /g'| cut -d' ' -f2 | sed "s/-.*//g")
elif [ "${sys_type}" == "apt-get" ]; then
dashboard_installed=$(apt list --installed 2>/dev/null | grep wazuh-dashboard)
dashboard_installed=$(apt list --installed 2>/dev/null | grep wazuh-dashboard | cut -d' ' -f2 | sed -e "s/-.*//")
fi

if [ -d "/var/lib/wazuh-dashboard/" ] || [ -d "/usr/share/wazuh-dashboard" ] || [ -d "/etc/wazuh-dashboard" ] || [ -d "/run/wazuh-dashboard/" ]; then
Expand Down

0 comments on commit c2f1334

Please sign in to comment.