From 0efdd9da71227cd8865df95c04b2d6492b4e9f7c Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 9 Sep 2012 22:43:10 +0200 Subject: [PATCH] clean chroot patch: add chroot for every connexions, modern test, local variabls --- liquidprompt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/liquidprompt b/liquidprompt index cb68d16..f86929e 100755 --- a/liquidprompt +++ b/liquidprompt @@ -331,26 +331,30 @@ _lp_connection() # else diplay the host without color # The connection is not expected to change from inside the shell, so we # build this just once +LP_HOST="${NO_COL}@" +if [[ -r /etc/debian_chroot ]] ; then + local debchroot + debchroot=$(cat /etc/debian_chroot) + LP_HOST="${LP_HOST}(${debchroot})" +fi + case "$(_lp_connection)" in lcl) if [[ "$LP_HOSTNAME_ALWAYS" != 1 ]] ; then + # FIXME do we want to display the chroot if local? LP_HOST="${NO_COL}" # no hostname if local else - LP_HOST="${NO_COL}@${LP_COLOR_HOST}${_LP_HOST_SYMBOL}${NO_COL}" + LP_HOST="${LP_HOST}${LP_COLOR_HOST}${_LP_HOST_SYMBOL}${NO_COL}" fi ;; ssh) - if [ -r /etc/debian_chroot ] ; then - _LP_HOST_CHROOT=$(cat /etc/debian_chroot) - _LP_HOST_CHROOT="($_LP_HOST_CHROOT)" - fi - LP_HOST="${NO_COL}@${LP_COLOR_SSH}${_LP_HOST_CHROOT}${_LP_HOST_SYMBOL}${NO_COL}" + LP_HOST="${LP_HOST}${LP_COLOR_SSH}${_LP_HOST_SYMBOL}${NO_COL}" ;; tel) - LP_HOST="${NO_COL}@${LP_COLOR_TELNET}${_LP_HOST_SYMBOL}${NO_COL}" + LP_HOST="${LP_HOST}${LP_COLOR_TELNET}${_LP_HOST_SYMBOL}${NO_COL}" ;; *) - LP_HOST="${NO_COL}@${_LP_HOST_SYMBOL}" # defaults to no color + LP_HOST="${LP_HOST}${_LP_HOST_SYMBOL}" # defaults to no color ;; esac