From 5206dfbc437e0581be9387fb695585b0c4da15bb Mon Sep 17 00:00:00 2001 From: host Date: Fri, 6 Nov 2026 10:09:02 +0000 Subject: [PATCH] =?UTF-8?q?fix(chv-guest):=20gt=20=E7=94=A8=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E8=B7=AF=E5=BE=84=E8=B0=83=E7=94=A8=EF=BC=88B-20?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round 5 真机构建在 gt 安装步失败:install.sh 已装好 /usr/local/bin/gt,但 virt-customize 的客机 sh 里 PATH 不含 /usr/local/bin,同一 --run-command 链里的 gt version 报 command not found,整个 virt-customize 退出非 0。 改两处为 /usr/local/bin/gt version(安装断言 + 版本读回文件)。 install.sh 自身的 SHA256 校验与二进制下载均已通过,不是下载问题。 --- chv-guest/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chv-guest/build.sh b/chv-guest/build.sh index aae53be..86635e3 100755 --- a/chv-guest/build.sh +++ b/chv-guest/build.sh @@ -216,7 +216,7 @@ run qemu-img convert -f qcow2 -O raw "$IMG" "$OUT/disk.raw" # BUILDINFO.versions.pip 里没有 playwright;Chromium 版本以 # ms-playwright 缓存目录名记录(如 chromium_headless_shell-1181), # 写进 /app/guest-versions-chromium.txt)。 -GT_INSTALL_CMD="curl -fsSL -o /tmp/gt-install.sh https://gitea.com/gitea/cli/raw/branch/main/scripts/install.sh && echo \"${GT_INSTALL_SH_SHA256} /tmp/gt-install.sh\" | sha256sum -c - && GITEA_CLI_VERSION=${GT_VERSION} GITEA_CLI_INSTALL_DIR=/usr/local/bin sh /tmp/gt-install.sh && rm -f /tmp/gt-install.sh && gt version" +GT_INSTALL_CMD="curl -fsSL -o /tmp/gt-install.sh https://gitea.com/gitea/cli/raw/branch/main/scripts/install.sh && echo \"${GT_INSTALL_SH_SHA256} /tmp/gt-install.sh\" | sha256sum -c - && GITEA_CLI_VERSION=${GT_VERSION} GITEA_CLI_INSTALL_DIR=/usr/local/bin sh /tmp/gt-install.sh && rm -f /tmp/gt-install.sh && /usr/local/bin/gt version" VC_ARGS=(-a "$OUT/disk.raw" --install git,openssh-server,cloud-init,python3,python3-pip,curl,ca-certificates,xz-utils,fonts-wqy-microhei --copy-in "$CODEX_BIN_DIR/codex:/usr/local/bin/" @@ -231,7 +231,7 @@ VC_ARGS=(-a "$OUT/disk.raw" --run-command 'printf "runcmd:\n - /usr/local/bin/chv-sync boot >>/var/log/chv-sync.log 2>&1 || true\n" > /etc/cloud/cloud.cfg.d/99-chv-sync.cfg' --run-command 'git config --system user.name chv && git config --system user.email chv@localhost && git config --system credential.helper store && git config --system init.defaultBranch main' --run-command "$GT_INSTALL_CMD" - --run-command 'gt version > /app/guest-versions-gt.txt' + --run-command '/usr/local/bin/gt version > /app/guest-versions-gt.txt' --run-command 'printf "ssh_deletekeys: false\nssh_genkeytypes: []\n" > /etc/cloud/cloud.cfg.d/99-chv-hostkey.cfg; systemctl enable ssh || true' --run-command 'printf "PasswordAuthentication no\nPermitRootLogin prohibit-password\nChallengeResponseAuthentication no\nKbdInteractiveAuthentication no\nPubkeyAuthentication yes\n" > /etc/ssh/sshd_config.d/99-chv.conf && mkdir -p /run/sshd && ssh-keygen -A && sshd -t && grep -q "^PasswordAuthentication no" /etc/ssh/sshd_config.d/99-chv.conf && grep -q "^PermitRootLogin prohibit-password" /etc/ssh/sshd_config.d/99-chv.conf && rm -f /etc/ssh/ssh_host_* && test -z "$(ls /etc/ssh/ssh_host_* 2>/dev/null)"' --run-command 'dpkg-query -W -f "\${Package} \${Version}\n" > /app/guest-versions-dpkg.txt; pip3 freeze > /app/guest-versions-pip.txt || true')