[OpenWrt-Devel,2/6] build: Remove directory symbolic links when cleaning STAGING_DIR
diff mbox series

Message ID 20190614183534.14768-2-jeffery.to@gmail.com
State New
Headers show
Series
  • [OpenWrt-Devel,1/6] build: Add auto file tracking / uninstall for Host/Install
Related show

Commit Message

Jeffery To June 14, 2019, 6:35 p.m. UTC
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@gmail.com>
---
 scripts/clean-package.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

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" | (