* usr/bin/byobu, usr/bin/byobu-janitor, usr/lib/byobu/include/common,

usr/lib/byobu/include/constants:
  - for users upgrading from an older version of byobu, where they were
    previously using a screen backend, keep them using a screen backend
  - for new users, default to tmux backend
This commit is contained in:
Dustin Kirkland 2012-01-15 13:29:00 -06:00
commit 2f4608544a
5 changed files with 28 additions and 12 deletions

5
debian/changelog vendored
View file

@ -26,6 +26,11 @@ byobu (5.3) unreleased; urgency=low
- support LC_TERMTYPE=[byobu|byobu-screen|byobu-tmux]
* etc/profile.d/Z97-byobu.sh, usr/bin/byobu-launcher: LP: #897711
- allow nesting, if LC_BYOBU > 1
* usr/bin/byobu, usr/bin/byobu-janitor, usr/lib/byobu/include/common,
usr/lib/byobu/include/constants:
- for users upgrading from an older version of byobu, where they were
previously using a screen backend, keep them using a screen backend
- for new users, default to tmux backend
[ Dustin Kirkland and Ryan Thompson ]
* usr/bin/byobu-reconnect-sockets, usr/bin/byobu-select-session: LP: #908944

View file

@ -31,12 +31,6 @@ if [ ! -O "$HOME" ]; then
exit 1
fi
# Determine backend as early as possible, if applicable
case "$0" in
*byobu-screen) BYOBU_BACKEND="screen" ;;
*byobu-tmux) BYOBU_BACKEND="tmux" ;;
esac
# Source local byobu config
if [ -r "$HOME/.byoburc" ]; then
# Ensure that this configuration is usable
@ -55,6 +49,12 @@ fi
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
# Override backend if we can determine intentions from argv[0]
case "$0" in
*byobu-screen) BYOBU_BACKEND="screen" ;;
*byobu-tmux) BYOBU_BACKEND="tmux" ;;
esac
# At this point, we're sure BYOBU_BACKEND is properly defined
export BYOBU_BACKEND

View file

@ -68,6 +68,7 @@ MC=0
[ -r "$BYOBU_CONFIG_DIR/profile.tmux" ] || echo "source \$BYOBU_PREFIX/share/$PKG/profiles/tmux" > "$BYOBU_CONFIG_DIR/profile.tmux"
[ -r "$BYOBU_CONFIG_DIR/keybindings" ] || echo "source \$BYOBU_PREFIX/share/$PKG/keybindings/common" > "$BYOBU_CONFIG_DIR/keybindings"
[ -r "$BYOBU_CONFIG_DIR/windows" ] || touch "$BYOBU_CONFIG_DIR/windows"
[ -r "$BYOBU_CONFIG_DIR/backend" ] || echo "BYOBU_BACKEND=$BYOBU_BACKEND" > "$BYOBU_CONFIG_DIR/backend"
[ -r "$HOME/.screenrc" ] || touch "$HOME/.screenrc"
[ -r "$BYOBU_CONFIG_DIR/.tmux.conf" ] || touch "$BYOBU_CONFIG_DIR/.tmux.conf"
for f in status statusrc; do

View file

@ -28,12 +28,22 @@ if [ -z "${BYOBU_INCLUDED_LIBS}" ]; then
[ -r "$BYOBU_CONFIG_DIR/backend" ] && . "$BYOBU_CONFIG_DIR/backend"
# Just in case there's no config file at all
if [ -z "${BYOBU_BACKEND}" ]; then
# If tmux is installed, use it
if command -v tmux >/dev/null; then
BYOBU_BACKEND=tmux
elif command -v screen >/dev/null; then
BYOBU_BACKEND=screen
if [ -d "$BYOBU_CONFIG_DIR" ] && [ -r "$BYOBU_CONFIG_DIR/profile" ]; then
# Previous byobu configuration exists, default to screen
for i in screen tmux; do
command -v $i >/dev/null && BYOBU_BACKEND="$i"
break
done
unset i
else
# New byobu configuration, default to tmux
for i in tmux screen; do
command -v $i >/dev/null && BYOBU_BACKEND="$i"
break
done
unset i
fi
if ! command -v "$BYOBU_BACKEND" >/dev/null; then
echo "ERROR: $PKG won't work without tmux or screen installed" 1>&2
fi
fi

View file

@ -86,7 +86,7 @@ case "$BYOBU_BACKEND" in
BYOBU_ARG_VERSION="-V"
ESC=
;;
*)
screen)
export BYOBU_BACKEND="screen"
BYOBU_ARG_VERSION="-v"
ESC="\005"