From 4b2087a536731be4942aca52c2d4d0b60f29bf91 Mon Sep 17 00:00:00 2001 From: usmanovb Date: Thu, 26 Jan 2023 23:03:19 +0300 Subject: [PATCH 1/2] Added options to curl to skip downloading of tbls if the file exists and a newer file is not available (-z curl option) --- use | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/use b/use index 408721d40..56bfb33fb 100644 --- a/use +++ b/use @@ -33,8 +33,7 @@ download() { echo "Unable to get tbls version." >&2 exit 1 } - rm -f "$TBLS_ARCHIVE" - curl -s -L -o "$TBLS_ARCHIVE" \ + curl -z "$TBLS_ARCHIVE" -s -L -o "$TBLS_ARCHIVE" \ "${TBLS_RELEASES_URL}/download/${TBLS_VERSION}/tbls_${TBLS_VERSION}_${TBLS_GOOS}_${TBLS_ARCH}.${TBLS_EXT}" } From 55339e8769c061a220b39407b14f3a22a470351d Mon Sep 17 00:00:00 2001 From: Bulat Usmanov Date: Fri, 27 Jan 2023 01:51:53 +0300 Subject: [PATCH 2/2] Added if clause to use or skip curl -z option --- use | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/use b/use index 56bfb33fb..a4619c9b9 100644 --- a/use +++ b/use @@ -33,7 +33,8 @@ download() { echo "Unable to get tbls version." >&2 exit 1 } - curl -z "$TBLS_ARCHIVE" -s -L -o "$TBLS_ARCHIVE" \ + curl `if [ -f "$TBLS_ARCHIVE" ]; then echo -z "$TBLS_ARCHIVE"; fi` \ # Skip downloading if the newest file was downloaded before + -s -L -o "$TBLS_ARCHIVE" \ "${TBLS_RELEASES_URL}/download/${TBLS_VERSION}/tbls_${TBLS_VERSION}_${TBLS_GOOS}_${TBLS_ARCH}.${TBLS_EXT}" }