[13196] | 1 | # Global bashrc file |
---|
| 2 | # |
---|
[22516] | 3 | # $Id: bashrc,v 1.39 2006-07-17 23:14:07 rbasch Exp $ |
---|
[13196] | 4 | |
---|
| 5 | # This file is sourced by default user file ~/.bashrc |
---|
| 6 | |
---|
| 7 | initdir=/usr/athena/lib/init |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | # ******************* ENVIRONMENT SETUP ******************* |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | # Set up standard system/user environment configuration (including setup of |
---|
| 16 | # environment variables, attachment of lockers, and setting of search path) |
---|
| 17 | |
---|
[21129] | 18 | # If we see ENV_SET set to empty, we could be a tcsh user who has |
---|
| 19 | # decided to run bash, or we could be a bash user suffering from the |
---|
| 20 | # misfeature that the standard xsession script runs the tcsh dotfiles |
---|
| 21 | # for all users. Running the environment setup for the former |
---|
| 22 | # category of user would be unfriendly (it resets the homedir and |
---|
| 23 | # path), so for now, only run environment setup for bash users. If |
---|
| 24 | # the xsession problem is ever fixed, change this conditional to check |
---|
| 25 | # for '"${ENV_SET+set}" != set' and eliminate the shell check. |
---|
| 26 | if [ "${ENV_SET:+set}" != set -a "${SHELL##*/}" = bash ]; then |
---|
[13196] | 27 | |
---|
| 28 | export ENV_SET=t # Avoid unnecessary repeat |
---|
[13222] | 29 | export HOSTTYPE="`/bin/athena/machtype`" |
---|
[13196] | 30 | |
---|
| 31 | umask 077 # Strictly protect files |
---|
| 32 | # (does not apply in AFS) |
---|
[21164] | 33 | ulimit -S -c 0 # Don't allow coredumps |
---|
[13196] | 34 | export EDITOR=emacs # Set default editor |
---|
| 35 | export VISUAL=emacs # Set default screen editor |
---|
| 36 | export MM_CHARSET=iso-8859-1 |
---|
| 37 | |
---|
[13222] | 38 | # Set standard Athena path variables (generic path for all users). |
---|
| 39 | # PATH will get set later after .bash_environment is run. |
---|
| 40 | case "$HOSTTYPE" in |
---|
| 41 | sgi) |
---|
[16552] | 42 | athena_path=/usr/athena/bin:/usr/athena/etc: |
---|
[16377] | 43 | athena_path=$athena_path:/bin/athena:/usr/sbin:/usr/bsd:/sbin |
---|
[17157] | 44 | athena_path=$athena_path:/usr/bin:/bin:/usr/bin/X11:/usr/etc |
---|
[13222] | 45 | MANPATH=/usr/athena/man:/usr/freeware/catman:/usr/share/catman |
---|
| 46 | MANPATH=$MANPATH:/usr/share/man:/usr/catman:/usr/man |
---|
| 47 | ;; |
---|
| 48 | sun4) |
---|
[16377] | 49 | athena_path=/srvd/patch:/usr/athena/bin:/usr/athena/etc |
---|
| 50 | athena_path=$athena_path:/bin/athena:/usr/openwin/bin |
---|
[19687] | 51 | athena_path=$athena_path:/usr/openwin/demo:/usr/dt/bin:/usr/bin |
---|
[20679] | 52 | athena_path=$athena_path:/usr/ccs/bin:/usr/sbin:/sbin |
---|
| 53 | athena_path=$athena_path:/usr/sfw/bin:/usr/ucb |
---|
[13222] | 54 | MANPATH=/usr/athena/man:/usr/openwin/man:/usr/dt/man:/usr/man |
---|
[20679] | 55 | MANPATH=$MANPATH:/usr/sfw/man |
---|
[13222] | 56 | ;; |
---|
| 57 | linux) |
---|
[22516] | 58 | athena_path=/usr/athena/bin:/usr/athena/etc |
---|
[16377] | 59 | athena_path=$athena_path:/bin/athena:/usr/bin:/bin |
---|
[17157] | 60 | athena_path=$athena_path:/usr/X11R6/bin:/usr/athena/etc |
---|
| 61 | athena_path=$athena_path:/usr/sbin:/sbin |
---|
[16137] | 62 | MANPATH=/usr/athena/man:/usr/share/man:/usr/X11R6/man |
---|
[13222] | 63 | ;; |
---|
| 64 | *) |
---|
| 65 | echo "Standard dotfiles do not support system type $HOSTTYPE." |
---|
| 66 | esac |
---|
| 67 | export MANPATH |
---|
| 68 | |
---|
[13196] | 69 | # Default "more" behavior |
---|
| 70 | case $HOSTTYPE in |
---|
| 71 | sgi) |
---|
| 72 | MORE=-se |
---|
| 73 | ;; |
---|
| 74 | *) |
---|
| 75 | MORE=-s |
---|
| 76 | ;; |
---|
| 77 | esac |
---|
| 78 | export MORE |
---|
| 79 | |
---|
[13266] | 80 | # Set miscellaneous system-dependent variables. |
---|
| 81 | case $HOSTTYPE in |
---|
| 82 | sgi) |
---|
| 83 | # The following set the default error message format |
---|
| 84 | # to omit the label and severity components, per the |
---|
| 85 | # standard IRIX /etc/profile. |
---|
| 86 | export MSGVERB=text:action |
---|
| 87 | export NOMSGLABEL=1 |
---|
| 88 | export NOMSGSEVERITY=1 |
---|
| 89 | ;; |
---|
| 90 | sun4) |
---|
[13196] | 91 | export OPENWINHOME=/usr/openwin |
---|
[13266] | 92 | ;; |
---|
[19148] | 93 | linux) |
---|
[19163] | 94 | # This is to ensure that native programs use the Athena |
---|
| 95 | # gconf, ORBit, bonobo-activation, etc. libraries |
---|
| 96 | # rather than the native ones. GNOME programs outside |
---|
| 97 | # of /usr/athena/bin may not function properly if it is |
---|
| 98 | # not set. |
---|
[19148] | 99 | export LD_LIBRARY_PATH=/usr/athena/lib |
---|
| 100 | ;; |
---|
[13266] | 101 | esac |
---|
[13196] | 102 | |
---|
| 103 | export ATHENA_SYS=`/bin/athena/machtype -S` |
---|
| 104 | export ATHENA_SYS_COMPAT=`/bin/athena/machtype -C` |
---|
| 105 | |
---|
[13238] | 106 | if [ -z "$ATHENA_SYS" ]; then |
---|
[13196] | 107 | export ATHENA_SYS=@sys |
---|
[13238] | 108 | fi |
---|
[13196] | 109 | |
---|
[13222] | 110 | if [ "${PRINTER+set}" != set -a -e /var/athena/clusterinfo ]; then |
---|
[13196] | 111 | PRINTER=`awk '/LPR/ { print $3 }' /var/athena/clusterinfo` |
---|
| 112 | if [ -n "$PRINTER" ]; then export PRINTER; fi |
---|
| 113 | fi |
---|
| 114 | |
---|
[22023] | 115 | export XDG_DATA_DIRS=/usr/athena/share:/usr/share |
---|
| 116 | |
---|
[13196] | 117 | # Reset the HOME variable to correspond to the actual location |
---|
| 118 | # of the user's home directory. This will avoid having long |
---|
| 119 | # pathnames being printed when /mit/<user> is a symlink to a |
---|
| 120 | # path within AFS. |
---|
[13222] | 121 | |
---|
[22439] | 122 | x=`(cd && /bin/pwd) 2>/dev/null` |
---|
[13196] | 123 | if [ -n "$x" ]; then |
---|
| 124 | export HOME=$x |
---|
[22439] | 125 | if [ "$x" = "`/bin/pwd`" ]; then |
---|
| 126 | cd "$HOME" |
---|
| 127 | fi |
---|
[13196] | 128 | fi |
---|
| 129 | unset x |
---|
| 130 | |
---|
| 131 | # Special version of ADD for the .bash_environment file. |
---|
| 132 | |
---|
| 133 | add () { |
---|
[13475] | 134 | eval "$( /bin/athena/attach -Padd -b -P"$athena_path" "$@" )" |
---|
[13196] | 135 | } |
---|
| 136 | |
---|
| 137 | # Run user environment customizations identified in your |
---|
| 138 | # ~/.bash_environment file. This is the place to include your |
---|
| 139 | # own environment variables, attach commands, and other system |
---|
| 140 | # wide setup commands. You can also cancel default behaviors |
---|
[13242] | 141 | # listed above. |
---|
[13196] | 142 | # ~/.bash_environment is not sourced if NOCALLS is set (i.e., |
---|
| 143 | # if you selected the xlogin "Ignore your customizations" |
---|
| 144 | # option when you logged in). |
---|
| 145 | |
---|
[13222] | 146 | if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then |
---|
[13196] | 147 | . ~/.bash_environment |
---|
| 148 | fi |
---|
| 149 | |
---|
[13564] | 150 | # On IRIX, limits are reset on exec of a setuid program, e.g. |
---|
| 151 | # xterm. So record now what the user wanted coredumpsize to |
---|
| 152 | # be so we can fix it later. |
---|
| 153 | export COREDUMPSIZE_LIMIT=`ulimit -c` |
---|
| 154 | |
---|
[13196] | 155 | # Standard Athena path |
---|
[18771] | 156 | athena_home_bin=$( /usr/athena/bin/athdir "$HOME" ) |
---|
| 157 | PATH=${athena_home_bin:+$athena_home_bin:}$athena_path:. |
---|
| 158 | unset athena_path athena_home_bin |
---|
[13196] | 159 | |
---|
| 160 | # Make sure applications can properly find their appdefs, etc. |
---|
| 161 | |
---|
[13222] | 162 | if [ "${XUSERFILESEARCHPATH+set}" != set ]; then |
---|
[13196] | 163 | XUSERFILESEARCHPATH=/usr/athena/lib/X11/app-defaults/%N |
---|
| 164 | else |
---|
[13222] | 165 | XUSERFILESEARCHPATH=$XUSERFILESEARCHPATH:/usr/athena/lib/X11/app-defaults/%N |
---|
[13238] | 166 | fi |
---|
[13196] | 167 | |
---|
[13238] | 168 | if [ sgi = "$HOSTTYPE" -a "${skip_sgi+set}" != set -a "${NOCALLS+set}" != set ]; then |
---|
[13196] | 169 | XUSERFILESEARCHPATH="$HOME/.desktop-$host/%N:$HOME/.desktop-$host/0.0/%N:$XUSERFILESEARCHPATH" |
---|
| 170 | fi |
---|
| 171 | |
---|
| 172 | export XUSERFILESEARCHPATH |
---|
| 173 | |
---|
| 174 | fi |
---|
| 175 | |
---|
| 176 | |
---|
| 177 | # ******************* BASH SETUP ******************* |
---|
| 178 | |
---|
| 179 | # Set up standard bash shell initializations |
---|
| 180 | |
---|
| 181 | set -o noclobber # Don't overwrite files with redirection |
---|
| 182 | |
---|
[13222] | 183 | if [ "${PS1+set}" = set ]; then |
---|
| 184 | if [ sgi = "$HOSTTYPE" -a -t 0 ]; then |
---|
| 185 | # Have no better way to do this at the moment. |
---|
| 186 | stty sane intr ^C |
---|
| 187 | fi |
---|
[16312] | 188 | case $HOME in |
---|
| 189 | /var/athena/tmphomedir/*) |
---|
[16335] | 190 | PS1="athena (temporary homedir)\$ " |
---|
[16312] | 191 | ;; |
---|
| 192 | *) |
---|
[16335] | 193 | PS1="athena\$ " |
---|
[16312] | 194 | ;; |
---|
| 195 | esac |
---|
[15035] | 196 | CDPATH=.:~ |
---|
[13222] | 197 | fi |
---|
[13196] | 198 | |
---|
[13564] | 199 | # Fix coredumpsize limit in case it was reset |
---|
[21164] | 200 | [ -n "$COREDUMPSIZE_LIMIT" ] && ulimit -S -c $COREDUMPSIZE_LIMIT |
---|
[13564] | 201 | |
---|
[13196] | 202 | # alias for re-establishing authentication |
---|
| 203 | renew () { kinit $USER && fsid -a && zctl load /dev/null ; } |
---|
| 204 | |
---|
| 205 | # alias for a convenient way to change terminal type |
---|
[13276] | 206 | term () { set -f; unset TERMCAP; eval "$( tset -s -I -Q "$@" )"; set +f; } |
---|
[13196] | 207 | |
---|
| 208 | # aliases dealing with x window system |
---|
[13276] | 209 | xresize () { set -f; eval "$( resize -u )"; set +f ; } |
---|
[13196] | 210 | |
---|
[13479] | 211 | if [ "${XSESSION+set}" = set ]; then |
---|
[13196] | 212 | if [ -z "$XSESSION" ]; then |
---|
[13238] | 213 | logout () { end_session && exit; } # logout for X |
---|
[13196] | 214 | else |
---|
[13238] | 215 | logout () { kill -HUP $XSESSION && exit; } # logout for X |
---|
[13196] | 216 | fi |
---|
| 217 | fi |
---|
| 218 | |
---|
| 219 | # aliases dealing with adding locker programs |
---|
| 220 | |
---|
| 221 | add_flags= |
---|
[13276] | 222 | add () { eval "$( /bin/athena/attach -Padd -b $add_flags "$@" )" ; } |
---|
[13196] | 223 | |
---|
[13238] | 224 | alias setup='echo "setup is not supported in bash yet"' |
---|
[13196] | 225 | |
---|
| 226 | |
---|
[13222] | 227 | # All of the bash initializing commands above can be overridden by using |
---|
| 228 | # "unset" or "unalias" commands (or by changing things using "set" or |
---|
[13196] | 229 | # "alias" again) in your ~/.bashrc.mine file, which is sourced here. |
---|
| 230 | # ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations" |
---|
| 231 | # option was selected to begin the session. |
---|
| 232 | |
---|
[13222] | 233 | if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then |
---|
[13196] | 234 | . ~/.bashrc.mine |
---|
| 235 | fi |
---|