Created
August 30, 2025 10:31
-
-
Save lesydimitri/f982137c48c62ded07912e7cb2dc01a8 to your computer and use it in GitHub Desktop.
Get Latest Claris FileMaker Download Links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Fetch release notes HTML content | |
| html_content=$(curl -s "https://help.claris.com/en/server-release-notes/content/index.html") | |
| # Find the first Version X.X.X string | |
| if [ -z "$newest_version" ]; then | |
| newest_version=$(echo "$html_content" | sed -n 's/.*Version \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/p' | head -n1) | |
| fi | |
| # Version string not found -> Exit | |
| if [ -z "$newest_version" ]; then | |
| echo "Failed to detect newest version" | |
| exit 1 | |
| fi | |
| echo "Detected base version: $newest_version" | |
| base_version="$newest_version" | |
| # All download URL patterns | |
| patterns=( | |
| "https://downloads.claris.com/esd/fmp_${base_version}.{}.dmg" | |
| "https://downloads.claris.com/esd/fmp_${base_version}.{}_x64.exe" | |
| "https://downloads.claris.com/esd/fms_${base_version}.{}.dmg" | |
| "https://downloads.claris.com/esd/fms_${base_version}.{}.exe" | |
| "https://downloads.claris.com/esd/fms_${base_version}.{}_Ubuntu22_amd64.zip" | |
| "https://downloads.claris.com/esd/fms_${base_version}.{}_Ubuntu22_arm64.zip" | |
| "https://downloads.claris.com/esd/fms_${base_version}.{}_Ubuntu24_amd64.zip" | |
| "https://downloads.claris.com/esd/fms_${base_version}.{}_Ubuntu24_arm64.zip" | |
| ) | |
| # Function to check a single URL; returns 0 on valid, 1 otherwise | |
| check_url() { | |
| local url=$1 response status clength min_size | |
| response=$(curl -sfI "$url") || return 1 | |
| status=$(printf '%s\n' "$response" | awk '/^HTTP/{print $2; exit}') | |
| clength=$(printf '%s\n' "$response" | awk '/^[Cc]ontent-[Ll]ength:/ {print $2}' | tr -d '\r') | |
| min_size=1000000 | |
| [[ $url == *.zip ]] && min_size=50000000 | |
| [[ $url == *.dmg ]] && min_size=5000000 | |
| [[ $url == *.exe ]] && min_size=5000000 | |
| if [[ $status == "200" && -n $clength && $clength -gt $min_size ]]; then | |
| local product platform size_mb | |
| [[ $url == *"/fmp_"* ]] && product="FileMaker Pro" || product="FileMaker Server" | |
| case "$url" in | |
| *.dmg) platform="macOS" ;; | |
| *_x64.exe) platform="Windows 64-bit" ;; | |
| *.exe) platform="Windows" ;; | |
| *Ubuntu22_amd64*) platform="Ubuntu 22.04 AMD64" ;; | |
| *Ubuntu22_arm64*) platform="Ubuntu 22.04 ARM64" ;; | |
| *Ubuntu24_amd64*) platform="Ubuntu 24.04 AMD64" ;; | |
| *Ubuntu24_arm64*) platform="Ubuntu 24.04 ARM64" ;; | |
| esac | |
| size_mb=$((clength/1024/1024)) | |
| printf '✓ FOUND: %s – %s\n URL: %s\n Size: %dMB\n\n' \ | |
| "$product" "$platform" "$url" "$size_mb" | |
| return 0 | |
| fi | |
| return 1 | |
| } | |
| echo "Searching for FileMaker downloads (base $base_version)..." | |
| echo | |
| for pattern in "${patterns[@]}"; do | |
| echo "Pattern: $(basename "$pattern")" | |
| found=0 | |
| flagfile=$(mktemp) | |
| # Launch builds 000–999 as background jobs, max 8 concurrent | |
| for build in $(seq -w 0 999); do | |
| # If already found, break out | |
| [[ -f "$flagfile.found" ]] && break | |
| # Enforce concurrency limit | |
| while (( $(jobs -rp | wc -l) >= 8 )); do | |
| sleep 0.1 | |
| done | |
| ( | |
| # Child: if another job found it, skip | |
| [[ -f "$flagfile.found" ]] && exit | |
| url=${pattern//\{\}/$build} | |
| if check_url "$url"; then | |
| # Mark that we found one | |
| touch "$flagfile.found" | |
| fi | |
| ) & | |
| done | |
| # Wait for all background checks to finish or be skipped | |
| wait | |
| if [[ -f "$flagfile.found" ]]; then | |
| found=1 | |
| fi | |
| rm -f "$flagfile" "$flagfile.found" | |
| if [[ $found -eq 0 ]]; then | |
| echo "No valid binary found for pattern: $(basename "$pattern")" | |
| fi | |
| echo | |
| done | |
| echo "Search completed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment