In this PR, the paths of the package have been modified to comply with the expected scaffolding for the Wazuh agent.
The new paths are the ones written in the issue:
242
In addition, some SPECS have been modified so that it doesn't fail to uninstall the agent if the agent is not running.
And so that the binary always finds its respective libraries.
DEB
# Install
```bash
dpkg -i wazuh-agent_5.0.0-0_amd64_c49b9c862.deb
Selecting previously unselected package wazuh-agent.
(Reading database ... 4381 files and directories currently installed.)
Preparing to unpack wazuh-agent_5.0.0-0_amd64_c49b9c862.deb ...
+ export INSTALLATION_WAZUH_DIR=/opt/wazuh-agent
+ BINARY_DIR=/usr/share/wazuh-agent/bin/
+ WAZUH_TMP_DIR=/opt/wazuh-agent/tmp
+ [ ! -d /opt/wazuh-agent/tmp ]
+ mkdir -p /opt/wazuh-agent/tmp
+ [ install = upgrade ]
+ exit 0
Unpacking wazuh-agent (5.0.0-0) ...
dpkg: dependency problems prevent configuration of wazuh-agent:
wazuh-agent depends on lsb-release; however:
Package lsb-release is not installed.
wazuh-agent depends on adduser; however:
Package adduser is not installed.
dpkg: error processing package wazuh-agent (--install):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.39-0ubuntu8.3) ...
Errors were encountered while processing:
wazuh-agent
apt install -f
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
adduser lsb-release
Suggested packages:
liblocale-gettext-perl perl cron quota ecryptfs-utils
The following NEW packages will be installed:
adduser lsb-release
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
Need to get 107 kB of archives.
After this operation, 480 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu noble/main amd64 lsb-release all 12.0-2 [6564 B]
Get:2 http://archive.ubuntu.com/ubuntu noble/main amd64 adduser all 3.137ubuntu1 [101 kB]
Fetched 107 kB in 2s (66.8 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package lsb-release.
(Reading database ... 4396 files and directories currently installed.)
Preparing to unpack .../lsb-release_12.0-2_all.deb ...
Unpacking lsb-release (12.0-2) ...
Selecting previously unselected package adduser.
Preparing to unpack .../adduser_3.137ubuntu1_all.deb ...
Unpacking adduser (3.137ubuntu1) ...
Setting up adduser (3.137ubuntu1) ...
Setting up lsb-release (12.0-2) ...
Setting up wazuh-agent (5.0.0-0) ...
+ export INSTALLATION_WAZUH_DIR=/opt/wazuh-agent
+ WAZUH_TMP_DIR=/opt/wazuh-agent/tmp
+ BINARY_DIR=/usr/share/wazuh-agent/bin/
+ lsb_release -si
+ OS=Ubuntu
+ lsb_release -sr
+ VER=24.04
+ USER=wazuh
+ GROUP=wazuh
+ OSMYSHELL=/sbin/nologin
+ [ ! -f /sbin/nologin ]
+ getent group wazuh
+ addgroup --system wazuh
+ getent passwd wazuh
+ adduser --system --home /opt/wazuh-agent --shell /sbin/nologin --ingroup wazuh wazuh
+ [ -f /opt/wazuh-agent/tmp/wazuh.restart ]
+ touch /etc/ld.so.conf.d/wazuh-agentlibs.conf
+ echo /usr/share/wazuh-agent/lib
+ ldconfig
+ exit 0
Processing triggers for libc-bin (2.39-0ubuntu8.3) ...
```
# Paths:
```bash
ls /usr/share/wazuh-agent/bin/
wazuh-agent
root@4d8ed406b874:~/Test# ls /usr/share/wazuh-agent/lib/
libdbsync.so libstdc++.so.6 libsysinfo.so
root@4d8ed406b874:~/Test# ls /etc/wazuh-agent/
wazuh.conf
```
# Purge
```bash
apt purge wazuh-agent
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
lsb-release
Use 'apt autoremove' to remove it.
The following packages will be REMOVED:
wazuh-agent*
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 6280 files and directories currently installed.)
Purging configuration files for wazuh-agent (5.0.0-0) ...
+ export INSTALLATION_WAZUH_DIR=/opt/wazuh-agent
+ WAZUH_TMP_DIR=/opt/wazuh-agent/tmp
+ BINARY_DIR=/usr/share/wazuh-agent/bin/
+ BINARY_LIB_DIR=/usr/share/wazuh-agent/lib/
+ getent passwd wazuh
+ getent group wazuh
+ rm -rf /opt/wazuh-agent
+ exit 0
dpkg: warning: while removing wazuh-agent, directory '/usr/share/wazuh-agent/bin' not empty so not remov
ed
root@4d8ed406b874:~/Test# ls /usr/share/wazuh-agent/bin/
var
root@4d8ed406b874:~/Test# ls /usr/share/wazuh-agent/lib/
ls: cannot access '/usr/share/wazuh-agent/lib/': No such file or directory
root@4d8ed406b874:~/Test# ls /etc/wazuh-agent/
ls: cannot access '/etc/wazuh-agent/': No such file or directory
```
Description
In this PR, the paths of the package have been modified to comply with the expected scaffolding for the Wazuh agent. The new paths are the ones written in the issue:
242
In addition, some SPECS have been modified so that it doesn't fail to uninstall the agent if the agent is not running. And so that the binary always finds its respective libraries.