mirror of
https://github.com/teddysun/across.git
synced 2025-01-31 20:29:36 +08:00
Compare commits
2 Commits
b77916e30a
...
503de4c505
Author | SHA1 | Date | |
---|---|---|---|
|
503de4c505 | ||
|
2d9b17634a |
@ -358,6 +358,7 @@ if [[ -n "$tmpDIST" ]]; then
|
|||||||
[[ "$isDigital" == '9' ]] && DIST='stretch';
|
[[ "$isDigital" == '9' ]] && DIST='stretch';
|
||||||
[[ "$isDigital" == '10' ]] && DIST='buster';
|
[[ "$isDigital" == '10' ]] && DIST='buster';
|
||||||
[[ "$isDigital" == '11' ]] && DIST='bullseye';
|
[[ "$isDigital" == '11' ]] && DIST='bullseye';
|
||||||
|
[[ "$isDigital" == '12' ]] && DIST='bookworm';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
||||||
@ -374,6 +375,7 @@ if [[ -n "$tmpDIST" ]]; then
|
|||||||
[[ "$isDigital" == '16.04' ]] && DIST='xenial';
|
[[ "$isDigital" == '16.04' ]] && DIST='xenial';
|
||||||
[[ "$isDigital" == '18.04' ]] && DIST='bionic';
|
[[ "$isDigital" == '18.04' ]] && DIST='bionic';
|
||||||
[[ "$isDigital" == '20.04' ]] && DIST='focal';
|
[[ "$isDigital" == '20.04' ]] && DIST='focal';
|
||||||
|
# [[ "$isDigital" == '22.04' ]] && DIST='jammy';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
||||||
@ -559,10 +561,10 @@ if [[ "$loaderMode" == "0" ]]; then
|
|||||||
[[ "$setInterfaceName" == "1" ]] && Add_OPTION="net.ifnames=0 biosdevname=0" || Add_OPTION=""
|
[[ "$setInterfaceName" == "1" ]] && Add_OPTION="net.ifnames=0 biosdevname=0" || Add_OPTION=""
|
||||||
[[ "$setIPv6" == "1" ]] && Add_OPTION="$Add_OPTION ipv6.disable=1"
|
[[ "$setIPv6" == "1" ]] && Add_OPTION="$Add_OPTION ipv6.disable=1"
|
||||||
|
|
||||||
lowMem || Add_OPTION="$Add_OPTION lowmem=+0"
|
lowMem || Add_OPTION="$Add_OPTION lowmem=+2"
|
||||||
|
|
||||||
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
||||||
BOOT_OPTION="auto=true $Add_OPTION hostname=$linux_relese domain= quiet"
|
BOOT_OPTION="auto=true $Add_OPTION hostname=$linux_relese domain=$linux_relese quiet"
|
||||||
elif [[ "$linux_relese" == 'centos' ]]; then
|
elif [[ "$linux_relese" == 'centos' ]]; then
|
||||||
BOOT_OPTION="ks=file://ks.cfg $Add_OPTION ksdevice=$interfaceSelect"
|
BOOT_OPTION="ks=file://ks.cfg $Add_OPTION ksdevice=$interfaceSelect"
|
||||||
fi
|
fi
|
||||||
@ -618,11 +620,18 @@ for COMP in `echo -en 'gzip\nlzma\nxz'`
|
|||||||
$UNCOMP < /tmp/$NewIMG | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1
|
$UNCOMP < /tmp/$NewIMG | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1
|
||||||
|
|
||||||
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
||||||
|
CurrentKernelVersion=`ls -1 ./lib/modules 2>/dev/null |head -n1`
|
||||||
|
[ -n "$CurrentKernelVersion" ] && SelectLowmem="di-utils-exit-installer,driver-injection-disk-detect,fdisk-udeb,netcfg-static,parted-udeb,partman-auto,partman-ext3,ata-modules-${CurrentKernelVersion}-di,efi-modules-${CurrentKernelVersion}-di,sata-modules-${CurrentKernelVersion}-di,scsi-modules-${CurrentKernelVersion}-di,scsi-nic-modules-${CurrentKernelVersion}-di" || SelectLowmem=""
|
||||||
cat >/tmp/boot/preseed.cfg<<EOF
|
cat >/tmp/boot/preseed.cfg<<EOF
|
||||||
d-i debian-installer/locale string en_US
|
d-i debian-installer/locale string en_US.UTF-8
|
||||||
|
d-i debian-installer/country string US
|
||||||
|
d-i debian-installer/language string en
|
||||||
|
|
||||||
d-i console-setup/layoutcode string us
|
d-i console-setup/layoutcode string us
|
||||||
|
|
||||||
d-i keyboard-configuration/xkb-keymap string us
|
d-i keyboard-configuration/xkb-keymap string us
|
||||||
|
d-i lowmem/low note
|
||||||
|
d-i anna/choose_modules_lowmem multiselect $SelectLowmem
|
||||||
|
|
||||||
d-i netcfg/choose_interface select $interfaceSelect
|
d-i netcfg/choose_interface select $interfaceSelect
|
||||||
|
|
||||||
@ -683,6 +692,7 @@ tasksel tasksel/first multiselect minimal
|
|||||||
d-i pkgsel/update-policy select none
|
d-i pkgsel/update-policy select none
|
||||||
d-i pkgsel/include string openssh-server
|
d-i pkgsel/include string openssh-server
|
||||||
d-i pkgsel/upgrade select none
|
d-i pkgsel/upgrade select none
|
||||||
|
d-i apt-setup/services-select multiselect
|
||||||
|
|
||||||
popularity-contest popularity-contest/participate boolean false
|
popularity-contest popularity-contest/participate boolean false
|
||||||
|
|
||||||
|
18
bench.sh
18
bench.sh
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Description: A Bench Script by Teddysun
|
# Description: A Bench Script by Teddysun
|
||||||
#
|
#
|
||||||
# Copyright (C) 2015 - 2022 Teddysun <i@teddysun.com>
|
# Copyright (C) 2015 - 2023 Teddysun <i@teddysun.com>
|
||||||
# Thanks: LookBack <admin@dwhd.org>
|
# Thanks: LookBack <admin@dwhd.org>
|
||||||
# URL: https://teddysun.com/444.html
|
# URL: https://teddysun.com/444.html
|
||||||
# https://github.com/teddysun/across/blob/master/bench.sh
|
# https://github.com/teddysun/across/blob/master/bench.sh
|
||||||
@ -39,7 +39,7 @@ _exists() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_exit() {
|
_exit() {
|
||||||
_red "\nThe script has been terminated.\n"
|
_red "\nThe script has been terminated. Cleaning up files...\n"
|
||||||
# clean up
|
# clean up
|
||||||
rm -fr speedtest.tgz speedtest-cli benchtest_*
|
rm -fr speedtest.tgz speedtest-cli benchtest_*
|
||||||
exit 1
|
exit 1
|
||||||
@ -228,7 +228,7 @@ install_speedtest() {
|
|||||||
|
|
||||||
print_intro() {
|
print_intro() {
|
||||||
echo "-------------------- A Bench.sh Script By Teddysun -------------------"
|
echo "-------------------- A Bench.sh Script By Teddysun -------------------"
|
||||||
echo " Version : $(_green v2022-06-01)"
|
echo " Version : $(_green v2023-06-10)"
|
||||||
echo " Usage : $(_red "wget -qO- bench.sh | bash")"
|
echo " Usage : $(_red "wget -qO- bench.sh | bash")"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,6 +305,7 @@ print_system_info() {
|
|||||||
echo " Kernel : $(_blue "$kern")"
|
echo " Kernel : $(_blue "$kern")"
|
||||||
echo " TCP CC : $(_yellow "$tcpctrl")"
|
echo " TCP CC : $(_yellow "$tcpctrl")"
|
||||||
echo " Virtualization : $(_blue "$virt")"
|
echo " Virtualization : $(_blue "$virt")"
|
||||||
|
echo " IPv4/IPv6 : $online"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_io_test() {
|
print_io_test() {
|
||||||
@ -350,6 +351,17 @@ print_end_time() {
|
|||||||
|
|
||||||
! _exists "wget" && _red "Error: wget command not found.\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
|
! _exists "free" && _red "Error: free command not found.\n" && exit 1
|
||||||
|
# check for curl/wget
|
||||||
|
command -v curl >/dev/null 2>&1 && local_curl=true || unset local_curl
|
||||||
|
# test if the host has IPv4/IPv6 connectivity
|
||||||
|
[[ ! -z ${local_curl} ]] && ip_check_cmd="curl -s -m 4" || ip_check_cmd="wget -qO- -T 4"
|
||||||
|
ipv4_check=$((ping -4 -c 1 -W 4 ipv4.google.com >/dev/null 2>&1 && echo true) || ${ip_check_cmd} -4 icanhazip.com 2> /dev/null)
|
||||||
|
ipv6_check=$((ping -6 -c 1 -W 4 ipv6.google.com >/dev/null 2>&1 && echo true) || ${ip_check_cmd} -6 icanhazip.com 2> /dev/null)
|
||||||
|
if [[ -z "$ipv4_check" && -z "$ipv6_check" ]]; then
|
||||||
|
_yellow "Warning: Both IPv4 and IPv6 connectivity were not detected.\n"
|
||||||
|
fi
|
||||||
|
[[ -z "$ipv4_check" ]] && online="$(_red "Offline")" || online="$(_green "Online")"
|
||||||
|
[[ -z "$ipv6_check" ]] && online+=" / $(_red "Offline")" || online+=" / $(_green "Online")"
|
||||||
start_time=$(date +%s)
|
start_time=$(date +%s)
|
||||||
get_system_info
|
get_system_info
|
||||||
check_virt
|
check_virt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user