mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 15:19:58 -05:00
23 lines
479 B
PowerShell
23 lines
479 B
PowerShell
function Test-IcingaZipBinaryChecksum()
|
|
{
|
|
param(
|
|
$Path
|
|
);
|
|
|
|
$MD5Path = [string]::Format('{0}.md5', $Path);
|
|
|
|
if ((Test-Path $MD5Path) -eq $FALSE) {
|
|
return $TRUE;
|
|
}
|
|
|
|
[string]$MD5Checksum = Get-Content $MD5Path;
|
|
$MD5Checksum = ($MD5Checksum.Split(' ')[0]).ToLower();
|
|
|
|
$FileHash = ((Get-FileHash $Path -Algorithm MD5).Hash).ToLower();
|
|
|
|
if ($MD5Checksum -ne $FileHash) {
|
|
return $FALSE;
|
|
}
|
|
|
|
return $TRUE;
|
|
}
|