Wazuh 包生成器脚本

问题描述 投票:0回答:1

在我的 Ubuntu x86_64 上运行 armhf 架构的脚本时,出现错误。

我遵循此说明https://github.com/wazuh/wazuh-agent/tree/master/packages

root@ubuntu:/home/symeon/Desktop/wazuh-agent/packages# ./generate_package.sh -t agent -a armhf -s ~/Files/STM32MP1/compiled_agent/

+++ dirname ./generate_package.sh
++ cd .
++ pwd -P
+ CURRENT_PATH=/home/symeon/Desktop/wazuh-agent/packages
++ cd /home/symeon/Desktop/wazuh-agent/packages/..
++ pwd -P
+ WAZUH_PATH=/home/symeon/Desktop/wazuh-agent
+ ARCHITECTURE=amd64
+ SYSTEM=deb
+ OUTDIR=/home/symeon/Desktop/wazuh-agent/packages/output/
+ BRANCH=
+ REVISION=0
+ TARGET=agent
+ JOBS=2
+ DEBUG=no
+ SRC=no
+ BUILD_DOCKER=yes
+ DOCKER_TAG=latest
+ INSTALLATION_PATH=/var/ossec
+ CHECKSUM=no
+ FUTURE=no
+ LEGACY=no
+ IS_STAGE=no
+ trap ctrl_c INT
+ main -t agent -a armhf -s /root/Files/STM32MP1/compiled_agent/
+ '[' -n -t ']'
+ case "$1" in
+ '[' -n agent ']'
+ TARGET=agent
+ shift 2
+ '[' -n -a ']'
+ case "$1" in
+ '[' -n armhf ']'
+ ARCHITECTURE=armhf
+ shift 2
+ '[' -n -s ']'
+ case "$1" in
+ '[' -n /root/Files/STM32MP1/compiled_agent/ ']'
+ OUTDIR=/root/Files/STM32MP1/compiled_agent/
+ shift 2
+ '[' -n '' ']'
+ '[' -z '' ']'
+ CUSTOM_CODE_VOL='-v /home/symeon/Desktop/wazuh-agent:/wazuh-local-src:Z'
+ build
+ build_pkg
+ '[' no = yes ']'
+ CONTAINER_NAME=pkg_deb_agent_builder_armhf
+ '[' armhf = arm64 ']'
+ '[' armhf = ppc64le ']'
+ DOCKERFILE_PATH=/home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent
+ cp /home/symeon/Desktop/wazuh-agent/packages/build.sh /home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent
+ cp /home/symeon/Desktop/wazuh-agent/packages/debs/utils/gen_permissions.sh /home/symeon/Desktop/wazuh-agent/packages/debs/utils/helper_function.sh /home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent
+ [[ yes == \y\e\s ]]
+ docker build -t pkg_deb_agent_builder_armhf:latest /home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent
[+] Building 0.7s (15/15) FINISHED                                                                                                                                             docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                     0.0s
 => => transferring dockerfile: 2.40kB                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/arm32v7/debian:stretch                                                                                                                        0.7s
 => [internal] load .dockerignore                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                          0.0s
 => [ 1/10] FROM docker.io/arm32v7/debian:stretch@sha256:f0d0ca7b1c94bfa3fd5e0aaff7acec45d9067cf57170ab248e7087388353ea4f                                                                0.0s
 => [internal] load build context                                                                                                                                                        0.0s
 => => transferring context: 7.71kB                                                                                                                                                      0.0s
 => CACHED [ 2/10] RUN echo "deb http://archive.debian.org/debian stretch contrib main non-free" > /etc/apt/sources.list &&     echo "deb http://archive.debian.org/debian-security str  0.0s
 => CACHED [ 3/10] RUN apt-get build-dep python3.5 -y --allow-change-held-packages                                                                                                       0.0s
 => CACHED [ 4/10] RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - &&     apt-get install -y --allow-change-held-packages nodejs                                             0.0s
 => CACHED [ 5/10] RUN curl -OL http://packages.wazuh.com/utils/gcc/gcc-9.4.0.tar.gz &&     tar xzf gcc-9.4.0.tar.gz  && cd gcc-9.4.0/ &&     linux32 ./contrib/download_prerequisites   0.0s
 => CACHED [ 6/10] RUN curl -OL http://packages.wazuh.com/utils/cmake/cmake-3.18.3.tar.gz &&     tar -zxvf cmake-3.18.3.tar.gz && cd cmake-3.18.3 &&     linux32 ./bootstrap --no-syste  0.0s
 => CACHED [ 7/10] ADD build.sh /usr/local/bin/build_package                                                                                                                             0.0s
 => CACHED [ 8/10] RUN chmod +x /usr/local/bin/build_package                                                                                                                             0.0s
 => CACHED [ 9/10] ADD helper_function.sh /usr/local/bin/helper_function.sh                                                                                                              0.0s
 => CACHED [10/10] ADD gen_permissions.sh /tmp/gen_permissions.sh                                                                                                                        0.0s
 => exporting to image                                                                                                                                                                   0.0s
 => => exporting layers                                                                                                                                                                  0.0s
 => => writing image sha256:a94cd5b94c853403f6c4f395070d0cda2970dec8fa7513d6d01cbd80d1b3a249                                                                                             0.0s
 => => naming to docker.io/library/pkg_deb_agent_builder_armhf:latest                                                                                                                    0.0s
