Files
salt-states/users/files/bashrc.jinja
2023-11-25 17:04:25 -05:00

74 lines
2.2 KiB
Django/Jinja

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# See bash(1) for more options
export HISTCONTROL=ignoredups
export HISTSIZE=2000000
export HISTFILESIZE=2000000
export HISTTIMEFORMAT="(%m/%d/%y) %T "
export PROMPT_COMMAND='history -a'
shopt -s histappend
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias vi='vim'
export EDITOR='vim'
export VISUAL='vim'
# 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 ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # color support
PS1="[\[\e[1;33;1m\]\$(awk '{print \$1}' /proc/loadavg)\[\e[0m\]/\[\e[1;34;1m\]\$(grep -c '^processor' /proc/cpuinfo)\[\e[0m\]][\[\e[1;31;1m\]\u\[\e[0m\]@\[\e[1;32;32m\]\h\[\e[39;1m\] \w\[\e[0m\]]$ "
else
PS1="[\$(awk {'print \$1'} /proc/loadavg)/\$(grep -c '^processor' /proc/cpuinfo)][\u@\h \w]$ "
fi
PATH="${PATH}:${HOME}/.local/bin"
alias random='< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-32};echo'
{%- if bashrc_user is defined %}
{%- if bashrc_user == 'root' and 'restic' in pillar %}
export RESTIC_REPOSITORY={{ salt.pillar.get('restic:repo') }}
export RESTIC_PASSWORD={{ salt.pillar.get('restic:pass') }}
{%- endif %}
{%- for alias, cmd_str in salt.pillar.get("bash_aliases:{}".format(bashrc_user), {}).items() %}
alias {{ alias }}="{{ cmd_str }}"
{%- endfor %}
{%- endif %}