init-debian/add-speedtest.sh
2024-02-17 09:25:59 +08:00

19 lines
638 B
Bash
Executable File

#!/usr/bin/env bash
set -e
OS_ARCH=$(dpkg --print-architecture) || (echo "Not Debian Based Distro" && exit 1)
OS_CODE=$(source /etc/os-release && echo "$VERSION_CODENAME")
main(){
echo "deb https://packagecloud.io/ookla/speedtest-cli/debian/ $OS_CODE main" | \
tee /etc/apt/sources.list.d/ookla_speedtest-cli.list
curl -fsSL "https://packagecloud.io/ookla/speedtest-cli/gpgkey" | \
gpg --dearmor | tee /etc/apt/trusted.gpg.d/ookla_speedtest-cli-archive-keyring.gpg > /dev/null
command="nala"
command -v $command &>/dev/null || command="apt"
$command update
$command install -y speedtest
}
main;