Skip to content

Commit

Permalink
scripts: signall: fix finish function not called when apk adbsign failed
Browse files Browse the repository at this point in the history
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: a94d4e1 ("add APK signing logic")
Signed-off-by: Petr Štetiar <[email protected]>
  • Loading branch information
ynezz committed Sep 29, 2024
1 parent 75b1334 commit 117e151
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/signall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 117e151

Please sign in to comment.