move cache cleanup back to before cache creation
authorJoey Hess <joeyh@joeyh.name>
Tue, 6 Oct 2020 12:46:35 +0000 (08:46 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 6 Oct 2020 12:46:35 +0000 (08:46 -0400)
It was moved to avoid a race, but that's now avoided in another way.
I prefer having it here, because this way if it somehow fails and
deletes the locpath that is going to be used, at least it will get
re-created.

standalone/linux/skel/runshell

index 59567454967c3d8b0047ed99fabd03d4b3daee23..afc78b36df6a2593e6a63a90e129389534ad8cb2 100755 (executable)
@@ -142,6 +142,14 @@ if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then
        LOCPATH="$HOME/.cache/git-annex/locales/$locpathbase"
        export LOCPATH
        
+       # Clean up locale caches when their standalone bundle no longer exists.
+       for localecache in $HOME/.cache/git-annex/locales/*; do
+               cachebase=$(cat "$localecache/base" 2>/dev/null || true)
+               if [ ! -d "$cachebase" ] || ! cmp "$localecache/buildid" "$cachebase/buildid" >/dev/null 2>&1 ; then
+                       rm -rf "$localecache" >/dev/null 2>&1 || true
+               fi
+       done
+       
        if [ ! -d "$LOCPATH" ]; then
                locpathtmp="$HOME/.cache/git-annex/locales.tmp/$locpathbase.$$"
                if ! mkdir -p "$locpathtmp"; then
@@ -183,14 +191,6 @@ if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then
                # in which cache the mv above would put it here.
                rm -rf "$LOCPATH/$locpathbase.$$"
        fi
-       
-       # Clean up locale caches when their standalone bundle no longer exists.
-       for localecache in $HOME/.cache/git-annex/locales/*; do
-               cachebase=$(cat "$localecache/base" 2>/dev/null || true)
-               if [ ! -d "$cachebase" ] || ! cmp "$localecache/buildid" "$cachebase/buildid" >/dev/null 2>&1 ; then
-                       rm -rf "$localecache" >/dev/null 2>&1 || true
-               fi
-       done
 fi
 
 useproot=""