Update bench.sh

This commit is contained in:
Teddysun 2022-01-01 21:28:37 +09:00
parent 56f11d49e4
commit ed8826fccb
No known key found for this signature in database
GPG Key ID: 09BD4C080AD6C46D

View File

@ -38,14 +38,6 @@ _exists() {
return ${rt}
}
_64bit(){
if [ $(getconf WORD_BIT) = '32' ] && [ $(getconf LONG_BIT) = '64' ]; then
return 0
else
return 1
fi
}
_exit() {
_red "\nThe script has been terminated.\n"
# clean up
@ -169,15 +161,43 @@ ipv4_info() {
local city="$(wget -q -T10 -O- ipinfo.io/city)"
local country="$(wget -q -T10 -O- ipinfo.io/country)"
local region="$(wget -q -T10 -O- ipinfo.io/region)"
[[ -n "$org" ]] && echo " Organization : $(_blue "$org")"
[[ -n "$city" && -n "country" ]] && echo " Location : $(_blue "$city / $country")"
[[ -n "$region" ]] && echo " Region : $(_yellow "$region")"
[[ -z "$org" ]] && echo " Region : $(_red "No ISP detected")"
if [[ -n "$org" ]]; then
echo " Organization : $(_blue "$org")"
fi
if [[ -n "$city" && -n "country" ]]; then
echo " Location : $(_blue "$city / $country")"
fi
if [[ -n "$region" ]]; then
echo " Region : $(_yellow "$region")"
fi
if [[ -z "$org" ]]; then
echo " Region : $(_red "No ISP detected")"
fi
}
install_speedtest() {
if [ ! -e "./speedtest-cli/speedtest" ]; then
_64bit && sys_bit=x86_64 || sys_bit=i386
sys_bit=""
local sysarch="$(uname -m)"
if [ "${sysarch}" = "unknown" ] || [ "${sysarch}" = "" ]; then
local sysarch="$(arch)"
fi
if [ "${sysarch}" = "x86_64" ]; then
sys_bit="x86_64"
fi
if [ "${sysarch}" = "i386" ] || [ "${sysarch}" = "i686" ]; then
sys_bit="i386"
fi
if [ "${sysarch}" = "armv8" ] || [ "${sysarch}" = "armv8l" ] || [ "${sysarch}" = "aarch64" ] || [ "${sysarch}" = "arm64" ]; then
sys_bit="aarch64"
fi
if [ "${sysarch}" = "armv7" ] || [ "${sysarch}" = "armv7l" ]; then
sys_bit="armhf"
fi
if [ "${sysarch}" = "armv6" ]; then
sys_bit="armel"
fi
[ -z "${sys_bit}" ] && _red "Error: Unsupported system architecture (${sysarch}).\n" && exit 1
url1="https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-${sys_bit}.tgz"
url2="https://dl.lamp.sh/files/ookla-speedtest-1.1.1-linux-${sys_bit}.tgz"
wget --no-check-certificate -q -T10 -O speedtest.tgz ${url1}
@ -191,7 +211,7 @@ install_speedtest() {
}
print_intro() {
echo " $(_yellow "*********************** A Bench.sh Script By Teddysun ***************")"
echo "-------------------- A Bench.sh Script By Teddysun -------------------"
echo " Intro : https://teddysun.com/444.html"
echo " Version : $(_green v2022-01-01)"
echo " Usage : $(_red "wget -qO- bench.sh | bash")"
@ -231,8 +251,12 @@ get_system_info() {
print_system_info() {
echo " CPU Model : $(_blue "$cname")"
echo " CPU Cores : $(_blue "$cores")"
if [ -n "$freq" ]; then
echo " CPU Frequency : $(_blue "$freq MHz")"
fi
if [ -n "$ccache" ]; then
echo " CPU Cache : $(_blue "$ccache")"
fi
echo " Total Disk : $(_yellow "$disk_total_size GB") $(_blue "($disk_used_size GB Used)")"
echo " Total Mem : $(_yellow "$tram MB") $(_blue "($uram MB Used)")"
echo " Total Swap : $(_blue "$swap MB ($uswap MB Used)")"
@ -286,12 +310,11 @@ print_end_time() {
echo " Timestamp : $date_time"
}
! _exists "wget" && _red "Error: wget command not found. You must be install wget command at first.\n" && exit 1
! _exists "wget" && _red "Error: wget command not found.\n" && exit 1
! _exists "free" && _red "Error: free command not found.\n" && exit 1
start_time=$(date +%s)
check_virt
clear
next
print_intro
next
get_system_info