image: fix CONFIG_CLEAN_IPKG with CONFIG_TARGET_PER_DEVICE_ROOTFS
[openwrt/staging/rmilecki.git] / include / rootfs.mk
index 2143ef804d8b0d35d06fe0b87ffe242429068773..6a6610019f6a4fb6c07c9c45feea338e202df1fa 100644 (file)
@@ -37,6 +37,7 @@ endif
 opkg = \
   IPKG_NO_SCRIPT=1 \
   IPKG_INSTROOT=$(1) \
+  TMPDIR=$(1)/tmp \
   $(STAGING_DIR_HOST)/bin/opkg \
        --offline-root $(1) \
        --force-depends \
@@ -51,6 +52,8 @@ opkg_package_files = $(wildcard \
        $(foreach dir,$(PACKAGE_SUBDIRS), \
          $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))
 
+TARGET_DIR_ORIG := $(TARGET_ROOTFS_DIR)/root.orig-$(BOARD)
+
 define prepare_rootfs
        @if [ -d $(TOPDIR)/files ]; then \
                $(call file_copy,$(TOPDIR)/files/.,$(1)); \
@@ -71,6 +74,7 @@ define prepare_rootfs
        @-find $(1) -name .svn  | $(XARGS) rm -rf
        @-find $(1) -name .git  | $(XARGS) rm -rf
        @-find $(1) -name '.#*' | $(XARGS) rm -f
+       rm -f $(1)/usr/lib/opkg/lists/*
        rm -f $(1)/usr/lib/opkg/info/*.postinst*
        rm -f $(1)/usr/lib/opkg/info/*.prerm*
        $(if $(CONFIG_CLEAN_IPKG),rm -rf $(1)/usr/lib/opkg)