fix(packaging): prioritize standalone Linux_Client.bin binary over shell installer and add Hub auto-download fallback
CI Test Suite / Run Component Tests & Pipeline Verification (push) Successful in 1m46s

This commit is contained in:
2026-10-04 01:18:58 +02:00
parent f0f6eba53b
commit 41563a8fb8
2 changed files with 47 additions and 11 deletions
+34 -4
View File
@@ -31,16 +31,46 @@ echo "[+] Installing LOGAR Client..."
mkdir -p "${INSTALL_DIR}" "${CONFIG_DIR}/certs" mkdir -p "${INSTALL_DIR}" "${CONFIG_DIR}/certs"
chmod 700 "${CONFIG_DIR}/certs" chmod 700 "${CONFIG_DIR}/certs"
if [ -f "dist/Linux_Client.bin" ]; then BIN_INSTALLED=0
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
if [ -f "${SCRIPT_DIR}/Linux_Client.bin" ]; then
cp "${SCRIPT_DIR}/Linux_Client.bin" "${INSTALL_DIR}/Linux_Client"
BIN_INSTALLED=1
elif [ -f "${SCRIPT_DIR}/Linux_Client" ]; then
cp "${SCRIPT_DIR}/Linux_Client" "${INSTALL_DIR}/Linux_Client"
BIN_INSTALLED=1
elif [ -f "dist/Linux_Client.bin" ]; then
cp dist/Linux_Client.bin "${INSTALL_DIR}/Linux_Client" cp dist/Linux_Client.bin "${INSTALL_DIR}/Linux_Client"
BIN_INSTALLED=1
elif [ -f "dist/Linux_Client" ]; then elif [ -f "dist/Linux_Client" ]; then
cp dist/Linux_Client "${INSTALL_DIR}/Linux_Client" cp dist/Linux_Client "${INSTALL_DIR}/Linux_Client"
else BIN_INSTALLED=1
echo "[!] Warning: dist/Linux_Client binary not found in current directory. Continuing with existing binary if present." elif [ -f "Linux_Client.bin" ]; then
cp Linux_Client.bin "${INSTALL_DIR}/Linux_Client"
BIN_INSTALLED=1
elif [ -f "Linux_Client" ]; then
cp Linux_Client "${INSTALL_DIR}/Linux_Client"
BIN_INSTALLED=1
fi fi
if [ -f "${INSTALL_DIR}/Linux_Client" ]; then # If binary is not available locally, fetch standalone binary from LOGAR Hub
if [ "${BIN_INSTALLED}" -eq 0 ] && [ ! -f "${INSTALL_DIR}/Linux_Client" ]; then
echo "[*] Client binary not found locally. Fetching standalone Linux client binary from LOGAR Hub (${HUB_URL}/api/client/update/download?os=linux)..."
if command -v curl >/dev/null 2>&1; then
curl -fsSL "${HUB_URL}/api/client/update/download?os=linux" -o "${INSTALL_DIR}/Linux_Client" || true
elif command -v wget >/dev/null 2>&1; then
wget -qO "${INSTALL_DIR}/Linux_Client" "${HUB_URL}/api/client/update/download?os=linux" || true
fi
fi
if [ -f "${INSTALL_DIR}/Linux_Client" ] && [ -s "${INSTALL_DIR}/Linux_Client" ]; then
chmod +x "${INSTALL_DIR}/Linux_Client" chmod +x "${INSTALL_DIR}/Linux_Client"
echo "[+] Standalone Linux Client executable installed at ${INSTALL_DIR}/Linux_Client"
else
echo "[-] Error: Failed to acquire LOGAR Linux client executable binary." >&2
echo "[-] Please provide Linux_Client.bin in the installer directory or verify HUB_URL connectivity." >&2
exit 1
fi fi
# Bootstrap certificate if missing and enrollment secret is provided # Bootstrap certificate if missing and enrollment secret is provided
+13 -7
View File
@@ -199,8 +199,10 @@ class ServerUpdateManager:
os_dir = os.path.join(self.update_dir, os_name) os_dir = os.path.join(self.update_dir, os_name)
found_pkg = None found_pkg = None
if os.path.exists(os_dir): if os.path.exists(os_dir):
for f in os.listdir(os_dir): # Search by priority: .bin/.exe first, then archives, never .sh
if f.endswith((".exe", ".bin", ".zip", ".tar.gz", ".sh")) and not f.startswith("."): valid_exts = (".exe", ".msi", ".zip") if os_name == "windows" else (".bin", ".tar.gz", ".tgz")
for f in sorted(os.listdir(os_dir), key=lambda x: (not x.endswith((".exe", ".bin")), x)):
if f.endswith(valid_exts) and not f.startswith(".") and not f.endswith(".sh"):
found_pkg = os.path.join(os_dir, f) found_pkg = os.path.join(os_dir, f)
break break
@@ -209,9 +211,9 @@ class ServerUpdateManager:
dist_dir = os.path.join(os.path.dirname(self.update_dir), "dist") dist_dir = os.path.join(os.path.dirname(self.update_dir), "dist")
if os.path.exists(dist_dir): if os.path.exists(dist_dir):
patterns = [ patterns = [
"LOGAR_Client_Setup.exe", "LOGAR_Client.exe", "Win_Client.exe" "LOGAR_Client_Setup.exe", "LOGAR-Client-Setup.exe", "Win_Client.exe", "LOGAR_Client.exe", "LOGAR-Windows-Client.zip"
] if os_name == "windows" else [ ] if os_name == "windows" else [
"Linux_Client.bin", "LOGAR_Client_Linux", "install_linux_client.sh" "Linux_Client.bin", "Linux_Client", "LOGAR_Client_Linux", "LOGAR-Linux-Client.tar.gz"
] ]
for pat in patterns: for pat in patterns:
candidate = os.path.join(dist_dir, pat) candidate = os.path.join(dist_dir, pat)
@@ -329,13 +331,17 @@ class ServerUpdateManager:
for asset in release_assets: for asset in release_assets:
name = (asset.get("name") or "").lower() name = (asset.get("name") or "").lower()
download_url = asset.get("download_url") download_url = asset.get("download_url")
if not download_url: if not download_url or name.endswith(".sh") or "server" in name or "checksum" in name or "sha256" in name:
continue continue
target_os = None target_os = None
if ("win" in name or name.endswith(".exe") or "setup" in name) and not results["windows"]: if ("win" in name or "setup" in name or name.endswith((".exe", ".msi", ".zip"))) and "client" in name and not results["windows"]:
target_os = "windows" target_os = "windows"
elif ("linux" in name or name.endswith((".bin", ".sh")) or "client_linux" in name) and not results["linux"]: elif ("win" in name or name.endswith(".exe")) and not results["windows"]:
target_os = "windows"
elif ("linux" in name or name.endswith((".bin", ".tar.gz", ".tgz"))) and ("client" in name or "agent" in name) and not results["linux"]:
target_os = "linux"
elif name in ("linux_client.bin", "linux_client", "logar_client_linux") and not results["linux"]:
target_os = "linux" target_os = "linux"
if not target_os: if not target_os: