From b1e96472a727ea68fd47f2d121eb2c07502eace8 Mon Sep 17 00:00:00 2001 From: zhanglikun Date: Tue, 12 Sep 2023 17:05:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=89=E8=A3=85=E5=86=85?= =?UTF-8?q?=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel_5.4/install.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/kernel_5.4/install.sh b/kernel_5.4/install.sh index 2e0fdc2..512c9f2 100644 --- a/kernel_5.4/install.sh +++ b/kernel_5.4/install.sh @@ -1,17 +1,24 @@ #!/bin/bash set -euo pipefail -yum remove -y kernel-tools-libs-3.10.0 -yum remove -y kernel-tools-3.10.0 - -cd 1 && yum install -y ./* && cd .. -cd 2 && yum install -y ./* && cd .. +yum install -y 1/* +echo "当前系统安装的内核有:" 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配置 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