Fix bug
This commit is contained in:
parent
455f31a6fd
commit
b109b6a7a0
|
@ -1,24 +1,25 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
## Installing BBR
|
||||||
|
cd $HOME
|
||||||
|
|
||||||
function BBR_Install {
|
## This part of the script is modified from https://github.com/KozakaiAya/TCP_BBR
|
||||||
## This part of the script is modified from https://github.com/KozakaiAya/TCP_BBR
|
apt-get -qqy install dkms
|
||||||
apt-get -qqy install dkms
|
apt-get -qqy install linux-headers-$(uname -r)
|
||||||
apt-get -qqy install linux-headers-$(uname -r)
|
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Miscellaneous/BBR/5.10.0/tcp_bbrx.c
|
||||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Miscellaneous/BBR/5.10.0/tcp_bbrx.c
|
kernel_ver=5.10.0
|
||||||
kernel_ver=5.10.0
|
algo=bbrx
|
||||||
algo=bbrx
|
bbr_file=tcp_$algo
|
||||||
bbr_file=tcp_$algo
|
bbr_src=$bbr_file.c
|
||||||
bbr_src=$bbr_file.c
|
bbr_obj=$bbr_file.o
|
||||||
bbr_obj=$bbr_file.o
|
|
||||||
|
|
||||||
mkdir -p $HOME/.bbr/src
|
mkdir -p $HOME/.bbr/src
|
||||||
cd $HOME/.bbr/src
|
cd $HOME/.bbr/src
|
||||||
|
|
||||||
mv $HOME/$bbr_src $HOME/.bbr/src/$bbr_src
|
mv $HOME/$bbr_src $HOME/.bbr/src/$bbr_src
|
||||||
|
|
||||||
# Create Makefile
|
# Create Makefile
|
||||||
cat > ./Makefile << EOF
|
cat > ./Makefile << EOF
|
||||||
obj-m:=$bbr_obj
|
obj-m:=$bbr_obj
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -47,46 +48,41 @@ PACKAGE_VERSION=$kernel_ver
|
||||||
REMAKE_INITRD=yes
|
REMAKE_INITRD=yes
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Start dkms install
|
# Start dkms install
|
||||||
cp -R . /usr/src/$algo-$kernel_ver
|
cp -R . /usr/src/$algo-$kernel_ver
|
||||||
|
|
||||||
dkms add -m $algo -v $kernel_ver
|
dkms add -m $algo -v $kernel_ver
|
||||||
if [ ! $? -eq 0 ]; then
|
if [ ! $? -eq 0 ]; then
|
||||||
dkms remove -m $algo/$kernel_ver --all
|
dkms remove -m $algo/$kernel_ver --all
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dkms build -m $algo -v $kernel_ver
|
dkms build -m $algo -v $kernel_ver
|
||||||
if [ ! $? -eq 0 ]; then
|
if [ ! $? -eq 0 ]; then
|
||||||
dkms remove -m $algo/$kernel_ver --all
|
dkms remove -m $algo/$kernel_ver --all
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dkms install -m $algo -v $kernel_ver
|
dkms install -m $algo -v $kernel_ver
|
||||||
if [ ! $? -eq 0 ]; then
|
if [ ! $? -eq 0 ]; then
|
||||||
dkms remove -m $algo/$kernel_ver --all
|
dkms remove -m $algo/$kernel_ver --all
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test loading module
|
# Test loading module
|
||||||
modprobe $bbr_file
|
modprobe $bbr_file
|
||||||
if [ ! $? -eq 0 ]; then
|
if [ ! $? -eq 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Auto-load kernel module at system startup
|
# Auto-load kernel module at system startup
|
||||||
echo $bbr_file | sudo tee -a /etc/modules
|
echo $bbr_file | sudo tee -a /etc/modules
|
||||||
sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf
|
sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf
|
||||||
echo "net.ipv4.tcp_congestion_control = $algo" >> /etc/sysctl.conf
|
echo "net.ipv4.tcp_congestion_control = $algo" >> /etc/sysctl.conf
|
||||||
sysctl -p > /dev/null
|
sysctl -p > /dev/null
|
||||||
|
|
||||||
cd $HOME
|
|
||||||
rm -r $HOME/.bbr
|
|
||||||
}
|
|
||||||
|
|
||||||
## Installing BBR
|
|
||||||
cd $HOME
|
cd $HOME
|
||||||
BBR_Install
|
rm -r $HOME/.bbr
|
||||||
|
|
||||||
## Clear
|
## Clear
|
||||||
systemctl disable bbrinstall.service
|
systemctl disable bbrinstall.service
|
||||||
|
|
|
@ -467,7 +467,7 @@ function Tweaked_BBR {
|
||||||
## Update Kernel
|
## Update Kernel
|
||||||
normal_1; echo "Updating Kernel"; normal_2
|
normal_1; echo "Updating Kernel"; normal_2
|
||||||
echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee -a /etc/apt/sources.list
|
echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee -a /etc/apt/sources.list
|
||||||
apt-get -qqy update && apt-get -qqy install linux-image-5.10.0-0.bpo.8-amd64
|
apt-get -qqy update && apt -qqyt buster-backports upgrade
|
||||||
## Install tweaked BBR automatically on reboot
|
## Install tweaked BBR automatically on reboot
|
||||||
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Miscellaneous/BBR/BBR.sh && chmod +x BBR.sh
|
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Miscellaneous/BBR/BBR.sh && chmod +x BBR.sh
|
||||||
cat << EOF > /etc/systemd/system/bbrinstall.service
|
cat << EOF > /etc/systemd/system/bbrinstall.service
|
||||||
|
|
Loading…
Reference in New Issue