[OpenWrt-Devel] [PATCH 2/6] build: Remove directory symbolic links when cleaning STAGING_DIR

Jeffery To jeffery.to at gmail.com
Fri Jun 14 14:35:30 EDT 2019


Currently, a symbolic link whose target is a directory will not be
removed by scripts/clean-package.sh. (In the first pass, the -f test is
false because the link target is a directory. In the second pass, the
link is not removed by rmdir.)

This updates clean-package.sh to remove all non-directories in the first
pass.

Signed-off-by: Jeffery To <jeffery.to at gmail.com>
---
 scripts/clean-package.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/clean-package.sh b/scripts/clean-package.sh
index 6dd9bf7306..035725625d 100755
--- a/scripts/clean-package.sh
+++ b/scripts/clean-package.sh
@@ -12,7 +12,7 @@ cat "$1" | (
 	cd "$2"
 	while read entry; do
 		[ -n "$entry" ] || break
-		[ -f "$entry" ] && rm -f $entry
+		[ ! -d "$entry" ] || [ -L "$entry" ] && rm -f "$entry"
 	done
 )
 sort -r "$1" | (
-- 
2.20.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list