From 4d2ca6b9b9fb42d645dc6683aa118a3144923cb7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Torbj=C3=B6rn=20L=C3=B6nnemark?= <tobbez@ryara.net>
Date: Tue, 17 Dec 2024 01:23:17 +0100
Subject: [PATCH] Fix thinlinc client downloader

The download page without trailing slash now redirects to trailing
slash, and the page also contains the link to the .rpm twice.
---
 files/add_latest_thinlinc_client_to_repos | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/files/add_latest_thinlinc_client_to_repos b/files/add_latest_thinlinc_client_to_repos
index 0212329..055b167 100755
--- a/files/add_latest_thinlinc_client_to_repos
+++ b/files/add_latest_thinlinc_client_to_repos
@@ -6,13 +6,15 @@ cleanup() {
 }
 trap cleanup 0
 
+set -o pipefail
+
 ensure_client_downloaded() {
     local url="$1" filename="$2"
     [ -f "$filename" ] && return
     curl --silent --show-error -o "${WORKDIR}/${filename}" "$url"
 }
 
-if ! latest_client_url="https://www.cendio.com$(curl --silent --show-error https://www.cendio.com/thinlinc/download | grep -Eo '/downloads/clients/thinlinc-client-[^"]+.x86_64.rpm')"; then
+if ! latest_client_url="https://www.cendio.com$(curl -L --silent --show-error https://www.cendio.com/thinlinc/download/ | grep -Eo '/downloads/clients/thinlinc-client-[^"]+.x86_64.rpm' | head -1)"; then
     exit 1
 fi
 
-- 
GitLab