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