ci: rewrite all ubuntu apt sources
This commit is contained in:
@@ -139,15 +139,36 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
sudo sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g; s|http://security.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64-posix mingw-w64-x86-64-dev
|
||||
else
|
||||
sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g; s|http://security.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' /etc/apt/sources.list
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64-posix mingw-w64-x86-64-dev
|
||||
fi
|
||||
apt_run() {
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
sudo "$@"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
rewrite_apt_sources() {
|
||||
local files=()
|
||||
[[ -f /etc/apt/sources.list ]] && files+=(/etc/apt/sources.list)
|
||||
while IFS= read -r file; do
|
||||
files+=("${file}")
|
||||
done < <(find /etc/apt/sources.list.d -type f \( -name "*.list" -o -name "*.sources" \) 2>/dev/null)
|
||||
|
||||
if [[ "${#files[@]}" -gt 0 ]]; then
|
||||
apt_run sed -i \
|
||||
-e 's|http://archive.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' \
|
||||
-e 's|https://archive.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' \
|
||||
-e 's|http://security.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' \
|
||||
-e 's|https://security.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' \
|
||||
-e 's|http://ports.ubuntu.com/ubuntu-ports|https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports|g' \
|
||||
-e 's|https://ports.ubuntu.com/ubuntu-ports|https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports|g' \
|
||||
"${files[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
rewrite_apt_sources
|
||||
apt_run apt-get update
|
||||
apt_run apt-get install -y --no-install-recommends binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64-posix mingw-w64-x86-64-dev
|
||||
rustup target add x86_64-pc-windows-gnu
|
||||
|
||||
- name: Build Windows x64
|
||||
|
||||
Reference in New Issue
Block a user