mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 21:42:24 +00:00
speedtest - snap install
This commit is contained in:
parent
5a4a42aeb8
commit
9b58277945
1 changed files with 31 additions and 23 deletions
54
x-ui.sh
54
x-ui.sh
|
@ -1238,30 +1238,38 @@ ssl_cert_issue_CF() {
|
||||||
run_speedtest() {
|
run_speedtest() {
|
||||||
# Check if Speedtest is already installed
|
# Check if Speedtest is already installed
|
||||||
if ! command -v speedtest &>/dev/null; then
|
if ! command -v speedtest &>/dev/null; then
|
||||||
# If not installed, install it
|
# If not installed, determine installation method
|
||||||
local pkg_manager=""
|
if command -v snap &>/dev/null; then
|
||||||
local speedtest_install_script=""
|
# Use snap to install Speedtest
|
||||||
|
echo "Installing Speedtest using snap..."
|
||||||
if command -v dnf &>/dev/null; then
|
snap install speedtest
|
||||||
pkg_manager="dnf"
|
|
||||||
speedtest_install_script="https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh"
|
|
||||||
elif command -v yum &>/dev/null; then
|
|
||||||
pkg_manager="yum"
|
|
||||||
speedtest_install_script="https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh"
|
|
||||||
elif command -v apt-get &>/dev/null; then
|
|
||||||
pkg_manager="apt-get"
|
|
||||||
speedtest_install_script="https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh"
|
|
||||||
elif command -v apt &>/dev/null; then
|
|
||||||
pkg_manager="apt"
|
|
||||||
speedtest_install_script="https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $pkg_manager ]]; then
|
|
||||||
echo "Error: Package manager not found. You may need to install Speedtest manually."
|
|
||||||
return 1
|
|
||||||
else
|
else
|
||||||
curl -s $speedtest_install_script | bash
|
# Fallback to using package managers
|
||||||
$pkg_manager install -y speedtest
|
local pkg_manager=""
|
||||||
|
local speedtest_install_script=""
|
||||||
|
|
||||||
|
if command -v dnf &>/dev/null; then
|
||||||
|
pkg_manager="dnf"
|
||||||
|
speedtest_install_script="https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh"
|
||||||
|
elif command -v yum &>/dev/null; then
|
||||||
|
pkg_manager="yum"
|
||||||
|
speedtest_install_script="https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh"
|
||||||
|
elif command -v apt-get &>/dev/null; then
|
||||||
|
pkg_manager="apt-get"
|
||||||
|
speedtest_install_script="https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh"
|
||||||
|
elif command -v apt &>/dev/null; then
|
||||||
|
pkg_manager="apt"
|
||||||
|
speedtest_install_script="https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $pkg_manager ]]; then
|
||||||
|
echo "Error: Package manager not found. You may need to install Speedtest manually."
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
echo "Installing Speedtest using $pkg_manager..."
|
||||||
|
curl -s $speedtest_install_script | bash
|
||||||
|
$pkg_manager install -y speedtest
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue