mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
33 lines
816 B
PowerShell
33 lines
816 B
PowerShell
function Compare-IcingaVersions()
|
|
{
|
|
param(
|
|
$CurrentVersion,
|
|
$RequiredVersion
|
|
);
|
|
|
|
if ([string]::IsNullOrEmpty($RequiredVersion)) {
|
|
return $FALSE;
|
|
}
|
|
|
|
$RequiredVersion = Split-IcingaVersion -Version $RequiredVersion;
|
|
|
|
if ([string]::IsNullOrEmpty($CurrentVersion) -eq $FALSE) {
|
|
$CurrentVersion = Split-IcingaVersion -Version $CurrentVersion;
|
|
} else {
|
|
$CurrentVersion = Get-IcingaAgentVersion;
|
|
}
|
|
|
|
if ($requiredVersion.Mayor -gt $currentVersion.Mayor) {
|
|
return $FALSE;
|
|
}
|
|
|
|
if ($requiredVersion.Minor -gt $currentVersion.Minor) {
|
|
return $FALSE;
|
|
}
|
|
|
|
if ($requiredVersion.Minor -ge $currentVersion.Minor -And $requiredVersion.Fixes -gt $currentVersion.Fixes) {
|
|
return $FALSE;
|
|
}
|
|
|
|
return $TRUE;
|
|
}
|