+ docker run -t --rm -v /root/Files/STM32MP1/compiled_agent/:/var/local/wazuh:Z -e SYSTEM=deb -e BUILD_TARGET=agent -e ARCHITECTURE_TARGET=armhf -e INSTALLATION_PATH=/var/ossec -e IS_STAGE=no -e WAZUH_BRANCH= -v /home/symeon/Desktop/wazuh-agent:/wazuh-local-src:Z pkg_deb_agent_builder_armhf:latest 0 2 no no no no no
WARNING: The requested image's platform (linux/arm/v7) does not match the detected host platform (linux/amd64/v4) and no specific platform was requested
+ '[' '!' -d /wazuh-local-src ']'
+ '[' no = no ']'
++ cd /wazuh-local-src
++ git rev-parse --short HEAD
+ short_commit_hash=fb573131e
++ build_directories /build_wazuh/agent 'wazuh*' no
++ local build_folder=/build_wazuh/agent
++ local 'wazuh_dir=wazuh*'
++ local future=no
++ mkdir -p /build_wazuh/agent
+++ cut -d v -f 2
+++ cat 'wazuh*/src/VERSION'
/bin/cat: 'wazuh*/src/VERSION': No such file or directory
++ wazuh_version=
++ [[ no == \y\e\s ]]
++ package_name=wazuh-agent-
++ source_dir=/build_wazuh/agent/wazuh-agent-
++ cp -R wazuh-local-src /build_wazuh/agent/wazuh-agent-
++ echo /build_wazuh/agent/wazuh-agent-
+ source_dir=/build_wazuh/agent/wazuh-agent-
++ cut -d v -f 2
++ cat /build_wazuh/agent/wazuh-agent-/src/VERSION
/bin/cat: /build_wazuh/agent/wazuh-agent-/src/VERSION: No such file or directory
+ wazuh_version=
+ package_name=wazuh-agent-
++ find /build_wazuh/agent/wazuh-agent- -name SPECS
++ grep deb
+ specs_path=/build_wazuh/agent/wazuh-agent-/packages/debs/SPECS
+ setup_build /build_wazuh/agent/wazuh-agent- /build_wazuh/agent/wazuh-agent-/packages/debs/SPECS /build_wazuh wazuh-agent- no
+ sources_dir=/build_wazuh/agent/wazuh-agent-
+ specs_path=/build_wazuh/agent/wazuh-agent-/packages/debs/SPECS
+ build_dir=/build_wazuh
+ package_name=wazuh-agent-
+ debug=no
+ cp -pr /build_wazuh/agent/wazuh-agent-/packages/debs/SPECS/wazuh-agent/debian /build_wazuh/agent/wazuh-agent-/debian
/bin/cp: cannot stat '/build_wazuh/agent/wazuh-agent-/packages/debs/SPECS/wazuh-agent/debian': No such file or directory
+ return 1
+ return 1
+ clean 1
+ exit_code=1
+ find /home/symeon/Desktop/wazuh-agent/packages/debs/armhf/agent '(' -name '*.sh' -o -name '*.tar.gz' -o -name 'wazuh-*' ')' '!' -name docker_builder.sh -exec rm -rf '{}' +
+ exit 1

