From 542e894c48597e911daaa04e5402e50cc3a17fd6 Mon Sep 17 00:00:00 2001 From: "@@@No user configured@@@" <@@@No user configured@@@> Date: Tue, 17 Nov 2015 23:37:20 +0100 Subject: [PATCH 1/3] Add permissions on bashrc file. --- tasks/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 72847b7..6a1a20a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,7 +5,10 @@ # tasks file for roles/glenux.bash - name: Install bashrc - copy: src=bashrc dest=~/.bashrc + copy: > + src=bashrc + dest=~/.bashrc + mode=0644 become: true become_user: "{{item}}" with_items: bash_users From 333c36a0b596fb5af97f3fb2800987dacb4e1551 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Wed, 18 Nov 2015 00:57:25 +0100 Subject: [PATCH 2/3] Add bash_aliases. --- files/bash_aliases | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 files/bash_aliases diff --git a/files/bash_aliases b/files/bash_aliases new file mode 100644 index 0000000..90efdf7 --- /dev/null +++ b/files/bash_aliases @@ -0,0 +1,70 @@ +### ALIASES SUDO +alias apt-get='sudo apt-get' +alias apt-cache='sudo apt-cache' +alias dpkg='sudo dpkg' +alias photo_dl='sudo gphoto2 --auto-detect -P' +alias gnux_dvd='sudo /home/warbrain/bin/gnux_dvd' + +alias svnforget='svn st | egrep '\''^(\!|\?).*\.(cpp|cc|am|h|hh|hxx|tex|png)$'\''' + +## ALIASES +alias atodo='todo -G' +alias tdg='todo -G' +alias be='bundle exec' + +alias ls='ls --color=auto -F' +alias makepatch='LC_ALL=C TZ=UTC0 diff -Naur ' +alias timidity='timidity -Oe' +alias synaptic='gksu synaptic' +alias sl='ls' +#alias cmake='colormake' +alias music123='esddsp music123' +alias xdu='du > ~/.tmp/du.out && xdu -n -c 7 ~/.tmp/du.out' +alias gnux_bgfiles='find -exec du -sh "{}" \; | egrep [0-9]M | sort -n | tail -n 11 | head -n 10' +alias fr='file-roller' +alias mp3blaster='esddsp mp3blaster' +alias ll='ls -lh' +alias llla='ls -la | less' +alias lsd="ls -F | egrep '\/$'" +alias speech='esddsp festival --tts' +alias gvimr='gvim --remote-tab' +alias grep='grep --color' +## SERVERS SSH + +alias host_dptmaths='ssh -X -C ssh.dptmaths.ens-cachan.fr -l rolland' +alias host_shamox='ssh -X -c arcfour -C -p 22 shamox.ath.cx -l warbrain' +alias host_darby='ssh -X -c arcfour -C darby -l warbrain' +alias host_daka='ssh -X -c arcfour -C daka -l warbrain' +# pass 'noir' +alias tunnel_murlock='ssh -L8882:localhost:8888 bewan@murlock.hd.free.fr -N' +#alias diades='ssh -X -c arcfour -C diades.glenux.net -l warbrain' +#alias dungeon='ssh -X -c blowfish -C dungeon -l warbrain' +#alias djeke='ssh -X -c blowfish -C djeke -l warbrain' +#alias sword='ssh -X -c blowfish -C sword.ath.cx -l warbrain' +alias ykhoo='ssh -X -c blowfish -C ykhoo.ath.cx -l warbrain' +alias daneel='ssh -X -c blowfish -C daneel.glenux.net -l warbrain' +alias ef='LD_PRELOAD=libefence.so.0.0 ' + +alias rm='rm -i' +alias cp='cp -i' +alias mv='mv -i' + +alias divx='find /cdrom -name \*.[Aa][Vv][Ii] -o -name \*.[oO][Gg][Mm] -ok mplayer \-fs \-x 512 \-y 300 {} \;' +#alias ip='/sbin/ifconfig eth0 | grep adr | sed -e "s/^.*adr://" |sed -e "s/ Bcast.*//" ' + +alias rmplayer="mplayer -ao esd -nocache" + +alias filter_video="egrep -i '\.(avi|mov|mpe?g|mkv|wmv|rm)$'" +alias filter_audio="egrep -i '\.(wav|flac|mp3|aac|m4a|ogg|wma)$'" +alias filter_image="egrep -i '\.(jpe?g|png|xcf(.gz)|eps|svg|gif)$'" +alias filter_imageart="egrep -i '\.(xcf(.gz)?|psd|ora|svg)$'" +alias filter_archive="egrep -i '\.(tar\.)?(gz|bz2|7z|tgz|zip|rar|ace|zoo|arj|lha)$'" +alias filter_document="egrep -i '\.(txt|pdf|ps|sxw|odt|doc|rtf)$'" + +alias pwgen="pwgen -B 10 14" +alias http_serve="python -m SimpleHTTPServer 5001" + +alias scp="BINARY_SSH=scp $HOME/bin/ssh" +alias rsync="BINARY_SSH=rsync $HOME/bin/ssh" +alias fuck='$(thefuck $(fc -ln -1))' +alias baloostatus='balooctl status 2>/dev/null |grep Indexed |awk -v p=200 "{print int(p * \$2/\$4)/p; }"' From fc5f81307c58b04b0e415f00eaac4eee8d9fa0aa Mon Sep 17 00:00:00 2001 From: "@@@No user configured@@@" <@@@No user configured@@@> Date: Wed, 18 Nov 2015 00:57:38 +0100 Subject: [PATCH 3/3] Reorganize bash role. --- files/bash_profile | 9 +++ files/bashrc | 6 ++ ...gnusidecloud.sh => 00-bin-gnusidecloud.sh} | 3 +- .../{01-private-bin.sh => 00-bin-private.sh} | 0 ...-resolv-host.sh => 20-fake-resolv-host.sh} | 0 .../{05-android.sh => 50-dev-android.sh} | 0 ...2-debian-variables.sh => 50-dev-debian.sh} | 0 files/bashrc.d/{05-go.sh => 50-dev-go.sh} | 0 files/bashrc.d/{05-opam.sh => 50-dev-opam.sh} | 0 .../bashrc.d/{05-rbenv.sh => 50-dev-rbenv.sh} | 0 .../{06-ruboto.sh => 50-dev-ruboto.sh} | 1 + files/bashrc.d/70-util-ansible.sh | 4 ++ files/bashrc.d/70-util-darcs.sh | 4 ++ files/bashrc.d/70-util-editor.sh | 10 ++++ files/bashrc.d/70-util-godir.sh | 8 +++ .../{11-gpg-agent.sh => 70-util-gpg.sh} | 0 .../{11-grep-options.sh => 70-util-grep.sh} | 4 ++ .../{09-pager.sh => 70-util-pager.sh} | 0 files/bashrc.d/80-app-gtk.sh | 4 ++ files/bashrc.d/{99-prompt.sh => 90-prompt.sh} | 0 files/bashrc.d/90-shell-display.sh | 3 + files/bashrc.d/90-shell-history.sh | 3 + ...ompletion-rmplayer.sh => 95-completion.sh} | 0 .../{99-aliases.sh => 95-misc-aliases.sh} | 0 ...sh-completion.sh => 99-misc-completion.sh} | 2 +- files/bashrc.d/99-misc.sh | 57 ------------------- tasks/main.yml | 14 +++-- 27 files changed, 67 insertions(+), 65 deletions(-) create mode 100644 files/bash_profile rename files/bashrc.d/{06-gnusidecloud.sh => 00-bin-gnusidecloud.sh} (77%) rename files/bashrc.d/{01-private-bin.sh => 00-bin-private.sh} (100%) rename files/bashrc.d/{98-fake-resolv-host.sh => 20-fake-resolv-host.sh} (100%) rename files/bashrc.d/{05-android.sh => 50-dev-android.sh} (100%) rename files/bashrc.d/{02-debian-variables.sh => 50-dev-debian.sh} (100%) rename files/bashrc.d/{05-go.sh => 50-dev-go.sh} (100%) rename files/bashrc.d/{05-opam.sh => 50-dev-opam.sh} (100%) rename files/bashrc.d/{05-rbenv.sh => 50-dev-rbenv.sh} (100%) rename files/bashrc.d/{06-ruboto.sh => 50-dev-ruboto.sh} (99%) create mode 100644 files/bashrc.d/70-util-ansible.sh create mode 100644 files/bashrc.d/70-util-darcs.sh create mode 100644 files/bashrc.d/70-util-editor.sh create mode 100644 files/bashrc.d/70-util-godir.sh rename files/bashrc.d/{11-gpg-agent.sh => 70-util-gpg.sh} (100%) rename files/bashrc.d/{11-grep-options.sh => 70-util-grep.sh} (70%) rename files/bashrc.d/{09-pager.sh => 70-util-pager.sh} (100%) create mode 100644 files/bashrc.d/80-app-gtk.sh rename files/bashrc.d/{99-prompt.sh => 90-prompt.sh} (100%) create mode 100644 files/bashrc.d/90-shell-display.sh create mode 100644 files/bashrc.d/90-shell-history.sh rename files/bashrc.d/{99-completion-rmplayer.sh => 95-completion.sh} (100%) rename files/bashrc.d/{99-aliases.sh => 95-misc-aliases.sh} (100%) rename files/bashrc.d/{99-system-bash-completion.sh => 99-misc-completion.sh} (94%) delete mode 100644 files/bashrc.d/99-misc.sh 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