[buildbot] scripts: signall: fix finish function not called when apk adbsign failed

LEDE Commits lede-commits at lists.infradead.org
Fri Oct 11 11:04:38 PDT 2024


ynezz pushed a commit to buildbot.git, branch main:
https://git.openwrt.org/117e151a2164a47c436436e644514ce2bcf09b07

commit 117e151a2164a47c436436e644514ce2bcf09b07
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Sun Sep 29 18:21:02 2024 +0000

    scripts: signall: fix finish function not called when apk adbsign failed
    
    The `finish 3` was not being called when the `apk adbsign` command
    failed within the `find` command using `-exec`. This happened because
    `find` does not exit with a non-zero status when the command executed by
    `-exec` fails, so the `|| finish 3` condition was not triggered.
    
    So lets replace the `find ... -exec ...` construct with a loop and call
    `finish 3` immediately if it fails.
    
    Fixes: a94d4e15fdc1 ("add APK signing logic")
    Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 scripts/signall.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/signall.sh b/scripts/signall.sh
index 4c7ef49..7b22386 100755
--- a/scripts/signall.sh
+++ b/scripts/signall.sh
@@ -76,8 +76,11 @@ if [ -n "$APKSIGNKEY" ]; then
 	echo "$APKSIGNKEY" > "$tmpdir/apk.pem"
 
 	umask 022
-	find "$tmpdir/tar/" -type f -name "packages.adb" -exec \
-		"${APK_BIN:-apk}" adbsign --allow-untrusted --sign-key "$(readlink -f "$tmpdir/apk.pem")" "{}" \; || finish 3
+	find "$tmpdir/tar/" -type f -name "packages.adb" -print0 | while IFS= read -r -d '' file; do
+		if ! "${APK_BIN:-apk}" adbsign --allow-untrusted --sign-key "$(readlink -f "$tmpdir/apk.pem")" "$file"; then
+			finish 3
+		fi
+	done
 
 	find "$tmpdir/tar/" -type f -name sha256sums | while read -r file; do
 		dir=$(dirname "$file")




More information about the lede-commits mailing list