* usr/lib/byobu/.dirs:

- use /dev/shm for cache, LP: #872551
This commit is contained in:
Dustin Kirkland 2011-10-22 02:11:27 -05:00
commit 14c14778f2
2 changed files with 24 additions and 12 deletions

2
debian/changelog vendored
View file

@ -16,6 +16,8 @@ byobu (4.43) unreleased; urgency=low
* usr/bin/byobu-launcher-install, usr/bin/byobu-launcher-uninstall:
- LP: #861534
- ensure launcher command removed from each file before installing
* usr/lib/byobu/.dirs:
- use /dev/shm for cache, LP: #872551
[ Daniel Hahler ]
* usr/bin/byobu, usr/bin/byobu-launcher-install, usr/bin/byobu-

View file

@ -38,17 +38,27 @@ fi
[ -r "$BYOBU_CONFIG_DIR/socketdir" ] && . "$BYOBU_CONFIG_DIR/socketdir"
# Create and export the runtime cache directory
if [ -d "$XDG_CACHE_HOME" ]; then
# Use XDG, as some users insist on such nonsense :-)
export BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG"
elif [ -d "$SOCKETDIR/S-$USER" ]; then
# But for FAR better performance, use a tmpfs if available
export BYOBU_RUN_DIR="$SOCKETDIR/S-$USER/$PKG"
elif [ -n "$TMUX" ] && [ d=$(dirname "$TMUX") ] && [ -d "$d" ]; then
# Or perhaps try the tmux tmpdir
export BYOBU_RUN_DIR="$d"
d=
if [ -w /dev/shm ]; then
# Use shm for performance, if possible
if [ -z "$BYOBU_RUN_DIR" ]; then
for i in /dev/shm/$PKG-$USER-*; do
if [ -d "$i" ] && [ -O "$i" ]; then
export BYOBU_RUN_DIR="$i"
break
fi
done
fi
# Still empty, make a new one
if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ]; then
export BYOBU_RUN_DIR=$(mktemp -d /dev/shm/$PKG-$USER-XXXXXXXX)
fi
else
# But if not, we'll use a cache directory
export BYOBU_RUN_DIR="$HOME/.cache/$PKG"
# For distros that don't have a /dev/shm, use local disk
if [ -d "$XDG_CACHE_HOME" ]; then
# Use XDG, as some users insist on such nonsense :-)
export BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG"
else
# But if not, we'll use a cache directory
export BYOBU_RUN_DIR="$HOME/.cache/$PKG"
fi
fi