image: fix CONFIG_CLEAN_IPKG with CONFIG_TARGET_PER_DEVICE_ROOTFS
[openwrt/openwrt.git] / include / rootfs.mk
index 90ee312..6a66100 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 \
@@ -47,6 +48,11 @@ opkg = \
        --add-arch all:100 \
        --add-arch $(if $(ARCH_PACKAGES),$(ARCH_PACKAGES),$(BOARD)):200
 
+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 \
@@ -68,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)