更新安装内核

This commit is contained in:
zhanglikun 2023-09-12 17:05:34 +08:00
parent cb13cd5cf6
commit b1e96472a7

View File

@ -1,17 +1,24 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
yum remove -y kernel-tools-libs-3.10.0 yum install -y 1/*
yum remove -y kernel-tools-3.10.0
cd 1 && yum install -y ./* && cd ..
cd 2 && yum install -y ./* && cd ..
echo "当前系统安装的内核有:"
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
grub2-set-default 0
KERNEL_ID=$(awk -F\' '$1=="menuentry " {print i++ ": " $2}' /etc/grub2.cfg | grep 5.4 | awk -F : '{print $1}')
echo "设置启动项为: $KERNEL_ID"
grub2-set-default $KERNEL_ID
## 生成grub配置 ## 生成grub配置
grub2-mkconfig -o /boot/grub2/grub.cfg grub2-mkconfig -o /boot/grub2/grub.cfg
# 删除旧内核(可选)
# # 更新kernel tools
# yum remove -y kernel-tools-libs-3.10.0
# yum remove -y kernel-tools-3.10.0
# yum install -y 2/*
# # 删除旧内核(可选)
# yum remove -y kernel-3.10.0 # yum remove -y kernel-3.10.0