$ErrorActionPreference = "Stop" $os = "win-x64" $version = "10.4.4" $hashUrl = "https://raw.githubusercontent.com/acitd/hash/refs/heads/main/stylezero/$version/$os-sha256" $hash = Invoke-RestMethod -Uri $hashUrl $url = "https://hub.stylezero.org/dist/stylezero/$version/stylezero-$version-$os.tar.xz" $tmp = "$env:TEMP\tmp-stylezero-$PID.tar.xz" $installDir = "$env:LOCALAPPDATA\Programs\stylezero" $exePath = "$installDir\stylezero.exe" Invoke-WebRequest -Uri $url -OutFile $tmp $computedHash = Get-FileHash -Path $tmp -Algorithm SHA256 | Select-Object -ExpandProperty Hash if ($computedHash -ne $hash.ToUpper()) { Write-Error "Hash mismatch. Aborting." Remove-Item $tmp -Force return } if (-not (Get-Command tar -ErrorAction SilentlyContinue)) { Write-Error "Missing 'tar'. Please install it or use Windows 10+ with tar support." Remove-Item $tmp -Force return } New-Item -ItemType Directory -Force -Path $installDir | Out-Null tar -xJf $tmp -C $installDir Remove-Item $tmp -Force $userPath = [Environment]::GetEnvironmentVariable("Path", "User") if ($userPath -notlike "*$installDir*") { [Environment]::SetEnvironmentVariable("Path", "$userPath;$installDir", "User") $env:Path += ";$installDir" Write-Host "Added $installDir to user PATH. You may need to restart your terminal." } Write-Host "stylezero $version installed to $installDir."