Add bashrc module.

This commit is contained in:
@@@No user configured@@@ 2015-11-17 12:07:59 +01:00
parent 6a7ecce73b
commit 0609db4265
19 changed files with 281 additions and 0 deletions

View file

@ -0,0 +1,10 @@
#!/bin/sh
###
# set PATH so it includes user's private bin if it exists
#
if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin:$PATH"
fi

View file

@ -0,0 +1,6 @@
#!/bin/sh
export DEBEMAIL="glenux@glenux.net"
export DEBFULLNAME="Glenn Y. Rolland"
export buildArea=$HOME/debian/build-area

View file

@ -0,0 +1,10 @@
#!/bin/sh
###
# Set up Android environment
#
ANDROIDDIR=$HOME/.adt-bundle
if [[ -e "$ANDROIDDIR" ]]; then
export PATH=$ANDROIDDIR/sdk/platform-tools:$ANDROIDDIR/sdk/tools:$PATH
fi

12
files/bashrc.d/05-go.sh Normal file
View file

@ -0,0 +1,12 @@
#!/bin/sh
##
# Set up Go environment
#
if hash go > /dev/null 2>&1; then
if [ -d "$HOME/bin" ]; then
export GOPATH="$HOME/src/Go"
export PATH="$GOPATH/bin:$PATH"
fi
fi

11
files/bashrc.d/05-opam.sh Normal file
View file

@ -0,0 +1,11 @@
#!/bin/sh
##
# Set up OCaml environment
#
if hash opam > /dev/null 2>&1 ; then
eval $(opam config env)
fi
# OPAM configuration
#. /home/warbrain/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true

View file

@ -0,0 +1,10 @@
#!/bin/sh
###
# Set up Ruby environment
#
#export PATH=/var/lib/gems/1.8/bin:$PATH
if [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi

View file

@ -0,0 +1,10 @@
#!/bin/sh
###
# Set up GNUSIDE CLOUD environment
#
GNUSIDE_CLOUD_PATH="$HOME/Documents/_GnusideCloud"
if [[ -s "$GNUSIDE_CLOUD_PATH/bin" ]]; then
export PATH="$GNUSIDE_CLOUD_PATH/bin:$PATH"
fi

View file

@ -0,0 +1,8 @@
export PATH
export ANDROID_HOME
if [ -d "$HOME/android-sdk-linux" ]; then
PATH="$HOME/android-sdk-linux/build-tools/19.1.0:$PATH"
PATH="$HOME/android-sdk-linux/tools:$PATH"
ANDROID_HOME="$HOME/android-sdk-linux/"
fi

View file

@ -0,0 +1,10 @@
#!/bin/sh
# Pager detection
for pager in most less more ; do
if hash $pager 2> /dev/null ; then
export PAGER=$pager
break
fi
done

View file

@ -0,0 +1,12 @@
#!/bin/sh
###
# GnuPG
#
if [ -f "${HOME}/.gpg-agent-info" ]; then
. "${HOME}/.gpg-agent-info"
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
fi

View file

@ -0,0 +1,5 @@
#!/bin/sh
#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

View file

@ -0,0 +1,3 @@
#echo "[ERROR] Fake resolv & host is not set up" >&2

View file

@ -0,0 +1,14 @@
#!/bin/sh
##
# ALIAS DEFINITIONS.
#
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

View file

@ -0,0 +1,12 @@
#!/bin/sh
# completion programmable sur les URLs qui vont bien
complete -W " 'mms://vip7.yacast.fr/encoderouifm'
'mms://vipbu.yacast.fr/encoderouifm'
'mms://vip2.yacast.fr/encoderfun1'
'mms://vipbu.yacast.fr/encoderfun'
'mms://vip1.yacast.fr/encodernrj'
'mms://vipbu.yacast.fr/encodernrj'
'mms://vip1.yacast.fr/encodernostalgie'
" rmplayer

57
files/bashrc.d/99-misc.sh Normal file
View file

@ -0,0 +1,57 @@
#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"
}

View file

@ -0,0 +1,56 @@
#!/bin/sh
##
# PROMPT DEFINITIONS.
#
ps1_show() {
local format=$1
local fun=$2
local str=$($fun)
if [ ! -z "$str" ]; then
printf "$format\n" "$str"
fi
}
ps1_vcs_branch() {
local vcs=""
local vcs_branch=""
local vcs_root=""
local vcs_root_path=""
local vcs_root_url=""
local vcs_branch_url=""
if hash git && git rev-parse > /dev/null 2>&1; then
vcs="git"
vcs_branch=$(git branch |sed -n "s/\* \(.*\)/\1/p")
elif hash hg && hg -q status > /dev/null 2>&1; then
vcs="hg"
vcs_branch=$(hg branch)
elif hash svn && svn info > /dev/null 2>&1; then
vcs="svn"
vcs_root_path=$(LANG=C LC_ALL=C svn info |sed -n "s/^Working Copy Root Path: //p")
vcs_root_url=$(cd "$vcs_root" ; LANG=C LC_ALL=C svn info |sed -n "s/^Repository Root: //p")
vcs_branch_url=$(cd "$vcs_root" ; LANG=C LC_ALL=C svn info |sed -n "s/^URL: //p")
vcs_branch=$(echo "$vcs_branch_url" |sed "s#^$vcs_root_url/##")
fi
if [ -z "$vcs" ]; then
echo ""
else
echo "$vcs:$vcs_branch"
fi
}
#export PS1=" \t [#\#]\n[\u@\h \w]\\$ "
#PS1='\[\033[1;32m\][\t|\d]\[\033[1;33m\][\u@\h] \[\033[0;36m\]\w\$\[\033[0m\]\n '
PS1="$ps1_context ."
PS1=$PS1": \[\e[1;33m\]\w\[\e[0m\] :"
PS1=$PS1"\`ps1_show ': \[\e[1;34m\]%s\[\e[0m\] :' ps1_vcs_branch\`" # vcs branch
PS1=$PS1": \[\e[0;32m\]\t\[\e[0m\] :"
#PS1=$PS1": \[\e[1;34m\]#\#\[\e[0m\] :" #command count
PS1=$PS1": \[\e[0;31m\]\u@\h " #username
PS1=$PS1"("`uname -m`")\[\e[0m\] :" # architecture
PS1=$PS1":.\n\$ "
export PS1

View file

@ -0,0 +1,8 @@
#!/bin/sh
##
# BASH COMPLETION
#
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi

View file

@ -1,2 +1,17 @@
--- ---
# tasks file for roles/glenux.bash # tasks file for roles/glenux.bash
- name: Install bashrc
fileglob:
- bashrc.d/*.sh
- name: Install bashrc.d files
copy:
"src={{item}}"
"dest=~/.bashrc.d/{{item|basename}}"
with_nested:
- bash_users
- bash_files
become: true
become_user: "{{item}}"

12
templates/bashrc.jinja2 Normal file
View file

@ -0,0 +1,12 @@
##
## BASH RC - every new shell
## 
if [ -d "$HOME/.bashrc.d" ]; then
for script in $(find "$HOME/.bashrc.d/" -name '*.sh' |sort -n) ; do
# echo "Loading `basename \"$script\"`..." # >&2
. $script
done
fi