include/rootfs: rework handling of post-install scripts for APK
Rework handling of post-install scripts for APK. As we do with OPKG, lets just iterate between each post-install package so we can actually check if something fail in applying them. To do this we first extract each .post-install script in APK scripts.tar. Also remove these files from final image as they are needed only for the first installation of the packages. Link: https://github.com/openwrt/openwrt/pull/15543 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
parent
b47fbca97f
commit
b92e62d464
@ -80,18 +80,21 @@ define prepare_rootfs
|
|||||||
@( \
|
@( \
|
||||||
cd $(1); \
|
cd $(1); \
|
||||||
if [ -n "$(CONFIG_USE_APK)" ]; then \
|
if [ -n "$(CONFIG_USE_APK)" ]; then \
|
||||||
$(STAGING_DIR_HOST)/bin/tar -xf ./lib/apk/db/scripts.tar --wildcards "*.post-install" -O > script.sh; \
|
IPKG_POSTINST_PATH=./lib/apk/db/*.post-install; \
|
||||||
chmod +x script.sh; \
|
$(STAGING_DIR_HOST)/bin/tar -C ./lib/apk/db/ -xf ./lib/apk/db/scripts.tar --wildcards "*.post-install"; \
|
||||||
IPKG_INSTROOT=$(1) $$(command -v bash) script.sh; \
|
|
||||||
else \
|
else \
|
||||||
for script in ./usr/lib/opkg/info/*.postinst; do \
|
IPKG_POSTINST_PATH=./usr/lib/opkg/info/*.postinst; \
|
||||||
|
fi; \
|
||||||
|
for script in $$IPKG_POSTINST_PATH; do \
|
||||||
IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \
|
IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \
|
||||||
ret=$$?; \
|
ret=$$?; \
|
||||||
if [ $$ret -ne 0 ]; then \
|
if [ $$ret -ne 0 ]; then \
|
||||||
echo "postinst script $$script has failed with exit code $$ret" >&2; \
|
echo "postinst script $$script has failed with exit code $$ret" >&2; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
|
[ -n "$(CONFIG_USE_APK)" ] && $(STAGING_DIR_HOST)/bin/tar --delete -f ./lib/apk/db/scripts.tar $$(basename $$script); \
|
||||||
done; \
|
done; \
|
||||||
|
if [ -z "$(CONFIG_USE_APK)" ]; then \
|
||||||
$(if $(IB),,awk -i inplace \
|
$(if $(IB),,awk -i inplace \
|
||||||
'/^Status:/ { \
|
'/^Status:/ { \
|
||||||
if ($$3 == "user") { $$3 = "ok" } \
|
if ($$3 == "user") { $$3 = "ok" } \
|
||||||
@ -115,6 +118,7 @@ define prepare_rootfs
|
|||||||
rm -rf \
|
rm -rf \
|
||||||
$(1)/boot \
|
$(1)/boot \
|
||||||
$(1)/tmp/* \
|
$(1)/tmp/* \
|
||||||
|
$(1)/lib/apk/db/*.post-install* \
|
||||||
$(1)/usr/lib/opkg/info/*.postinst* \
|
$(1)/usr/lib/opkg/info/*.postinst* \
|
||||||
$(1)/usr/lib/opkg/lists/* \
|
$(1)/usr/lib/opkg/lists/* \
|
||||||
$(1)/var/lock/*.lock
|
$(1)/var/lock/*.lock
|
||||||
|
Loading…
x
Reference in New Issue
Block a user