domain=`hostname -f | rev | cut -d. -f 1,2,3 | rev`
hostname=`hostname -f | sed s/$domain// | sed 's/\.$//'`

export MYSQL_PS1="\u@"$hostname" [\d]> "

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"

HOST=`hostname -f | cut -f1 -d.`
[ -f ~/.prompt_colors ] && . ~/.prompt_colors
if [ "X$OVERRIDE_PS1" != "X" ]; then
        export PS1=$OVERRIDE_PS1
else
    case "$TERM" in
    xterm*)
        #export PS1="\[\e[${COLOR_HOST}m\]${HOST}\[\e[${COLOR_DOMAIN}m\].${DOMAIN}\[\e[0m\]:\w\\$ "
        #PS1="\[\033]2;${HOST}.${DOMAIN}:\w\007\]$PS1"
        export PS1="\[$(tput bold)\]\[\033[38;5;172m\]$QLOUD_APPLICATION.\[\033[38;5;34m\]\$QLOUD_ENVIRONMENT.\[\033[38;5;32m\]$QLOUD_COMPONENT.\[\033[38;5;244m\]$HOST\[$(tput sgr0)\]:\w# "
        ;;
    *)
		PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
        ;;
	esac
fi

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

alias ll='ls -l'

if [ -z $PGSSLROOTCERT ];then
    export PGSSLROOTCERT="/usr/local/share/ca-certificates/YandexInternalRootCA.crt"
fi

if [ -z $PGPASSFILE ];then
    export PGPASSFILE="/etc/yamail/.pgpass"
fi

alias events='jctl list events -host '

source /root/ansible-juggler/bin/activate
