offline-kubernetes-install/kernel_5.4/install.sh

25 lines
580 B
Bash
Raw Normal View History

2023-04-26 19:57:49 +08:00
#!/bin/bash
set -euo pipefail
2023-09-12 17:05:34 +08:00
yum install -y 1/*
2023-04-26 19:57:49 +08:00
2023-09-12 17:05:34 +08:00
echo "当前系统安装的内核有:"
2023-04-26 19:57:49 +08:00
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
2023-09-12 17:05:34 +08:00
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
2023-04-26 19:57:49 +08:00
## 生成grub配置
grub2-mkconfig -o /boot/grub2/grub.cfg
2023-09-12 17:05:34 +08:00
# # 更新kernel tools
# yum remove -y kernel-tools-libs-3.10.0
# yum remove -y kernel-tools-3.10.0
# yum install -y 2/*
# # 删除旧内核(可选)
2023-04-26 19:57:49 +08:00
# yum remove -y kernel-3.10.0