fall back to /tmp for LOCPATH if HOME does not exist or not writable
In this case, we can't clean up old locale caches, but presumably the system has something to clean up /tmp eventually.
This commit is contained in:
parent
e802323071
commit
f991c8c526
1 changed files with 7 additions and 0 deletions
|
@ -126,6 +126,13 @@ unset LD_PRELOAD
|
||||||
ORIG_LOCPATH="$LOCPATH"
|
ORIG_LOCPATH="$LOCPATH"
|
||||||
export ORIG_LOCPATH
|
export ORIG_LOCPATH
|
||||||
LOCPATH="$HOME/.cache/git-annex/locales/$(echo "$base" | tr / _ )"
|
LOCPATH="$HOME/.cache/git-annex/locales/$(echo "$base" | tr / _ )"
|
||||||
|
if ! mkdir -p "$LOCPATH" 2>/dev/null; then
|
||||||
|
tlocpath=$(mktemp -d -p /tmp annexlocalesXXXXXXXXX 2>/dev/null || true)
|
||||||
|
if [ -z "$tlocpath" ]; then
|
||||||
|
tlocpath="/tmp/annexlocales.$$"
|
||||||
|
fi
|
||||||
|
LOCPATH="$tlocpath/locales/$(echo "$base" | tr / _ )"
|
||||||
|
fi
|
||||||
export LOCPATH
|
export LOCPATH
|
||||||
|
|
||||||
# Clean up locale caches when their standalone bundle no longer exists.
|
# Clean up locale caches when their standalone bundle no longer exists.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue