跳到主要内容

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

浏览文件

validate-artifact.sh

68 行 · 1.6 KB历史下载
1#!/bin/bash
2
3# SPDX-FileCopyrightText: Copyright The Lima Authors
4# SPDX-License-Identifier: Apache-2.0
5#
6# This script validates that lima-<VERSION>-Darwin-arm64.tar.gz (or .zip)
7# contains lima-guestagent.Linux-aarch64
8# but does not contain share/lima/lima-guestagent.Linux-x86_64
9
10set -eu -o pipefail
11
12list_archive() {
13 if [[ $1 == *.zip ]]; then
14 zipinfo -1 "$1"
15 else
16 tar tzf "$1"
17 fi
18}
19
20must_contain() {
21 tmp="$(mktemp)"
22 list_archive "$1" >"$tmp"
23 if ! grep -q "$2" "$tmp"; then
24 echo >&2 "ERROR: $1 must contain $2"
25 cat "$tmp"
26 rm -f "$tmp"
27 exit 1
28 fi
29 rm -f "$tmp"
30}
31
32must_not_contain() {
33 tmp="$(mktemp)"
34 list_archive "$1" >"$tmp"
35 if grep -q "$2" "$tmp"; then
36 echo >&2 "ERROR: $1 must not contain $2"
37 cat "$tmp"
38 rm -f "$tmp"
39 exit 1
40 fi
41 rm -f "$tmp"
42}
43
44validate_artifact() {
45 FILE="$1"
46 MYARCH="x86_64"
47 OTHERARCH="aarch64"
48 if [[ $FILE == *"aarch64"* || $FILE == *"arm64"* || $FILE == *"ARM64"* ]]; then
49 MYARCH="aarch64"
50 OTHERARCH="x86_64"
51 fi
52 if [[ $FILE == *"go-mod-vendor.tar.gz" || $FILE == *"sbom.tar.gz" ]]; then
53 : NOP
54 elif [[ $FILE == *"lima-additional-guestagents"*".tar.gz" || $FILE == *"lima-additional-guestagents"*".zip" ]]; then
55 must_not_contain "$FILE" "lima-guestagent.Linux-$MYARCH"
56 must_contain "$FILE" "lima-guestagent.Linux-$OTHERARCH"
57 elif [[ $FILE == *"lima-"*".tar.gz" || $FILE == *"lima-"*".zip" ]]; then
58 must_not_contain "$FILE" "lima-guestagent.Linux-$OTHERARCH"
59 must_contain "$FILE" "lima-guestagent.Linux-$MYARCH"
60 else
61 echo >&2 "ERROR: Unexpected file: $FILE"
62 exit 1
63 fi
64}
65
66for FILE in "$@"; do
67 validate_artifact "$FILE"
68done