From 628b208c64521210b192eb66d31845352161de7e Mon Sep 17 00:00:00 2001 From: Manuel Date: Thu, 25 Jul 2024 14:28:45 +0200 Subject: [PATCH] fix: addressed requested changes and removed deprecated installation scripts --- packages/debs/SPECS/wazuh-agent/debian/prerm | 2 -- .../debs/SPECS/wazuh-manager/debian/preinst | 2 +- packages/macos/package_files/preinstall.sh | 7 +++++++ packages/rpms/SPECS/wazuh-manager.spec | 4 ++-- src/init/inst-functions.sh | 21 ++----------------- 5 files changed, 12 insertions(+), 24 deletions(-) diff --git a/packages/debs/SPECS/wazuh-agent/debian/prerm b/packages/debs/SPECS/wazuh-agent/debian/prerm index 90ae0dea015..61c85044523 100644 --- a/packages/debs/SPECS/wazuh-agent/debian/prerm +++ b/packages/debs/SPECS/wazuh-agent/debian/prerm @@ -46,9 +46,7 @@ case "$1" in ;; failed-upgrade) - if [ -f ]; then - fi ;; *) diff --git a/packages/debs/SPECS/wazuh-manager/debian/preinst b/packages/debs/SPECS/wazuh-manager/debian/preinst index bcc1d9cfb7a..ce365ec8fea 100644 --- a/packages/debs/SPECS/wazuh-manager/debian/preinst +++ b/packages/debs/SPECS/wazuh-manager/debian/preinst @@ -46,7 +46,7 @@ case "$1" in if [ -f /etc/ossec-init.conf ]; then . /etc/ossec-init.conf else - VERSION=$(${DIR}/bin/wazuh-control info -v) + VERSION=$(${DIR}/bin/wazuh-control info -v) fi # Get the major and minor version diff --git a/packages/macos/package_files/preinstall.sh b/packages/macos/package_files/preinstall.sh index d9f952749e6..f115bdb08d7 100755 --- a/packages/macos/package_files/preinstall.sh +++ b/packages/macos/package_files/preinstall.sh @@ -35,6 +35,7 @@ if [ -d "${DIR}" ]; then ======= touch "${DIR}/WAZUH_PKG_UPGRADE" upgrade="true" +<<<<<<< HEAD if | grep "is running" > /dev/null 2>&1; then >>>>>>> 058865e67c (refactor: removed references to deprecated daemons in packages files) @@ -46,6 +47,9 @@ if [ -d "${DIR}" ]; then ${DIR}/bin/ossec-control stop restart="true" fi +======= +fi +>>>>>>> cff2779e10 (fix: addressed requested changes and removed deprecated installation scripts) <<<<<<< HEAD ======= @@ -112,6 +116,7 @@ if [[ ${new_uid} != ${new_gid} ]] exit 5; fi +<<<<<<< HEAD <<<<<<< HEAD ======= # Stops the agent before upgrading it @@ -120,6 +125,8 @@ elif [ -f ]; then fi >>>>>>> 058865e67c (refactor: removed references to deprecated daemons in packages files) +======= +>>>>>>> cff2779e10 (fix: addressed requested changes and removed deprecated installation scripts) # Creating the group echo "Checking group..." if [[ $(dscl . -read /Groups/wazuh) ]] diff --git a/packages/rpms/SPECS/wazuh-manager.spec b/packages/rpms/SPECS/wazuh-manager.spec index 4266592f015..bd52715dab8 100644 --- a/packages/rpms/SPECS/wazuh-manager.spec +++ b/packages/rpms/SPECS/wazuh-manager.spec @@ -263,7 +263,7 @@ if [ $1 = 2 ]; then . %{_sysconfdir}/ossec-init.conf else # Ask wazuh-control the version - VERSION=$() + VERSION=$(%{_localstatedir}/bin/wazuh-control info -v) fi # Get the major and minor version @@ -293,7 +293,7 @@ fi %post -echo "VERSION=\"$()\"" > /etc/ossec-init.conf +echo "VERSION=\"$(%{_localstatedir}/bin/wazuh-control info -v)\"" > /etc/ossec-init.conf # Upgrade install code block if [ $1 = 2 ]; then diff --git a/src/init/inst-functions.sh b/src/init/inst-functions.sh index da56de01a57..ea62ed114db 100644 --- a/src/init/inst-functions.sh +++ b/src/init/inst-functions.sh @@ -752,25 +752,8 @@ InstallCommon() WAZUH_GROUP='wazuh' WAZUH_USER='wazuh' INSTALL="install" - - if [ ${INSTYPE} = 'server' ]; then - OSSEC_CONTROL_SRC='./init/wazuh-server.sh' - OSSEC_CONF_SRC='../etc/ossec-server.conf' - elif [ ${INSTYPE} = 'agent' ]; then - OSSEC_CONTROL_SRC='./init/wazuh-client.sh' - OSSEC_CONF_SRC='../etc/ossec-agent.conf' - elif [ ${INSTYPE} = 'local' ]; then - OSSEC_CONTROL_SRC='./init/wazuh-local.sh' - OSSEC_CONF_SRC='../etc/ossec-local.conf' - fi - - if [ ${DIST_NAME} = "sunos" ]; then - INSTALL="ginstall" - elif [ ${DIST_NAME} = "HP-UX" ]; then - INSTALL="/usr/local/coreutils/bin/install" - elif [ ${DIST_NAME} = "AIX" ]; then - INSTALL="/opt/freeware/bin/install" - fi + OSSEC_CONTROL_SRC='./init/wazuh-server.sh' + OSSEC_CONF_SRC='../etc/ossec-server.conf' ./init/adduser.sh ${WAZUH_USER} ${WAZUH_GROUP} ${INSTALLDIR}