File fix.patch of Package pesign-obs-integration
Index: pesign-obs-integration-10.2+git20260402.224c81f/pesign-repackage.spec.in
===================================================================
--- pesign-obs-integration-10.2+git20260402.224c81f.orig/pesign-repackage.spec.in
+++ pesign-obs-integration-10.2+git20260402.224c81f/pesign-repackage.spec.in
@@ -105,10 +105,12 @@ for rpm in %_sourcedir/*.rpm; do
# coexist in the buildroot without cpio conflicts.
if [ ${#files_to_sign[@]} -gt 0 ]; then
_needs_signing=0
+ pkg_name=$(rpm -qp --qf '%%{name}' "$rpm")
while IFS= read -r _f; do
if [ -n "${files_to_sign["$_f"]+x}" ]; then
_needs_signing=1
- break
+ # Store the package name as the value for later identification. TODO:
+ files_to_sign["$_f"]="$pkg_name" #TODO: fix, 只改到了第一個找到的sign file, 其他的都是default 1, 錯誤
fi
done < <(rpm -qp --qf '[%%{filenames}\n]' "$rpm" 2>/dev/null)
if [ "$_needs_signing" -eq 0 ]; then
@@ -123,8 +125,7 @@ for rpm in %_sourcedir/*.rpm; do
fi
# To avoid conflict with duplicate installed file use suffix and
# RemovePathPostfixes from RPM macros.
- pkg_name=$(rpm -qp --qf '%%{name}' "$rpm")
- mkdir -p "tmp_extract"
+ mkdir -p "tmp_extract"
rpm2cpio "$rpm" | cpio -idm -D "tmp_extract" || exit
find "tmp_extract" -depth ! -type d -print0 | while IFS= read -r -d '' f; do
mv "$f" "${f}.${pkg_name}"
@@ -206,7 +207,13 @@ for sig in "${sigs[@]}"; do
echo "$sig signature can not be decrypted by $cert" >&2
exit 1
fi
- f=%buildroot/${sig%.sig}
+ _f="/${sig%.sig}"
+ pkg_name="${files_to_sign["$_f"]}"
+ # --- Debug 開始 ---
+ echo "DEBUG: [Key] $_f"
+ echo "DEBUG: [Pkg] ${pkg_name:-"MISSING (Empty)"}"
+ f="%buildroot/${sig%.sig}.$pkg_name"
+ echo "DEBUG: [Path] $f"
case "/$sig" in
*.ko.sig|*.mod.sig)
/usr/lib/rpm/pesign/kernel-sign-file -i pkcs7 -s "$sig" sha256 "$cert" "$f"