mirror of
https://github.com/teddysun/across.git
synced 2025-01-18 22:09:35 +08:00
Update comments
Adding additional string inside makes it more safe Signed-off-by: Teddysun <i@teddysun.com>
This commit is contained in:
parent
b2b6aaab1c
commit
fbb53a19b5
16
bbr.sh
16
bbr.sh
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# System Required: CentOS 6+, Debian7+, Ubuntu12+
|
# System Required: CentOS 6+, Debian7+, Ubuntu12+
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016-2017 Teddysun <i@teddysun.com>
|
# Copyright (C) 2016-2018 Teddysun <i@teddysun.com>
|
||||||
#
|
#
|
||||||
# URL: https://teddysun.com/489.html
|
# URL: https://teddysun.com/489.html
|
||||||
#
|
#
|
||||||
@ -34,6 +34,8 @@ elif cat /proc/version | grep -Eqi "ubuntu"; then
|
|||||||
release="ubuntu"
|
release="ubuntu"
|
||||||
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
|
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
|
||||||
release="centos"
|
release="centos"
|
||||||
|
else
|
||||||
|
release=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_latest_version() {
|
get_latest_version() {
|
||||||
@ -85,7 +87,7 @@ getversion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
centosversion() {
|
centosversion() {
|
||||||
if [ "${release}" == "centos" ]; then
|
if [ x"${release}" == x"centos" ]; then
|
||||||
local code=$1
|
local code=$1
|
||||||
local version="$(getversion)"
|
local version="$(getversion)"
|
||||||
local main_ver=${version%%.*}
|
local main_ver=${version%%.*}
|
||||||
@ -101,7 +103,7 @@ centosversion() {
|
|||||||
|
|
||||||
check_bbr_status() {
|
check_bbr_status() {
|
||||||
local param=$(sysctl net.ipv4.tcp_available_congestion_control | awk '{print $3}')
|
local param=$(sysctl net.ipv4.tcp_available_congestion_control | awk '{print $3}')
|
||||||
if [[ "${param}" == "bbr" ]]; then
|
if [[ x"${param}" == x"bbr" ]]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
@ -151,7 +153,7 @@ sysctl_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_config() {
|
install_config() {
|
||||||
if [[ "${release}" == "centos" ]]; then
|
if [[ x"${release}" == x"centos" ]]; then
|
||||||
if centosversion 6; then
|
if centosversion 6; then
|
||||||
if [ ! -f "/boot/grub/grub.conf" ]; then
|
if [ ! -f "/boot/grub/grub.conf" ]; then
|
||||||
echo -e "${red}Error:${plain} /boot/grub/grub.conf not found, please check it."
|
echo -e "${red}Error:${plain} /boot/grub/grub.conf not found, please check it."
|
||||||
@ -165,7 +167,7 @@ install_config() {
|
|||||||
fi
|
fi
|
||||||
grub2-set-default 0
|
grub2-set-default 0
|
||||||
fi
|
fi
|
||||||
elif [[ "${release}" == "debian" || "${release}" == "ubuntu" ]]; then
|
elif [[ x"${release}" == x"debian" || x"${release}" == x"ubuntu" ]]; then
|
||||||
/usr/sbin/update-grub
|
/usr/sbin/update-grub
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -198,14 +200,14 @@ install_bbr() {
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${release}" == "centos" ]]; then
|
if [[ x"${release}" == x"centos" ]]; then
|
||||||
install_elrepo
|
install_elrepo
|
||||||
yum --enablerepo=elrepo-kernel -y install kernel-ml kernel-ml-devel
|
yum --enablerepo=elrepo-kernel -y install kernel-ml kernel-ml-devel
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "${red}Error:${plain} Install latest kernel failed, please check it."
|
echo -e "${red}Error:${plain} Install latest kernel failed, please check it."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif [[ "${release}" == "debian" || "${release}" == "ubuntu" ]]; then
|
elif [[ x"${release}" == x"debian" || x"${release}" == x"ubuntu" ]]; then
|
||||||
[[ ! -e "/usr/bin/wget" ]] && apt-get -y update && apt-get -y install wget
|
[[ ! -e "/usr/bin/wget" ]] && apt-get -y update && apt-get -y install wget
|
||||||
get_latest_version
|
get_latest_version
|
||||||
[ $? -ne 0 ] && echo -e "${red}Error:${plain} Get latest kernel version failed." && exit 1
|
[ $? -ne 0 ] && echo -e "${red}Error:${plain} Get latest kernel version failed." && exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user