I'm trying to build the wazuh agent for windows from source, following the official documentation https://documentation.wazuh.com/current/deployment-options/wazuh-from-sources/wazuh-agent/index.html.
This guide is said to be tested on Ubuntu 20.04 but after typing:
make deps TARGET=winagent
make TARGET=winagent
I got the following error:
grep: /etc/redhat-release: No such file or directory
curl -so external/cJSON.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/cJSON.tar.gz || true
cd external && test -e cJSON.tar.gz && gunzip cJSON.tar.gz || true
cd external && test -e cJSON.tar && tar -xf cJSON.tar || true
test -e external/cJSON.tar && rm external/cJSON.tar || true
test -d external/cJSON ||\
(curl -so external/cJSON.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/cJSON.tar.gz &&\
cd external && gunzip cJSON.tar.gz && tar -xf cJSON.tar && rm cJSON.tar)
curl -so external/curl.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/curl.tar.gz || true
cd external && test -e curl.tar.gz && gunzip curl.tar.gz || true
cd external && test -e curl.tar && tar -xf curl.tar || true
test -e external/curl.tar && rm external/curl.tar || true
test -d external/curl ||\
(curl -so external/curl.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/curl.tar.gz &&\
cd external && gunzip curl.tar.gz && tar -xf curl.tar && rm curl.tar)
curl -so external/libdb.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libdb.tar.gz || true
cd external && test -e libdb.tar.gz && gunzip libdb.tar.gz || true
cd external && test -e libdb.tar && tar -xf libdb.tar || true
test -e external/libdb.tar && rm external/libdb.tar || true
test -d external/libdb ||\
(curl -so external/libdb.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libdb.tar.gz &&\
cd external && gunzip libdb.tar.gz && tar -xf libdb.tar && rm libdb.tar)
curl -so external/libffi.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libffi.tar.gz || true
cd external && test -e libffi.tar.gz && gunzip libffi.tar.gz || true
cd external && test -e libffi.tar && tar -xf libffi.tar || true
test -e external/libffi.tar && rm external/libffi.tar || true
test -d external/libffi ||\
(curl -so external/libffi.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libffi.tar.gz &&\
cd external && gunzip libffi.tar.gz && tar -xf libffi.tar && rm libffi.tar)
curl -so external/libyaml.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libyaml.tar.gz || true
cd external && test -e libyaml.tar.gz && gunzip libyaml.tar.gz || true
cd external && test -e libyaml.tar && tar -xf libyaml.tar || true
test -e external/libyaml.tar && rm external/libyaml.tar || true
test -d external/libyaml ||\
(curl -so external/libyaml.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libyaml.tar.gz &&\
cd external && gunzip libyaml.tar.gz && tar -xf libyaml.tar && rm libyaml.tar)
curl -so external/openssl.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/openssl.tar.gz || true
cd external && test -e openssl.tar.gz && gunzip openssl.tar.gz || true
cd external && test -e openssl.tar && tar -xf openssl.tar || true
test -e external/openssl.tar && rm external/openssl.tar || true
test -d external/openssl ||\
(curl -so external/openssl.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/openssl.tar.gz &&\
cd external && gunzip openssl.tar.gz && tar -xf openssl.tar && rm openssl.tar)
curl -so external/procps.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/procps.tar.gz || true
cd external && test -e procps.tar.gz && gunzip procps.tar.gz || true
cd external && test -e procps.tar && tar -xf procps.tar || true
test -e external/procps.tar && rm external/procps.tar || true
test -d external/procps ||\
(curl -so external/procps.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/procps.tar.gz &&\
cd external && gunzip procps.tar.gz && tar -xf procps.tar && rm procps.tar)
curl -so external/sqlite.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/sqlite.tar.gz || true
cd external && test -e sqlite.tar.gz && gunzip sqlite.tar.gz || true
cd external && test -e sqlite.tar && tar -xf sqlite.tar || true
test -e external/sqlite.tar && rm external/sqlite.tar || true
test -d external/sqlite ||\
(curl -so external/sqlite.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/sqlite.tar.gz &&\
cd external && gunzip sqlite.tar.gz && tar -xf sqlite.tar && rm sqlite.tar)
curl -so external/zlib.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/zlib.tar.gz || true
cd external && test -e zlib.tar.gz && gunzip zlib.tar.gz || true
cd external && test -e zlib.tar && tar -xf zlib.tar || true
test -e external/zlib.tar && rm external/zlib.tar || true
test -d external/zlib ||\
(curl -so external/zlib.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/zlib.tar.gz &&\
cd external && gunzip zlib.tar.gz && tar -xf zlib.tar && rm zlib.tar)
curl -so external/audit-userspace.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/audit-userspace.tar.gz || true
cd external && test -e audit-userspace.tar.gz && gunzip audit-userspace.tar.gz || true
gzip: audit-userspace.tar.gz: not in gzip format
cd external && test -e audit-userspace.tar && tar -xf audit-userspace.tar || true
test -e external/audit-userspace.tar && rm external/audit-userspace.tar || true
test -d external/audit-userspace ||\
(curl -so external/audit-userspace.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/audit-userspace.tar.gz &&\
cd external && gunzip audit-userspace.tar.gz && tar -xf audit-userspace.tar && rm audit-userspace.tar)
curl -so external/msgpack.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/msgpack.tar.gz || true
cd external && test -e msgpack.tar.gz && gunzip msgpack.tar.gz || true
cd external && test -e msgpack.tar && tar -xf msgpack.tar || true
test -e external/msgpack.tar && rm external/msgpack.tar || true
test -d external/msgpack ||\
(curl -so external/msgpack.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/msgpack.tar.gz &&\
cd external && gunzip msgpack.tar.gz && tar -xf msgpack.tar && rm msgpack.tar)
curl -so external/bzip2.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/bzip2.tar.gz || true
cd external && test -e bzip2.tar.gz && gunzip bzip2.tar.gz || true
cd external && test -e bzip2.tar && tar -xf bzip2.tar || true
test -e external/bzip2.tar && rm external/bzip2.tar || true
test -d external/bzip2 ||\
(curl -so external/bzip2.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/bzip2.tar.gz &&\
cd external && gunzip bzip2.tar.gz && tar -xf bzip2.tar && rm bzip2.tar)
curl -so external/nlohmann.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/nlohmann.tar.gz || true
cd external && test -e nlohmann.tar.gz && gunzip nlohmann.tar.gz || true
gzip: nlohmann.tar.gz: not in gzip format
cd external && test -e nlohmann.tar && tar -xf nlohmann.tar || true
test -e external/nlohmann.tar && rm external/nlohmann.tar || true
test -d external/nlohmann ||\
(curl -so external/nlohmann.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/nlohmann.tar.gz &&\
cd external && gunzip nlohmann.tar.gz && tar -xf nlohmann.tar && rm nlohmann.tar)
curl -so external/googletest.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/googletest.tar.gz || true
cd external && test -e googletest.tar.gz && gunzip googletest.tar.gz || true
gzip: googletest.tar.gz: not in gzip format
cd external && test -e googletest.tar && tar -xf googletest.tar || true
test -e external/googletest.tar && rm external/googletest.tar || true
test -d external/googletest ||\
(curl -so external/googletest.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/googletest.tar.gz &&\
cd external && gunzip googletest.tar.gz && tar -xf googletest.tar && rm googletest.tar)
curl -so external/libpcre2.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libpcre2.tar.gz || true
cd external && test -e libpcre2.tar.gz && gunzip libpcre2.tar.gz || true
cd external && test -e libpcre2.tar && tar -xf libpcre2.tar || true
test -e external/libpcre2.tar && rm external/libpcre2.tar || true
test -d external/libpcre2 ||\
(curl -so external/libpcre2.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libpcre2.tar.gz &&\
cd external && gunzip libpcre2.tar.gz && tar -xf libpcre2.tar && rm libpcre2.tar)
curl -so external/libplist.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libplist.tar.gz || true
cd external && test -e libplist.tar.gz && gunzip libplist.tar.gz || true
cd external && test -e libplist.tar && tar -xf libplist.tar || true
test -e external/libplist.tar && rm external/libplist.tar || true
test -d external/libplist ||\
(curl -so external/libplist.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libplist.tar.gz &&\
cd external && gunzip libplist.tar.gz && tar -xf libplist.tar && rm libplist.tar)
curl -so external/pacman.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/pacman.tar.gz || true
cd external && test -e pacman.tar.gz && gunzip pacman.tar.gz || true
gzip: pacman.tar.gz: not in gzip format
cd external && test -e pacman.tar && tar -xf pacman.tar || true
test -e external/pacman.tar && rm external/pacman.tar || true
test -d external/pacman ||\
(curl -so external/pacman.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/pacman.tar.gz &&\
cd external && gunzip pacman.tar.gz && tar -xf pacman.tar && rm pacman.tar)
curl -so external/libarchive.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libarchive.tar.gz || true
cd external && test -e libarchive.tar.gz && gunzip libarchive.tar.gz || true
gzip: libarchive.tar.gz: not in gzip format
cd external && test -e libarchive.tar && tar -xf libarchive.tar || true
test -e external/libarchive.tar && rm external/libarchive.tar || true
test -d external/libarchive ||\
(curl -so external/libarchive.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libarchive.tar.gz &&\
cd external && gunzip libarchive.tar.gz && tar -xf libarchive.tar && rm libarchive.tar)
curl -so external/popt.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/popt.tar.gz || true
cd external && test -e popt.tar.gz && gunzip popt.tar.gz || true
gzip: popt.tar.gz: not in gzip format
cd external && test -e popt.tar && tar -xf popt.tar || true
test -e external/popt.tar && rm external/popt.tar || true
test -d external/popt ||\
(curl -so external/popt.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/popt.tar.gz &&\
cd external && gunzip popt.tar.gz && tar -xf popt.tar && rm popt.tar)
curl -so external/rpm.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/rpm.tar.gz || true
cd external && test -e rpm.tar.gz && gunzip rpm.tar.gz || true
gzip: rpm.tar.gz: not in gzip format
cd external && test -e rpm.tar && tar -xf rpm.tar || true
test -e external/rpm.tar && rm external/rpm.tar || true
test -d external/rpm ||\
(curl -so external/rpm.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/rpm.tar.gz &&\
cd external && gunzip rpm.tar.gz && tar -xf rpm.tar && rm rpm.tar)
grep: /etc/redhat-release: No such file or directory
cp /usr/i686-w64-mingw32/lib/libwinpthread-1.dll win32/libwinpthread-1.dll
cp win32/libgcc_s_sjlj-1.dll
cp: missing destination file operand after 'win32/libgcc_s_sjlj-1.dll'
Try 'cp --help' for more information.
make: *** [Makefile:781: win32/libgcc_s_sjlj-1.dll] Error 1
That I solved by commenting out the line
#CHECK_CENTOS5 := $(shell sh -c 'grep "CentOS release 5." /etc/redhat-release > /dev/null && echo YES || echo not')
In the Makefile
Now I get the following error the I'm not able to solve
curl -so external/cJSON.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/cJSON.tar.gz || true
cd external && test -e cJSON.tar.gz && gunzip cJSON.tar.gz || true
cd external && test -e cJSON.tar && tar -xf cJSON.tar || true
test -e external/cJSON.tar && rm external/cJSON.tar || true
test -d external/cJSON ||\
(curl -so external/cJSON.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/cJSON.tar.gz &&\
cd external && gunzip cJSON.tar.gz && tar -xf cJSON.tar && rm cJSON.tar)
curl -so external/curl.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/curl.tar.gz || true
cd external && test -e curl.tar.gz && gunzip curl.tar.gz || true
cd external && test -e curl.tar && tar -xf curl.tar || true
test -e external/curl.tar && rm external/curl.tar || true
test -d external/curl ||\
(curl -so external/curl.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/curl.tar.gz &&\
cd external && gunzip curl.tar.gz && tar -xf curl.tar && rm curl.tar)
curl -so external/libdb.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libdb.tar.gz || true
cd external && test -e libdb.tar.gz && gunzip libdb.tar.gz || true
cd external && test -e libdb.tar && tar -xf libdb.tar || true
test -e external/libdb.tar && rm external/libdb.tar || true
test -d external/libdb ||\
(curl -so external/libdb.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libdb.tar.gz &&\
cd external && gunzip libdb.tar.gz && tar -xf libdb.tar && rm libdb.tar)
curl -so external/libffi.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libffi.tar.gz || true
cd external && test -e libffi.tar.gz && gunzip libffi.tar.gz || true
cd external && test -e libffi.tar && tar -xf libffi.tar || true
test -e external/libffi.tar && rm external/libffi.tar || true
test -d external/libffi ||\
(curl -so external/libffi.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libffi.tar.gz &&\
cd external && gunzip libffi.tar.gz && tar -xf libffi.tar && rm libffi.tar)
curl -so external/libyaml.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libyaml.tar.gz || true
cd external && test -e libyaml.tar.gz && gunzip libyaml.tar.gz || true
cd external && test -e libyaml.tar && tar -xf libyaml.tar || true
test -e external/libyaml.tar && rm external/libyaml.tar || true
test -d external/libyaml ||\
(curl -so external/libyaml.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libyaml.tar.gz &&\
cd external && gunzip libyaml.tar.gz && tar -xf libyaml.tar && rm libyaml.tar)
curl -so external/openssl.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/openssl.tar.gz || true
cd external && test -e openssl.tar.gz && gunzip openssl.tar.gz || true
cd external && test -e openssl.tar && tar -xf openssl.tar || true
test -e external/openssl.tar && rm external/openssl.tar || true
test -d external/openssl ||\
(curl -so external/openssl.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/openssl.tar.gz &&\
cd external && gunzip openssl.tar.gz && tar -xf openssl.tar && rm openssl.tar)
curl -so external/procps.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/procps.tar.gz || true
cd external && test -e procps.tar.gz && gunzip procps.tar.gz || true
cd external && test -e procps.tar && tar -xf procps.tar || true
test -e external/procps.tar && rm external/procps.tar || true
test -d external/procps ||\
(curl -so external/procps.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/procps.tar.gz &&\
cd external && gunzip procps.tar.gz && tar -xf procps.tar && rm procps.tar)
curl -so external/sqlite.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/sqlite.tar.gz || true
cd external && test -e sqlite.tar.gz && gunzip sqlite.tar.gz || true
cd external && test -e sqlite.tar && tar -xf sqlite.tar || true
test -e external/sqlite.tar && rm external/sqlite.tar || true
test -d external/sqlite ||\
(curl -so external/sqlite.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/sqlite.tar.gz &&\
cd external && gunzip sqlite.tar.gz && tar -xf sqlite.tar && rm sqlite.tar)
curl -so external/zlib.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/zlib.tar.gz || true
cd external && test -e zlib.tar.gz && gunzip zlib.tar.gz || true
cd external && test -e zlib.tar && tar -xf zlib.tar || true
test -e external/zlib.tar && rm external/zlib.tar || true
test -d external/zlib ||\
(curl -so external/zlib.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/zlib.tar.gz &&\
cd external && gunzip zlib.tar.gz && tar -xf zlib.tar && rm zlib.tar)
curl -so external/audit-userspace.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/audit-userspace.tar.gz || true
cd external && test -e audit-userspace.tar.gz && gunzip audit-userspace.tar.gz || true
gzip: audit-userspace.tar.gz: not in gzip format
cd external && test -e audit-userspace.tar && tar -xf audit-userspace.tar || true
test -e external/audit-userspace.tar && rm external/audit-userspace.tar || true
test -d external/audit-userspace ||\
(curl -so external/audit-userspace.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/audit-userspace.tar.gz &&\
cd external && gunzip audit-userspace.tar.gz && tar -xf audit-userspace.tar && rm audit-userspace.tar)
curl -so external/msgpack.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/msgpack.tar.gz || true
cd external && test -e msgpack.tar.gz && gunzip msgpack.tar.gz || true
cd external && test -e msgpack.tar && tar -xf msgpack.tar || true
test -e external/msgpack.tar && rm external/msgpack.tar || true
test -d external/msgpack ||\
(curl -so external/msgpack.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/msgpack.tar.gz &&\
cd external && gunzip msgpack.tar.gz && tar -xf msgpack.tar && rm msgpack.tar)
curl -so external/bzip2.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/bzip2.tar.gz || true
cd external && test -e bzip2.tar.gz && gunzip bzip2.tar.gz || true
cd external && test -e bzip2.tar && tar -xf bzip2.tar || true
test -e external/bzip2.tar && rm external/bzip2.tar || true
test -d external/bzip2 ||\
(curl -so external/bzip2.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/bzip2.tar.gz &&\
cd external && gunzip bzip2.tar.gz && tar -xf bzip2.tar && rm bzip2.tar)
curl -so external/nlohmann.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/nlohmann.tar.gz || true
cd external && test -e nlohmann.tar.gz && gunzip nlohmann.tar.gz || true
gzip: nlohmann.tar.gz: not in gzip format
cd external && test -e nlohmann.tar && tar -xf nlohmann.tar || true
test -e external/nlohmann.tar && rm external/nlohmann.tar || true
test -d external/nlohmann ||\
(curl -so external/nlohmann.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/nlohmann.tar.gz &&\
cd external && gunzip nlohmann.tar.gz && tar -xf nlohmann.tar && rm nlohmann.tar)
curl -so external/googletest.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/googletest.tar.gz || true
cd external && test -e googletest.tar.gz && gunzip googletest.tar.gz || true
gzip: googletest.tar.gz: not in gzip format
cd external && test -e googletest.tar && tar -xf googletest.tar || true
test -e external/googletest.tar && rm external/googletest.tar || true
test -d external/googletest ||\
(curl -so external/googletest.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/googletest.tar.gz &&\
cd external && gunzip googletest.tar.gz && tar -xf googletest.tar && rm googletest.tar)
curl -so external/libpcre2.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libpcre2.tar.gz || true
cd external && test -e libpcre2.tar.gz && gunzip libpcre2.tar.gz || true
cd external && test -e libpcre2.tar && tar -xf libpcre2.tar || true
test -e external/libpcre2.tar && rm external/libpcre2.tar || true
test -d external/libpcre2 ||\
(curl -so external/libpcre2.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libpcre2.tar.gz &&\
cd external && gunzip libpcre2.tar.gz && tar -xf libpcre2.tar && rm libpcre2.tar)
curl -so external/libplist.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libplist.tar.gz || true
cd external && test -e libplist.tar.gz && gunzip libplist.tar.gz || true
cd external && test -e libplist.tar && tar -xf libplist.tar || true
test -e external/libplist.tar && rm external/libplist.tar || true
test -d external/libplist ||\
(curl -so external/libplist.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libplist.tar.gz &&\
cd external && gunzip libplist.tar.gz && tar -xf libplist.tar && rm libplist.tar)
curl -so external/pacman.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/pacman.tar.gz || true
cd external && test -e pacman.tar.gz && gunzip pacman.tar.gz || true
gzip: pacman.tar.gz: not in gzip format
cd external && test -e pacman.tar && tar -xf pacman.tar || true
test -e external/pacman.tar && rm external/pacman.tar || true
test -d external/pacman ||\
(curl -so external/pacman.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/pacman.tar.gz &&\
cd external && gunzip pacman.tar.gz && tar -xf pacman.tar && rm pacman.tar)
curl -so external/libarchive.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/libarchive.tar.gz || true
cd external && test -e libarchive.tar.gz && gunzip libarchive.tar.gz || true
gzip: libarchive.tar.gz: not in gzip format
cd external && test -e libarchive.tar && tar -xf libarchive.tar || true
test -e external/libarchive.tar && rm external/libarchive.tar || true
test -d external/libarchive ||\
(curl -so external/libarchive.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/libarchive.tar.gz &&\
cd external && gunzip libarchive.tar.gz && tar -xf libarchive.tar && rm libarchive.tar)
curl -so external/popt.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/popt.tar.gz || true
cd external && test -e popt.tar.gz && gunzip popt.tar.gz || true
gzip: popt.tar.gz: not in gzip format
cd external && test -e popt.tar && tar -xf popt.tar || true
test -e external/popt.tar && rm external/popt.tar || true
test -d external/popt ||\
(curl -so external/popt.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/popt.tar.gz &&\
cd external && gunzip popt.tar.gz && tar -xf popt.tar && rm popt.tar)
curl -so external/rpm.tar.gz https://packages.wazuh.com/deps/17/libraries/windows/rpm.tar.gz || true
cd external && test -e rpm.tar.gz && gunzip rpm.tar.gz || true
gzip: rpm.tar.gz: not in gzip format
cd external && test -e rpm.tar && tar -xf rpm.tar || true
test -e external/rpm.tar && rm external/rpm.tar || true
test -d external/rpm ||\
(curl -so external/rpm.tar.gz https://packages.wazuh.com/deps/17/libraries/sources/rpm.tar.gz &&\
cd external && gunzip rpm.tar.gz && tar -xf rpm.tar && rm rpm.tar)
cp /usr/i686-w64-mingw32/lib/libwinpthread-1.dll win32/libwinpthread-1.dll
cp win32/libgcc_s_sjlj-1.dll
cp: missing destination file operand after 'win32/libgcc_s_sjlj-1.dll'
Try 'cp --help' for more information.
make: *** [Makefile:781: win32/libgcc_s_sjlj-1.dll] Error 1
Its not recommended to edit the files by commenting lines to avoid errors, since the installer contains all the necessary steps to install the agent correctly.
After several tests I was able to reproduce the error, and it was when I tried to generate the agent in Ubuntu 22. This is an expected behavior as Wazuh version 4.3 is not supported for Ubuntu 22.
The documentation did not mention the repository update step, please run an apt-get update command at the beginning of the installation and then repeat all the steps again, make sure that the system is Ubuntu 20.
Also, make sure that all dependencies are installed correctly as the error shown for libgcc_s_sjlj-1.dll is related to the mingw dependency.
Related
I am very new to shell scripting and i need to write a script, the conditions are pretty straight fwd:
i have 2 dir location
First Dir:
$ABC_123/cert
which contains 3 files:
file1.pem
file2.pem
file3.pem
Second Dir:
$ABC_123/private
which contains 2 files:
file4.pem
file5.pem
these files needs to be replaced/appended with files from a user input dir location depending on below conditions
if file3 is present in the user input dir location then take back of all files under the above two dir and then replace file1,file2,file4,file5 and append file3
if file3 is not present in the user input dir location then take back up and replace only file 1,file2,file4,file5 only
i want to write a shell function for back up and replace/append conditions.
Below is the shell i wrote:
#!/bin/sh
$ABC_123=/ABC/123/XCOM
export ABC_123
# input the change number
printf 'Enter the NUMBER number\n'
read NUMBER
file1="$ABC_123/certs/fil2cert.pem"
file2="$ABC_123/certs/fil2cert.pem"
file3="$ABC_123/certs/fil3cert.pem"
file4="$ABC_123/private/fil4key.pem"
file5="$ABC_123/private/fil5key.pem"
file6="$ABC_123/private/fil6key.pem"
file7="/tmp/$NUMBER/fil3cert.pem"
# Begining of the implementation
if [ -f $file1 ] && [ -f $file2 ] && [ -f $file3 ] && [ -f $file4 ] && [ -f $file5 ] && [ ! -f $file6 ] && [ -f $file7 ]
then
#
#BACKUP
#
cp -p $file1 $file1.$(date +%Y-%m-%d).bkp
cp -p $file2 $file2.$(date +%Y-%m-%d).bkp
cp -p $file3 $file3.$(date +%Y-%m-%d).bkp
cp -p $file4 $file4.$(date +%Y-%m-%d).bkp
cp -p $file5 $file5.$(date +%Y-%m-%d).bkp
#
#REPLACE
#
cp /tmp/$NUMBER/*key.pem $ABC_123/private/
cp /tmp/$NUMBER/*cert.pem $ABC_123/certs/
cat /tmp/$NUMBER/fil3cert.pem >> $ABC_123/certs/fil3cert.pem
#
#CHANGE PERMISSIONS
#
chmod 644 $ABC_123/private/*key.pem
chmod 644 $ABC_123/certs/*cert.pem
chmod 644 $ABC_123/certs/fil3cert.pem
chown root:root $ABC_123/private/*key.pem
chown root:root $ABC_123/certs/*cert.pem
chown root:root $ABC_123/certs/fil3cert.pem
elif [ -f $file1 ] && [ -f $file2 ] && [ -f $file3 ] && [ -f $file4 ] && [ -f $file5 ] && [ ! -f $file6 ] && [ ! -f $file7 ]
then
#
#BACKUP
#
cp -p $file1 $file1.$(date +%Y-%m-%d).bkp
cp -p $file2 $file2.$(date +%Y-%m-%d).bkp
cp -p $file3 $file3.$(date +%Y-%m-%d).bkp
cp -p $file4 $file4.$(date +%Y-%m-%d).bkp
#
#REPLACE
#
cp /tmp/$NUMBER/*key.pem $ABC_123/private/
cp /tmp/$NUMBER/*cert.pem $ABC_123/certs/
#
#CHANGE PERMISSIONS
#
chmod 644 $ABC_123/private/*key.pem
chmod 644 $ABC_123/certs/*cert.pem
chown root:root $ABC_123/private/*key.pem
chown root:root $ABC_123/certs/*cert.pem
elif [ ! -f $file1 ] && [ ! -f $file2 ] && [ ! -f $file3 ] && [ ! -f $file4 ] && [ ! -f $file5 ] && [ ! -f $file6 ]
then
#
#REPLACE
#
cp /tmp/$NUMBER/*key.pem $ABC_123/private/
cp /tmp/$NUMBER/*cert.pem $ABC_123/certs/
cp /tmp/$NUMBER/fil3cert.pem $ABC_123/certs/
#
#CHANGE PERMISSIONS
#
chmod 644 $ABC_123/private/*key.pem
chmod 644 $ABC_123/certs/*cert.pem
chmod 644 $ABC_123/certs/fil3cert.pem
chown root:root $ABC_123/private/*key.pem
chown root:root $ABC_123/certs/*cert.pem
chown root:root $ABC_123/certs/fil3cert.pem
elif [ -f $file6 ]
then
#
# BACKUP
#
find $ABC_123/certs/* -type f -exec mv {} {}.$(date +%Y-%m-%d).bkp \;
find $ABC_123/private/* -type f -exec mv {} {}.$(date +%Y-%m-%d).bkp \;
#
# REPLACE
#
cp /tmp/$NUMBER/*key.pem $ABC_123/private/
cp /tmp/$NUMBER/*cert.pem $ABC_123/certs/
cp /tmp/$NUMBER/fil3cert.pem $ABC_123/certs/
#
# CHANGE PERMISSIONS
#
chmod 644 $ABC_123/private/*key.pem
chmod 644 $ABC_123/certs/*cert.pem
chmod 644 $ABC_123/certs/fil3cert.pem
chown root:root $ABC_123/private/*key.pem
chown root:root $ABC_123/certs/*cert.pem
chown root:root $ABC_123/certs/fil3cert.pem
elif [ ! -f "$file1" ] || [ ! -f "$file2" ] || [ ! -f "$file3" ] || [ ! -f "$file4" ] || [ ! -f "$file5" ] && [ ! -f "$file6" ] ; then
# At least one file is missing, writing the list of missing file(s):
echo -n "Missing file(s): "
for i in "$file1" "$file2" "$file3" "$file4" "$file5" ; do
if [ ! -f "$i" ] ; then
echo -n "$i "
fi
done
echo
fi
i want to use shell function instead of repeating the BACKUP,REPLACEMENT and CHANGE PERMISSION command again and again
Your shell function could be something like
all_present() {
for file
do
[ -f $file ] || return 1
done
return 0
}
and it would be used like this:
if ! all_present "$file1" "$file2" "$file3" "$file4" "$file5" "$file6"
then
echo at least one is missing
...
BTW: In case you can switch from shell to bash or zsh or ksh, you can hold all files in an array and the whole expression would be simpler.
I'm trying to automate a post-build process to get closer to a one-click release. However, I'm having problems with a script that.
Expected: The script to work exactly like the command line.
Results: Everything works, including grabbing the versionCodes except I am getting a curl: (26) Failed to open/read local data from file/application
The script I wanted to imitate with a more automated approach.
react-native bundle \
--platform android \
--dev false \
--entry-file index.js \
--bundle-output android-release.bundle \
--sourcemap-output android-release.bundle.map &&
curl https://upload.bugsnag.com/react-native-source-map \
-F apiKey=API-KEY \
-F appVersion=10.6.7 \
-F appVersionCode=4515 \
-F dev=false \
-F platform=android \
-F sourceMap=#android-release.bundle.map \
-F bundle=#android-release.bundle
react-native bundle \
--platform ios \
--dev false \
--entry-file index.js \
--bundle-output ios-release.bundle \
--sourcemap-output ios-release.bundle.map &&
curl https://upload.bugsnag.com/react-native-source-map \
-F apiKey=API-KEY \
-F appVersion=10.6.7 \
-F appBundleVersion=4515 \
-F dev=false \
-F platform=ios \
-F sourceMap=#ios-release.bundle.map \
-F bundle=#ios-release.bundle
So I wrote a script to fix this, which is
#!/bin/sh
# Ensure this is run on the commit used to generate the published app!
# Comment this line out to enable bundling and publishing
# debug=echo
bundle () {
platform=$1
$debug yarn react-native bundle \
--platform "$platform" \
--dev false \
--entry-file index.js \
--bundle-output "$platform-release.bundle" \
--sourcemap-output "$platform-release.bundle.map"
}
upload () {
platform=$1
version=$2
version_code=$3
# See https://docs.bugsnag.com/api/rn-source-map-upload/#uploading-source-maps
curl --http1.1 https://upload.bugsnag.com/react-native-source-map \
-F apiKey="$BUGSNAG_API_KEY" \
-F appVersion="$version" \
-F appVersionCode="$version_code" \
-F dev=false \
-F platform="$platform" \
-F sourceMap=#"$platform-release-bundle.map" \
-F bundle=#"$platform-release.bundle" \
}
read_version () {
local tag=$1
local file=$2
echo "$(grep -m 1 $tag $file | grep -o '[0-9]\+\(\.[0-9]\+\)*')"
}
BUGSNAG_API_KEY=$(plutil -p ios/RVLife/Info.plist | grep BugsnagAPIKey | awk '{ print $3 }' | sed 's/"//g')
if [[ -z $BUGSNAG_API_KEY ]]; then
echo "Couldn't find bugsnag API key"
exit 1
fi
IOS_VERSION=$(read_version MARKETING_VERSION ios/RVLife.xcodeproj/project.pbxproj)
echo "iOS app version: $IOS_VERSION"
IOS_VERSION_CODE=$(read_version CURRENT_PROJECT_VERSION ios/RVLife.xcodeproj/project.pbxproj)
echo "iOS version code: $IOS_VERSION_CODE"
if [[ -z $IOS_VERSION || -z $IOS_VERSION_CODE ]]; then
echo "Couldn't get iOS app versions"
exit 1
fi
bundle ios
upload ios "$IOS_VERSION" "$IOS_VERSION_CODE"
echo ""
ANDROID_VERSION=$(read_version versionName android/app/build.gradle)
echo "Android app version: $ANDROID_VERSION"
ANDROID_VERSION_CODE=$(read_version versionCode android/app/build.gradle)
echo "Android version code: $ANDROID_VERSION_CODE"
if [[ -z $ANDROID_VERSION || -z $ANDROID_VERSION_CODE ]]; then
echo "Couldn't get Android app versions"
exit 1
fi
bundle android
upload android "$ANDROID_VERSION" "$ANDROID_VERSION_CODE"
I'm assuming I messed up some syntax or permissions or something somewhere, but can't seem to find the area I did. Any help is appreciated.
Difference between bash -x myScript and set -x on command line
Command Line
omz_termsupport_preexec:1> [[ '' == true ]]
+omz_termsupport_preexec:3> emulate -L zsh
+omz_termsupport_preexec:4> setopt extended_glob
+omz_termsupport_preexec:7> local -a cmdargs
+omz_termsupport_preexec:8> cmdargs=( curl https://upload.bugsnag.com/react-native-source-map -F -F -F -F -F - )
+omz_termsupport_preexec:10> [[ curl = fg ]]
+omz_termsupport_preexec:44> local CMD=curl
+omz_termsupport_preexec:45> local LINE='curl https://upload.bugsnag.com/react-native-source-map -F -F -F -F -F -'
+omz_termsupport_preexec:47> title '$CMD' '%100>...>$LINE%<<'
+title:1> emulate -L zsh
+title:2> setopt prompt_subst
+title:4> [[ '' == *term* ]]
+title:8> : '%100>...>$LINE%<<'
+title:10> case xterm-256color (cygwin | xterm*)
+title:12> print -Pn '\e]2;%100\>...\>\$LINE%\<\<\a'
+title:13> print -Pn '\e]1;\$CMD\a'
+-zsh:75> curl https://upload.bugsnag.com/react-native-source-map -F 'apiKey=API-KEY' -F 'appVersion=10.6.7’ -F 'appBundleVersion=4515' -F 'dev=false' -F 'platform=ios' -F 'sourceMap=#ios-release.bundle.map' -F 'bundle=#ios-release.bundle'
OK%
SH Script
+ upload ios 10.6.7 4515
+ platform=ios
+ version=10.6.7
+ version_code=4515
+ curl --http1.1 https://upload.bugsnag.com/react-native-source-map -F apiKey=API-KEY -F appVersion=10.6.7 -F appVersionCode=4515 -F dev=false -F platform=ios -F sourceMap=#ios-release-bundle.map -F bundle=#ios-release.bundle
curl: (26) Failed to open/read local data from file/application
+ echo ''
I need to create a directory in root directory of Linux if it's not already present in it.So i am using the if [-d "$/root/folder" ]; but it's going to else part even if directory exist. Please help with this. Below is the code-
#! /bin/sh
if [ -d "$/root/folder" ];then
echo "folder file already exist"
else
echo "Settings in progress" \
&& mkdir folder \
&& chmod 7777 folder \
&& cd folder \
&& mkdir FolderConnector \
&& chmod 7777 FolderConnector \
&& cd FolderConnector \
&& mkdir ClientInput \
&& mkdir ClientOutput \
&& chmod 7777 ClientInput \
&& chmod 7777 ClientOutput \
&& cat /home/data/RTV/file2 >>/etc/exports \
&& exportfs -r \
&& exportfs \
&& echo "Settings completed successfully."
fi
What I would do :
#! /bin/sh
set -e
if [ -d "/root/folder" ]; then
echo "folder file already exist"
else
echo "Settings in progress"
mkdir folder
chmod 7777 folde
cd folder
mkdir FolderConnector
chmod 7777 FolderConnector
cd FolderConnector
mkdir ClientInput
mkdir ClientOutput
chmod 7777 ClientInput
chmod 7777 ClientOutput
cat /home/data/RTV/file2 >>/etc/exports
exportfs -r
exportfs
echo "Settings completed successfully."
fi
set -e stop the script on the first error
you had a $ character in your test
I am having a problem accessing external exadata database from docker.
Docker File:
FROM centos:7.3.1611
WORKDIR /tmp
ADD . /tmp
ENV http_proxy=<added>
ENV https_proxy=<added>
ENV RHEL_FRONTEND=noninteractive
ENV ORACLE_INSTANTCLIENT_MAJOR=12.2
ENV ORACLE_INSTANTCLIENT_VERSION=12.2.0.1.0
ENV ORACLE=/usr
ENV ORACLE_HOME=$ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
ENV C_INCLUDE_PATH=$C_INCLUDE_PATH:$ORACLE/include/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64
RUN yum update && yum install -y libaio1 \
curl rpm2cpio cpio \
&& mkdir $ORACLE && TMP_DIR="$(mktemp -d)" && cd "$TMP_DIR" \
&& oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-basic-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o basic.rpm \
&& rpm2cpio basic.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf ./* \
&& ln -s libclntsh.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libclntsh.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& ln -s libocci.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libocci.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-devel-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o devel.rpm \
&& rpm2cpio devel.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf "$TMP_DIR" \
&& echo "$ORACLE_HOME/lib" > /etc/ld.so.conf.d/oracle.conf && chmod o+r /etc/ld.so.conf.d/oracle.conf && ldconfig \
&& rm -rf /var/lib/apt/lists/* && apt-get purge -y --auto-remove curl rpm2cpio cpio
RUN pip --no-cache-dir install Flask==0.12.2
ENV SHELL /bin/bash
EXPOSE 80
# WORKDIR /docker
ENTRYPOINT ["python"]
CMD ["app.py"]
Error:returned a non-zero code: 1
Can anyone help me to resolve this?
The build command fails when executing the below command:
RUN yum update && yum install -y libaio1 \
curl rpm2cpio cpio \
&& mkdir $ORACLE && TMP_DIR="$(mktemp -d)" && cd "$TMP_DIR" \
&& oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-basic-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o basic.rpm \
&& rpm2cpio basic.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf ./* \
&& ln -s libclntsh.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libclntsh.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& ln -s libocci.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libocci.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-devel-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o devel.rpm \
&& rpm2cpio devel.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf "$TMP_DIR" \
&& echo "$ORACLE_HOME/lib" > /etc/ld.so.conf.d/oracle.conf && chmod o+r /etc/ld.so.conf.d/oracle.conf && ldconfig \
&& rm -rf /var/lib/apt/lists/* && apt-get purge -y --auto-remove curl rpm2cpio cpio
I have the following code in a Makefile:
NODES = celery1 celery2 celery3 priority export
get-status = /bin/bash -c "ps -p `/bin/bash -c '[ -a log/$(1).pid ] && cat log/$(1).pid || echo 1'` -o command= | grep $(1) > /dev/null && echo \"[$(1)] Appears to be running\" || eval 'echo \"[$(1)] Not running\" && exit 1'"
celery-status:
for n in ${NODES}; do $(call get-status,$$n); done
I can't manage to make it work. And when I do:
get-status = /bin/bash -c "ps -p `/bin/bash -c '[ -a log/$(1).pid ] && cat log/$(1).pid || echo $(1)'` -o command= | grep $(1) > /dev/null && echo \"[$(1)] Appears to be running\" || eval 'echo \"[$(1)] Not running\" && exit 1'" 1 displaying the argument instead of 1
celery-status:
for n in ${NODES}; do echo $(call get-status,$$n); done # echo the statements
Here is the output:
/bin/bash -c ps -p -o command= | grep celery1 > /dev/null && echo "[celery1] Appears to be running" || eval 'echo "[celery1] Not running" && exit 1'
/bin/bash -c ps -p -o command= | grep celery2 > /dev/null && echo "[celery2] Appears to be running" || eval 'echo "[celery2] Not running" && exit 1'
/bin/bash -c ps -p -o command= | grep celery3 > /dev/null && echo "[celery3] Appears to be running" || eval 'echo "[celery3] Not running" && exit 1'
/bin/bash -c ps -p -o command= | grep priority > /dev/null && echo "[priority] Appears to be running" || eval 'echo "[priority] Not running" && exit 1'
/bin/bash -c ps -p -o command= | grep export > /dev/null && echo "[export] Appears to be running" || eval 'echo "[export] Not running" && exit 1'
It looks like the $(1) does not work, maybe I'm not escaping correctly.
I'm a bit desperate here :/