From 144968a003f251ad09b2ada8693764ec8a37ddd8 Mon Sep 17 00:00:00 2001 From: Roland Date: Wed, 20 May 2026 19:32:32 -0600 Subject: [PATCH] Fixing build.sh cleanup of prior build's immutable files. The chroot hook applies chattr +i to /opt/wrolpi-blobs/*, which then prevents rm -rf from wiping BUILD_DIR on subsequent runs. lb's chroot_includes_after_packages rsync then fails with "Operation not permitted" trying to overwrite the leftovers. Strip +i before rm. Co-Authored-By: Claude Opus 4.7 (1M context) --- wrolpi-portable/build.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/wrolpi-portable/build.sh b/wrolpi-portable/build.sh index b5bfa0bc..fb204065 100755 --- a/wrolpi-portable/build.sh +++ b/wrolpi-portable/build.sh @@ -46,9 +46,16 @@ if [ $EUID != 0 ]; then exit $? fi -# Clear out old builds. -[ -d "${BUILD_DIR}" ] && rm -rf "${BUILD_DIR}" -mkdir "${BUILD_DIR}" +# Clear out old builds. Strip immutable flag from blob files first — the +# chroot hook applies chattr +i to /opt/wrolpi-blobs/*; without removing +# that here, rm -rf leaves them behind and the next lb build's +# chroot_includes_after_packages rsync fails with "Operation not permitted" +# trying to overwrite them. +if [ -d "${BUILD_DIR}" ]; then + find "${BUILD_DIR}" -path '*/opt/wrolpi-blobs/*' -type f -exec chattr -i {} + 2>/dev/null || true + rm -rf "${BUILD_DIR}" +fi +mkdir -p "${BUILD_DIR}" cd "${BUILD_DIR}" || (echo "Work directory must exist" && exit 1) set -e