allow files/ to overwrite existing symlinks (fixes #3508)
authorFelix Fietkau <nbd@openwrt.org>
Sun, 23 Jan 2011 20:59:13 +0000 (20:59 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 23 Jan 2011 20:59:13 +0000 (20:59 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25078 3c298f89-4303-0410-b956-a3cf2f4a3e73

package/Makefile

index 786edd4..8e8c6c9 100644 (file)
@@ -64,6 +64,14 @@ endif
 $(curdir)/rootfs-prepare: $(TMP_DIR)/.build
        @-$(MAKE) package/preconfig
        @if [ -d $(TOPDIR)/files ]; then \
+               ( cd $(TOPDIR)/files; find -type f ) | \
+                       ( cd $(TARGET_DIR); while :; do \
+                               read FILE; \
+                               [ -z "$$FILE" ] && break; \
+                               [ -L "$$FILE" ] || continue; \
+                               echo "Removing symlink $(TARGET_DIR)/$$FILE"; \
+                               rm -f "$$FILE"; \
+                       done; ); \
                $(CP) $(TOPDIR)/files/. $(TARGET_DIR); \
        fi
        @mkdir -p $(TARGET_DIR)/etc/rc.d