From c2f13343eaba2687cbf4356b33b590987a5a02db Mon Sep 17 00:00:00 2001 From: DFolchA Date: Wed, 30 Nov 2022 17:36:20 +0100 Subject: [PATCH] Get version when checking if componets are installed --- unattended_installer/common_functions/common.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/unattended_installer/common_functions/common.sh b/unattended_installer/common_functions/common.sh index b38315b781..b0aa687940 100644 --- a/unattended_installer/common_functions/common.sh +++ b/unattended_installer/common_functions/common.sh @@ -68,9 +68,9 @@ 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 @@ -78,9 +78,9 @@ function common_checkInstalled() { 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 @@ -88,9 +88,9 @@ function common_checkInstalled() { 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 @@ -98,9 +98,9 @@ function common_checkInstalled() { 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