diff --git a/scripts/build-apt-repo.sh b/scripts/build-apt-repo.sh index 0bba958..8bd5b9e 100644 --- a/scripts/build-apt-repo.sh +++ b/scripts/build-apt-repo.sh @@ -173,6 +173,8 @@ for arch in $ARCHES; do done apt-ftparchive packages "$tmp_pool" > "$out_dir/Packages" + # apt-ftparchive 会把临时目录的绝对路径写入 Filename,客户端无法下载;改为相对仓库根的 pool/... 路径。 + sed -i "s|^Filename: .*\\.tmp-pool-${arch}/|Filename: pool/${COMPONENT}/|" "$out_dir/Packages" gzip -kf "$out_dir/Packages" rm -rf "$tmp_pool" done diff --git a/scripts/verify-apt-repo.sh b/scripts/verify-apt-repo.sh index ad1feb2..b2414d7 100644 --- a/scripts/verify-apt-repo.sh +++ b/scripts/verify-apt-repo.sh @@ -88,6 +88,10 @@ for arch in $ARCHES; do echo "错误: Packages.gz 不是有效 gzip 文件: $pkg_gz" >&2 exit 1 fi + if gzip -dc "$pkg_gz" | grep -q '^Filename:.*\.tmp-pool-'; then + echo "错误: $pkg_gz 中 Filename 仍指向构建临时目录 .tmp-pool-*,客户端无法下载。请使用最新 scripts/build-apt-repo.sh 重新生成 dist/repo。" >&2 + exit 1 + fi done if ! find "$REPO_DIR/pool/$COMPONENT" -type f -name "*.deb" | read -r _; then