[OpenWrt-Devel] [PATCH] remove .git files from images

joerg jungermann jj at borkum.net
Tue Apr 12 09:56:47 EDT 2016

If you have your ./files/ directory stored in a git repository,
the .git will be included into images using precious space.
This patch removes .git directories before packing images.

Signed-off-by: Joerg Jungermann <jj at borkum.net>

diff --git a/package/Makefile b/package/Makefile
index c97e2c1..e0bd75b 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -123,6 +123,7 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install
 	$(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(TARGET_DIR)/usr/lib/opkg/status)
 	@-find $(TARGET_DIR) -name CVS   | $(XARGS) rm -rf
 	@-find $(TARGET_DIR) -name .svn  | $(XARGS) rm -rf
+	@-find $(TARGET_DIR) -name .git  | $(XARGS) rm -rf
 	@-find $(TARGET_DIR) -name '.#*' | $(XARGS) rm -f
 	rm -f $(TARGET_DIR)/usr/lib/opkg/info/*.postinst*
 	rm -f $(TARGET_DIR)/usr/lib/opkg/info/*.prerm*

Joerg Jungermann
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list