Last active
May 18, 2023 20:27
-
-
Save mbierman/9ac6a35622ee5a0c631ed6f6ad74b722 to your computer and use it in GitHub Desktop.
Install Speedtest for firewalla
This file contains 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 | |
# 2.1.0 | |
# https://gist.github.com/mbierman/9ac6a35622ee5a0c631ed6f6ad74b722 | |
# Put this script in ~/.firewalla/config/post_main.d in order to resinstall after upgrades | |
log=/data/fw_reboot.txt | |
if ! [ -w $log ] ; then | |
sudo touch $log | |
sudo chmod a+w $log | |
fi | |
rel=$(lsb_release -rs); echo $rel | |
app=speedtest | |
edate=$(date +'%a %b %d %H:%M:%S %Z %Y') | |
Cversion=$(curl https://www.speedtest.net/apps/cli | egrep -o '<a href="https://install.speedtest.net/app/cli/ookla-speedtest-([0-9]{1,}\.)+([0-9]{1,}\.)+([0-9]{1,})+-linux-x86_64.tgz">x86_64</a>' | cut -f3 -d "-") | |
install () { | |
# unalias apt | |
# unalias apt-get | |
# sudo apt update | |
# sudo apt-get install curl | |
# curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash | |
# sudo apt-get install speedtest | |
# sudo apt-get update -yq | |
# curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash | |
# sudo apt-get install -yq $app | |
# if (( $(echo "$rel < 19" | bc -l )); then | |
rel2=19 | |
if [[ $(bc <<< "$rel < $rel2") -eq 1 ]]; then | |
echo "Rel is $rel. Install old way..." | |
file="/etc/apt/sources.list.d/speedtest.list" | |
[ -f "$file" ] && sudo sudo && /etc/apt/sources.list.d/speedtest.list && rm $file | |
export DEBIAN_FRONTEND=noninteractive | |
binary=ookla-speedtest-${Cversion}-linux-x86_64 | |
sudo curl https://install.speedtest.net/app/cli/${binary}.tgz --output /data/${binary}.tgz | |
sudo gunzip /data/ookla-speedtest*.tgz | |
sudo tar -xvf /data/ookla-speedtest*.tar | |
cd /data | |
sudo rm ${binary}.tar speedtest.5 ${binary}.tar.z | |
else | |
echo "Rel is $rel. Install easy way..." | |
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash | |
sudo apt-get install speedtest | |
fi | |
echo -e "$edate $app instaleld!" | tee -a $log | |
} | |
if [ -x "/data/speedtest" ]; then | |
Iversion=$(/data/speedtest --version | grep Linux | sed -e 's|Speedtest by Ookla ||g' | cut -f1 -d" " | cut -f1-3 -d".") | |
if [ "$Iversion" = "$Cversion" ] ; then | |
install | |
echo -e "\n\n$app instaleld!\n bye" | |
exit | |
else | |
echo "updating speedtest" | |
install | |
exit | |
fi | |
else | |
echo "$app wasn't installed " | |
echo "installing..." | |
install | |
exit | |
fi |
cstrat
commented
Mar 28, 2021
Thanks for this script, I just installed it. Exactly what I needed, just hope they build it into the firewalla interface at some point 👍
You’re welcome! Glad you found it useful.
Michael - I made some edits to the gist to add in automatic architecture detection and some cleanup on the unpacking portion. Let me know if you are interested in the edits and I can see about uploading them to the gist.
@chezdude2010 sure, great.
curl -s -L -C- https://gist.githubusercontent.com/mbierman/9ac6a35622ee5a0c631ed6f6ad74b722/raw/ddf3ac5e2dc6102b1f560656fff8320586872c80/install_speedtest.sh | cat <(cat <(bash))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment