* usr/bin/byobu-janitor, usr/lib/byobu/.constants:

- LP: #553105, #780081: support XDG user dirs
This commit is contained in:
Dustin Kirkland 2011-06-29 01:37:33 +00:00
commit e61d9f0316
3 changed files with 13 additions and 16 deletions

4
debian/changelog vendored
View file

@ -1,4 +1,4 @@
byobu (4.17) unreleased; urgency=low
byobu (4.17-0ubuntu1) oneiric; urgency=low
* usr/bin/byobu-launch: LP: #802646
- ensure that .profile gets sourced if launching byobu by default,
@ -46,6 +46,8 @@ byobu (4.17) unreleased; urgency=low
profile, usr/bin/byobu-select-session, usr/bin/byobu-silent,
usr/bin/byobu-status:
- fix up a few more $HOME/.$PKG refs to $BYOBU_CONFIG_DIR
* usr/bin/byobu-janitor, usr/lib/byobu/.constants:
- LP: #553105, #780081: support XDG user dirs
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 27 Jun 2011 14:14:17 +0000

View file

@ -23,17 +23,8 @@ PKG="byobu"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/.common"
XDG="$HOME/.local/share/$PKG"
FLAG="$BYOBU_RUN_DIR/reload-required"
# Let's get prepped to switch over to XDG one day; maintain symlink for now
mkdir -p "$XDG"
if [ ! -h "$BYOBU_CONFIG_DIR" ]; then
mv -f "$BYOBU_CONFIG_DIR"/* "$BYOBU_CONFIG_DIR"/.* "$XDG" 2>/dev/null || true
rmdir "$BYOBU_CONFIG_DIR" 2>/dev/null || true
fi
ln -sf "$XDG" "$BYOBU_CONFIG_DIR"
# Exit immediately, if we're not forced, and there is no reload flag
if [ "$1" != "--force" ] && [ ! -e "$FLAG" ]; then
exit 0

View file

@ -21,19 +21,23 @@
PKG="byobu"
# Create and set the user configuration directory
export BYOBU_CONFIG_DIR="$HOME/.$PKG"
mkdir -p "$BYOBU_CONFIG_DIR"
if [ -d "$XDG_CONFIG_HOME" ] && mkdir -p "$XDG_CONFIG_HOME/$PKG"; then
export BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG"
elif mkdir -p "$HOME/.$PKG"; then
export BYOBU_CONFIG_DIR="$HOME/.$PKG"
fi
# Grab the global, then local socket directory
[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir"
[ -r "$BYOBU_CONFIG_DIR/socketdir" ] && . "$BYOBU_CONFIG_DIR/socketdir"
# Hopefully, we can make a runtime data directory in a tmpfs
if mkdir -p "$SOCKETDIR/S-$USER/$PKG" 2>/dev/null; then
if [ -d "$XDG_CACHE_HOME" ] && mkdir -p "$XDG_CACHE_HOME/$PKG"; then
export BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG"
elif mkdir -p "$SOCKETDIR/S-$USER/$PKG" 2>/dev/null; then
export BYOBU_RUN_DIR="$SOCKETDIR/S-$USER/$PKG"
else
# But if not, we'll use a cache direcotry
mkdir -p "$HOME/.cache/$PKG"
elif mkdir -p "$HOME/.cache/$PKG"; then
# But if not, we'll use a cache directory
export BYOBU_RUN_DIR="$HOME/.cache/$PKG"
fi