Permalink
Browse files

Root now get's my bash config.

  • Loading branch information...
1 parent d043eaf commit cf3d7fbc2bcf87dfe473aac3e2ad795afd958cf7 @uberj committed Apr 5, 2012
@@ -4,16 +4,3 @@
}
File <| tag == "bash" |>
}
-
-define bash::user_config ($home="/home/${title}") {
-
- @file {
- "${title}-bashrc":
- path => "${home}/.bashrc",
- content => template("bash/bashrc.erb"),
- ensure => present,
- tag => "bash",
- owner => "${title}",
- group => "users",
- }
-}
@@ -0,0 +1,15 @@
+define bash::user_config (
+ $home="/home/${title}",
+ $template="bash/bashrc.erb"
+) {
+
+ @file {
+ "${title}-bashrc":
+ path => "${home}/.bashrc",
+ content => template("${template}"),
+ ensure => present,
+ tag => "bash",
+ owner => "${title}",
+ group => "users",
+ }
+}
@@ -8,7 +8,7 @@
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
-PS1_art="(> ^ ^)>"
+PS1_art=""
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
@@ -28,7 +28,7 @@ shopt -s checkwinsize
# Enable history appending instead of overwriting. #139609
shopt -s histappend
-# Change the window title of X terminals
+# Change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
@@ -81,44 +81,3 @@ else
PS1='\u@\h \w ${PS1_art}'
fi
fi
-extract () {
- if [ -f $1 ] ; then
- case $1 in
- *.tar.bz2) tar xvjf $1 ;;
- *.tar.gz) tar xvzf $1 ;;
- *.bz2) bunzip2 $1 ;;
- *.rar) unrar x $1 ;;
- *.gz) gunzip $1 ;;
- *.tar) tar xvf $1 ;;
- *.tbz2) tar xvjf $1 ;;
- *.tgz) tar xvzf $1 ;;
- *.zip) unzip $1 ;;
- *.Z) uncompress $1 ;;
- *.7z) 7z x $1 ;;
- *) echo "'$1' cannot be extracted via >extract<" ;;
- esac
- else
- echo "'$1' is not a valid file"
- fi
-}
-
-# dircolors
-EDITOR=vim
-PATH=$PATH:/sbin/
-
-# git settings
-GIT_COMMITER_NAME="uberj"
-GIT_COMMITER_EMAIL="uberj@onid.orst.edu"
-GIT_AUTHOR_NAME="Jacques Uber"
-GIT_AUTHOR_EMAIL="uberj@onid.orst.edu"
-
-# Try to keep environment pollution down, EPA loves us.
-unset use_color safe_term match_lhs
-alias d='ls -l | grep -E ^d'
-alias f='ls -l | grep -E ^[^d]'
-alias ll='ls -lah'
-alias sl='ls'
-alias term1="rdesktop -T'nws-term1.nws.oregonstate.edu - Terminal Server Client' -rsound:local -rclipboard:PRIMARYCLIPBOARD -b -4 nws-term1.nws.oregonstate.edu -uuberj -donid"
-alias dud="$HOME/.file_usage"
-alias pyclean="rm *.pyc"
-alias assh="ssh -A"
@@ -19,7 +19,14 @@
}
#os::user_config { "$ { username}": }
- bash::user_config { "${username}": }
+ bash::user_config { "${username}":
+ template => "users/uberj/bashrc.erb",
+ }
+ # Give root my config
+ bash::user_config { "root":
+ home=>"/root/",
+ template => "users/uberj/bashrc.erb",
+ }
xmonad::user_config { "${username}":
xmonad_template => "users/uberj/xmonad.erb",
xmobar_template => "users/uberj/xmobar.erb",
@@ -0,0 +1,124 @@
+# /etc/bash/bashrc
+#
+#
+#
+#
+#
+# Source global definitions
+if [ -f /etc/bashrc ]; then
+ . /etc/bashrc
+fi
+PS1_art="(> ^ ^)>"
+
+# Test for an interactive shell. There is no need to set anything
+# past this point for scp and rcp, and it's important to refrain from
+# outputting anything in those cases.
+
+if [[ $- != *i* ]] ; then
+ # Shell is non-interactive. Be done now!
+ return
+fi
+
+# Bash won't get SIGWINCH if another process is in the foreground.
+# Enable checkwinsize so that bash will check the terminal size when
+# it regains control. #65623
+# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
+shopt -s checkwinsize
+
+# Enable history appending instead of overwriting. #139609
+shopt -s histappend
+
+# Change the window title of X terminals
+case ${TERM} in
+ xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)
+ PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
+ ;;
+ screen)
+ PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
+ ;;
+esac
+
+use_color=false
+
+# Set colorful PS1 only on colorful terminals.
+# dircolors --print-database uses its own built-in database
+# instead of using /etc/DIR_COLORS. Try to use the external file
+# first to take advantage of user additions. Use internal bash
+# globbing instead of external grep binary.
+safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
+match_lhs=""
+[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
+[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
+[[ -z ${match_lhs} ]] \
+ && type -P dircolors >/dev/null \
+ && match_lhs=$(dircolors --print-database)
+[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
+
+if ${use_color} ; then
+ # Enable colors for ls, etc. Prefer ~/.dir_colors #64489
+ if type -P dircolors >/dev/null ; then
+ if [[ -f ~/.dir_colors ]] ; then
+ eval $(dircolors -b ~/.dir_colors)
+ elif [[ -f /etc/DIR_COLORS ]] ; then
+ eval $(dircolors -b /etc/DIR_COLORS)
+ fi
+ fi
+
+ if [[ ${EUID} == 0 ]] ; then
+ PS1="\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] "
+ else
+ PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w ${PS1_art}\[\033[00m\] "
+
+ fi
+
+ alias ls='ls --color=auto'
+ alias grep='grep --colour=auto'
+else
+ if [[ ${EUID} == 0 ]] ; then
+ # show root@ when we don't have colors
+ PS1='\u@\h \W \& '
+ else
+ PS1='\u@\h \w ${PS1_art}'
+ fi
+fi
+extract () {
+ if [ -f $1 ] ; then
+ case $1 in
+ *.tar.bz2) tar xvjf $1 ;;
+ *.tar.gz) tar xvzf $1 ;;
+ *.bz2) bunzip2 $1 ;;
+ *.rar) unrar x $1 ;;
+ *.gz) gunzip $1 ;;
+ *.tar) tar xvf $1 ;;
+ *.tbz2) tar xvjf $1 ;;
+ *.tgz) tar xvzf $1 ;;
+ *.zip) unzip $1 ;;
+ *.Z) uncompress $1 ;;
+ *.7z) 7z x $1 ;;
+ *) echo "'$1' cannot be extracted via >extract<" ;;
+ esac
+ else
+ echo "'$1' is not a valid file"
+ fi
+}
+
+# dircolors
+EDITOR=vim
+PATH=$PATH:/sbin/
+
+# git settings
+GIT_COMMITER_NAME="uberj"
+GIT_COMMITER_EMAIL="uberj@onid.orst.edu"
+GIT_AUTHOR_NAME="Jacques Uber"
+GIT_AUTHOR_EMAIL="uberj@onid.orst.edu"
+
+# Try to keep environment pollution down, EPA loves us.
+unset use_color safe_term match_lhs
+alias d='ls -l | grep -E ^d'
+alias f='ls -l | grep -E ^[^d]'
+alias ll='ls -lah'
+alias sl='ls'
+alias term1="rdesktop -T'nws-term1.nws.oregonstate.edu - Terminal Server Client' -rsound:local -rclipboard:PRIMARYCLIPBOARD -b -4 nws-term1.nws.oregonstate.edu -uuberj -donid"
+alias dud="$HOME/.file_usage"
+alias pyclean="rm *.pyc"
+alias assh="ssh -A"

0 comments on commit cf3d7fb

Please sign in to comment.