Skip to content

Instantly share code, notes, and snippets.

@necenzurat
Last active May 24, 2020 11:25
Show Gist options
  • Save necenzurat/2498b9f0e296a046004789c338bec6a5 to your computer and use it in GitHub Desktop.
Save necenzurat/2498b9f0e296a046004789c338bec6a5 to your computer and use it in GitHub Desktop.
oficial speedtest installer
#!/bin/bash
#
# A speedtest agnostic(ish) install script
#
# @version 0.1.0
# @license DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#
# uncomment this for debugging
# set -x
# Set environment
# speedtest.net version
version='1.0.0'
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
wgetPath=$(command -v wget)
tarPath=$(command -v tar)
lowercase() {
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
function osFlavour() {
osVer=$(lowercase $(uname));
case $osVer in
linux*) echo "linux" ;;
freebsd*) echo "freebsd" ;;
darwin*) echo "macosx" ;;
win*) echo "win" ;;
msys*) echo "MSYS / MinGW / Git Bash" ;; #nah
cygwin*) echo "cygwin" ;; #nah
bsd*) echo "bsd" ;;
sun*) echo "solaris" ;;
aix*) echo "aix" ;;
*) echo "unknown: $(uname)" ;;
esac
}
function osType () {
osType=$(uname -m)
case $osType in
x86_64|amd64) echo 'x86_64';;
i?86|x86) echo 'i386';;
arm*) echo 'arm';;
aarch64) echo 'arm64';;
*) echo "unknown: $(uname -m)";;
esac
}
downloadUrl="https://bintray.com/ookla/download/download_file?file_path=ookla-speedtest-${version}-$(osType)-$(osFlavour).tgz"
if [[ "$(osFlavour)" == "macosx" ]]; then
downloadUrl="https://bintray.com/ookla/download/download_file?file_path=ookla-speedtest-${version}-macosx.tgz"
fi
if [[ "$(osFlavour)" == "freebsd" ]]; then
downloadUrl="https://bintray.com/ookla/download/download_file?file_path=ookla-speedtest-${version}-freebsd.tgz"
fi
if [ ! -w "speedtest" ]; then
echo -e "\033[33mDownloading '$downloadUrl' to speedtest.tar... \033[0m"
${wgetPath} -O speedtest.tgz "$downloadUrl" -q
echo -e "\033[33mUnpacking archive... \033[0m"
${tarPath} zxf speedtest.tgz
echo -e "\033[33mGiving execute permissions... \033[0m"
chmod +x speedtest
./speedtest --accept-gdpr --accept-license -h >> /dev/null
fi
echo -e "\033[92mStarting the shit... \033[0m"
echo -e "\033[36mRunning Fixed ISP test... \033[0m"
./speedtest --accept-gdpr --accept-license -A -s 11494
./speedtest --accept-gdpr --accept-license -A -s 15004
./speedtest --accept-gdpr --accept-license -A -s 4111
echo -e "\033[36mRunning Mobile ISP test... \033[0m"
./speedtest --accept-gdpr --accept-license -A -s 2155
./speedtest --accept-gdpr --accept-license -A -s 4590
echo -e "\033[95mRunning Euroweb Control ISP test... \033[0m"
./speedtest --accept-gdpr --accept-license -A -s 22845
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment