Files
deepseek-harness/scripts/prepare-ci-apt-https.sh
T
2026-11-23 20:11:16 +08:00

23 lines
828 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Ubuntu HTTP archive mirrors can stall for tens of seconds per package
# (Blacksmith lists http://azure.archive.ubuntu.com first), and Playwright's
# `install --with-deps` installs many of them. Point every APT source at HTTPS
# before that step, so a hosted runner spends seconds instead of minutes there.
sudo python3 - <<'PY'
from pathlib import Path
import re
apt = Path('/etc/apt')
sources = [apt / 'sources.list', apt / 'blacksmith-ubuntu-mirrors.txt',
*(apt / 'sources.list.d').glob('*.list'),
*(apt / 'sources.list.d').glob('*.sources')]
for source in sources:
if source.is_file():
source.write_text(re.sub(
r'http://(?:[a-z0-9-]+\.)*(archive|security)\.ubuntu\.com/',
r'https://\1.ubuntu.com/', source.read_text()))
PY