[buildbot] phase1: ccache.sh: avoid creating nested symlink

LEDE Commits lede-commits at lists.infradead.org
Mon Jan 23 05:26:23 PST 2017


jow pushed a commit to buildbot.git, branch master:
https://git.lede-project.org/7ce7c867e3c27bdbcf5c79cfc449feaf3f19b1f5

commit 7ce7c867e3c27bdbcf5c79cfc449feaf3f19b1f5
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Mon Jan 23 14:21:41 2017 +0100

    phase1: ccache.sh: avoid creating nested symlink
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 phase1/ccache.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/phase1/ccache.sh b/phase1/ccache.sh
index 61590f2..46081f3 100755
--- a/phase1/ccache.sh
+++ b/phase1/ccache.sh
@@ -11,9 +11,11 @@ grep -sq compiler_check "$HOME/.ccache/ccache.conf" || \
 	echo "compiler_check = %compiler% -dumpmachine; %compiler% -dumpversion" >> "$HOME/.ccache/ccache.conf"
 
 for dir in $(make --no-print-directory val.TOOLCHAIN_DIR val.STAGING_DIR val.STAGING_DIR_HOST V=s | grep staging_dir/); do
-	mkdir -p "$dir"
-	test -L "$dir/ccache" || rm -rf "$dir/ccache"
-	ln -s "$HOME/.ccache" "$dir/ccache"
+	if [ ! -L "$dir/ccache" ]; then
+		mkdir -vp "$dir"
+		rm -vrf "$dir/ccache"
+		ln -vs "$HOME/.ccache" "$dir/ccache"
+	fi
 done
 
 ./staging_dir/host/bin/ccache -s 2>/dev/null



More information about the lede-commits mailing list