跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

install-nsis.ps1

37 行 · 2.0 KB历史下载
1#requires -Version 7.0
2[CmdletBinding()]
3param([string]$Destination = $env:RUNNER_TEMP)
4
5$ErrorActionPreference = 'Stop'
6if (-not $Destination) { throw 'Set RUNNER_TEMP or pass -Destination for the NSIS tool directory.' }
7$version = '3.13'
8$expectedSHA256 = 'ba63dffc4410ee89193e1cb5a41989991bd77c61068da17e3156d136b7b0b3d8'
9$url = "https://downloads.sourceforge.net/project/nsis/NSIS%203/$version/nsis-$version.zip"
10New-Item -ItemType Directory -Path $Destination -Force | Out-Null
11$zip = Join-Path $Destination "nsis-$version.zip"
12
13# SourceForge returns a browser download page (HTTP 200 HTML) for PowerShell's
14# default user agent. Use the command-line downloader it redirects to the ZIP.
15$curl = if ($IsWindows) { 'curl.exe' } else { 'curl' }
16& $curl --fail --location --silent --show-error --retry 3 --connect-timeout 15 --max-time 120 --output $zip --write-out "NSIS download: HTTP %{http_code}, %{content_type}, %{size_download} bytes\n" $url
17if ($LASTEXITCODE -ne 0) { throw "NSIS download failed (curl exit $LASTEXITCODE)." }
18
19$stream = [IO.File]::OpenRead($zip)
20try {
21 $magic = [byte[]]::new(4)
22 $read = $stream.Read($magic, 0, 4)
23} finally { $stream.Dispose() }
24if ($read -ne 4 -or [Convert]::ToHexString($magic) -ne '504B0304') {
25 throw 'NSIS download is not a ZIP. SourceForge may have returned an HTML page; the downloaded content will not be installed.'
26}
27$actualSHA256 = (Get-FileHash -LiteralPath $zip -Algorithm SHA256).Hash
28if ($actualSHA256 -ne $expectedSHA256) {
29 throw "NSIS checksum mismatch. Expected $expectedSHA256; received $actualSHA256."
30}
31Expand-Archive -LiteralPath $zip -DestinationPath $Destination -Force
32$toolDirectory = Join-Path $Destination "nsis-$version"
33if (-not (Test-Path -LiteralPath (Join-Path $toolDirectory 'makensis.exe') -PathType Leaf)) {
34 throw 'Verified NSIS ZIP did not contain the expected compiler.'
35}
36if ($env:GITHUB_PATH) { Add-Content -LiteralPath $env:GITHUB_PATH -Value $toolDirectory }
37Write-Host "Verified NSIS $version ZIP and extracted the compiler."