From 9e3bbcb5e1cce9c73e72db1a95f46ad7baa0360a Mon Sep 17 00:00:00 2001 From: sergei-pyshnoi <121864472+sergei-pyshnoi@users.noreply.github.com> Date: Tue, 4 Apr 2023 17:52:40 +0200 Subject: [PATCH] [Ubuntu] Add systemd version to software report (#7387) --- .../linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 | 6 ++++++ .../scripts/SoftwareReport/SoftwareReport.Generator.ps1 | 1 + 2 files changed, 7 insertions(+) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 3f5badf5..873f35ce 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -371,3 +371,9 @@ function Build-PackageManagementEnvironmentTable { } ) } + +function Get-SystemdVersion { + $matches = [regex]::Matches((systemctl --version | head -n 1), "\((.*?)\)") + $result = foreach ($match in $matches) {$match.Groups[1].Value} + return $result +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index d8cd6b11..5edc9068 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -30,6 +30,7 @@ $softwareReport = [SoftwareReport]::new("Ubuntu $(Get-OSVersionShort)") $softwareReport.Root.AddToolVersion("OS Version:", $(Get-OSVersionFull)) $softwareReport.Root.AddToolVersion("Kernel Version:", $(Get-KernelVersion)) $softwareReport.Root.AddToolVersion("Image Version:", $env:IMAGE_VERSION) +$softwareReport.Root.AddToolVersion("Systemd version:", $(Get-SystemdVersion)) $installedSoftware = $softwareReport.Root.AddHeader("Installed Software")