Update mermaids.sh

This commit is contained in:
Dan 2026-04-16 22:27:46 +08:00
parent f98812fc82
commit bc1ff5e2dd

View File

@ -130,16 +130,15 @@ PORT="${1:-80}"
# 1. Update & install Caddy + deps # 1. Update & install Caddy + deps
log "Setting up apt with public DNS..." log "Setting up apt with public DNS..."
mkdir -p /etc/apt/apt.conf.d/
cat > /etc/apt/apt.conf.d/99dns <<'EOF' mkdir -p /etc/apt/apt.conf.d
cat > /etc/apt/apt.conf.d/99-dns <<'EOF'
Acquire::Dns "1.1.1.1"; Acquire::Dns "1.1.1.1";
Acquire::Dns "8.8.8.8";
EOF EOF
# Also override resolv.conf *only during apt* (safer than global) # Ensure resolv.conf uses a plain DNS for fallback
cat > /etc/resolv.conf.apt <<'EOF' cat > /etc/resolv.conf <<'EOF'
nameserver 1.1.1.1 nameserver 1.1.1.1
nameserver 8.8.8.8
EOF EOF
log "Updating package lists..." log "Updating package lists..."
@ -147,12 +146,12 @@ log "Updating package lists..."
if grep -q "deb debianmain" /etc/apt/sources.list; then if grep -q "deb debianmain" /etc/apt/sources.list; then
sed -i 's/deb \(.*\) main/deb \1 main non-free non-free-firmware/' /etc/apt/sources.list sed -i 's/deb \(.*\) main/deb \1 main non-free non-free-firmware/' /etc/apt/sources.list
fi fi
apt-get update -o Acquire::ForceIPv4=true -o Acquire::Dns="1.1.1.1" || { apt-get update -o Acquire::Retries=3 || {
warn "apt-get update failed — checking DNS..." warn "apt-get update failed — checking DNS..."
cat /etc/resolv.conf cat /etc/resolv.conf
exit 1 exit 1
} }
rm /etc/resolv.conf.apt /etc/apt/apt.conf.d/99dns 2>/dev/null rm /etc/resolv.conf /etc/apt/apt.conf.d/99-dns 2>/dev/null
log "Installing dependencies..." log "Installing dependencies..."
apt-get install -y -qq \ apt-get install -y -qq \