Skip to content

Commit

Permalink
Update ./scripts/Build/Update TRMM agent.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
P6g9YHK6 committed Dec 21, 2024
1 parent 70673dc commit b8f19df
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions scripts_staging/Build/Update TRMM agent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,30 @@
version=latest
version=2.7.0
issigned=true
trmm_api_target=api.exemple.com
.NOTES
Author: SAN
Date: 29.10.24
#public
.CHANGELOG
- Initial version
- Added support for environment variable input
- Enhanced error handling and process execution
- Added local version check to skip download if versions match
.TODO
integrate to monthly update runs
integrate to our monthly update runs
test if api target is really needed
#>

# Variables
$version = $env:version # Specify a version manually, or leave as "latest" to get the latest version from GitHub
$version = $env:version # Specify a version manually, or set it as "latest" to get the latest version from GitHub
$isSigned = $env:issigned -eq 'true' # Set to true to download the signed version
$signedDownloadToken = $env:trmm_sign_download_token # Token used for signed downloads only
$apiTarget = $env:trmm_api_target # Environment variable for the API target URL

# Check for signed download token if isSigned is true
if ($isSigned -and -not $signedDownloadToken) {
Write-Output "Error: Missing signed download token. Exiting..."
# Check for signed download token and API target if isSigned is true
if ($isSigned -and (-not $signedDownloadToken -or -not $apiTarget)) {
Write-Output "Error: Missing signed download token or API target. Exiting..."
exit 1
}

Expand Down Expand Up @@ -132,7 +132,7 @@ try {
# Determine the download URL based on the $isSigned variable
if ($isSigned) {
# Download the signed agent using the token
$downloadUrl = "https://agents.tacticalrmm.com/api/v2/agents?version=$version&arch=amd64&token=$signedDownloadToken&plat=windows&api=api-rmm-managed-services.vtx.ch"
$downloadUrl = "https://agents.tacticalrmm.com/api/v2/agents?version=$version&arch=amd64&token=$signedDownloadToken&plat=windows&api=$apiTarget"
} else {
# Download the unsigned agent directly from GitHub releases
$downloadUrl = "https://github.com/amidaware/rmmagent/releases/download/v$version/tacticalagent-v$version-windows-amd64.exe"
Expand Down

0 comments on commit b8f19df

Please sign in to comment.