source: trunk/debathena/debathena/dotfiles/bashrc @ 24770

Revision 24770, 4.0 KB checked in by jdreed, 15 years ago (diff)
In dotfiles: * Ensure the user's locker is attached
Line 
1# Global bashrc file
2#
3# $Id: bashrc,v 1.39 2006-07-17 23:14:07 rbasch Exp $
4
5# This file is sourced by default user file ~/.bashrc
6
7initdir=/usr/lib/init
8
9# *******************   ENVIRONMENT SETUP   *******************
10
11
12
13# Set up standard system/user environment configuration (including setup of
14# environment variables, attachment of lockers, and setting of search path)
15
16# If we see ENV_SET set to empty, we could be a tcsh user who has
17# decided to run bash, or we could be a bash user suffering from the
18# misfeature that the standard xsession script runs the tcsh dotfiles
19# for all users.  Running the environment setup for the former
20# category of user would be unfriendly (it resets the homedir and
21# changes the path), so for now, only run environment setup for bash
22# users.  If the xsession problem is ever fixed, change this
23# conditional to check for '"${ENV_SET+set}" != set' and eliminate the
24# shell check.
25if [ "${ENV_SET:+set}" != set -a "${SHELL##*/}" = bash ]; then
26
27        export ENV_SET=t                        # Avoid unnecessary repeat
28        export HOSTTYPE="`/bin/machtype`"
29
30        # Ensure user's homedir is attached, for legacy things
31        # that care about attachtab
32        /bin/attach $USER
33
34        if [ -r "$HOME/.generation" ]; then
35                export ATHENA_DOTFILE_GENERATION=`cat "$HOME/.generation"`
36        else
37                export ATHENA_DOTFILE_GENERATION=0
38        fi
39
40        ulimit -S -c 0                          # Don't allow coredumps
41        export EDITOR=emacs                     # Set default editor
42        export MM_CHARSET=iso-8859-1
43
44        export EMAIL="$USER@mit.edu"            # Set default email address
45
46        export MORE=-s
47
48        # Set double-sided printing for sufficiently recent users.
49        if [ 1 -le "$ATHENA_DOTFILE_GENERATION" ]; then
50                export LPROPT=-Zduplex
51        fi
52
53        export ATHENA_SYS=`/bin/machtype -S`
54        export ATHENA_SYS_COMPAT=`/bin/machtype -C`
55
56        if [ -z "$ATHENA_SYS" ]; then
57                export ATHENA_SYS=@sys
58        fi
59
60        if [ "${PRINTER+set}" != set \
61          -a -e /var/run/athena-clusterinfo.csh ]; then
62                PRINTER=`awk '/LPR/ { print $3 }' \
63                  /var/run/athena-clusterinfo.csh`
64                if [ -n "$PRINTER" ]; then export PRINTER; fi
65        fi
66
67        # Reset the HOME variable to correspond to the actual location
68        # of the user's home directory.  This will avoid having long
69        # pathnames being printed when /mit/<user> is a symlink to a
70        # path within AFS.
71
72        x=`(cd && /bin/pwd) 2>/dev/null`
73        if [ -n "$x" ]; then
74                export HOME=$x
75                if [ "$x" = "`/bin/pwd`" ]; then
76                        cd "$HOME"
77                fi
78        fi
79        unset x
80
81        # Run user environment customizations identified in your
82        # ~/.bash_environment file.  This is the place to include your
83        # own environment variables, attach commands, and other system
84        # wide setup commands.  You can also cancel default behaviors
85        # listed above.
86        # ~/.bash_environment is not sourced if NOCALLS is set (i.e.,
87        # if you selected the xlogin "Ignore your customizations"
88        # option when you logged in).
89
90        if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then
91                . ~/.bash_environment
92        fi
93
94        # If the user has a bindir in $HOME, put it in front of the path.
95        athena_home_bin=$( /usr/bin/athdir "$HOME" )
96        PATH=${athena_home_bin:+$athena_home_bin:}$PATH
97        unset athena_home_bin
98
99fi
100
101
102# *******************  BASH SETUP   *******************
103
104# Set up standard bash shell initializations
105
106if [ "${XSESSION+set}" = set ]; then
107        logout () { gnome-session-save --kill --silent; exit; } # logout for X
108fi
109
110#   aliases dealing with adding locker programs
111
112setup_tty () {(export SUBJECT="$@"; $SHELL)}
113setup_X () {(export SUBJECT="$@"; xterm -title "$@" &)}
114
115if [ -n "$XSESSION" ]; then
116   alias setup=setup_X
117else
118   alias setup=setup_tty
119fi
120
121remove () { export SUBJECT="$@";
122            source $initdir/env_remove.bash;
123            unset SUBJECT; }
124
125if [ -n "$SUBJECT" -a -r $initdir/env_setup.bash ]; then
126        source $initdir/env_setup.bash
127fi
128
129
130# All of the bash initializing commands above can be overridden by using
131# "unset" or "unalias" commands (or by changing things using "set" or
132# "alias" again) in your ~/.bashrc.mine file, which is sourced here.
133# ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations"
134# option was selected to begin the session.
135
136if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then
137        . ~/.bashrc.mine
138fi
Note: See TracBrowser for help on using the repository browser.