0009-include-rootfs.mk-keep-Require-User-lines-with-CONFIG_CLEAN_IPKG.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Tue, 24 Jan 2017 17:00:43 +0100
  3. Subject: include/rootfs.mk: keep Require-User lines with CONFIG_CLEAN_IPKG
  4. Require-User is handled by /etc/uci-defaults/13_fix_group_user on first
  5. boot, so we need to keep these when removing all opkg data with
  6. CONFIG_CLEAN_IPKG.
  7. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
  8. diff --git a/include/rootfs.mk b/include/rootfs.mk
  9. index 90d70a11f2e775c83b9907ec1f296c0e4d535ad6..c014b1d14ab0963687417809431abc0bf314830c 100644
  10. --- a/include/rootfs.mk
  11. +++ b/include/rootfs.mk
  12. @@ -47,6 +47,14 @@ opkg = \
  13. TARGET_DIR_ORIG := $(TARGET_ROOTFS_DIR)/root.orig-$(BOARD)
  14. +ifdef CONFIG_CLEAN_IPKG
  15. + define clean_ipkg
  16. + -find $(1)/usr/lib/opkg -type f -and -not -name '*.control' | $(XARGS) rm -rf
  17. + -sed -i -ne '/^Require-User: /p' $(1)/usr/lib/opkg/info/*.control
  18. + -find $(1)/usr/lib/opkg -empty | $(XARGS) rm -rf
  19. + endef
  20. +endif
  21. +
  22. define prepare_rootfs
  23. @if [ -d $(TOPDIR)/files ]; then \
  24. $(call file_copy,$(TOPDIR)/files/.,$(1)); \
  25. @@ -75,6 +83,6 @@ define prepare_rootfs
  26. rm -f $(1)/usr/lib/opkg/lists/*
  27. rm -f $(1)/usr/lib/opkg/info/*.postinst*
  28. rm -f $(1)/usr/lib/opkg/info/*.prerm*
  29. - $(if $(CONFIG_CLEAN_IPKG),rm -rf $(1)/usr/lib/opkg)
  30. + $(call clean_ipkg,$(1))
  31. $(call mklibs,$(1))
  32. endef