From f7b7dfccc20cff5259873ebb33814bbcf68dee7a Mon Sep 17 00:00:00 2001 From: boypt <1033514+boypt@users.noreply.github.com> Date: Fri, 7 Aug 2026 17:00:12 +0800 Subject: [PATCH] docs: auto-detect ARCH and EL when downloading from latest release Replace the hardcoded 'el7' / 'x86_64' filter with ARCH and EL variables, populated from `uname -m` and `./compile.sh GETEL` respectively. UOS 20 still requires manually setting EL=uos20 since it's not auto-detectable from the running system. --- README.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c5234d2..9bb90e8 100644 --- a/README.md +++ b/README.md @@ -66,15 +66,24 @@ yum install -y gcc44 ### Download RPMs -You can download the needed RPMs from the Release, or use a simple script to download. - -The following example filters out files with `contains("el7") and contains("x86_64")` to download. +You can download the needed RPMs from the GitHub Release using the GitHub +API. The script below auto-detects your architecture and EL version from +the running system, then fetches the matching asset from the latest +release. ```bash -curl -s https://api.github.com/repos/boypt/openssh-rpms/releases/latest \ -| jq -r '.assets[] | select(.name | ascii_downcase | contains("el7") and contains("x86_64")) | .browser_download_url' \ -| wget -i - --show-progress -c +ARCH=$(uname -m) +# Read the system's own rpm dist tag (.el8 -> el8, .el7 -> el7, ...). +# Override for non-elN dists (e.g. UOS 20) or when auto-detect fails. +# If unsure which EL value to use, see the "Supported (tested) Distro" +# table at the top of this README. +EL=$(rpm --eval '%{?dist}' 2>/dev/null | grep -oE 'el[0-9]+' | head -1) +[[ -z "$EL" ]] && EL=el7 +curl -s https://api.github.com/repos/boypt/openssh-rpms/releases/latest \ +| jq -r --arg el "$EL" --arg arch "$ARCH" \ + '.assets[] | select(.name | ascii_downcase | contains($el) and contains($arch)) | .browser_download_url' \ +| wget -i - --show-progress -c ``` ### Build RPMs