Skip to content

Commit

Permalink
Merge pull request #2346 from wazuh/merge-4.5.1-into-4.5.2
Browse files Browse the repository at this point in the history
Merge 4.5.1 into 4.5.2
  • Loading branch information
vikman90 authored Aug 11, 2023
2 parents 8e2ccc1 + 942d133 commit 1ec3956
Show file tree
Hide file tree
Showing 9 changed files with 1,289 additions and 28 deletions.
30 changes: 25 additions & 5 deletions macos/generate_wazuh_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ CURRENT_PATH="$( cd $(dirname ${0}) ; pwd -P )"
SOURCES_DIRECTORY="${CURRENT_PATH}/repository"
WAZUH_PATH="${SOURCES_DIRECTORY}/wazuh"
WAZUH_SOURCE_REPOSITORY="https://github.com/wazuh/wazuh"
AGENT_PKG_FILE="${CURRENT_PATH}/package_files/wazuh-agent.pkgproj"
export CONFIG="${WAZUH_PATH}/etc/preloaded-vars.conf"
ENTITLEMENTS_PATH="${CURRENT_PATH}/entitlements.plist"
ARCH="intel64"
INSTALLATION_PATH="/Library/Ossec" # Installation path
VERSION="" # Default VERSION (branch/tag)
REVISION="1" # Package revision.
Expand Down Expand Up @@ -150,8 +150,8 @@ function build_package() {

# create package
if packagesbuild ${AGENT_PKG_FILE} --build-folder ${DESTINATION} ; then
echo "The wazuh agent package for MacOS X has been successfully built."
pkg_name="wazuh-agent-${VERSION}-${REVISION}.pkg"
echo "The wazuh agent package for macOS has been successfully built."
pkg_name="wazuh-agent-${VERSION}-${REVISION}.${ARCH}.pkg"
sign_pkg
notarize_pkg
if [[ "${CHECKSUM}" == "yes" ]]; then
Expand All @@ -170,6 +170,7 @@ function help() {
echo "Usage: $0 [OPTIONS]"
echo
echo " Build options:"
echo " -a, --architecture <arch> [Optional] Target architecture of the package [intel64/arm64]. By Default: intel64."
echo " -b, --branch <branch> [Required] Select Git branch or tag e.g. $BRANCH"
echo " -s, --store-path <path> [Optional] Set the destination absolute path of package."
echo " -j, --jobs <number> [Optional] Number of parallel jobs when compiling."
Expand All @@ -196,14 +197,14 @@ function get_pkgproj_specs() {

VERSION=$(< "${WAZUH_PATH}/src/VERSION" cut -d "-" -f1 | cut -c 2-)

pkg_file="specs/wazuh-agent.pkgproj"
pkg_file="specs/wazuh-agent-${ARCH}.pkgproj"

if [ ! -f "${pkg_file}" ]; then
echo "Warning: the file ${pkg_file} does not exists. Check the version selected."
exit 1
else
echo "Modifiying ${pkg_file} to match revision."
sed -i -e "s:${VERSION}-.*<:${VERSION}-${REVISION}<:g" "${pkg_file}"
sed -i -e "s:${VERSION}-.*<:${VERSION}-${REVISION}.${ARCH}<:g" "${pkg_file}"
cp "${pkg_file}" "${AGENT_PKG_FILE}"
fi

Expand Down Expand Up @@ -236,6 +237,10 @@ function install_deps() {
echo "Something went wrong installing packagesbuild."
fi

if [ "$(uname -m)" = "arm64" ]; then
echo "Installing build dependencies for arm64 architecture"
brew install gcc binutils autoconf automake libtool cmake
fi
exit 0
}

Expand All @@ -262,6 +267,14 @@ function main() {
while [ -n "$1" ]
do
case "$1" in
"-a"|"--architecture")
if [ -n "$2" ]; then
ARCH="$2"
shift 2
else
help 1
fi
;;
"-b"|"--branch")
if [ -n "$2" ]; then
BRANCH_TAG="$2"
Expand Down Expand Up @@ -382,12 +395,19 @@ function main() {

testdep

if [ "${ARCH}" != "intel64" ] && [ "${ARCH}" != "arm64" ]; then
echo "Error: architecture not supported."
echo "Supported architectures: intel64, arm64"
exit 1
fi

if [ -z "${CHECKSUMDIR}" ]; then
CHECKSUMDIR="${DESTINATION}"
fi

if [[ "$BUILD" != "no" ]]; then
check_root
AGENT_PKG_FILE="${CURRENT_PATH}/package_files/wazuh-agent-${ARCH}.pkgproj"
build_package
"${CURRENT_PATH}/uninstall.sh"
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1000,9 +1000,9 @@
<key>DICTIONARY</key>
<dict>
<key>IC_REQUIREMENT_CPU_ARCHITECTURE_FAMILY</key>
<integer>2</integer>
<integer>3</integer>
<key>IC_REQUIREMENT_CPU_INTEL_ARCHITECTURE_TYPE</key>
<integer>2</integer>
<integer>0</integer>
<key>IC_REQUIREMENT_CPU_MINIMUM_CPU_CORES_COUNT</key>
<integer>1</integer>
<key>IC_REQUIREMENT_CPU_MINIMUM_FREQUENCY</key>
Expand All @@ -1022,9 +1022,10 @@
<key>SECONDARY_VALUE</key>
<string></string>
<key>VALUE</key>
<string>This installer has been built for 64-bit Intel architecture. It won't install in other platforms.</string>
<string>This installer has been built for Apple Silicon architecture. It won't install in other platforms.</string>
</dict>
</array>

<key>NAME</key>
<string>Processor</string>
<key>STATE</key>
Expand Down Expand Up @@ -1239,7 +1240,7 @@
</dict>
</array>
<key>NAME</key>
<string>wazuh-agent-4.5.2-1</string>
<string>wazuh-agent-4.5.2-1.arm64</string>
<key>PAYLOAD_ONLY</key>
<false/>
<key>TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING</key>
Expand Down
Loading

0 comments on commit 1ec3956

Please sign in to comment.