From 32b78ce1f015fa146031f470321f25f0bee11aba Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Wed, 2 Sep 2026 19:35:20 +0200 Subject: [PATCH] imsd: place the re-signed apks with the packages dir's owner Run 50 got past the key copy and the re-sign, then died on the move into pmbootstrap's packages dir: abuild created that directory from inside the chroot, so it belongs to the chroot user (uid 12345) and the build user cannot write there. Install the files via sudo with the directory's own owner and mode 0644, as abuild would have left them, and fail with a clear message if the directory is missing instead of creating a wrongly-owned one. --- build.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 7d3519f..64bd9f7 100755 --- a/build.sh +++ b/build.sh @@ -277,8 +277,20 @@ for _f in "$IMSD_DL"/*.apk; do python3 ./apk-resign.py "$_f" "$KEYCOPY" "$(basename "$ABUILD_KEY").pub" done rm -f "$KEYCOPY" -mkdir -p "$WORKDIR/packages/edge/aarch64" -mv "$IMSD_DL"/*.apk "$WORKDIR/packages/edge/aarch64/" +# The packages dir belongs to pmbootstrap's chroot user as well (abuild wrote +# it from inside the chroot), so the build user cannot write there either +# (run 50): install the files with the directory's own owner, as abuild would +# have left them. The dir exists because the builds above populated it. +PKGDIR="$WORKDIR/packages/edge/aarch64" +if [ ! -d "$PKGDIR" ]; then + echo "$PKGDIR missing - the package builds above should have created it" >&2 + exit 1 +fi +for _f in "$IMSD_DL"/*.apk; do + sudo install -m 0644 -o "$(stat -c %u "$PKGDIR")" -g "$(stat -c %g "$PKGDIR")" \ + "$_f" "$PKGDIR/$(basename "$_f")" +done +rm -f "$IMSD_DL"/*.apk pmbootstrap index # --- 4. build the image -------------------------------------------------------