mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
[Windows] Implement new directories hierarchy (#8616)
This commit is contained in:
committed by
GitHub
parent
84a7deae24
commit
d1f2c9a3be
@@ -0,0 +1,60 @@
|
||||
function Get-ApachePath {
|
||||
return Join-Path "C:\tools\" (Get-Item C:\tools\apache*).Name
|
||||
}
|
||||
|
||||
function Get-NginxPath {
|
||||
return Join-Path "C:\tools\" (Get-Item C:\tools\nginx*).Name
|
||||
}
|
||||
|
||||
function Get-ApacheVersion {
|
||||
$apacheBinPath = Join-Path (Get-ApachePath) "\bin\httpd"
|
||||
(. $apacheBinPath -V | Select-String -Pattern "Apache/") -match "Apache/(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.Version
|
||||
}
|
||||
|
||||
function Get-NginxVersion {
|
||||
$nginxBinPath = Join-Path (Get-NginxPath) "nginx"
|
||||
(cmd /c "$nginxBinPath -v 2>&1") -match "nginx/(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.Version
|
||||
}
|
||||
|
||||
function Get-ApacheSection
|
||||
{
|
||||
$name = "Apache"
|
||||
$apachePort = "80"
|
||||
$apacheService = Get-Service -Name $name
|
||||
$apacheVersion = Get-ApacheVersion
|
||||
$apacheConfigFile = Join-Path (Get-ApachePath) "\conf\httpd.conf"
|
||||
return [PSCustomObject]@{
|
||||
Name = $name
|
||||
Version = $apacheVersion
|
||||
ConfigFile = $apacheConfigFile
|
||||
ServiceName = $apacheService.Name
|
||||
ServiceStatus = $apacheService.Status
|
||||
ListenPort = $apachePort
|
||||
}
|
||||
}
|
||||
|
||||
function Get-NginxSection
|
||||
{
|
||||
$name = "Nginx"
|
||||
$nginxPort = "80"
|
||||
$nginxService = Get-Service -Name $name
|
||||
$nginxVersion = Get-NginxVersion
|
||||
$nginxConfigFile = Join-Path (Get-NginxPath) "\conf\nginx.conf"
|
||||
return [PSCustomObject]@{
|
||||
Name = $name
|
||||
Version = $nginxVersion
|
||||
ConfigFile = $nginxConfigFile
|
||||
ServiceName = $nginxService.Name
|
||||
ServiceStatus = $nginxService.Status
|
||||
ListenPort = $nginxPort
|
||||
}
|
||||
}
|
||||
|
||||
function Build-WebServersSection {
|
||||
return @(
|
||||
(Get-ApacheSection),
|
||||
(Get-NginxSection)
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user