A simple alternative to Chef and Puppet to bootstrap *nix machines.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

77 lines
1.9 KiB

  1. # Set file as having been loaded to avoid looping
  2. IS_BASH_PROFILE_LOADED=true
  3. # If bashrc hasn't been loaded, load it
  4. if [ -z "$IS_BASHRC_LOADED" ] ; then
  5. source $HOME/.bashrc
  6. fi
  7. # Some stuff is OS Dependent
  8. DET_OS="unknown"
  9. UNAME_STR=`uname`
  10. if [[ "$UNAME_STR" == "Darwin" ]]; then
  11. DET_OS="mac"
  12. elif [[ "$UNAME_STR" == "Linux" ]]; then
  13. DET_OS="linux"
  14. fi
  15. # Since this is a mac, source the bashrc
  16. if [[ "$DET_OS" == "mac" ]]; then
  17. # Bash Completion
  18. if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
  19. . /opt/local/etc/profile.d/bash_completion.sh
  20. fi
  21. if [ -f /opt/local/share/bash-completion/completions/git-flow ]; then
  22. . /opt/local/share/bash-completion/completions/git-flow
  23. fi
  24. fi
  25. # Set prompt to include some useful information
  26. function ps_git_branch {
  27. ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  28. echo " ("${ref#refs/heads/}")"
  29. }
  30. function ps_atf_target {
  31. org=$(atf-target 2> /dev/null) || return
  32. echo " [$org]"
  33. }
  34. function ps_force_target {
  35. `git config force.use 2> /dev/null` || return
  36. org=$(force-target 2> /dev/null) || return
  37. echo " [$org]"
  38. }
  39. function ps_host_name {
  40. [ -z $TMUX ] || return && echo '\h '
  41. }
  42. function ps_virtual_env {
  43. [ -z "$VIRTUAL_ENV" ] && return
  44. venv=$(basename "$VIRTUAL_ENV") || return
  45. echo " [$venv]"
  46. }
  47. # Alias for colors
  48. RED="\[\033[0;31m\]"
  49. YELLOW="\[\033[0;33m\]"
  50. GREEN="\[\033[0;32m\]"
  51. ENDCOLOR="\[\e[0m\]"
  52. # New prompt format
  53. PS1="$(ps_host_name)\W$YELLOW\$(ps_git_branch)$ENDCOLOR$GREEN\$(ps_atf_target)\$(ps_force_target)\$(ps_virtual_env)$ENDCOLOR\$ "
  54. # Prompt Title
  55. export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"'
  56. # Set cursor colors
  57. export CLICOLOR=1
  58. export LSCOLORS=ExFxCxDxBxegedabagacad
  59. # Vim colors
  60. [ -n "$VIM_COLOR" ] || export VIM_COLOR=$(eval $HOME/bin/get_vim_colorscheme.sh) || export VIM_COLOR='wombat256mod'
  61. export FZF_DEFAULT_COMMAND='ag -g ""'
  62. export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND \$dir"