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}"
|
PORT="${1:-80}"
|
||||||
|
|
||||||
# === Now run operations ===
|
# === 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
|
# Hardcode Debian repo IPs (Fastly)
|
||||||
cp /etc/resolv.conf /etc/resolv.conf.bak 2>/dev/null || true
|
cat > /etc/apt/sources.list <<'EOF'
|
||||||
|
deb http://146.75.22.132/debian bookworm main non-free non-free-firmware
|
||||||
# Force public DNS (bypass AdGuard which may have DoH issues)
|
deb http://146.75.22.132/debian-security bookworm-security main non-free non-free-firmware
|
||||||
cat > /etc/resolv.conf <<'EOF'
|
deb http://146.75.22.132/debian bookworm-updates main non-free non-free-firmware
|
||||||
nameserver 1.1.1.1
|
|
||||||
nameserver 8.8.8.8
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Verify DNS works
|
# Skip resolv.conf entirely — no DNS queries needed
|
||||||
log "Verifying DNS resolution..."
|
log "Installing dependencies (no DNS required)..."
|
||||||
if ! nslookup deb.debian.org 1.1.1.1 &>/dev/null; then
|
apt-get update -o Acquire::Retries=5 || {
|
||||||
die "DNS resolution failed — check network connectivity"
|
warn "Failed with primary IP — trying fallback..."
|
||||||
fi
|
# Fallback to secondary Fastly node
|
||||||
|
sed -i 's|146.75.22.132|151.101.2.132|g' /etc/apt/sources.list
|
||||||
log "DNS verified ✓"
|
apt-get update -o Acquire::Retries=5 || die "apt-get update failed after all retries"
|
||||||
|
|
||||||
# === 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"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log "✓ apt-get update succeeded"
|
|
||||||
|
|
||||||
log "Installing dependencies..."
|
log "Installing dependencies..."
|
||||||
apt-get install -y -qq \
|
apt-get install -y -qq \
|
||||||
wget \
|
wget \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user