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