From 169a3c7bf799b0ef547f74bdae4843f9d7acc4e4 Mon Sep 17 00:00:00 2001 From: Conor425 Date: Fri, 16 May 2025 21:21:40 +0000 Subject: [PATCH] Add librespeed cli speedtest --- librespeed-cli-test-linux.sh | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 librespeed-cli-test-linux.sh diff --git a/librespeed-cli-test-linux.sh b/librespeed-cli-test-linux.sh new file mode 100644 index 0000000..096edbb --- /dev/null +++ b/librespeed-cli-test-linux.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Get the architecture from uname +ARCH=$(uname -m) + +# Map the architecture to the corresponding tar.gz name +case $ARCH in + armv7l) + ARCH_TAR="armv7" + ;; + x86_64) + ARCH_TAR="amd64" + ;; + *) + echo "Unsupported architecture: $ARCH" + exit 1 + ;; +esac + +# Fetch the latest release information from GitHub +RELEASE_INFO=$(curl -s https://api.github.com/repos/librespeed/speedtest-cli/releases/latest) + +# Extract the download URL for the correct architecture and only for Linux +DOWNLOAD_URL=$(echo "$RELEASE_INFO" | jq -r ".assets[] | select(.name | contains(\"linux\") and contains(\"${ARCH_TAR}\")) | .browser_download_url") + +# Check if a download URL was found +if [ -z "$DOWNLOAD_URL" ]; then + echo "No download URL found for architecture: $ARCH_TAR" + exit 1 +fi + +# Debugging output +echo "Downloading from: $DOWNLOAD_URL" + +# Download, extract, and clean up +wget "$DOWNLOAD_URL" -O librespeed-cli.tar.gz +if [ $? -ne 0 ]; then + echo "Failed to download the file." + exit 1 +fi + +tar -xvzf librespeed-cli.tar.gz +if [ $? -ne 0 ]; then + echo "Failed to extract the tar file." + exit 1 +fi + +./librespeed-cli +sleep 1 +rm librespeed-cli +rm LICENSE +rm librespeed-cli.tar.gz \ No newline at end of file