include: rootfs: fix APK compressed scripts tarball support

APK will generate the compressed scripts.tar by default, however we rely
on using TAR support for updating the tarball on the fly and this does not
work when tarball is compressed and will cause the following errors:
staging_dir/host/bin/tar: Cannot update compressed archives
Try /staging_dir/host/bin/tar --help' or
staging_dir/host/bin/tar --usage' for more information.

So, lets simply decompress the scripts.tar.gz before usage and then
compress it after we are done.

Fixes: 5d85657f6d ("apk-tools: implement compression of on-device scripts.tar")
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Robert Marko 2025-11-19 13:46:29 +01:00
parent 9359fc9376
commit f4ff823435

View File

@ -78,7 +78,8 @@ define prepare_rootfs
cd $(1); \
if [ -n "$(CONFIG_USE_APK)" ]; then \
IPKG_POSTINST_PATH=./lib/apk/db/*.post-install; \
$(STAGING_DIR_HOST)/bin/tar -C ./lib/apk/db/ -xzf ./lib/apk/db/scripts.tar.gz --wildcards "*.post-install"; \
$(STAGING_DIR_HOST)/bin/gzip -d ./lib/apk/db/scripts.tar; \
$(STAGING_DIR_HOST)/bin/tar -C ./lib/apk/db/ -xf ./lib/apk/db/scripts.tar --wildcards "*.post-install"; \
else \
IPKG_POSTINST_PATH=./usr/lib/opkg/info/*.postinst; \
fi; \
@ -89,8 +90,9 @@ define prepare_rootfs
echo "postinst script $$script has failed with exit code $$ret" >&2; \
exit 1; \
fi; \
[ -n "$(CONFIG_USE_APK)" ] && $(STAGING_DIR_HOST)/bin/tar --delete -zf ./lib/apk/db/scripts.tar.gz $$(basename $$script); \
[ -n "$(CONFIG_USE_APK)" ] && $(STAGING_DIR_HOST)/bin/tar --delete -f ./lib/apk/db/scripts.tar $$(basename $$script); \
done; \
[ -n "$(CONFIG_USE_APK)" ] && $(STAGING_DIR_HOST)/bin/gzip -f -9n -S ".gz" ./lib/apk/db/scripts.tar; \
if [ -z "$(CONFIG_USE_APK)" ]; then \
$(if $(IB),,awk -i inplace \
'/^Status:/ { \