Skip to content

Commit

Permalink
add: files related to package generation, deprecating vbs into ps1 sc…
Browse files Browse the repository at this point in the history
…ripts
  • Loading branch information
jotacarma90 committed Jan 9, 2025
1 parent 9274bff commit de1f616
Show file tree
Hide file tree
Showing 16 changed files with 791 additions and 261 deletions.
Empty file.
Empty file.
16 changes: 0 additions & 16 deletions packages/windows/Dockerfile

This file was deleted.

46 changes: 46 additions & 0 deletions packages/windows/cleanup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
$CleanPath = "C:\ProgramData\wazuh-agent"
Write-Host "Running cleanup.ps1 for path $CleanPath"

# List of files to keep after uninstallation
$Exceptions = @(
"config/wazuh-agent.yml"
)

$ExceptionPaths = $Exceptions | ForEach-Object { Join-Path -Path $CleanPath -ChildPath $_ }

# Remove Wazuh data folder
Get-ChildItem -Path $CleanPath -Recurse -File | ForEach-Object {
if ($_.FullName -notin $ExceptionPaths) {
Write-Host "Removing file: $($_.FullName)"
Remove-Item -Path $_.FullName -Force
} else {
Write-Host "Skipping file (exception): $($_.FullName)"
}
}

Get-ChildItem -Path $CleanPath -Recurse -Directory | Sort-Object -Property FullName -Descending | ForEach-Object {
if (-not (Get-ChildItem -Path $_.FullName -Recurse)) {
Write-Host "Removing empty directory: $($_.FullName)"
Remove-Item -Path $_.FullName -Force
}
}

if (-not (Get-ChildItem -Path $CleanPath -Recurse)) {
Write-Host "Removing root directory: $CleanPath"
Remove-Item -Path $CleanPath -Force
}


# Remove Wazuh service
$serviceName = "Wazuh Agent"
$wazuhagent = "$PSScriptRoot\wazuh-agent.exe"

Write-Host "Removing service $serviceName."
if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) {
& $wazuhagent --remove-service
Write-Host "Service $serviceName removed successfully."
} else {
Write-Host "Service $serviceName not found."
}

Write-Host "cleanup.ps1 script completed."
33 changes: 0 additions & 33 deletions packages/windows/entrypoint.sh

This file was deleted.

29 changes: 29 additions & 0 deletions packages/windows/generate_compiled_windows_agent.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Created by Wazuh, Inc. <[email protected]>.
# This program is a free software; you can redistribute it and/or modify it under the terms of GPLv2

param (
[string]$MSI_NAME = "wazuh-agent",
[string]$BUILD_TESTS = "0",
[string]$CMAKE_CONFIG = "Debug"
)

if(($help.isPresent)) {
"
This tool can be used to generate the Windows Wazuh agent msi package.
PARAMETERS TO BUILD WAZUH-AGENT MSI (OPTIONALS):
1. MSI_NAME: MSI package name output. By default 'wazuh-agent'.
2. BUILD_TESTS: Define test mode action (0 or 1). By default '0'.
2. CMAKE_CONFIG: Cmake config type, Debug, Release, RelWithDebInfo or MinSizeRel. By default 'Debug'.
"
Exit
}

$originalDir = Get-Location
cd $PSScriptRoot/../..
mkdir build -Force
$Env:CUSTOM_PACKAGE_NAME = $MSI_NAME
$Env:CUSTOM_CMAKE_CONFIG = $CMAKE_CONFIG
cmake src -B build -DBUILD_TESTS=$BUILD_TESTS -G "Visual Studio 17 2022" -A x64
cmake --build build --config $CMAKE_CONFIG
cd $originalDir
153 changes: 0 additions & 153 deletions packages/windows/generate_compiled_windows_agent.sh

This file was deleted.

Loading

0 comments on commit de1f616

Please sign in to comment.