From cbe501ea656619f695c6ace45b9f6b37f226649d Mon Sep 17 00:00:00 2001 From: weidongkl Date: Thu, 19 Sep 2024 15:29:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Duname=20-r=20=E5=92=8C?= =?UTF-8?q?=20-a=20=E8=BF=94=E5=9B=9E=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: weidongkl (cherry picked from commit 2a3c4bc8918e3fd83e0d6d47445734fa107a8696) --- uname-build-checks.spec | 5 ++++- uname.sh | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/uname-build-checks.spec b/uname-build-checks.spec index 30ad5c8..80ff0e4 100644 --- a/uname-build-checks.spec +++ b/uname-build-checks.spec @@ -8,7 +8,7 @@ License: GPL-2.0-or-later Group: Development/Tools/Building Summary: post checks for build after rpms have been created Version: 1.0 -Release: 0.6 +Release: 0.7 BuildRequires: kernel, rpm, coreutils Source0: uname.sh BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -55,6 +55,9 @@ fi /.oe_kernelversion %changelog +* Thu Sep 19 2024 weidongkl 1.0-0.7 +- fix: https://gitee.com/src-openeuler/uname-build-checks/issues/IAS6IX + * Wed Jun 12 2024 yinyongkang 1.0-0.6 - license info rectification diff --git a/uname.sh b/uname.sh index 9e7cafb..b5c29f8 100644 --- a/uname.sh +++ b/uname.sh @@ -4,6 +4,11 @@ OUTPUT=`uname.bin $*` NOT_INSTALLED="is not installed" if [[ $* == "-r" ]];then + lines=`rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' kernel | wc -l` + if [ "$lines" -gt 1 ]; then + echo $OUTPUT + exit 0 + fi dir=`rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' kernel | head -n 1` if [ -z "$(echo "$dir" | grep "$NOT_INSTALLED")" ]; then [ -n "$dir" ] && echo $dir && exit 0 -- Gitee