build,IB: include kmods only in local builds
[openwrt/openwrt.git] / target / imagebuilder / Makefile
index fb6c26b482c04da3420221e6856088ae5747bf35..1575f59b613bee9777133b71fd4360eebb77e3a9 100644 (file)
@@ -38,23 +38,27 @@ $(BIN_DIR)/$(IB_NAME).tar.xz: clean
 ifeq ($(CONFIG_IB_STANDALONE),)
        echo '## Remote package repositories' >> $(PKG_BUILD_DIR)/repositories.conf
        $(call FeedSourcesAppend,$(PKG_BUILD_DIR)/repositories.conf)
+       $(VERSION_SED_SCRIPT) $(PKG_BUILD_DIR)/repositories.conf
 endif
 
+ifeq ($(CONFIG_BUILDBOT),)
+       $(INSTALL_DIR) $(PKG_BUILD_DIR)/packages
        echo ''                                                        >> $(PKG_BUILD_DIR)/repositories.conf
        echo '## This is the local package repository, do not remove!' >> $(PKG_BUILD_DIR)/repositories.conf
        echo 'src imagebuilder file:packages'                          >> $(PKG_BUILD_DIR)/repositories.conf
 
-       $(VERSION_SED_SCRIPT) $(PKG_BUILD_DIR)/repositories.conf
-
-ifeq ($(CONFIG_IB_STANDALONE),)
-       (cd $(call FeedPackageDir,libc); $(FIND) -type f -name 'libc_*.ipk' -or -name 'kernel_*.ipk' -or -name 'kmod-*.ipk') | \
-               while read path; do \
-                       mkdir -p "$(PKG_BUILD_DIR)/packages/$${path%/*}"; \
-                       cp "$(call FeedPackageDir,libc)/$$path" "$(PKG_BUILD_DIR)/packages/$$path"; \
-               done
+  ifeq ($(CONFIG_IB_STANDALONE),)
+       $(FIND) $(call FeedPackageDir,libc) -type f \
+               \( -name 'libc_*.ipk' -or -name 'kernel_*.ipk' -or -name 'kmod-*.ipk' \) \
+               -exec $(CP) -t $(PKG_BUILD_DIR)/packages {} +
+  else
+       $(FIND) $(wildcard $(PACKAGE_SUBDIRS)) -type f -name '*.ipk' \
+               -exec $(CP) -t $(PKG_BUILD_DIR)/packages/ {} +
+  endif
 else
-       $(INSTALL_DIR) $(PKG_BUILD_DIR)/packages
-       find $(wildcard $(PACKAGE_SUBDIRS)) -type f -name '*.ipk' -exec $(CP) {} $(PKG_BUILD_DIR)/packages/ \;
+       $(FIND) $(call FeedPackageDir,libc) -type f \
+               \( -name 'libc_*.ipk' -or -name 'kernel_*.ipk' \) \
+               -exec $(CP) -t $(IB_LDIR)/ {} +
 endif
 
        $(CP) $(TOPDIR)/target/linux $(PKG_BUILD_DIR)/target/