* 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
This commit is contained in:
Dustin Kirkland 2013-08-10 09:22:09 +01:00
commit d2431665ba
5 changed files with 20 additions and 13 deletions

6
debian/changelog vendored
View file

@ -1,6 +1,10 @@
byobu (5.55) unreleased; urgency=low 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 <kirkland@ubuntu.com> Wed, 07 Aug 2013 12:49:27 +0100 -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 07 Aug 2013 12:49:27 +0100

View file

@ -29,8 +29,7 @@ __distro() {
# user defined # user defined
true true
else else
get_distro DISTRO="$BYOBU_DISTRO"
DISTRO="$_RET"
fi fi
color bold2; printf "%s" "$DISTRO"; color -- color bold2; printf "%s" "$DISTRO"; color --
} }

View file

@ -57,5 +57,7 @@ if [ -z "${BYOBU_INCLUDED_LIBS}" ]; then
. "${BYOBU_PREFIX}/lib/${PKG}/include/shutil" . "${BYOBU_PREFIX}/lib/${PKG}/include/shutil"
. "${BYOBU_PREFIX}/lib/${PKG}/include/constants" . "${BYOBU_PREFIX}/lib/${PKG}/include/constants"
get_distro || true
export BYOBU_DISTRO="$_RET"
BYOBU_INCLUDED_LIBS=1 BYOBU_INCLUDED_LIBS=1
fi fi

View file

@ -31,8 +31,7 @@ __logo() {
printf "%s" "$LOGO" printf "%s" "$LOGO"
return return
fi fi
get_distro local distro="$(printf "%s" "$BYOBU_DISTRO" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"
local distro="$(printf "%s" "$_RET" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"
case "$distro" in case "$distro" in
*ubuntu*) *ubuntu*)
if $MARKUP; then if $MARKUP; then

View file

@ -16,15 +16,18 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Ensure that we're in a tmux or screen session # 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 # Ensure that we're in bash, in a byobu environment
if [ -n "$BYOBU_BACKEND" ] && [ "$SHELL" = "/bin/bash" ]; then if [ -n "$BYOBU_BACKEND" ] && [ "$SHELL" = "/bin/bash" ]; then
if [ -z "$DISTRO" ] && grep -qs "^Ubuntu" /etc/issue; then case "$BYOBU_DISTRO" in
"Ubuntu")
# Use Ubuntu colors (grey / aubergine / orange) # 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\]❭ " 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) # 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\]\$ " PS1="${debian_chroot:+($debian_chroot)}\[\e[00;32m\]\u\[\e[00m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;31m\]\w\[\e[00m\]\$ "
fi ;;
esac
fi fi
fi fi