From cfddcc3e04496d2db92ababe7a14607272d7ef4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 23 Aug 2014 20:15:50 +0200 Subject: [PATCH] bash as default shell --- roles/container/files/bashrc | 104 +++++++++++++++++++ roles/container/files/dircolors | 176 ++++++++++++++++++++++++++++++++ roles/container/files/zshrc | 41 -------- roles/container/tasks/main.yml | 16 ++- 4 files changed, 291 insertions(+), 46 deletions(-) create mode 100644 roles/container/files/bashrc create mode 100644 roles/container/files/dircolors delete mode 100644 roles/container/files/zshrc diff --git a/roles/container/files/bashrc b/roles/container/files/bashrc new file mode 100644 index 0000000..c373144 --- /dev/null +++ b/roles/container/files/bashrc @@ -0,0 +1,104 @@ +# +# .bashrc - interactive shell configuration +# + +# check for interactive +[[ $- = *i* ]] || return + +export TTY=$(tty) +export GPG_TTY=$TTY + +# shell opts: see bash(1) +shopt -s cdspell dirspell extglob histverify no_empty_cmd_completion checkwinsize + +set -o notify # notify of completed background jobs immediately +ulimit -S -c 0 # disable core dumps +stty -ctlecho # turn off control character echoing + +if [[ $TERM = linux ]]; then + setterm -regtabs 2 # set tab width of 4 (only works on TTY) +fi + +# more for less +export LESS=-R # use -X to avoid sending terminal initialization +export LESS_TERMCAP_mb=$'\e[01;31m' +export LESS_TERMCAP_md=$'\e[01;31m' +export LESS_TERMCAP_me=$'\e[0m' +export LESS_TERMCAP_se=$'\e[0m' +export LESS_TERMCAP_so=$'\e[01;44;33m' +export LESS_TERMCAP_ue=$'\e[0m' +export LESS_TERMCAP_us=$'\e[01;32m' + +# history +export HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd *" +export HISTCONTROL="ignoreboth:erasedups" +export HISTSIZE=1000 +export HISTFILESIZE=2000 + +GIT_EXEC_PATH=/usr/lib/git:/usr/share/git/remote-helpers + +source_bash_completion() { + local f + [[ $BASH_COMPLETION ]] && return 0 + for f in /{etc,usr/share/bash-completion}/bash_completion; do + if [[ -r $f ]]; then + . "$f" + return 0; + fi + done +} + +# External config +if [[ -r ~/.dircolors ]] && type -p dircolors >/dev/null; then + eval $(dircolors -b "$HOME/.dircolors") +fi + +PS1='\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]' + +source_bash_completion +[[ -r /usr/share/bash-completion/completions/git ]] && . /usr/share/bash-completion/completions/git +unset -f source_bash_completion + +# git prompt +[[ -f /usr/share/git/git-prompt.sh ]] && . /usr/share/git/git-prompt.sh + +urlencode() { + local i= char= url=$* + declare -i len=${#url} + + for (( i = 0; i < len; i++ )); do + char=${url:i:1} + case "$char" in + [a-zA-Z0-9.~_-]) printf "$char" ;; + ' ') printf + ;; + *) printf '%%%X' "'$char" ;; + esac + done +} + +mkcd() { + [[ $1 ]] || return 0 + [[ -d $1 ]] || mkdir -vp "$1" + [[ -d $1 ]] && builtin cd "$1" +} + +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias ff='/usr/bin/find . -iname "*$@*"' +alias gensums='[[ -f PKGBUILD ]] && makepkg -g >> PKGBUILD' +alias info='info --vi-keys' +alias j='jobs' +alias lla='ls -la' +alias ls='ls --group-directories-first --color' +alias md5='md5sum' +alias sd='systemctl' +alias ls='ls --color=auto' +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +[[ -r "$HOME/.bashrc.local" ]] && . "$HOME/basrc.local" diff --git a/roles/container/files/dircolors b/roles/container/files/dircolors new file mode 100644 index 0000000..b2c8a0e --- /dev/null +++ b/roles/container/files/dircolors @@ -0,0 +1,176 @@ +# Configuration file for dircolors, a utility to help you set the +# LS_COLORS environment variable used by GNU ls with the --color option. +# Copyright (C) 1996, 1999-2008 +# Free Software Foundation, Inc. +# Copying and distribution of this file, with or without modification, +# are permitted provided the copyright notice and this notice are preserved. +# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the +# slackware version of dircolors) are recognized but ignored. +# Below, there should be one TERM entry for each termtype that is colorizable +TERM Eterm +TERM ansi +TERM color-xterm +TERM con132x25 +TERM con132x30 +TERM con132x43 +TERM con132x60 +TERM con80x25 +TERM con80x28 +TERM con80x30 +TERM con80x43 +TERM con80x50 +TERM con80x60 +TERM cons25 +TERM console +TERM cygwin +TERM dtterm +TERM eterm-color +TERM gnome +TERM gnome-256color +TERM konsole +TERM kterm +TERM linux +TERM linux-c +TERM mach-color +TERM mlterm +TERM putty +TERM rxvt +TERM rxvt-256color +TERM rxvt-cygwin +TERM rxvt-cygwin-native +TERM rxvt-unicode +TERM rxvt-unicode-256color +TERM screen +TERM screen-256color +TERM screen-bce +TERM screen-w +TERM screen.linux +TERM vt100 +TERM xterm +TERM xterm-16color +TERM xterm-256color +TERM xterm-88color +TERM xterm-color +TERM xterm-debian + +# defaults +NORMAL 00 +FILE 00 +DIR 01;34 +LINK 01;36 +FIFO 40;33 +SOCK 01;35 +DOOR 01;35 +BLK 40;33;01 +CHR 40;33;01 +ORPHAN 40;31;01 +EXEC 01;32 +#SETUID 37;41 +#SETGID 30;43 +#STICKY_OTHER_WRITABLE 30;42 +#OTHER_WRITABLE 34;42 +#STICKY 37;44 + +# archives or compressed +.7z 01;31 +.Z 01;31 +.ace 01;31 +.arj 01;31 +.bz 01;31 +.bz2 01;31 +.cpio 01;31 +.deb 01;31 +.dz 01;31 +.gz 01;31 +.jar 01;31 +.lzh 01;31 +.lzma 01;31 +.rar 01;31 +.rpm 01;31 +.rz 01;31 +.svgz 01;31 +.tar 01;31 +.taz 01;31 +.tbz2 01;31 +.tgz 01;31 +.tz 01;31 +.xz 01;31 +.z 01;31 +.zip 01;31 +.zoo 01;31 + +# images +.asf 01;35 +.avi 01;35 +.bmp 01;35 +.dl 01;35 +.flc 01;35 +.fli 01;35 +.gif 01;35 +.gl 01;35 +.jpeg 01;35 +.jpg 01;35 +.m2v 01;35 +.m4v 01;35 +.mkv 01;35 +.mng 01;35 +.mov 01;35 +.mp4 01;35 +.mp4v 01;35 +.mpeg 01;35 +.mpg 01;35 +.nuv 01;35 +.ogm 01;35 +.pbm 01;35 +.pcx 01;35 +.pgm 01;35 +.png 01;35 +.ppm 01;35 +.qt 01;35 +.rm 01;35 +.rmvb 01;35 +.svg 01;35 +.tga 01;35 +.tif 01;35 +.tiff 01;35 +.vob 01;35 +.wmv 01;35 +.xbm 01;35 +.xcf 01;35 +.xpm 01;35 +.xwd 01;35 +.yuv 01;35 + +# audio +.aac 00;36 +.au 00;36 +.flac 00;36 +.mid 00;36 +.midi 00;36 +.mka 00;36 +.mp3 00;36 +.mpc 00;36 +.ogg 00;36 +.ra 00;36 +.wav 00;36 + +# source code +.C 00;36 +.H 00;36 +.c 00;36 +.cc 00;36 +.cpp 00;36 +.cxx 00;36 +.h 00;36 +.hpp 00;36 +.hxx 00;36 +.py 00;36 +.sh 00;36 +.vim 00;36 + +# objects +.a 00;33 +.ko 00;33 +.o 00;33 +.so 00;33 + diff --git a/roles/container/files/zshrc b/roles/container/files/zshrc deleted file mode 100644 index 88d4d12..0000000 --- a/roles/container/files/zshrc +++ /dev/null @@ -1,41 +0,0 @@ -# {{ ansible_managed }} -# Path to your oh-my-zsh configuration. -ZSH=$HOME/.oh-my-zsh - -# Set name of the theme to load. -# Look in ~/.oh-my-zsh/themes/ -# Optionally, if you set this to "random", it'll load a random theme each -# time that oh-my-zsh is loaded. -# ZSH_THEME="steeef" -ZSH_THEME="robbyrussell" - -# Example aliases -# alias zshconfig="mate ~/.zshrc" -# alias ohmyzsh="mate ~/.oh-my-zsh" - -# Set to this to use case-sensitive completion -# CASE_SENSITIVE="true" - -# Comment this out to disable bi-weekly auto-update checks -DISABLE_AUTO_UPDATE="true" - -# Uncomment to change how many often would you like to wait before auto-updates occur? (in days) -# export UPDATE_ZSH_DAYS=13 - -# Uncomment following line if you want to disable colors in ls -# DISABLE_LS_COLORS="true" - -# Uncomment following line if you want to disable autosetting terminal title. -# DISABLE_AUTO_TITLE="true" - -# Uncomment following line if you want red dots to be displayed while waiting for completion -# COMPLETION_WAITING_DOTS="true" - -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -plugins=(git common-aliases dircycle gem gitfast last-working-dir systemd pip python ruby svn urltools) - -[ -s ~/.zshrc.local ] && source ~/.zshrc.local - -source $ZSH/oh-my-zsh.sh diff --git a/roles/container/tasks/main.yml b/roles/container/tasks/main.yml index 73d7449..5f3eb1e 100644 --- a/roles/container/tasks/main.yml +++ b/roles/container/tasks/main.yml @@ -8,11 +8,17 @@ service: name={{ item }} state=stopped enabled=no with_items: masked_services -- user: name=root shell=/usr/bin/zsh -- name: Clone oh-my-zsh repo - git: repo=https://github.com/robbyrussell/oh-my-zsh.git dest=/root/.oh-my-zsh -- name: deploy .zshrc - copy: src=zshrc dest=/root/.zshrc +- user: name=root shell=/bin/bash +- name: delete oh-my-zsh repo + file: path=/root/.oh-my-zsh state=absent +- name: delete .zshrc + file: path=/root/.zshrs state=absent +- name: deploy .bashrc + copy: src=bashrc dest=/root/.bashrc +- name: deploy .dircolors + copy: src=dircolors dest=/root/.dircolors - mount: name=/run/systemd/journal/ src=/mnt/journal fstype=none opts=bind,ro state=present - name: deploy .vimrc copy: src=vimrc dest=/root/.vimrc +- name: backup directory + file: path=/root/.vim.backupdir state=directory