diff --git a/debian/changelog b/debian/changelog index 50af3aa2..6a0f5e28 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ byobu (5.55) unreleased; urgency=low - * UNRELEASED + * usr/lib/byobu/distro, usr/lib/byobu/include/common, + usr/lib/byobu/logo, usr/share/byobu/profiles/bashrc: + - save a couple of forks in the fast path + - load BYOBU_DISTRO into the environment as we need this in + multiple places -- Dustin Kirkland Wed, 07 Aug 2013 12:49:27 +0100 diff --git a/usr/lib/byobu/distro b/usr/lib/byobu/distro index 38fed7c3..fbc36031 100755 --- a/usr/lib/byobu/distro +++ b/usr/lib/byobu/distro @@ -29,8 +29,7 @@ __distro() { # user defined true else - get_distro - DISTRO="$_RET" + DISTRO="$BYOBU_DISTRO" fi color bold2; printf "%s" "$DISTRO"; color -- } diff --git a/usr/lib/byobu/include/common b/usr/lib/byobu/include/common index 1b782872..bfb13f89 100755 --- a/usr/lib/byobu/include/common +++ b/usr/lib/byobu/include/common @@ -57,5 +57,7 @@ if [ -z "${BYOBU_INCLUDED_LIBS}" ]; then . "${BYOBU_PREFIX}/lib/${PKG}/include/shutil" . "${BYOBU_PREFIX}/lib/${PKG}/include/constants" + get_distro || true + export BYOBU_DISTRO="$_RET" BYOBU_INCLUDED_LIBS=1 fi diff --git a/usr/lib/byobu/logo b/usr/lib/byobu/logo index cfe9252f..44c710aa 100755 --- a/usr/lib/byobu/logo +++ b/usr/lib/byobu/logo @@ -31,8 +31,7 @@ __logo() { printf "%s" "$LOGO" return fi - get_distro - local distro="$(printf "%s" "$_RET" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')" + local distro="$(printf "%s" "$BYOBU_DISTRO" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')" case "$distro" in *ubuntu*) if $MARKUP; then diff --git a/usr/share/byobu/profiles/bashrc b/usr/share/byobu/profiles/bashrc index 79d40327..1fac63fc 100644 --- a/usr/share/byobu/profiles/bashrc +++ b/usr/share/byobu/profiles/bashrc @@ -16,15 +16,18 @@ # along with this program. If not, see . # Ensure that we're in a tmux or screen session -if [ -n "$TMUX" ] || (printf "$TERMCAP" | grep -qs "screen"); then +if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then # Ensure that we're in bash, in a byobu environment if [ -n "$BYOBU_BACKEND" ] && [ "$SHELL" = "/bin/bash" ]; then - if [ -z "$DISTRO" ] && grep -qs "^Ubuntu" /etc/issue; then - # Use Ubuntu colors (grey / aubergine / orange) - PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]❭ " - else - # Use Byobu colors (green / blue / red) - PS1="${debian_chroot:+($debian_chroot)}\[\e[00;32m\]\u\[\e[00m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;31m\]\w\[\e[00m\]\$ " - fi + case "$BYOBU_DISTRO" in + "Ubuntu") + # Use Ubuntu colors (grey / aubergine / orange) + PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]❭ " + ;; + *) + # Use Byobu colors (green / blue / red) + PS1="${debian_chroot:+($debian_chroot)}\[\e[00;32m\]\u\[\e[00m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;31m\]\w\[\e[00m\]\$ " + ;; + esac fi fi