Skip to content

Commit d589713

Browse files
authored
Update build-linux.yml (2dust#8724)
1 parent 4550ddb commit d589713

1 file changed

Lines changed: 57 additions & 4 deletions

File tree

.github/workflows/build-linux.yml

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,64 @@ jobs:
103103

104104
steps:
105105
- name: Prepare tools (Red Hat)
106+
shell: bash
106107
run: |
107-
dnf repolist all
108-
dnf -y makecache
109-
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
110-
dnf -y install sudo git rpm-build rpmdevtools dnf-plugins-core rsync findutils tar gzip unzip which
108+
set -euo pipefail
109+
110+
. /etc/os-release
111+
EL_MAJOR="${VERSION_ID%%.*}"
112+
echo "EL_MAJOR=${EL_MAJOR}"
113+
114+
dnf -y makecache || true
115+
command -v curl >/dev/null || dnf -y install curl ca-certificates
116+
117+
ARCH="$(uname -m)"
118+
case "$ARCH" in x86_64|aarch64) ;; *) echo "Unsupported arch: $ARCH"; exit 1 ;; esac
119+
120+
install_epel_from_dir() {
121+
local base="$1" rpm
122+
echo "Try: $base"
123+
124+
rpm="$(
125+
{
126+
curl -fsSL "$base/Packages/" 2>/dev/null
127+
curl -fsSL "$base/Packages/e/" 2>/dev/null | sed 's|href="|href="e/|'
128+
} |
129+
sed -n 's/.*href="\([^"]*epel-release-[^"]*\.noarch\.rpm\)".*/\1/p' |
130+
sort -V | tail -n1
131+
)" || true
132+
133+
if [[ -n "$rpm" ]]; then
134+
dnf -y install "$base/Packages/$rpm"
135+
return 0
136+
fi
137+
return 1
138+
}
139+
140+
FEDORA="https://dl.fedoraproject.org/pub/epel/epel-release-latest-${EL_MAJOR}.noarch.rpm"
141+
echo "Try Fedora: $FEDORA"
142+
143+
if curl -fsSLI "$FEDORA" >/dev/null; then
144+
dnf -y install "$FEDORA"
145+
else
146+
ROCKY="https://dl.rockylinux.org/pub/rocky/${EL_MAJOR}/extras/${ARCH}/os"
147+
if install_epel_from_dir "$ROCKY"; then
148+
:
149+
else
150+
ALMA="https://repo.almalinux.org/almalinux/${EL_MAJOR}/extras/${ARCH}/os"
151+
if install_epel_from_dir "$ALMA"; then
152+
:
153+
else
154+
echo "EPEL bootstrap failed (Fedora/Rocky/Alma)"
155+
exit 1
156+
fi
157+
fi
158+
fi
159+
160+
dnf -y install sudo git rpm-build rpmdevtools dnf-plugins-core \
161+
rsync findutils tar gzip unzip which
162+
163+
dnf repolist | grep -i epel || true
111164
112165
- name: Checkout repo (for scripts)
113166
uses: actions/checkout@v6.0.1

0 commit comments

Comments
 (0)