mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-14 13:56:47 +00:00
feat: Return apt packages with their installed versions (#2939)
This commit is contained in:
@@ -295,10 +295,20 @@ function Get-CachedDockerImagesTableData {
|
||||
}
|
||||
|
||||
function Get-AptPackages {
|
||||
$toolsetJson = Get-ToolsetContent
|
||||
$apt = $toolsetJson.apt
|
||||
$pkgs = ($apt.common_packages + $apt.cmd_packages | Sort-Object) -join ", "
|
||||
return $pkgs
|
||||
$apt = (Get-ToolsetContent).Apt
|
||||
$output = @()
|
||||
ForEach ($pkg in ($apt.common_packages + $apt.cmd_packages)) {
|
||||
$version = $(dpkg-query -W -f '${Version}' $pkg)
|
||||
if ($Null -eq $version) {
|
||||
$version = $(dpkg-query -W -f '${Version}' "$pkg*")
|
||||
}
|
||||
|
||||
$output += [PSCustomObject] @{
|
||||
Name = $pkg
|
||||
Version = $version
|
||||
}
|
||||
}
|
||||
return ($output | Sort-Object Name)
|
||||
}
|
||||
|
||||
function Get-PipxVersion {
|
||||
|
||||
@@ -286,6 +286,6 @@ $markdown += Get-CachedDockerImagesTableData | New-MDTable
|
||||
$markdown += New-MDNewLine
|
||||
|
||||
$markdown += New-MDHeader "Installed apt packages" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines @(Get-AptPackages)
|
||||
$markdown += Get-AptPackages | New-MDTable
|
||||
|
||||
$markdown | Out-File -FilePath "${OutputDirectory}/Ubuntu-Readme.md"
|
||||
|
||||
Reference in New Issue
Block a user