Add librespeed cli speedtest
This commit is contained in:
parent
3bf0ebfa3b
commit
169a3c7bf7
1 changed files with 52 additions and 0 deletions
52
librespeed-cli-test-linux.sh
Normal file
52
librespeed-cli-test-linux.sh
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue