2024-05-24 11:40:08 +02:00
|
|
|
{% if user is defined %}
|
2024-03-26 15:58:56 +01:00
|
|
|
# {{ user.home | default('/home/' + user.name) }}/.bashrc"
|
|
|
|
# for user {{ user.name }}
|
2024-05-24 11:40:08 +02:00
|
|
|
{% else %}
|
|
|
|
# /root/.bashrc
|
|
|
|
{% endif %}
|
2024-04-06 22:59:38 +02:00
|
|
|
{{ ansible_managed | ansible.builtin.comment }}
|
2024-03-26 15:58:56 +01:00
|
|
|
|
|
|
|
# Source global definitions
|
|
|
|
if [ -f /etc/bash.bashrc ]; then
|
2024-04-06 19:42:57 +02:00
|
|
|
source /etc/bash.bashrc
|
2024-03-26 15:58:56 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# User specific environment
|
|
|
|
PATH="{{ l3d_users__bashrc_path }}"
|
|
|
|
export PATH
|
|
|
|
|
|
|
|
# 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)"
|
2024-04-06 20:17:51 +02:00
|
|
|
{% for alias in l3d_users__dotfiles__aliases %}
|
2024-04-06 19:42:57 +02:00
|
|
|
{% if alias.color %}
|
2024-03-26 15:58:56 +01:00
|
|
|
alias {{ alias.alias }}="{{ alias.command }} --color=auto"
|
2024-04-06 19:42:57 +02:00
|
|
|
{% endif %}
|
2024-03-26 15:58:56 +01:00
|
|
|
{% endfor %}
|
|
|
|
fi
|
|
|
|
|
|
|
|
{% for alias in l3d_users__dotfiles__aliases %}
|
2024-04-06 19:42:57 +02:00
|
|
|
{% if not alias.color %}
|
2024-03-26 15:58:56 +01:00
|
|
|
alias {{ alias.alias }}="{{ alias.command }}"
|
2024-04-06 19:42:57 +02:00
|
|
|
{% endif %}
|
2024-03-26 15:58:56 +01:00
|
|
|
{% endfor %}
|
|
|
|
|
2024-04-06 19:42:57 +02:00
|
|
|
{% if l3d_users__dotfiles__bash_completion_enabled %}
|
2024-03-26 15:58:56 +01:00
|
|
|
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
|
2024-04-06 19:42:57 +02:00
|
|
|
{% endif %}
|
2024-03-26 15:58:56 +01:00
|
|
|
|
|
|
|
# fancy Prompt
|
|
|
|
export PS1='{{ l3d_users__dotfiles__user_prompt }} '
|
|
|
|
|
2024-05-24 11:40:08 +02:00
|
|
|
# bash_history
|
2024-03-26 15:58:56 +01:00
|
|
|
HISTCONTROL={{ l3d_users__dotfiles__history_control }}
|
|
|
|
shopt -s histappend
|
|
|
|
{% if ansible_os_family == 'Redhat' %}
|
2024-04-06 22:59:38 +02:00
|
|
|
# HISTSIZE={{ l3d_users__dotfiles__history_size }}
|
|
|
|
# HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }}
|
2024-03-26 15:58:56 +01:00
|
|
|
{% elif ansible_distribution == "CentOS" %}
|
2024-04-06 22:59:38 +02:00
|
|
|
# HISTSIZE={{ l3d_users__dotfiles__history_size }}
|
|
|
|
# HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }}
|
2024-03-26 15:58:56 +01:00
|
|
|
{% else %}
|
2024-04-06 22:59:38 +02:00
|
|
|
HISTSIZE={{ l3d_users__dotfiles__history_size }}
|
|
|
|
HISTFILESIZE={{ l3d_users__dotfiles__history_file_size }}
|
2024-03-26 15:58:56 +01:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
# additional general rules
|
2024-04-06 22:59:38 +02:00
|
|
|
{% for _row in l3d_users__dotfiles__additional_user_bashrc_lines | default() %}
|
2024-03-26 15:58:56 +01:00
|
|
|
{{ _row }}
|
|
|
|
{% endfor %}
|
|
|
|
|
2024-05-24 11:40:08 +02:00
|
|
|
{% if user is defined %}
|
2024-03-26 15:58:56 +01:00
|
|
|
# additional user rules
|
2024-05-24 11:40:08 +02:00
|
|
|
{% for custom in user.bashrc | default([]) %}
|
|
|
|
{{ custom }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2024-03-26 15:58:56 +01:00
|
|
|
|
|
|
|
# vim:ts=4:sw=4
|