From eaf96dc7f6f30aa284917dfa70e987ec0112c1e8 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Mon, 16 Jan 2023 07:36:51 +0100 Subject: [PATCH] make_mirror.sh: remove the old cache if the last run failed --- make_mirror.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/make_mirror.sh b/make_mirror.sh index 3799cd0..023bf5e 100755 --- a/make_mirror.sh +++ b/make_mirror.sh @@ -358,16 +358,22 @@ if [ -e "./shared/cache.A" ] && [ -e "./shared/cache.B" ]; then echo "cache symlink points to $(readlink ./shared/cache)" >&2 case "$(readlink ./shared/cache)" in cache.A) - echo "maybe rm -r ./shared/cache.B" >&2 + echo "removing ./shared/cache.B" >&2 + rm -r ./shared/cache.B ;; cache.B) - echo "maybe rm -r ./shared/cache.A" >&2 + echo "removing ./shared/cache.A" >&2 + rm -r ./shared/cache.A ;; *) echo "unexpected" >&2 + exit 1 + ;; esac + else + echo "./shared/cache doesn't exist" >&2 + exit 1 fi - exit 1 fi if [ -e "./shared/cache.A" ]; then