跳到主要内容

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

浏览文件

licenses

131 行 · 5.1 KB历史下载
1#!/usr/bin/env bash
2#
3# THIRD_PARTY_LICENSES: the license and notice files of every module and of Go
4# itself that the release binaries are built from.
5#
6# scripts/licenses rewrite THIRD_PARTY_LICENSES
7# scripts/licenses --check fail when it is out of date
8#
9# The modules are those of `go list -deps` for the binary on Linux, macOS and
10# Windows and for the guest agent embedded in it, with the Makefile's tags.
11# Needs go and a module cache (go mod download). Run it again after a change
12# of go.mod or third_party/.
13
14set -euo pipefail
15
16ROOT="$(CDPATH= cd -P -- "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null && pwd)"
17OUT="$ROOT/THIRD_PARTY_LICENSES"
18cd "$ROOT"
19
20check=""
21case "${1:-}" in
22 "") ;;
23 --check) check=1 ;;
24 *) sed -n '5,6p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2 ;;
25esac
26
27tags="$(awk '$1 == "TAGS" && $2 == ":=" { print $3 }' Makefile)"
28[ -n "$tags" ] || { echo "licenses: no TAGS in the Makefile" >&2; exit 1; }
29
30# <path> <version> <dir> per module, for one target.
31modules() { # <goos> <goarch> <cgo> <package>
32 GOOS="$1" GOARCH="$2" CGO_ENABLED="$3" GOWORK=off go list -deps -tags "$tags" \
33 -f '{{with .Module}}{{if not .Main}}{{.Path}}{{"\t"}}{{with .Replace}}{{.Path}}{{else}}{{.Version}}{{end}}{{"\t"}}{{.Dir}}{{end}}{{end}}' "$4"
34}
35
36# Modules only the macOS or Windows builds use are not in a cache filled by a
37# Linux build.
38GOWORK=off go mod download
39
40list="$(mktemp)"
41trap 'rm -f "$list"' EXIT
42{
43 modules linux amd64 0 ./cmd/agent-vm
44 modules linux arm64 0 ./cmd/agent-vm
45 modules linux amd64 0 ./cmd/cage
46 modules linux arm64 0 ./cmd/cage
47 modules darwin arm64 1 ./cmd/agent-vm
48 modules darwin arm64 1 ./cmd/cage
49 modules darwin amd64 1 ./cmd/agent-vm
50 modules windows amd64 0 ./cmd/agent-vm
51 modules windows amd64 0 ./cmd/cage
52 modules windows arm64 0 ./cmd/agent-vm
53 modules linux arm64 0 github.com/lima-vm/lima/v2/cmd/lima-guestagent
54 modules linux amd64 0 github.com/lima-vm/lima/v2/cmd/lima-guestagent
55 modules darwin arm64 0 github.com/lima-vm/lima/v2/cmd/lima-guestagent
56} | awk -F '\t' 'NF == 3 && !seen[$1]++' | LC_ALL=C sort > "$list"
57
58[ -s "$list" ] || { echo "licenses: go list found no module" >&2; exit 1; }
59
60render() {
61 cat <<'EOF'
62Third-party licenses
63
64agent-vm is MIT licensed (LICENSE). The binary is built from the modules
65below and from Go's standard library. Each section gives a module, its
66version and the license and notice files at the root of its source, verbatim.
67third_party/ holds the bundled Lima, sshocker, pkg/sftp and gvisor-tap-vsock
68source compiled into Cage (see NOTICE).
69
70Generated by scripts/licenses.
71
72EOF
73 printf '================================================================================\n'
74 printf 'gaoyifan/china-operator-ip: mainland exit address list (MIT)\n'
75 printf '================================================================================\n\n'
76 cat internal/exitpolicy/data/LICENSE
77 printf '\n'
78 printf '================================================================================\n'
79 printf 'Go standard library (BSD-3-Clause)\n'
80 printf '================================================================================\n\n'
81 go_license="$(go env GOROOT)/LICENSE"
82 # Homebrew keeps the Go license beside libexec rather than inside GOROOT.
83 if [ ! -f "$go_license" ]; then go_license="$(go env GOROOT)/../LICENSE"; fi
84 cat "$go_license"
85 printf '\n'
86 while IFS=$'\t' read -r path version dir; do
87 found=0
88 # LICENSE, LICENCE, COPYING, NOTICE, UNLICENSE, PATENTS, with any suffix.
89 while IFS= read -r f; do
90 found=1
91 printf '================================================================================\n'
92 printf '%s %s: %s\n' "$path" "${version:-}" "$(basename "$f")"
93 printf '================================================================================\n\n'
94 cat "$f"
95 printf '\n'
96 done < <(find "$dir" -maxdepth 1 -type f \( -iname 'licen[sc]e*' -o -iname 'copying*' -o -iname 'notice*' -o -iname 'unlicense*' -o -iname 'patents*' \) | LC_ALL=C sort)
97 if [ "$found" = 0 ]; then
98 echo "licenses: no license file in $path $version ($dir)" >&2
99 return 1
100 fi
101 done < "$list"
102 tailnet_version="$(awk '$1 == "tailscale.com" { sub(/^v/, "", $2); print $2 }' tools/tailnet/go.mod)"
103 cat <<EOF
104
105Cage guest Tailscale component
106-----------------------------
107Tailscale $tailnet_version (https://github.com/tailscale/tailscale), BSD-3-Clause.
108The guest-only executable also uses gliderlabs/ssh (BSD-3-Clause), pkg/sftp
109(BSD-2-Clause), creack/pty (MIT), UserExistsError/conpty (MIT), and the
110transitive modules pinned in tools/tailnet/go.mod and tools/tailnet/go.sum.
111Full license notices for the modules linked on Linux, macOS and Windows
112are distributed in the application licenses/tailnet-go directory.
113EOF
114}
115
116tmp="$(mktemp)"
117trap 'rm -f "$list" "$tmp"' EXIT
118render > "$tmp"
119
120if [ -n "$check" ]; then
121 if cmp -s "$tmp" "$OUT"; then
122 echo "THIRD_PARTY_LICENSES is up to date"
123 else
124 echo "THIRD_PARTY_LICENSES is out of date: run scripts/licenses" >&2
125 diff "$OUT" "$tmp" | head -20 >&2 || true
126 exit 1
127 fi
128else
129 cat "$tmp" > "$OUT"
130 echo "THIRD_PARTY_LICENSES: $(wc -l < "$list" | tr -d ' ') modules"
131fi