From 9a1ad86bd5473eae0c79aa36662ca6c41118f950 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Fri, 19 Sep 2025 09:04:14 +0300 Subject: [PATCH] Add check-version.sh script --- check-version.sh | 11 +++++++++++ source.sh | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 check-version.sh diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..ce157e4 --- /dev/null +++ b/check-version.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +URL="ftp://ftp.gnu.org/gnu/mtools/" + +# Get version number from FTP server +VERSION=$(curl -s --list-only "$URL" | grep -E '^mtools-[0-9]{1,}\.[0-9]{1,}(\.[0-9]{1,})?.tar.gz$' | cut -d '-' -f2 | sort -V | tail -n1) + +# Remove '.tar.gz' suffix from VERSION variable +VERSION=${VERSION//.tar.gz/} + +echo "$VERSION" diff --git a/source.sh b/source.sh index 04d25d1..d69ac2b 100644 --- a/source.sh +++ b/source.sh @@ -2,7 +2,7 @@ # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT -DOWNLOAD="http://ftp.gnu.org/gnu/mtools/mtools-${BPM_PKG_VERSION}.tar.gz" +DOWNLOAD="https://ftpmirror.gnu.org/gnu/mtools/mtools-${BPM_PKG_VERSION}.tar.gz" FILENAME="${DOWNLOAD##*/}" # The prepare function is executed in the root of the temp directory