This commit is contained in:
2025-11-21 16:51:00 +08:00
parent 7818a3b6e0
commit 5117bc2591
2 changed files with 11 additions and 3 deletions

6
run.sh
View File

@@ -49,6 +49,10 @@ update_and_build() {
return 0
fi
# 配置 Git safe.directory解决所有权问题
CURRENT_DIR=$(pwd)
git config --global --add safe.directory "$CURRENT_DIR" 2>/dev/null || true
# 拉取最新代码
if git pull 2>&1; then
echo -e "${GREEN}✓ 代码更新完成${NC}"
@@ -87,7 +91,7 @@ update_and_build() {
;;
esac
if GOOS=linux GOARCH=${ARCH} CGO_ENABLED=0 go build -ldflags="-w -s" -o "$BINARY_NAME" ./cmd/agent 2>&1; then
if GOOS=linux GOARCH=${ARCH} CGO_ENABLED=0 go build -buildvcs=false -ldflags="-w -s" -o "$BINARY_NAME" ./cmd/agent 2>&1; then
if [ -f "$BINARY_NAME" ] && [ -s "$BINARY_NAME" ]; then
chmod +x "$BINARY_NAME"
echo -e "${GREEN}✓ 编译成功${NC}"