`root@ubuntu:/home/symeon/Desktop/wazuh-agent/packages#``

构建器脚本找不到某些文件。 有人可以帮忙吗? 预先感谢您。

*更新 我从 https://github.com/wazuh/wazuh/tree/master/packages 存储库下载并构建,并遇到以下错误。

# Build the binaries
make -C src deps TARGET=agent
make[2]: Entering directory '/build_wazuh/agent/wazuh-agent-5.0.0/src'
curl -so external/cJSON.tar.gz https://packages.wazuh.com/deps/30/libraries/linux/arm32/cJSON.tar.gz || true
cd external && test -e cJSON.tar.gz && gunzip cJSON.tar.gz || true
/bin/sh: 1: cd: can't cd to external
cd external && test -e cJSON.tar && tar -xf cJSON.tar || true
/bin/sh: 1: cd: can't cd to external
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/30/libraries/sources/cJSON.tar.gz &&\
cd external && gunzip cJSON.tar.gz && tar -xf cJSON.tar && rm cJSON.tar)
Makefile:952: recipe for target 'external/cJSON.tar.gz' failed
make[2]: *** [external/cJSON.tar.gz] Error 23
make[2]: Leaving directory '/build_wazuh/agent/wazuh-agent-5.0.0/src'
debian/rules:40: recipe for target 'override_dh_install' failed
make[1]: *** [override_dh_install] Error 2
make[1]: Leaving directory '/build_wazuh/agent/wazuh-agent-5.0.0'
debian/rules:30: recipe for target 'binary' failed
make: *** [binary] Error 2
dpkg-buildpackage: error: sudo debian/rules binary gave error exit status 2
debuild: fatal error at line 1116:
dpkg-buildpackage -rsudo -us -uc -b -nc failed
+ return 1
+ return 1
+ clean 1
+ exit_code=1
+ find /home/user/Desktop/STM32/wazuh/packages/debs/armhf/agent '(' -name '*.sh' -o -name '*.tar.gz' -o -name 'wazuh-*' ')' '!' -name docker_builder.sh -exec rm -rf '{}' +
+ exit 1
cross-compiling wazuh armhf
1个回答
0
投票

您举报的行为属于预期行为

在第一种情况下,您使用的是

wazuh-agent
存储库,该存储库目前正在开发中,可能无法正常运行,如
README
文件所示。

Work in progress: This project is currently under development. It is not functional and is not compatible with the official release version of the Wazuh manager.

此开发针对

5.0.0
,预计将部分迁移
wazuh/wazuh
存储库,以便
wazuh/wazuh
存储库专用于Wazuh管理器,而
wazuh-agent
存储库将专用于Wazuh代理.

在第二种情况下,存储库几乎是正确的,但您使用的是

master
分支,该分支当前对应于
5.0.0
(将部分迁移),并且也如存储库的
README
文件所示。它可能包含错误。

master branch contains the latest code, be aware of possible bugs on this branch.

目前当前的生产版本是

v4.9.2
,我建议如果您想创建一个包,请遵循官方文档,因为它引用了正确的版本、分支/标签和存储库。

如果你想构建Wazuh代理包,可以参考

Wazuh packages generation guide
https://documentation.wazuh.com/current/development/packaging/index.html

© www.soinside.com 2019 - 2024. All rights reserved.