Files
salt-states/users/files/bashrc.jinja
Keiran Snowden 5be2a914ac manage restic rsa
2023-11-27 01:42:37 -05:00

69 lines
2.1 KiB
Django/Jinja

# If not running interactively, don't do anything
{# code: lang=jinja-shell -#}
# vim: et:ai:ts=4:sw=4:ft=sh
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 grep='grep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
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 salt.pillar.get('restic:client', None) is not none %}
source /opt/restic/env.sh
{%- endif %}
{%- for alias, cmd_str in salt.pillar.get("bash_aliases:{}".format(bashrc_user), {}).items() %}
alias {{ alias }}="{{ cmd_str }}"
{%- endfor %}
{%- endif %}