Update mermaids.sh
This commit is contained in:
parent
2566928b8c
commit
de40a7e11e
53
mermaids.sh
53
mermaids.sh
@ -135,50 +135,25 @@ die() { echo -e "${RED}[$(date +%H:%M:%S)]${NC} $1"; exit 1; }
|
||||
PORT="${1:-80}"
|
||||
|
||||
# === Now run operations ===
|
||||
log "Setting up DNS (critical step)..."
|
||||
# === BYPASS DNS: Use Debian CDN IP directly ===
|
||||
log "Bypassing DNS — using Fastly CDN IPs directly..."
|
||||
|
||||
# Backup original resolv.conf
|
||||
cp /etc/resolv.conf /etc/resolv.conf.bak 2>/dev/null || true
|
||||
|
||||
# Force public DNS (bypass AdGuard which may have DoH issues)
|
||||
cat > /etc/resolv.conf <<'EOF'
|
||||
nameserver 1.1.1.1
|
||||
nameserver 8.8.8.8
|
||||
# Hardcode Debian repo IPs (Fastly)
|
||||
cat > /etc/apt/sources.list <<'EOF'
|
||||
deb http://146.75.22.132/debian bookworm main non-free non-free-firmware
|
||||
deb http://146.75.22.132/debian-security bookworm-security main non-free non-free-firmware
|
||||
deb http://146.75.22.132/debian bookworm-updates main non-free non-free-firmware
|
||||
EOF
|
||||
|
||||
# Verify DNS works
|
||||
log "Verifying DNS resolution..."
|
||||
if ! nslookup deb.debian.org 1.1.1.1 &>/dev/null; then
|
||||
die "DNS resolution failed — check network connectivity"
|
||||
fi
|
||||
|
||||
log "DNS verified ✓"
|
||||
|
||||
# === 2. Now configure apt ===
|
||||
log "Configuring apt sources..."
|
||||
mkdir -p /etc/apt/apt.conf.d
|
||||
|
||||
# Use explicit DNS for apt (redundant but safe)
|
||||
cat > /etc/apt/apt.conf.d/99-dns <<'EOF'
|
||||
Acquire::Dns "1.1.1.1";
|
||||
Acquire::Dns "8.8.8.8";
|
||||
EOF
|
||||
|
||||
# Enable non-free repository
|
||||
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
|
||||
fi
|
||||
|
||||
# === 3. Update apt (with retries) ===
|
||||
log "Updating package lists (with retries)..."
|
||||
apt-get update -o Acquire::Retries=5 -o APT::Acquire::Retries=5 || {
|
||||
warn "First apt-get update failed — retrying..."
|
||||
sleep 5
|
||||
apt-get update -o Acquire::Retries=5 || die "apt-get update failed after retries"
|
||||
# Skip resolv.conf entirely — no DNS queries needed
|
||||
log "Installing dependencies (no DNS required)..."
|
||||
apt-get update -o Acquire::Retries=5 || {
|
||||
warn "Failed with primary IP — trying fallback..."
|
||||
# Fallback to secondary Fastly node
|
||||
sed -i 's|146.75.22.132|151.101.2.132|g' /etc/apt/sources.list
|
||||
apt-get update -o Acquire::Retries=5 || die "apt-get update failed after all retries"
|
||||
}
|
||||
|
||||
log "✓ apt-get update succeeded"
|
||||
|
||||
log "Installing dependencies..."
|
||||
apt-get install -y -qq \
|
||||
wget \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user