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