From c5c61ea3f6de2647ab9947e5d13537446cd60eee 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:19:44 +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..214a910 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