fix(apt-install): 修复下载依赖的环境变量设置

This commit is contained in:
严浩
2025-12-20 23:49:25 +08:00
parent 9d9e332929
commit 0215ed05f0

View File

@@ -1,6 +1,6 @@
#!/bin/bash
#-------------------------------------------------------------------------------------------------------------
# URL="https://git.1-h.cc/Scripts/Linux/raw/branch/2026/devcontainer/apt-install-with-cache.sh"; bash <(curl -fsSL "$URL") git vim curl
# curl -fsSL https://Git.1-H.CC/Scripts/Linux/raw/branch/2026/devcontainer/apt-install-with-cache.sh | sudo bash -s -- git vim curl
#-------------------------------------------------------------------------------------------------------------
# =================配置区域=================
@@ -54,7 +54,8 @@ fi
# -o Dir::Cache::archives="$CACHE_DIR" 告诉 apt 把包下载到我们指定的目录
# --download-only 告诉 apt 只下载依赖包,不要解压安装
echo "⬇️ 正在检查并下载依赖..."
$SUDO DEBIAN_FRONTEND=noninteractive apt-get install -y --download-only \
export DEBIAN_FRONTEND=noninteractive
$SUDO apt-get install -y --download-only \
-o Dir::Cache::archives="$CACHE_DIR" \
$PACKAGES > "$LOG_FILE" 2>&1
@@ -81,7 +82,8 @@ echo "✅ 依赖下载/缓存完成。"
# 再次运行 install指向同一个缓存目录。
# apt 会检测到目录里已经有对应的 .deb 文件(且哈希值匹配),就会直接使用缓存,跳过下载。
echo "🚀 开始安装..."
$SUDO DEBIAN_FRONTEND=noninteractive apt-get install -y \
export DEBIAN_FRONTEND=noninteractive
$SUDO apt-get install -y \
-o Dir::Cache::archives="$CACHE_DIR" \
$PACKAGES > "$LOG_FILE" 2>&1