Skip to content

Commit 88cfab4

Browse files
Copilot0xrinegade
andcommitted
Fix ISO workflow pacman download failure by replacing hardcoded mirror with multi-mirror fallback system
Co-authored-by: 0xrinegade <[email protected]>
1 parent 1504e0c commit 88cfab4

File tree

1 file changed

+60
-9
lines changed

1 file changed

+60
-9
lines changed

.github/workflows/build-iso.yml

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,31 +71,82 @@ jobs:
7171
7272
- name: Install pacman and archiso
7373
run: |
74-
# Install pacman on Ubuntu
75-
wget https://mirror.rackspace.com/archlinux/extra/os/x86_64/pacman-6.1.0-3-x86_64.pkg.tar.zst
76-
sudo apt-get install -y zstd
77-
sudo zstd -d pacman-6.1.0-3-x86_64.pkg.tar.zst
78-
sudo tar -xf pacman-6.1.0-3-x86_64.pkg.tar -C /
74+
# Install required tools
75+
sudo apt-get install -y zstd curl
76+
77+
# Define multiple reliable Arch Linux mirrors for fallback
78+
MIRRORS=(
79+
"https://geo.mirror.pkgbuild.com/extra/os/x86_64"
80+
"https://mirror.osbeck.com/archlinux/extra/os/x86_64"
81+
"https://mirrors.kernel.org/archlinux/extra/os/x86_64"
82+
"https://archlinux.uk.mirror.allworldit.com/archlinux/extra/os/x86_64"
83+
"https://america.mirror.pkgbuild.com/extra/os/x86_64"
84+
)
85+
86+
# Find the latest pacman package dynamically
87+
echo "Finding latest pacman package..."
88+
PACMAN_PKG=""
89+
for mirror in "${MIRRORS[@]}"; do
90+
echo "Trying mirror: $mirror"
91+
# Get package list and find latest pacman
92+
if PACMAN_PKG=$(curl -s "${mirror}/" | grep -o 'pacman-[0-9][^"]*\.pkg\.tar\.zst' | sort -V | tail -1); then
93+
if [ -n "$PACMAN_PKG" ]; then
94+
echo "Found pacman package: $PACMAN_PKG"
95+
# Try to download it
96+
if wget -q --spider "${mirror}/${PACMAN_PKG}"; then
97+
echo "Successfully verified package exists at: ${mirror}/${PACMAN_PKG}"
98+
wget "${mirror}/${PACMAN_PKG}"
99+
break
100+
fi
101+
fi
102+
fi
103+
echo "Mirror failed, trying next..."
104+
PACMAN_PKG=""
105+
done
106+
107+
# Verify we downloaded a pacman package
108+
if [ -z "$PACMAN_PKG" ] || [ ! -f "$PACMAN_PKG" ]; then
109+
echo "ERROR: Could not download pacman from any mirror"
110+
echo "Tried mirrors: ${MIRRORS[*]}"
111+
exit 1
112+
fi
113+
114+
echo "Successfully downloaded: $PACMAN_PKG"
115+
116+
# Extract and install pacman
117+
sudo zstd -d "$PACMAN_PKG"
118+
PACMAN_TAR="${PACMAN_PKG%.zst}"
119+
sudo tar -xf "$PACMAN_TAR" -C /
79120
80-
# Configure pacman
121+
# Configure pacman with multiple mirrors for reliability
81122
sudo mkdir -p /etc/pacman.d
82123
sudo tee /etc/pacman.conf > /dev/null << 'EOF'
83124
[options]
84125
Architecture = x86_64
85126
CheckSpace
127+
SigLevel = Required DatabaseOptional
128+
LocalFileSigLevel = Optional
86129
87130
[core]
88-
Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch
131+
Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch
132+
Server = https://mirror.osbeck.com/archlinux/$repo/os/$arch
133+
Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch
134+
Server = https://archlinux.uk.mirror.allworldit.com/archlinux/$repo/os/$arch
135+
Server = https://america.mirror.pkgbuild.com/$repo/os/$arch
89136
90137
[extra]
91-
Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch
138+
Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch
139+
Server = https://mirror.osbeck.com/archlinux/$repo/os/$arch
140+
Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch
141+
Server = https://archlinux.uk.mirror.allworldit.com/archlinux/$repo/os/$arch
142+
Server = https://america.mirror.pkgbuild.com/$repo/os/$arch
92143
EOF
93144
94145
# Initialize pacman keyring
95146
sudo pacman-key --init
96147
sudo pacman-key --populate archlinux
97148
98-
# Install archiso
149+
# Update package databases and install archiso
99150
sudo pacman -Sy --noconfirm archiso
100151
101152
- name: Create OSVMarchi ISO build environment

0 commit comments

Comments
 (0)