Skip to content

Commit

Permalink
Merge pull request #656 from aaronparker/apps
Browse files Browse the repository at this point in the history
Apps
  • Loading branch information
aaronparker authored Apr 14, 2024
2 parents ff712a0 + 136fad4 commit 0863e79
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 56 deletions.
28 changes: 16 additions & 12 deletions Evergreen/Apps/Get-DockerDesktop.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Get-DockerDesktop {
function Get-DockerDesktop {
<#
.SYNOPSIS
Returns the available Docker Desktop versions.
Expand All @@ -16,19 +16,23 @@ Function Get-DockerDesktop {
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Get the releases data
$Updates = Invoke-EvergreenRestMethod -Uri $res.Get.Update.Uri

foreach ($Update in $Updates) {
if ($Null -ne $Update) {
$PSObject = [PSCustomObject] @{
Version = $Update.enclosure.shortVersionString
Build = $Update.enclosure.version
Size = $Update.enclosure.length
Type = Get-FileType -File $($Update.enclosure.url | Where-Object { $_ -match "\.exe$" } | Select-Object -First 1)
URI = $Update.enclosure.url | Where-Object { $_ -match "\.exe$" } | Select-Object -First 1
}
Write-Output -InputObject $PSObject
# Select the latest version
$Latest = $Updates | `
Sort-Object -Property @{ Expression = { [System.Version]$_.enclosure.shortVersionString }; Descending = $true } | `
Select-Object -First 1

# Output the latest version
foreach ($Item in $Latest.enclosure.url) {
$PSObject = [PSCustomObject] @{
Version = $Latest.enclosure.shortVersionString
Build = $Latest.enclosure.version
Size = $Latest.enclosure.length
Type = Get-FileType -File $Item
URI = $Item
}
Write-Output -InputObject $PSObject
}

}
25 changes: 25 additions & 0 deletions Evergreen/Apps/Get-DrataAgent.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function Get-DrataAgent {
<#
.NOTES
Author: Aaron Parker
Twitter: @stealthpuppy
#>
[OutputType([System.Management.Automation.PSObject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="Product name is a plural")]
[CmdletBinding(SupportsShouldProcess = $false)]
param (
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Pass the repo releases API URL and return a formatted object
$params = @{
Uri = $res.Get.Uri
MatchVersion = $res.Get.MatchVersion
Filter = $res.Get.MatchFileTypes
}
$object = Get-GitHubRepoRelease @params
Write-Output -InputObject $object
}
39 changes: 18 additions & 21 deletions Disabled/Get-LibreOffice.ps1 → Evergreen/Apps/Get-LibreOffice.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Get-LibreOffice {
function Get-LibreOffice {
<#
.SYNOPSIS
Gets the latest LibreOffice version and download URIs, including help packs / language packs for Windows.
Expand All @@ -7,56 +7,53 @@ Function Get-LibreOffice {
Author: Bronson Magnan
Twitter: @cit_bronson
This functions scrapes the vendor web page to find versions and downloads.
TODO: find a better method to find version and URLs
Uses: https://cgit.freedesktop.org/libreoffice/website/tree/check.php?h=update
.LINK
https://github.com/aaronparker/Evergreen
#>
[OutputType([System.Management.Automation.PSObject])]
[CmdletBinding(SupportsShouldProcess = $False)]
[CmdletBinding(SupportsShouldProcess = $false)]
param (
[Parameter(Mandatory = $False, Position = 0)]
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Query the LibreOffice update API
ForEach ($item in $res.Get.Update.UserAgent.GetEnumerator()) {
foreach ($item in $res.Get.Update.UserAgent.GetEnumerator()) {
$params = @{
Uri = $res.Get.Update.Uri
UserAgent = $res.Get.Update.UserAgent[$item.Key]
ContentType = $res.Get.Update.ContentType
SkipCertificateCheck = $True
}
$Update = Invoke-EvergreenRestMethod @params
If ($Null -ne $Update) {
if ($null -ne $Update) {

If ($Null -eq $Update.description.version) {
if ($null -eq $Update.description.version) {
Write-Warning "$($MyInvocation.MyCommand): failed to return a version number for release $($item.Name) from: $($res.Get.Update.Uri)."
}
Else {
else {
Write-Verbose "$($MyInvocation.MyCommand): $($res.Get.Update.Uri) returned version: $($Update.description.version)."

# Get downloads for each platform for the latest version
ForEach ($platform in $res.Get.Download.Platforms.GetEnumerator()) {
foreach ($platform in $res.Get.Download.Platforms.GetEnumerator()) {

Write-Verbose "$($MyInvocation.MyCommand): parsing: $($res.Get.Download.Uri)/$($Update.description.version)/$($platform.Name)/."
$params = @{
Uri = "$($res.Get.Download.Uri)/$($Update.description.version)/$($platform.Name)/"
ReturnObject = "All"
}
$PlatformList = Invoke-EvergreenWebRequest @params
#Write-Verbose "PlatformList is type: $($PlatformList.GetType())"
If ($Null -eq $PlatformList) {

if ($null -eq $PlatformList) {
Write-Warning "$($MyInvocation.MyCommand): Check that the following URL is valid: $($res.Get.Download.Uri)/$($Update.description.version)/$($platform.Name)/."
}
Else {
else {
$Architectures = ($PlatformList.Links | Where-Object { $_.href -match $res.Get.Download.MatchArchitectures }).href -replace "/", ""
ForEach ($arch in $Architectures) {
foreach ($arch in $Architectures) {

# Get downloads for each architecture for the latest version/platform
Write-Verbose "$($MyInvocation.MyCommand): parsing: $($res.Get.Download.Uri)/$($Update.description.version)/$($platform.Name)/$arch/."
Expand All @@ -65,21 +62,21 @@ Function Get-LibreOffice {
ReturnObject = "All"
}
$ArchitectureList = Invoke-EvergreenWebRequest @params
#Write-Verbose "ArchitectureList is type: $($ArchitectureList.GetType())"
If ($Null -eq $ArchitectureList) {

if ($null -eq $ArchitectureList) {
Write-Warning "$($MyInvocation.MyCommand): Check that the following URL is valid: $($res.Get.Download.Uri)/$($Update.description.version)/$($platform.Name)/$arch/."
}
Else {
else {
$Files = ($ArchitectureList.Links | Where-Object { $_.href -match $res.Get.Download.MatchExtensions }).href -replace "/", ""
ForEach ($file in ($Files | Where-Object { $_ -notlike "*sdk*" })) {
foreach ($file in ($Files | Where-Object { $_ -notlike "*sdk*" })) {

# Match language string
Remove-Variable -Name "Language", "match" -ErrorAction "SilentlyContinue"
$match = $file | Select-String -Pattern $res.Get.Download.MatchLanguage
If ($Null -ne $match) {
if ($null -ne $match) {
$Language = $match.Matches.Groups[1].Value
}
Else {
else {
$Language = $res.Get.Download.NoLanguage
}

Expand Down
33 changes: 19 additions & 14 deletions Evergreen/Apps/Get-deviceTRUST.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Get-deviceTRUST {
function Get-deviceTRUST {
<#
.SYNOPSIS
Get the current version and download URLs for deviceTRUST.
Expand All @@ -9,9 +9,9 @@ Function Get-deviceTRUST {
Twitter: @stealthpuppy
#>
[OutputType([System.Management.Automation.PSObject])]
[CmdletBinding(SupportsShouldProcess = $False)]
[CmdletBinding(SupportsShouldProcess = $false)]
param (
[Parameter(Mandatory = $False, Position = 0)]
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
Expand All @@ -24,17 +24,22 @@ Function Get-deviceTRUST {
$Updates = Invoke-EvergreenRestMethod @params

# Build the output object
If ($Null -ne $Updates) {
ForEach ($item in $Updates) {
Write-Verbose -Message "$($MyInvocation.MyCommand): build object for: $($item.Name)."
$PSObject = [PSCustomObject] @{
Version = $item.Version
Platform = $item.Platform
Type = $item.Type
Name = $item.Name
URI = $item.URL
}
Write-Output -InputObject $PSObject
$WindowsUpdates = $Updates | Where-Object { $_.Platform -eq "Windows" }

foreach ($Type in ($WindowsUpdates.Type | Select-Object -Unique)) {
Write-Verbose -Message "$($MyInvocation.MyCommand): build output for: $Type."

$Filtered = $WindowsUpdates | Where-Object { $_.Type -eq $Type }
$Latest = $Filtered | Sort-Object -Property @{ Expression = { [System.Version]$_.Version }; Descending = $true } | Select-Object -First 1
Write-Verbose -Message "$($MyInvocation.MyCommand): found version: $($Latest.Version)."

$PSObject = [PSCustomObject] @{
Version = $Latest.Version
Platform = $Latest.Platform
Type = $Latest.Type
Name = $Latest.Name
URI = $Latest.URL
}
Write-Output -InputObject $PSObject
}
}
3 changes: 0 additions & 3 deletions Evergreen/Manifests/1Password7.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"Uri": "https://c.1password.com/dist/1P/win6/updates-stable.json",
"ContentType": "application/json; charset=utf-8",
"Property": "rules"
},
"Download": {
"Uri": "https://download.app.com"
}
},
"Install": {
Expand Down
2 changes: 1 addition & 1 deletion Evergreen/Manifests/DevToys.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Name": "DevToys",
"Source": "https://devtoys.app/",
"Get": {
"Uri": "https://api.github.com/repos/veler/DevToys/releases/latest",
"Uri": "https://api.github.com/repos/DevToys-app/DevToys/releases/latest",
"MatchVersion": "(\\d+(\\.\\d+){1,4}).*",
"MatchFileTypes": "\\.exe$|\\.msi$|\\.msixbundle$"
},
Expand Down
23 changes: 23 additions & 0 deletions Evergreen/Manifests/DrataAgent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"Name": "Drata Agent",
"Source": "https://help.drata.com/en/articles/5002305-installing-the-drata-agent-via-windows-os",
"Get": {
"Uri": "https://api.github.com/repos/drata/agent-releases/releases/latest",
"MatchVersion": "(\\d+(\\.\\d+){1,4}).*",
"MatchFileTypes": "\\.exe$|\\.msi$"
},
"Install": {
"Setup": "",
"Preinstall": "",
"Physical": {
"Arguments": "",
"PostInstall": [
]
},
"Virtual": {
"Arguments": "",
"PostInstall": [
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Uri": "https://update.libreoffice.org/check.php",
"UserAgent": {
"Still": "LibreOffice 0 (3215f89-f603614-ab984f2-7348103-1225a5b; Windows; x86; )",
"Fresh": "LibreOffice 6.3.2 (98b30e735bda24bc04ab42594c85f7fd8be07b9c; Windows; x86;)"
"Fresh": "LibreOffice 7.6.5 (38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b; Windows; x86;)"
},
"ContentType": "text/xml"
},
Expand Down
3 changes: 0 additions & 3 deletions Evergreen/Manifests/MicrosoftVisualStudio.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"Update": {
"Uri": "https://aka.ms/vs/17/release/channel",
"MatchFilter": "VisualStudio.17.Release.Bootstrappers.Setup"
},
"Download": {
"Uri": "https://download.app.com"
}
},
"Install": {
Expand Down
2 changes: 1 addition & 1 deletion Evergreen/Manifests/Slack.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Source": "https://slack.com/intl/en-au/help/articles/212475728-Deploy-Slack-via-Microsoft-Installer",
"Get": {
"Update": {
"Uri": "https://update.app.com"
"Uri": ""
},
"Download": {
"PerUser": {
Expand Down

0 comments on commit 0863e79

Please sign in to comment.