* 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 * usr/bin/byobu-launch: LP: #802646
- ensure that .profile gets sourced if launching byobu by default, - 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, profile, usr/bin/byobu-select-session, usr/bin/byobu-silent,
usr/bin/byobu-status: usr/bin/byobu-status:
- fix up a few more $HOME/.$PKG refs to $BYOBU_CONFIG_DIR - 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 -- 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 [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/.common" . "${BYOBU_PREFIX}/lib/${PKG}/.common"
XDG="$HOME/.local/share/$PKG"
FLAG="$BYOBU_RUN_DIR/reload-required" 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 # Exit immediately, if we're not forced, and there is no reload flag
if [ "$1" != "--force" ] && [ ! -e "$FLAG" ]; then if [ "$1" != "--force" ] && [ ! -e "$FLAG" ]; then
exit 0 exit 0

View file

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