]> git.phdru.name Git - dotfiles.git/blob - .profile
0e3ffdd34fb2e413fa64487bb00306e04914b6b7
[dotfiles.git] / .profile
1 #
2 # $HOME/.profile (works with sh, ksh and bash)
3 #
4
5 case "$SHELL" in
6    */*csh) SHELL=/bin/bash
7    ;;
8    # this is for bash.exe
9    *command.com | \
10       *\\bash) SHELL=//c/ubin/bash
11    ;;
12 esac
13
14 if [ -z "$USER" ]; then
15    USER="$LOGNAME"; export USER
16 fi
17
18 ### umask sets a mask for the default file permissions,
19 ### umask 022 is less restrictive, 077 more paranoid
20 umask 077
21
22 PATH="$HOME"/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
23 MANPATH="$HOME"/man:/usr/local/man:/usr/share/man:/usr/man
24 # LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib
25 export PATH MANPATH # LD_LIBRARY_PATH
26
27 LANG=C
28 #LC_ALL=C
29 case "$LC_CTYPE" in
30    *UTF-8) # LC_CTYPE is already set
31    ;;
32
33    *) LC_CTYPE=ru_RU.KOI8-R
34    ;;
35 esac
36 LC_COLLATE="$LC_CTYPE"
37 #LANGUAGE="ru en"
38 export LANG LC_CTYPE LC_COLLATE
39 unset LC_ALL LANGUAGE
40
41 # Default for df/du
42 BLOCKSIZE=1k
43 export BLOCKSIZE
44
45 ### uncomment to select an alternate timezone (/etc/localtime is default)
46 # TZ=/usr/share/zoneinfo/Europe/Moscow; export TZ
47
48 ### NEWS Configuration
49 ORGANIZATION=Home
50 # NNTPSERVER=news
51 export ORGANIZATION # NNTPSERVER
52
53 (set -P 2>/dev/null) && set -P # follow physical paths, not symlinks
54
55 # Interactive only commands
56 if [ -t 0 ] ; then
57    if [ -z "$TERM" ]; then
58       eval `tset -Q -s -m 'network:?xterm'`
59    fi
60
61    stty sane erase ^H
62
63    if [ -n "`which less 2>/dev/null`" ]; then
64       HAS_LESS=true
65    fi
66
67    case "$TERM" in
68       linux)
69          # mutt, python and vim
70          BACKGROUND=DARK
71          export BACKGROUND
72          [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/dark_bg
73       ;;
74
75       *rxvt*|screen*|*term*|vt100)
76          BACKGROUND=LIGHT
77          export BACKGROUND
78          [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg
79       ;;
80    esac
81
82    if [ -x /usr/bin/dircolors ]; then
83        test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
84    fi
85
86    if [ -n "$HAS_LESS" ]; then
87       PAGER=less
88       LESS="Rgimq"
89       case "$LC_CTYPE" in
90          *UTF-8) LESSCHARSET=utf-8
91          ;;
92
93          *) LESSCHARSET=koi8-r
94          ;;
95       esac
96       #LESSCHARDEF=32c.
97       LESSEDIT='vim ?lt+%lt. -- %f'
98       export LESS LESSCHARSET LESSEDIT # LESSCHARDEF
99
100    else
101       PAGER=more
102    fi
103    export PAGER
104
105    EDITOR="$HOME"/.vim/vim.sh
106    VISUAL="$EDITOR"
107    FCEDIT="$EDITOR"
108    export EDITOR VISUAL FCEDIT
109
110    HISTCONTROL=ignoreboth
111    HISTIGNORE='&: *:x:X:[bf]g'
112    HISTFILE="$HOME/.sh_history"
113    HISTFILESIZE=1000
114    HISTSIZE=1000
115    export HISTCONTROL HISTIGNORE HISTFILE HISTFILESIZE HISTSIZE
116
117    # Used by bash/mc for hostname completion
118    HOSTFILE="$HOME"/lib/config/hosts
119    export HOSTFILE
120
121    MAIL="/var/mail/$USER"
122    MAILPATH="$MAIL:$HOME/mail/admin:$HOME/mail/block:$HOME/mail/bulk"
123    if [ -d "$HOME"/mail/lists/ ]; then
124          MAILPATH="$MAILPATH:`echo $HOME/mail/lists/* | sed 's/ /:/g'`"
125    fi
126    export MAIL MAILPATH
127
128    BROWSER="links2:links:elinks:w3m:lynx"
129    case "$TERM" in
130       *rxvt*|screen*|*term*|vt100)
131          BROWSER="l:$BROWSER"
132       ;;
133    esac
134    export BROWSER
135
136    #all_proxy="http://localhost:3128"
137    #ftp_proxy="$all_proxy"
138    #gopher_proxy="$all_proxy"
139    #http_proxy="$all_proxy"
140    #https_proxy="$all_proxy"
141    auto_proxy="file:///home/phd/admin/WWW/Mozilla/mozilla.pac"
142    no_proxy="localhost,127.0.0.1"
143    #export all_proxy ftp_proxy http_proxy https_proxy auto_proxy no_proxy # gopher_proxy
144    export auto_proxy no_proxy
145
146    ENV="$HOME/.shellrc"
147    export ENV
148
149    case "$SHELL" in
150       */bash)
151          shopt -s checkwinsize
152          # display the user, host and current working directory
153          # in the terminal title
154          case "$TERM" in
155             *rxvt*|screen*|*term*|vt100)
156                OPS1="\[\033]0;\u@\h:\w\007\]"
157                case "$TERM" in
158                   screen*)
159                      OPS1=${OPS1}"\[\033k\u@\h:\w\033\\\\\]" # Set screen/tmux caption
160                   ;;
161                esac
162             ;;
163
164             *)
165                OPS1=""
166             ;;
167          esac
168
169          OPS1=${OPS1}"\u@\h \W "
170          . "$ENV"
171          ;;
172       *)
173          OPS1="`/usr/bin/whoami`@`/bin/hostname -s` "
174          ;;
175    esac
176
177    #PROMPT_DIRTRIM=2
178    export OPS1 # PROMPT_DIRTRIM
179
180    ### biff controls new mail notification
181    #biff n
182    ### mesg controls messages (write/talk) from other users
183    mesg n
184    # make mail(1) use a pager
185    crt=; export crt
186
187    PYTHONSTARTUP="$HOME"/lib/python/init.py
188    export PYTHONSTARTUP
189
190    name="Oleg Broytman"
191    email="phd@phdru.name"
192
193    GIT_AUTHOR_NAME="$name"
194    GIT_AUTHOR_EMAIL="$email"
195    GIT_COMMITTER_NAME="$name"
196    GIT_COMMITTER_EMAIL="$email"
197    export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
198
199    HGUSER="$name <$email>"
200    export HGUSER
201
202    unset name email
203
204    if test -f .hushlogin && ! cmp -s .motd /etc/motd; then
205       tee $HOME/.motd < /etc/motd
206    fi
207 fi
208
209 # No need to set DISPLAY - ssh sets DISPLAY and calls xauth
210 #DISPLAY="`who am i | awk '{print substr($6, 2, length($6)-2 )}' | sed -e 's/:.*$//'`:0.0"
211 #export DISPLAY
212
213 if [ -n "$DISPLAY" ]; then
214    # mutt, python and vim
215    BACKGROUND=LIGHT
216    export BACKGROUND
217    [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg
218
219    # BROWSERs
220    BROWSER="firefox:seamonkey:chromium:google-chrome:opera:xlinks2:$BROWSER"
221
222    ### X Window System Configuration
223    #XAPPLRESDIR="$HOME/lib/X11/app-defaults/"; export XAPPLRESDIR
224    ### Old-style XNLSPATH
225    #XNLSPATH=/usr/X11R6/lib/X11/nls; export XNLSPATH
226
227    # For GTK2/GLib to convert filenames between internal and locale encodings
228    G_FILENAME_ENCODING="@locale"
229    export G_FILENAME_ENCODING
230    #G_BROKEN_FILENAMES=1
231    #export G_BROKEN_FILENAMES
232
233    # X Input Method, for Multi key (Compose) to work
234    GTK_IM_MODULE=xim
235    QT_IM_MODULE=xim
236    export GTK_IM_MODULE QT_IM_MODULE
237
238    # GTK2 anti-aliasing
239    GDK_USE_XFT=1
240    export GDK_USE_XFT
241
242    # nVidia OpenGL full scene anti-aliasing
243    #__GL_FSAA_MODE=4
244    #export __GL_FSAA_MODE
245 fi
246
247 [ -n "$HAS_LESS" ] && unset HAS_LESS
248
249 #
250 # read in usepkg function
251 # . "$HOME"/lib/config/usepkg.sh
252 #
253
254 #
255 # usepkg gnu
256 #
257
258 #
259 # If SUN console, start the windows system
260 #
261 # if [ `tty` = /dev/console ] ; then
262 #    if [ "$TERM" = sun -o "$TERM" = AT386 ] ; then
263 #
264 #       if [ ${OPENWINHOME:-""} = "" ] ; then
265 #          OPENWINHOME=/usr/openwin
266 #          export OPENWINHOME
267 #       fi
268 #
269 #       echo ""
270 #       echo "Starting OpenWindows in 5 seconds (type Control-C to interrupt)"
271 #       sleep 5
272 #
273 #       "$OPENWINHOME"/bin/openwin
274 #
275 #       clear      # get rid of annoying cursor rectangle
276 #       #exit      # logout after leaving windows system
277 #
278 #    fi
279 # fi