-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: files related to package generation, deprecating vbs into ps1 sc…
…ripts
- Loading branch information
1 parent
9274bff
commit de1f616
Showing
16 changed files
with
791 additions
and
261 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.