Files
runner-images-sangeeth/images/linux/scripts/SoftwareReport/SoftwareReport.WebServers.psm1
Maxim Lobanov c00379c85c [Ubuntu] Update documentation generation to use shared software report module (#6823)
* Create ubuntu-report.yml

* Update ubuntu-report.yml

* Update ubuntu-report.yml

* Update Common.Helpers.psm1

* Update ubuntu-report.yml

* Update ubuntu-report.yml

* Update SoftwareReport.Generator.ps1

* Update ubuntu-report.yml

* Update ubuntu-report.yml

* env vars

* Implement language and runtime

* Add package management section

* fix typo

* fix typo

* add projectManagement and tools

* fix some tools

* add CLI tools, Java, PHP Tools, Haskell Tools, Rust Tools, Browsers, .NET Core

* fix typo

* more changes

* fix typo

* fix typo

* fix typo

* change templates

* fix toolset

* Update Ubuntu2004 and 2204 templates

* fix cargo

* fix tiny nitpicks

* Fix AddToolVersionsList

* Remove unused methods

* Fix contructor
2022-12-21 19:38:54 +01:00

56 lines
1.7 KiB
PowerShell

function Get-ApacheVersion {
$name = "apache2"
$port = 80
$version = bash -c "apache2 -v | grep -Po 'Apache/(\d+.){2}\d+'" | Take-OutputPart -Part 1 -Delimiter "/"
$serviceStatus = systemctl status apache2 | grep "Active:" | Take-OutputPart -Part 1
$configFile = "/etc/apache2/apache2.conf"
return [PsCustomObject]@{
"Name" = $name
"Version" = $version
"ConfigFile" = $configFile
"ServiceStatus" = $serviceStatus
"ListenPort" = $port
}
}
function Get-NginxVersion {
$name = "nginx"
$port = 80
$version = (dpkg-query --showformat='${Version}' --show nginx).Split('-')[0]
$serviceStatus = systemctl status nginx | grep "Active:" | Take-OutputPart -Part 1
$configFile = "/etc/nginx/nginx.conf"
return [PsCustomObject]@{
"Name" = $name
"Version" = $version
"ConfigFile" = $configFile
"ServiceStatus" = $serviceStatus
"ListenPort" = $port
}
}
function Get-Xsp4Version {
$name = "mono-xsp4"
$port = (grep '^port=' /etc/default/mono-xsp4).Split('=')[1]
$version = (dpkg-query --showformat='${Version}' --show mono-xsp4).Split('-')[0]
$serviceStatus = systemctl show -p ActiveState --value mono-xsp4
$configFile = "/etc/default/mono-xsp4"
return [PsCustomObject]@{
"Name" = $name
"Version" = $version
"ConfigFile" = $configFile
"ServiceStatus" = $serviceStatus
"ListenPort" = $port
}
}
function Build-WebServersTable {
$servers = @()
$servers += (Get-ApacheVersion)
if (Test-IsUbuntu20) {
$servers += (Get-Xsp4Version)
}
$servers += (Get-NginxVersion)
return $servers
}