diff --git a/files/bash_profile b/files/bash_profile new file mode 100644 index 0000000..7af268c --- /dev/null +++ b/files/bash_profile @@ -0,0 +1,9 @@ +## +## BASH PROFILE - Only for login shells +## + + +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi + diff --git a/files/bashrc b/files/bashrc index c604b28..eff621c 100644 --- a/files/bashrc +++ b/files/bashrc @@ -2,6 +2,12 @@ ## BASH RC - every new shell ##  +## 01-29 environment changes (XX-bin-... and XX-env-) +## 40-69 development settings (XX-dev) +## 70-89 utilities and applications specific environment changes (XX-app-...) +## 90-99 shell customisation : colors, prompt, etc. +## 95-99 miscelanous or low priority : aliases and completion (XX-misc-) + if [ -d "$HOME/.bashrc.d" ]; then for script in $(find "$HOME/.bashrc.d/" -name '*.sh' |sort -n) ; do # echo "Loading `basename \"$script\"`..." # >&2 diff --git a/files/bashrc.d/06-gnusidecloud.sh b/files/bashrc.d/00-bin-gnusidecloud.sh similarity index 77% rename from files/bashrc.d/06-gnusidecloud.sh rename to files/bashrc.d/00-bin-gnusidecloud.sh index 9ed0cd8..14bcd72 100644 --- a/files/bashrc.d/06-gnusidecloud.sh +++ b/files/bashrc.d/00-bin-gnusidecloud.sh @@ -5,6 +5,7 @@ # GNUSIDE_CLOUD_PATH="$HOME/Documents/_GnusideCloud" -if [[ -s "$GNUSIDE_CLOUD_PATH/bin" ]]; then +if [ -d "$GNUSIDE_CLOUD_PATH/bin" ]; then export PATH="$GNUSIDE_CLOUD_PATH/bin:$PATH" fi + diff --git a/files/bashrc.d/01-private-bin.sh b/files/bashrc.d/00-bin-private.sh similarity index 100% rename from files/bashrc.d/01-private-bin.sh rename to files/bashrc.d/00-bin-private.sh diff --git a/files/bashrc.d/98-fake-resolv-host.sh b/files/bashrc.d/20-fake-resolv-host.sh similarity index 100% rename from files/bashrc.d/98-fake-resolv-host.sh rename to files/bashrc.d/20-fake-resolv-host.sh diff --git a/files/bashrc.d/05-android.sh b/files/bashrc.d/50-dev-android.sh similarity index 100% rename from files/bashrc.d/05-android.sh rename to files/bashrc.d/50-dev-android.sh diff --git a/files/bashrc.d/02-debian-variables.sh b/files/bashrc.d/50-dev-debian.sh similarity index 100% rename from files/bashrc.d/02-debian-variables.sh rename to files/bashrc.d/50-dev-debian.sh diff --git a/files/bashrc.d/05-go.sh b/files/bashrc.d/50-dev-go.sh similarity index 100% rename from files/bashrc.d/05-go.sh rename to files/bashrc.d/50-dev-go.sh diff --git a/files/bashrc.d/05-opam.sh b/files/bashrc.d/50-dev-opam.sh similarity index 100% rename from files/bashrc.d/05-opam.sh rename to files/bashrc.d/50-dev-opam.sh diff --git a/files/bashrc.d/05-rbenv.sh b/files/bashrc.d/50-dev-rbenv.sh similarity index 100% rename from files/bashrc.d/05-rbenv.sh rename to files/bashrc.d/50-dev-rbenv.sh diff --git a/files/bashrc.d/06-ruboto.sh b/files/bashrc.d/50-dev-ruboto.sh similarity index 99% rename from files/bashrc.d/06-ruboto.sh rename to files/bashrc.d/50-dev-ruboto.sh index 219ea13..7e1fade 100644 --- a/files/bashrc.d/06-ruboto.sh +++ b/files/bashrc.d/50-dev-ruboto.sh @@ -1,3 +1,4 @@ + export PATH export ANDROID_HOME diff --git a/files/bashrc.d/70-util-ansible.sh b/files/bashrc.d/70-util-ansible.sh new file mode 100644 index 0000000..d2401df --- /dev/null +++ b/files/bashrc.d/70-util-ansible.sh @@ -0,0 +1,4 @@ + +# Disable ansible cowsay +export ANSIBLE_NOCOWS=1 + diff --git a/files/bashrc.d/70-util-darcs.sh b/files/bashrc.d/70-util-darcs.sh new file mode 100644 index 0000000..260f4ee --- /dev/null +++ b/files/bashrc.d/70-util-darcs.sh @@ -0,0 +1,4 @@ + +# Help darcs on network mounts +export DARCS_SLOPPY_LOCKS=1 + diff --git a/files/bashrc.d/70-util-editor.sh b/files/bashrc.d/70-util-editor.sh new file mode 100644 index 0000000..3b1a08a --- /dev/null +++ b/files/bashrc.d/70-util-editor.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Pager detection +for pager in vim nano emacs ; do + if hash $pager 2> /dev/null ; then + export PAGER=$pager + break + fi +done + diff --git a/files/bashrc.d/70-util-godir.sh b/files/bashrc.d/70-util-godir.sh new file mode 100644 index 0000000..18f4ac6 --- /dev/null +++ b/files/bashrc.d/70-util-godir.sh @@ -0,0 +1,8 @@ + +if hash gx-search-baloo >/dev/null 2>&1 ; then + function godir() { + dir=$(gx-search-baloo "$@") + cd "$dir" + } +fi + diff --git a/files/bashrc.d/11-gpg-agent.sh b/files/bashrc.d/70-util-gpg.sh similarity index 100% rename from files/bashrc.d/11-gpg-agent.sh rename to files/bashrc.d/70-util-gpg.sh diff --git a/files/bashrc.d/11-grep-options.sh b/files/bashrc.d/70-util-grep.sh similarity index 70% rename from files/bashrc.d/11-grep-options.sh rename to files/bashrc.d/70-util-grep.sh index ce5b781..60e0992 100644 --- a/files/bashrc.d/11-grep-options.sh +++ b/files/bashrc.d/70-util-grep.sh @@ -3,3 +3,7 @@ #export GREP_OPTIONS="--color" #GREP_COLORS="ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36" #export GREP_COLORS + +# disable deprecated variable +export GREP_OPTIONS= + diff --git a/files/bashrc.d/09-pager.sh b/files/bashrc.d/70-util-pager.sh similarity index 100% rename from files/bashrc.d/09-pager.sh rename to files/bashrc.d/70-util-pager.sh diff --git a/files/bashrc.d/80-app-gtk.sh b/files/bashrc.d/80-app-gtk.sh new file mode 100644 index 0000000..3fcdfa5 --- /dev/null +++ b/files/bashrc.d/80-app-gtk.sh @@ -0,0 +1,4 @@ + +# This line was appended by KDE +# Make sure our customised gtkrc file is loaded. +export GTK2_RC_FILES=$HOME/.gtkrc-2.0 diff --git a/files/bashrc.d/99-prompt.sh b/files/bashrc.d/90-prompt.sh similarity index 100% rename from files/bashrc.d/99-prompt.sh rename to files/bashrc.d/90-prompt.sh diff --git a/files/bashrc.d/90-shell-display.sh b/files/bashrc.d/90-shell-display.sh new file mode 100644 index 0000000..0152ea4 --- /dev/null +++ b/files/bashrc.d/90-shell-display.sh @@ -0,0 +1,3 @@ +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize diff --git a/files/bashrc.d/90-shell-history.sh b/files/bashrc.d/90-shell-history.sh new file mode 100644 index 0000000..080813b --- /dev/null +++ b/files/bashrc.d/90-shell-history.sh @@ -0,0 +1,3 @@ + +# don't put duplicate lines in the history. See bash(1) for more options +export HISTCONTROL=ignoredups diff --git a/files/bashrc.d/99-completion-rmplayer.sh b/files/bashrc.d/95-completion.sh similarity index 100% rename from files/bashrc.d/99-completion-rmplayer.sh rename to files/bashrc.d/95-completion.sh diff --git a/files/bashrc.d/99-aliases.sh b/files/bashrc.d/95-misc-aliases.sh similarity index 100% rename from files/bashrc.d/99-aliases.sh rename to files/bashrc.d/95-misc-aliases.sh diff --git a/files/bashrc.d/99-system-bash-completion.sh b/files/bashrc.d/99-misc-completion.sh similarity index 94% rename from files/bashrc.d/99-system-bash-completion.sh rename to files/bashrc.d/99-misc-completion.sh index 8d5c67e..3bdad3b 100644 --- a/files/bashrc.d/99-system-bash-completion.sh +++ b/files/bashrc.d/99-misc-completion.sh @@ -1,4 +1,3 @@ -#!/bin/sh ## # BASH COMPLETION @@ -6,3 +5,4 @@ if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi + diff --git a/files/bashrc.d/99-misc.sh b/files/bashrc.d/99-misc.sh deleted file mode 100644 index 052682d..0000000 --- a/files/bashrc.d/99-misc.sh +++ /dev/null @@ -1,57 +0,0 @@ -#source /etc/bash_completion - -export EDITOR=vim - -# disable deprecated variable -export GREP_OPTIONS= - -# load sub-bashrc - -## 01-10 environment changes (XX-environment-...) -## 11-20 applications specific environment changes (XX-application-...) -## 81-99 shell customisation (colors, prompt, etc.) -## 91-99 aliases and completion - -export SHELL_ISLOGIN=${SHELL_ISLOGIN:-0} -#echo $SHELL_ISLOGIN - -# don't put duplicate lines in the history. See bash(1) for more options -export HISTCONTROL=ignoredups - -### -# DISPLAY & COLORS -# - -export LS_COLORS="$LS_COLORS*.flac=01;35:" - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -#??? shopt -s checkwinsize - - -# This line was appended by KDE -# Make sure our customised gtkrc file is loaded. -# export GTK2_RC_FILES=$HOME/.gtkrc-2.0 - - -## -# APPLICATION-SPECIFIC SETUP -# - -# This line was appended by KDE -# Make sure our customised gtkrc file is loaded. -export GTK2_RC_FILES=$HOME/.gtkrc-2.0 - -# Help darcs on network mounts -export DARCS_SLOPPY_LOCKS=1 - -# Disable ansible cowsay -export ANSIBLE_NOCOWS=1 - -function godir() { - dir=$(gx-search-baloo "$@") - cd "$dir" -} - - - diff --git a/tasks/main.yml b/tasks/main.yml index 6a1a20a..9a0d54b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,14 +4,16 @@ register: bash_scripts # tasks file for roles/glenux.bash -- name: Install bashrc - copy: > - src=bashrc - dest=~/.bashrc +- name: Install main configuration files for bash + copy: + src={{item[1]}} + dest=~/.{{item[1]|basename}} mode=0644 become: true - become_user: "{{item}}" - with_items: bash_users + become_user: "{{item[0]}}" + with_nested: + - bash_users + - ['bashrc', 'bash_profile', 'bash_aliases'] - name: Create bashrc.d directory file: path=~/.bashrc.d state=directory