From 7ce7c867e3c27bdbcf5c79cfc449feaf3f19b1f5 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 23 Jan 2017 14:21:41 +0100 Subject: [PATCH] phase1: ccache.sh: avoid creating nested symlink Signed-off-by: Jo-Philipp Wich --- 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 -- 2.30.2