File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 $outFile = " envfetch.exe"
1010 Invoke-WebRequest - Uri " https://github.com/ankddev/envfetch/releases/latest/download/envfetch-windows-amd64.exe" - OutFile $outFile
1111
12+ # Check integrity
13+ $expectedChecksum = Invoke-WebRequest - Uri " https://github.com/ankddev/envfetch/releases/latest/download/envfetch-windows-amd64.exe.sha256"
14+ $expectedChecksum = [System.Text.Encoding ]::UTF8.GetString($expectedChecksum.Content ).TrimEnd()
15+ $actualChecksum = (Get-FileHash - Path $outFile - Algorithm SHA256).Hash.ToLower()
16+ if ($actualChecksum -ne $expectedChecksum ) {
17+ Write-Host " Checksum mismatch!"
18+ Write-Host " Expected: \" $expectedChecksum \" "
19+ Write-Host " Actual: \" $actualChecksum \" "
20+ Write-Host " Please download the file manually and verify its integrity."
21+ exit 1
22+ }
23+
1224 # Add to PATH
1325 $userPath = [Environment ]::GetEnvironmentVariable(" Path" , " User" )
1426 if ($userPath -notlike " *$envfetchPath *" ) {
You can’t perform that action at this time.
0 commit comments