scripts: signall: fix wrong GPG signature on apk packages.adb index
authorPetr Štetiar <ynezz@true.cz>
Sat, 28 Sep 2024 12:22:35 +0000 (12:22 +0000)
committerPetr Štetiar <ynezz@true.cz>
Sat, 28 Sep 2024 17:10:39 +0000 (17:10 +0000)
Currently the GPG signature verification of apk's packages.adb index
fails as the file is modified with `apk adbsign` after its GPG signed.

So lets fix it by moving the `apk adbsign` before the GPG signing step.

Fixes: a94d4e15fdc1 ("add APK signing logic")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
scripts/signall.sh

index c15c9f25951969ef67badefb3e3de06c8e5e4d43..21593498b7c151409acb42c04596d6a0141f5eea 100755 (executable)
@@ -71,6 +71,15 @@ USIGNCOMMENT="$(iniget "${CONFIG_INI:-config.ini}" "branch $branch" "usign_comme
 APKSIGNKEY="$(iniget "${CONFIG_INI:-config.ini}" "branch $branch" "apk_key")"
 fi
 
+if [ -n "$APKSIGNKEY" ]; then
+    umask 077
+    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 6
+fi
+
 if echo "$GPGKEY" | grep -q "BEGIN PGP PRIVATE KEY BLOCK"; then
        umask 077
        echo "$GPGPASS" > "$tmpdir/gpg.pass"
@@ -105,15 +114,6 @@ if [ -n "$USIGNKEY" ]; then
                signify-openbsd -S -s "$(readlink -f "$tmpdir/usign.sec")" -m "{}" \; || finish 5
 fi
 
-if [ -n "$APKSIGNKEY" ]; then
-    umask 077
-    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 6
-fi
-
 tar -C "$tmpdir/tar/" -czf "$tarball" . || finish 6
 
 finish 0