From 87604b01348c47a2e1a4f22e9755e8e063394282 Mon Sep 17 00:00:00 2001 From: Twangboy Date: Fri, 4 Sep 2026 09:41:07 -0600 Subject: [PATCH] fix(bootstrap): port ALT Linux onedir fixes to Arch Linux install_arch_linux_onedir()/install_arch_linux_onedir_post() carry the same three bugs just fixed for ALT Linux in bootstrap-salt.sh (its code was evidently copied from Arch's): - ONEDIR_REV as a bare major version (e.g. '3006') - a documented, valid input per __validate_salt_version_arg - passed through unresolved and produced a nonexistent GitHub release tag (v3006). - GitHub Releases doesn't carry an onedir tarball asset for every historical point release (e.g. v3007.1's release page has no onedir asset at all, only source tarballs/docs). - The Linux arm64 tarball name used 'aarch64' instead of the actual 'arm64' used in onedir filenames on both GitHub and artifactory. - install_arch_linux_onedir_post() only exported PATH via /etc/profile.d, which a non-login-shell invocation (e.g. 'docker exec salt-call ...') never sources. Apply the same fixes: resolve 'latest' and bare major versions via __get_packagesite_onedir_latest() (already used by the macOS/Windows/ Photon onedir installers), fetch from the artifactory generic repo instead of GitHub Releases, fix the arm64 filename, and symlink onedir binaries into /usr/bin. Note: Arch Linux has no CI coverage in this repo (no arch/archlinux reference in .github/workflows/test-linux.yml or templates/generate.py), so this couldn't be verified end-to-end via CI. Verified instead: bash -n syntax check, the version-resolution logic exercised in isolation against latest/bare-major/full-version/ package-release-suffix inputs, and the resulting artifactory URLs confirmed live (200) for both x86_64 and arm64. --- bootstrap-salt.sh | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 53d963c52..f483079b1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -6274,19 +6274,30 @@ install_arch_linux_onedir() { version="${ONEDIR_REV:-latest}" arch="x86_64" - [ "$(uname -m)" = "aarch64" ] && arch="aarch64" + # Onedir tarball filenames use "arm64", not the "aarch64" uname reports. + [ "$(uname -m)" = "aarch64" ] && arch="arm64" - # Resolve "latest" to actual version + # Resolve "latest", or a bare major version (e.g. "3006"), to the actual + # latest GA release for that series via the artifactory directory listing + # (same mechanism used for macOS/Windows/Photon onedir installs). A full + # version string (e.g. "3006.26") is used as-is. if [ "$version" = "latest" ]; then - version=$(wget -qO- https://api.github.com/repos/saltstack/salt/releases/latest \ - | grep -Eo '"tag_name": *"v[0-9.]+(-[0-9]+)?"' \ - | sed 's/"tag_name": *"v//;s/"//') || return 1 + __get_packagesite_onedir_latest || return 1 + version="$_GENERIC_PKG_VERSION" + elif [ "$(echo "$version" | grep -E '^[0-9]{4}$')" != "" ]; then + __get_packagesite_onedir_latest "$version" || return 1 + version="$_GENERIC_PKG_VERSION" + else + version=$(__salt_version_string "$version") fi - version=$(__salt_version_string "$version") - tarball="salt-${version}-onedir-linux-${arch}.tar.xz" - url="https://github.com/saltstack/salt/releases/download/v${version}/${tarball}" + # GitHub Releases doesn't carry an onedir tarball asset for every + # historical point release (only newer ones do), while the artifactory + # generic repo has the complete history - it's the same source already + # used by the macOS/Windows/Photon onedir installers, and by the CI + # images' own provisioning. + url="https://${_REPO_URL}/saltproject-generic/onedir/${version}/${tarball}" extractdir="/tmp/salt-${version}-onedir-linux-${arch}" echoinfo "Downloading Salt onedir: $url" @@ -6477,13 +6488,20 @@ EOF systemctl daemon-reload - # Add onedir paths system-wide + # Add onedir paths system-wide. This only takes effect for login/interactive + # shells that source /etc/profile.d - it does not help something like + # `docker exec salt-call ...`, which runs without one, so also + # symlink the onedir binaries into /usr/bin, already on PATH everywhere. cat >/etc/profile.d/saltstack.sh <<'EOF' export PATH=/opt/saltstack/salt:/opt/saltstack/salt/bin:$PATH EOF chmod 644 /etc/profile.d/saltstack.sh + for bin in /opt/saltstack/salt/salt*; do + [ -f "$bin" ] && [ -x "$bin" ] && ln -sf "$bin" "/usr/bin/$(basename "$bin")" + done + if [ "$_START_DAEMONS" -eq $BS_TRUE ]; then systemctl enable --now salt-minion.service fi