avoid depending on cmp
authorJoey Hess <joeyh@joeyh.name>
Tue, 6 Oct 2020 15:25:17 +0000 (11:25 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 6 Oct 2020 15:27:05 +0000 (11:27 -0400)
If it was not available, the caches would get deleted unncessarily.
This should be just as fast as using it.

standalone/linux/skel/runshell

index afc78b36df6a2593e6a63a90e129389534ad8cb2..4daf57dae718423aca0bd47f1bb80b997173db72 100755 (executable)
@@ -145,7 +145,7 @@ if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then
        # 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
+               if [ ! -d "$cachebase" ] || [ "$(cat "$localecache/buildid" 2>/dev/null || true)" != "$(cat "$cachebase/buildid" 2>/dev/null || true)" ]; then
                        rm -rf "$localecache" >/dev/null 2>&1 || true
                fi
        done