From e61d9f0316890500eb1350bceafa19fe17147f26 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Wed, 29 Jun 2011 01:37:33 +0000 Subject: [PATCH] * usr/bin/byobu-janitor, usr/lib/byobu/.constants: - LP: #553105, #780081: support XDG user dirs --- debian/changelog | 4 +++- usr/bin/byobu-janitor | 9 --------- usr/lib/byobu/.constants | 16 ++++++++++------ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7ee137d1..c57aa884 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Mon, 27 Jun 2011 14:14:17 +0000 diff --git a/usr/bin/byobu-janitor b/usr/bin/byobu-janitor index d0d2a752..9d633d92 100755 --- a/usr/bin/byobu-janitor +++ b/usr/bin/byobu-janitor @@ -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 diff --git a/usr/lib/byobu/.constants b/usr/lib/byobu/.constants index b013fa29..e13302a7 100755 --- a/usr/lib/byobu/.constants +++ b/usr/lib/byobu/.constants @@ -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