|
|
|
|
@ -5,7 +5,24 @@ export DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
|
|
dpkg --add-architecture arm64
|
|
|
|
|
|
|
|
|
|
# 保留基础镜像默认 amd64 源,只补充 arm64 ports 源,避免覆盖后出现源配置兼容问题。
|
|
|
|
|
# 强制将默认源限制为 amd64,避免 apt 去 archive/security 拉 arm64 索引(会 404)。
|
|
|
|
|
if [[ -f /etc/apt/sources.list ]]; then
|
|
|
|
|
cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
|
|
|
|
sed -E -i \
|
|
|
|
|
-e 's|^deb[[:space:]]+http://|deb [arch=amd64] http://|g' \
|
|
|
|
|
-e 's|^deb[[:space:]]+https://|deb [arch=amd64] https://|g' \
|
|
|
|
|
/etc/apt/sources.list
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
for list_file in /etc/apt/sources.list.d/*.list; do
|
|
|
|
|
[[ -e "$list_file" ]] || continue
|
|
|
|
|
sed -E -i \
|
|
|
|
|
-e 's|^deb[[:space:]]+http://|deb [arch=amd64] http://|g' \
|
|
|
|
|
-e 's|^deb[[:space:]]+https://|deb [arch=amd64] https://|g' \
|
|
|
|
|
"$list_file"
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# 清理并重建 arm64 ports 源,仅用于 arm64 索引与依赖解析。
|
|
|
|
|
rm -f /etc/apt/sources.list.d/arm64-ports.list
|
|
|
|
|
cat > /etc/apt/sources.list.d/arm64-ports.list <<'EOF'
|
|
|
|
|
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal main restricted universe multiverse
|
|
|
|
|
|