* 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: * usr/bin/byobu-launcher-install, usr/bin/byobu-launcher-uninstall:
- LP: #861534 - LP: #861534
- ensure launcher command removed from each file before installing - ensure launcher command removed from each file before installing
* usr/lib/byobu/.dirs:
- use /dev/shm for cache, LP: #872551
[ Daniel Hahler ] [ Daniel Hahler ]
* usr/bin/byobu, usr/bin/byobu-launcher-install, usr/bin/byobu- * 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" [ -r "$BYOBU_CONFIG_DIR/socketdir" ] && . "$BYOBU_CONFIG_DIR/socketdir"
# Create and export the runtime cache directory # Create and export the runtime cache directory
if [ -d "$XDG_CACHE_HOME" ]; then if [ -w /dev/shm ]; then
# Use XDG, as some users insist on such nonsense :-) # Use shm for performance, if possible
export BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG" if [ -z "$BYOBU_RUN_DIR" ]; then
elif [ -d "$SOCKETDIR/S-$USER" ]; then for i in /dev/shm/$PKG-$USER-*; do
# But for FAR better performance, use a tmpfs if available if [ -d "$i" ] && [ -O "$i" ]; then
export BYOBU_RUN_DIR="$SOCKETDIR/S-$USER/$PKG" export BYOBU_RUN_DIR="$i"
elif [ -n "$TMUX" ] && [ d=$(dirname "$TMUX") ] && [ -d "$d" ]; then break
# Or perhaps try the tmux tmpdir fi
export BYOBU_RUN_DIR="$d" done
d= 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 else
# But if not, we'll use a cache directory # For distros that don't have a /dev/shm, use local disk
export BYOBU_RUN_DIR="$HOME/.cache/$PKG" 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 fi