]> git.donarmstrong.com Git - home-base.git/blob - .bashrc
update debian host keys and authorized keys default for phone
[home-base.git] / .bashrc
1 # ~/.bashrc: executed by bash(1) for non-login shells.
2 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
3 # for examples
4
5 # If running interactively, then:
6 if [ "$PS1" ]; then
7
8     # don't put duplicate lines in the history. See bash(1) for more options
9     export HISTCONTROL=ignoredups
10     if [ -x ~/bin/sane_editor ]; then
11         EDITOR=~/bin/sane_editor;
12     elif [ -x /usr/bin/jed ]; then
13         EDITOR="/usr/bin/jed";
14     elif [ -x /usr/bin/vi ]; then
15         EDITOR="/usr/bin/vi";
16     fi;
17
18     if [ -n "$EDITOR" ]; then
19         export EDITOR;
20     fi;
21     # bts debian options
22
23     if [ -e bin/faf ]; then
24         complete -F _command faf
25     fi;
26
27     export DEBEMAIL="don@debian.org"
28
29     # enable color support of ls and also add handy aliases
30     eval `dircolors -b`
31     alias ls='ls --color=auto'
32     alias gr='gimp-remote'
33     alias emc='sane_editor'
34
35     alias svn-b="svn-buildpackage --svn-builder 'pdebuild --buildresult ..' --svn-ignore-new"
36
37     # set a fancy prompt
38     #printf '\33]2;%s\007'
39     
40     # See if we're in a chroot
41     if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
42         debian_chroot=$(cat /etc/debian_chroot)
43     fi
44
45     # we want to set the color based on what machine we're on
46     # if it's a remote, SSH_CONNECTION will be set
47     # set variable identifying the chroot you work in (used in the prompt below)
48     
49     if [ -n "$SSH_CONNECTION" -o -n "$SSH_CLIENT" ]; then
50         # figure out what color to use
51         COLOR=$(hostname|md5sum|perl -ne 'if (/^([a-f\d]{8})/) {
52               my $num = unpack(q(L),pack(q(H*),$1));
53               my @col = map {(qq(0;${_}m),qq(1;${_}m))} 31..37;
54               my $col = $col[$num % @col];
55               if ($col eq q(0;36m)) {
56                  $col = q(1;30m);
57               }
58               print $col;
59               }')
60         PS1="${debian_chroot:+($debian_chroot)}\[\033[$COLOR\]\h \[\033[0;36m\]\t \w$\[\033[0m\] "
61         unset COLOR
62     else
63         PS1="${debian_chroot:+($debian_chroot)}\[\033[0;36m\]\h \t \w$\[\033[0m\] "
64     fi;
65     # \[\033[1;36m\][\w]\n\[\033[0;36m\][\h|\t]$ \[\033[0m\]
66
67     # make sure the term we're using exists in the termcap
68     TOEOPT='-a'
69     if ! toe $TOEOPT >/dev/null 2>&1; then
70         TOEOPT=''
71     fi;
72     if ! toe $TOEOPT|grep -q "^$TERM    "; then
73         # if it doesn't, try to switch
74         case $TERM in
75             rxvt*)
76                 TERM="rxvt"
77                 ;;
78             xterm*)
79                 TERM="xterm"
80                 ;;
81             *)
82                 ;;
83         esac
84         export TERM;
85     fi;
86     # If this is an xterm set the title to user@host:dir
87     case $TERM in
88         screen|xterm*)
89             PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
90             ;;
91         rxvt*)
92             PROMPT_COMMAND='echo -ne "\033]2;${USER}@${HOSTNAME}: ${PWD}\007"'
93             ;;
94
95         *)
96             ;;
97     esac
98
99     # enable programmable completion features (you don't need to enable
100     # this, if it's already enabled in /etc/bash.bashrc).
101     if [ -f /etc/bash_completion ]; then
102       . /etc/bash_completion;
103     fi;
104
105     # set up ssh-agent
106     if which ssh-agent >/dev/null && [ -d ~/.ssh ]; then
107 #       for 
108         if [ -e ~/.ssh/ssh_agent_info ] && \
109             [ -n "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" ] && \
110             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" >/dev/null 2>&1; then
111             . ~/.ssh/ssh_agent_info > /dev/null
112         elif [ -e ~/.ssh/ssh_agent_info_$(hostname) ] && \
113             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info_$(hostname))" >/dev/null 2>&1; then
114             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
115         else
116             ssh-agent -s > ~/.ssh/ssh_agent_info_$(hostname)
117             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
118         fi;
119     fi;
120     
121     alias aumix2='aumix -d /dev/mixer1 -I'
122     if locale -a |grep -qi en_US.utf8; then
123         LANG="en_US.UTF-8"
124     else
125         LANG=C
126     fi;
127     export LANG
128     
129     # If we're running on liszt, include /var/list/.bin in the path
130     if [ "$(hostname)" == "liszt" ] && [ -d /var/list/.bin ]; then
131         PATH="/var/list/.bin:$PATH"
132     fi;
133     export PATH="~/bin:$PATH"
134     
135     if [ ! -e ~/tmp ]; then
136         mkdir ~/tmp;
137     fi;
138     export TMPDIR="$(echo ~/tmp)";
139
140     if [ -n "$(which devtodo)" ]; then
141         for a in tda tdd tde; do
142             alias "s${a}"="STODO_NO_COMMIT=1 $a"
143         done;
144
145         TODO_OPTIONS="--timeout --summary"
146
147         cd ()
148         {
149             # use pushd instead of cd
150             if [ -z "$1" ] || [ "$1" == "-" ]; then
151                 builtin cd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS};
152             else
153                 builtin pushd "$@" >/dev/null && [ -r .todo ] && devtodo ${TODO_OPTIONS};
154             fi;
155         }
156
157         pushd ()
158         {
159             builtin pushd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
160         }
161         
162         popd ()
163         {
164             builtin popd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
165         }              
166         
167         # Run todo initially upon login
168         devtodo ${TODO_OPTIONS}
169     fi;
170 fi