From 6aa57d22c5b1e98081df4e2f07524c5f8d98e53d Mon Sep 17 00:00:00 2001 From: zgzxx Date: Thu, 11 Apr 2024 11:18:08 +0800 Subject: [PATCH] Determine whether to sign based on the marco --- ...support-EBS-sign-for-IMA-digest-list.patch | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Feature-support-EBS-sign-for-IMA-digest-list.patch b/Feature-support-EBS-sign-for-IMA-digest-list.patch index bd0fed0..db0a6a2 100644 --- a/Feature-support-EBS-sign-for-IMA-digest-list.patch +++ b/Feature-support-EBS-sign-for-IMA-digest-list.patch @@ -7,13 +7,13 @@ Signed-off-by: Huaxin Lu Signed-off-by: zhangguangzhi --- - brp-digest-list | 46 +++++----- - brp-ebs-sign | 238 ++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 262 insertions(+), 22 deletions(-) + brp-digest-list | 46 ++++----- + brp-ebs-sign | 250 ++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 274 insertions(+), 22 deletions(-) create mode 100644 brp-ebs-sign diff --git a/brp-digest-list b/brp-digest-list -index e698b7a..d1e2600 100644 +index e698b7a..03c0a2b 100644 --- a/brp-digest-list +++ b/brp-digest-list @@ -26,7 +26,6 @@ fi @@ -79,10 +79,10 @@ index e698b7a..d1e2600 100644 +#fi diff --git a/brp-ebs-sign b/brp-ebs-sign new file mode 100644 -index 0000000..a7a83e5 +index 0000000..3432d4b --- /dev/null +++ b/brp-ebs-sign -@@ -0,0 +1,238 @@ +@@ -0,0 +1,250 @@ +#!/bin/bash + +INPUT_TYPE=$1 @@ -100,6 +100,7 @@ index 0000000..a7a83e5 +CONFIG_RETEST_COUNT=5 +SIGN_RESULT=0 +FAILED_SIGN_PERMISSION_DENIED=2 ++RPMMACROS_FILE="$HOME/.rpmmacros" + +# Tool functions for JSON +get_json_value(){ @@ -120,6 +121,15 @@ index 0000000..a7a83e5 + printf '}' +} + ++# Determine whether to sign based on the marco ++check_sign_macro() { ++ flag="$(grep "%openEuler_sign_rsa " $RPM_CONFIG_FILE | awk '{print $2}')" ++ if [ -z "$flag" ] || [ $flag -ne 1 ]; then ++ echo "Signature is not required" ++ exit 0 ++ fi ++} ++ +# Prepare sign functions for each sign type +module_sign_pre() { + if [[ "$INPUT_FILE" != *.ko ]]; then @@ -299,6 +309,8 @@ index 0000000..a7a83e5 +} + +# Main function ++check_sign_macro ++ +sign_pre + +for ((i=1; i<=$CONFIG_RETEST_COUNT; i++)); do -- Gitee