From 250a07a4a27d763be8d6785db3b63c58a3fd7bf7 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 20 Dec 2016 14:55:38 +0100 Subject: [PATCH] saving uncommitted changes in /etc prior to emerge run --- .etckeeper | 1 + bash/bashrc.d/fbrehm.sh | 44 ++++++++++++++++++++++++++++++++++++----- motd.tail | 6 ++++++ 3 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 motd.tail diff --git a/.etckeeper b/.etckeeper index 00b92dc..de19b75 100755 --- a/.etckeeper +++ b/.etckeeper @@ -349,6 +349,7 @@ maybe chmod 0644 'modprobe.d/aliases.conf' maybe chmod 0644 'modprobe.d/i386.conf' maybe chmod 0755 'modules-load.d' maybe chmod 0644 'modules-load.d/.keep_sys-apps_systemd-0' +maybe chmod 0644 'motd.tail' maybe chmod 0644 'nanorc' maybe chmod 0644 'networks' maybe chmod 0644 'nsswitch.conf' diff --git a/bash/bashrc.d/fbrehm.sh b/bash/bashrc.d/fbrehm.sh index eacd56d..79fbaa3 100644 --- a/bash/bashrc.d/fbrehm.sh +++ b/bash/bashrc.d/fbrehm.sh @@ -99,7 +99,7 @@ fi #done # Try to keep environment pollution down, EPA loves us. -unset use_color safe_term match_lhs +unset safe_term match_lhs if [ -d /usr/scripts ] ; then export PATH="/usr/scripts:${PATH}" @@ -170,12 +170,46 @@ if [ -f /usr/share/mc/mc.gentoo ]; then . /usr/share/mc/mc.gentoo fi -if [ -e /etc/bash_completion.d/git ] ; then - if [[ ${EUID} == 0 ]] ; then - PS1='$? \[\033[01;31m\]\h\[\033[01;30m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(__git_ps1)\[\033[01;34m\] \$ \[\033[00m\]' +GP_RC="/usr/share/bash-completion/completions/git-prompt" +if [[ -r "${GP_RC}" ]] ; then + . "${GP_RC}" +fi + +prompt_status() { + local e=$?; + [[ $e != 0 ]] && echo -e "$e "; +} + +if ${use_color} ; then + if type -t __git_ps1 >/dev/null ; then + if [[ "$UID" = 0 ]]; then + PS1='\[\e[31m\]$(prompt_status)\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w\[\033[01;31m\]$(__git_ps1)\[\033[01;35m\] \$ \[\033[00m\]' + else + PS1='\[\e[31m\]$(prompt_status)\[\033[01;32m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w\[\033[01;31m\]$(__git_ps1)\[\033[01;35m\] > \[\033[00m\]' + fi + else + if [[ "$UID" = 0 ]]; then + PS1='\[\e[31m\]$(prompt_status)\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]' + else + PS1='\[\e[31m\]$(prompt_status)\[\033[01;32m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]> \[\033[00m\]' + fi + fi +else + if type -t __git_ps1 >/dev/null ; then + if [[ "$UID" = 0 ]]; then + PS1='$(prompt_status)\u@\h \w$(__git_ps1) \$ ' + else + PS1='$(prompt_status)\u@\h \w$(__git_ps1) > ' + fi else - PS1='$? \[\033[01;32m\]\u@\h\[\033[01;30m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(__git_ps1)\[\033[01;34m\] > \[\033[00m\]' + if [[ "$UID" = 0 ]]; then + PS1='$(prompt_status)\u@\h \w \$ ' + else + PS1='$(prompt_status)\u@\h \w > ' + fi fi fi +unset use_color + # vim: ts=4 expandtab diff --git a/motd.tail b/motd.tail new file mode 100644 index 0000000..88702e2 --- /dev/null +++ b/motd.tail @@ -0,0 +1,6 @@ + ____ _ +| __ ) ___ _ __| |_ __ _ +| _ \ / _ \ '__| __/ _` | +| |_) | __/ | | || (_| | +|____/ \___|_| \__\__,_| + -- 2.39.5