[Next] [Previous] [Up] [Top] [Contents] [Index]

Appendix C. Fermi Login Files

C.2 Bourne Shell Family

C.2.1 .profile

The default FUE .profile file is found in /usr/local/etc/stdprofile.


# @(#) stdprofile 1.6 Delta: 92/11/05 14:19:26 Extraction 94/07/06 15:16:17 @(#)

#
# .profile default settings for all users
#
# Execute fermi.profile first!
#
if [ -r /usr/local/etc/fermi.profile ]
then
  . /usr/local/etc/fermi.profile
fi
#
# PS1 sets prompt to <machine_name>
# PS2 sets secondary prompt to <more>
#
export PS1;             PS1="<${MACH_ID}> "
export PS2;             PS2="<more> "
#
# HISTSIZE is the number of commands retained in history
#
export HISTSIZE;        HISTSIZE=20       #retain the last 20 commands
#
# EDITOR is used as your default editor, emacs or vi typically
# VISUAL is used as your command line editor, emacs or vi typically
# To use the emacs version, comment out or remove the vi references
# and uncomment the emacs verisons...
#
#export EDITOR;         EDITOR=emacs
#export VISUAL;         VISUAL=emacs
#
export EDITOR;          EDITOR=vi
export VISUAL;          VISUAL=vi
#
# The standard fermi.profile does not attempt to include /usr/5bin
# (in SunOS) in your PATH.  /usr/5bin contains the UNIX System V version
# of several commands.  By including /usr/5bin first, you will get the
# System V version before the BSD version.  Uncomment one of the following
# if you so desire:
#
# PATH=/usr/5bin:$PATH
# PATH=$PATH:/usr/5bin
#
# ENV is the location of your shell alias file
#
export ENV;             ENV=~/.shrc
#
# Uncomment the following to change...
#
#stty kill ^U   # sets line kill to <ctrl>U
#stty erase  # sets erase to backspace
#stty intr ^?   # sets interrupt to delete
#
if [ "`basename $SHELL|sed 's/[0-9]//'`" = "sh" ] && [ -r $HOME/.shrc ]
then
  . $HOME/.shrc
fi

This file calls /usr/local/bin/fermi.profile.

C.2.2 fermi.profile

The default FUE fermi.profile file is found in /usr/local/etc/fermi.profile.


# @(#) fermi.profile 1.33 Delta: 94/10/31 22:14:25 Extraction 94/11/02 16:56:08
@(#)

# fermi.profile settings for all users; called by the user bourne/korn .profile
# Set the umask so that newly created files and directories will be readable
# by others, but writable only by the user.
umask 022
MACH_ID="`/usr/local/bin/funame -n`"
MACH_TYPE="`/usr/local/bin/funame -m`"
MACH_OS="`/usr/local/bin/funame -s`"
#
# Set the PATH appropriately
#
if [ -r /usr/local/etc/setpath.sh ]
then
  . /usr/local/etc/setpath.sh
fi

#
# Set a respectable MANPATH
#
MANPATH=/usr/products/catman:/usr/products/man:/afs/fnal/products/catman:/afs/fn
al/products/man:/usr/catman:/usr/man:/usr/share/catman:/usr/share/man:/usr/local
/catman:/usr/local/man
#
# Following put in to handle NQS
# Only do rest if non-interactive session
#
if [ "$ENVIRONMENT" != "BATCH" ] && [ "x`logname`" != "x" ]
then
#
# Determine the terminal type
#
TTYPE=`echo $TERM | cut -c1`
case $TERM in
""|arpanet|net|network|dialup|unknown|dumb)
        TERM=vt100
        stty erase '^?'
;;
*)
        if [ -r /usr/lib/terminfo/$TTYPE/$TERM -o -r /usr/share/lib/terminfo/$TT
YPE/$TERM ]
        then
                case $TERM in
                iris-ansi*|hp)
                        stty erase '^h'
                ;;
                *)
                        stty erase '^?'
                ;;
                esac
        else
                BTERM=`echo $TERM | cut -c1-3`
                if [ -r /usr/lib/terminfo/$TTYPE/$BTERM -o -r /usr/share/lib/ter
minfo/$TTYPE/$BTERM ]
                then
                        TERM=$BTERM
                        stty erase '^?'
                else
                        case $MACH_OS in
                        IRIX|SunOS|AIX)
                                case $BTERM in
                                vt[2|3])
                                        TERM=vt220
                                        stty erase '^?'
                                ;;
                                *)
                                        TERM=vt100
                                        stty erase '^?'
                                ;;
                                esac
                        ;;
                        ULTRIX)
                                case $BTERM in
                                vt3)
                                        TERM=vt300
                                        stty erase '^?'
                                ;;
                                vt2)
                                        TERM=vt200
                                        stty erase '^?'
                                ;;
                                *)
                                        TERM=vt100
                                        stty erase '^?'
                                ;;
                                esac
                        ;;
                        OSF1)
                                case $BTERM in
                                vt[2|3])
                                        stty erase '^?'
                                ;;
                                *)
                                        TERM=vt100
                                        stty erase '^?'
                                ;;
                                esac
                        ;;
                        HP-UX)
                                case $BTERM in
                                vt3)
                                        TERM=vt320
                                        stty erase '^?'
                                ;;
                                vt2)
                                        TERM=vt200
                                        stty erase '^?'
                                ;;
                                *)
                                        TERM=vt100
                                        stty erase '^?'
                                ;;
                                esac

                        ;;
                        *)
                                TERM=vt100
                                stty erase '^?'
                        ;;
                        esac
                fi
        fi
;;
esac
#
# Set the DISPLAY
#
if [ x"$DISPLAY" = x ]
then
        TTYPORT=`tty`
        if [ "$TTYPORT" = "/dev/console" ]
        then
                DISPLAY="localhost:0"
        elif [ "$REMOTEHOST" = "" ]
        then
                TTYNAME=`echo $TTYPORT | cut -c6-`
                REMOTEHOST=`who|grep "$TTYNAME"|awk '{print $6}'|sed 's/(//'|sed
 's/)//'`
                DISPLAY="${REMOTEHOST}:0"
        else
                DISPLAY="${REMOTEHOST}:0"
        fi
fi
#
# Who are you?
#
if [ "x$LOGNAME" = "x" ]
then
        if [ "x$USER" = "x" ]
        then
        if [ "x$REMOTEUSER" != "x" ]
        then
                LOGNAME="$REMOTEUSER"
        fi
        else
                LOGNAME="$USER"
        fi
fi
#
# The case statement is to set the mail variable
# based on machine type.  Also motd and news are
# dependent on system type. Some systems automatically
# display motd (and thus shouldn't be repeated here.
# Others don't have news.
#
case $MACH_OS in
IRIX)
        TZ=CST6CDT
        if [ "`funame -r | cut -c1`" = "3" ]
        then
                MAIL=/usr/mail/$LOGNAME
                /bin/mail -e
                if [ $? = 0 ]
                then
                        echo 'You have mail.'
                fi
        fi
        if [ -d /usr/news ]
        then
                /usr/bin/news
        fi
;;
SunOS)
        TZ=CST6CDT
        MAIL=/usr/spool/mail/$LOGNAME
;;
AIX)
        TZ=CST6CDT
        /bin/news
        MAIL="/usr/spool/mail/$LOGNAME"
        export MAILMESG;MAILMESG="[YOU HAVE NEW MAIL]"
        if [ -s $MAIL ]
        then
                echo 'You have mail.'
        fi
        EMULATE=none
        export EMULATE
;;
ULTRIX)
        MAIL=/usr/spool/mail/$USER
;;
OSF1)
        /usr/bin/news
        MAIL=/usr/spool/mail/$USER
;;
HP_UX)
        TZ=CST6CDT
        cat -s /etc/motd
        MAIL=/usr/mail/$LOGNAME
        /bin/mail -e
        if [ $? = 0 ]
        then
                echo 'You have mail.'
        fi
        /usr/bin/news
;;
"")
        # Catch for the "funame returns null" bug
        :
;;
*)
        cat -s /etc/motd
        if [ -x /usr/bin/news ]
        then
                /usr/bin/news
        fi
        if [ -x /bin/news ]
        then
                /bin/news
        fi
        if [ -d /usr/spool/mail ]
        then
                MAIL=/usr/spool/mail
        fi
        if [    -d /usr/mail    ]
        then
                MAIL=/usr/mail/$LOGNAME
        fi
        if [ -x /bin/mail ]
        then
                /bin/mail -e
                if [ $? = 0 ]
                then
                        echo 'You have mail.'
                fi
        fi
;;
esac
#
#  Establish PAGER
#
if [ -x /usr/local/bin/less ]
then
        PAGER=/usr/local/bin/less
else
        PAGER=more
fi
#
# Common terminal characteristics
#
stty intr '^c'  # set interrupt key to <ctrl-c>
stty kill '^x'  # set kill key to <ctrl-x>
stty echoe                      # erase ERASEd characters
echo "Terminal Type is $TERM"
if [ -x /usr/local/bin/Info ]
then
        /usr/local/bin/Info -new
fi
# Some systems the user doesn't own his tty device ( Sun OpenWindows) so
# redirect stderr
/bin/chmod 622 `tty` >/dev/null 2>&1
export DISPLAY MAIL TZ TERM PATH PAGER MANPATH

fi      # This is end of if statement for interactive use.
#
# Check for existance of local.profile file. This is the file admins should
# put in any changes, additions, etc. so that they don't need to re-edit this
# file every release.
#
if [ -r /usr/local/etc/local.profile ]
then
  . /usr/local/etc/local.profile
fi

fermi.profile executes /usr/local/etc/setpath.sh to set the path variable.

C.2.3 setpath.sh

The default FUE setpath.sh file is found in /usr/local/etc/setpath.sh.


# @(#) setpath.sh 1.9 Delta: 95/01/18 15:29:38 Extraction 95/03/22 22:13:53 @(#)

if [ "x"$HOME = "x" ]
then
        HOME=/
fi

PATH=""
for DIR in /usr/sbin \
                                         /opt/SUNWspro/bin \
                                         /usr/ccs/bin \
                                         /usr/lang \
                                         /usr/bsd \
                                         /bin \
                                         /usr/bin \
                                         /usr/lbin \
                                         /usr/ucb \
                                         /etc \
                                         /usr/etc \
                                         /usr/afsws/bin \
                                         /usr/openwin/bin \
                                         /usr/bin/X11 \
                                         /usr/kinet/bin \
                                         /usr/local/bin \
                                         /usr/bin/mh \
                                         /usr/sccs
do
        if [ -d ${DIR} ]
        then
                PATH=${PATH}${DIR}:
        fi
done
#
# zsh bug fix
#
PATH=`echo $PATH|/bin/sed 's/\.//g'`
if [ "x"$MACH_OS = "x" ]
then
        MACH_OS=`funame -s`
fi
# do not do this if you are root, because //bin is your $HOME/bin, and
# do not put current directory in root's path
if [ "$HOME" != "/" ]
then
        #
        # Add your HOME/bin and bin."flavor"
        # Put your Sun executables in a bin named bin.SunOS,
        #     your IRIX executables in bin.IRIX,
        #     your AIX     "         " bin.AIX,
        #  ...etc...
        #
        for DIR in ${HOME}/bin.${MACH_OS} $HOME/bin
        do
                if [ -d ${DIR} ]
                then
                        PATH=${DIR}:${PATH}
                fi
        done
        PATH=${PATH}.:
fi

export PATH

C.2.4 .shrc

The default FUE .shrc file is found in /usr/local/etc/stdshrc.


# .shrc default settings for all users

#execute fermi.shrc first
if [ -r /usr/local/etc/fermi.shrc ]
then
        . /usr/local/etc/fermi.shrc
fi

#Place items that you want run even when not interactive shell here

#skip if not interactive shell
if [ "x$USER" = "x" ] || [ "x$PS1" = "x" ]
then
        :
else


        if [ "`basename $SHELL|sed 's/[0-9]//'`" != "sh" ]
        then
          set -o noclobber            #prevent overwrite when redirecting output
          set -o ignoreeof            #prevent accidental logouts

  # Have mail point to fermimail which is a Berkely mail version. Some packages
  # expect mail to be a System V version of mail. If you are having problems
  # of this type, you may need to remove the alias.
        alias mail='fermimail'

  #Define various aliases; user selects desired alias by removng the # sign
  # ONLY IF YOUR SHELL SUPPORTS ALIASING!
          #alias        a='alias'
          #alias        logout='exit'
          #alias        killit='kill -9'        # guarantees that a process is k
illed
          #alias        ll='ls -l'              # generate a long listing
          #alias        la='ls -a'              # see hidden files
          #alias        lf='ls -CF'             # check file TYPE (exe, dir ..)
          #alias        rmi='rm -i'             # confirm before deletion
          #alias        cpi='cp -i'             # no overwrite of output file
          #alias        mvi='mv -i'             # confirm before moving
          #alias        more='less'             # when you explicitly "more" a f
ile

  #Next alias replaces standard info command on SGI platforms
          #alias        info='Info'            #get list of info articles

        #VMS type commands
          #alias        dir='ls -l'
          #alias        copy='cp'
          #alias        rename='mv'

        else
  # Have mail point to fermimail which is a Berkely mail version. Some packages
  # expect mail to be a System V version of mail. If you are having problems
  # of this type, you may need to remove the alias.
          mail ()
          {
            fermimail "$@"
          }
  #Define various functions; user selects desired functions by removng the # sig
n
  #Provided for shells that do not support aliasing.
          #killit ()
          #{
            #  kill -9  # guarantees that a process is killed
          #}
          #ll ()
          #{
            #  ls -l    "$@"     # generate a long listing
          #}
          #la ()
          #{
            #  ls -a    "$@"     # see hidden files
          #}
          #lf ()
          #{
            #  ls -CF "$@"      # display file type, columnwise
          #}
          #rmi ()
          #{
            #  rm -i "$@"       # confirm before delete
          #}
          #cpi ()
          #{
            #  cp -i "$@"       # no overwrite of output file (see also set nocl
obber)
          #}
          #mvi ()
          #{
            #  mv -i "$@"       # confirm before moving
          #}
          #more ()
          #{
            #  less "$@"    # when you explicitly "more" a file
          #}

  #Next function replaces standard info command on SGI platforms
          #info ()
          #{
            #  Info "$@"        # get list of info articles
          #}

  #VMS type commands
          #dir ()
          #{
            #  ls -l "$@"
          #}
          #copy ()
          #{
            #  cp "$@"
          #}
          #rename ()
          #{
            #  mv "$@"
          #}
        fi
fi

The .shrc file calls /usr/local/etc/fermi.shrc.

C.2.5 fermi.shrc

The default FUE fermi.shrc file is found in /usr/local/etc/fermi.shrc.


# @(#) fermi.shrc 1.10 Delta: 94/09/29 22:22:52 Extraction 94/09/29 22:34:43 @(#
)

# fermi.shrc settings for all users; will be called by the default .profile

#
# Setup UPS
#
if [ -r /usr/local/etc/setups.sh ]
then
        . /usr/local/etc/setups.sh
fi

#Do machine dependent functions:
case $MACH_OS in
IRIX)
  fermimail ()
  {
    /usr/sbin/Mail "$@"
  }
;;
SunOS)
  fermimail ()
  {
    /usr/ucb/Mail "$@"
  }
  man ()
  {
        /usr/bin/man -F "$@"
  }
;;
AIX)
  fermimail ()
  {
    /usr/ucb/Mail "$@"
  }
;;
ULTRIX)
  fermimail ()
  {
    /usr/ucb/Mail "$@"
  }
;;
OSF1)
  fermimail ()
  {
    /usr/bin/Mail "$@"
  }
;;
HP-UX)
  fermimail ()
  {
    /usr/bin/mailx "$@"
  }
;;
*)
  if [ -x /usr/ucb/Mail ]
  then
    fermimail ()
    {
      /usr/ucb/Mail "$@"
    }
  elif [ -x /usr/sbin/Mail ]
  then
    fermimail ()
    {
      /usr/sbin/Mail "$@"
    }
  elif [ -x /usr/bsd/Mail ]
  then
    fermimail ()
    {
      /usr/bsd/Mail "$@"
    }
  elif [ -x /usr/bin/mailx ]
  then
    fermimail ()
    {
      /usr/bin/mailx "$@"
    }
  elif [ -x /usr/bin/Mail ]
  then
    fermimail ()
    {
      /usr/bin/Mail "$@"
    }
  fi
;;
esac
#
# Check for existance of local.shsrc file. This is the file admins should
# put in any changes, additions, etc. so that they don't need to re-edit this
# file every release.
#
if [ -r /usr/local/etc/local.shrc ]
then
  . /usr/local/etc/local.shrc
fi

fermi.shrc executes /usr/local/etc/setups.sh.

C.2.6 setups.sh

The default FUE setups.sh file is found in /usr/local/etc/setups.sh.


# @(#) setups.sh 2.2 Delta: 95/01/09 15:48:34 Extraction 95/03/22 22:13:54 @(#)

#Set environment for UPS
if [ ! -r $HOME/.noupsproducts ] #start if .noupsproducts
then
        MACH_OS=`funame -s`
        fchar=`echo ${PRODUCTS:-}|cut -c1`
        if [ "x$fchar" != "x/" ] #start check if $PRODUCTS already set
        then
                prodset=no
                unset PRODUCTS
                # Add any other directories that are UPS databases in the
                # for list
                for PROD in $UPS_EXTRA_DIR \
                    /`funame -n`/products/ups_database/declared \
                         `logdir products`/ups_database/declared \
                         /usr/products/ups_database/declared \
                         /afs/fnal/products/ups_database/declared
                do
                        if [ -d $PROD ]
                        then
                                if [ "$prodset" = "no" ]
                                then
                                        PRODUCTS=$PROD
                                else
                                        exists=`echo $PRODUCTS | grep -c $PROD`
                                        if [ $exists = "0" ]
                                        then
                                                PRODUCTS="$PRODUCTS $PROD"
                                        fi
                                fi
                                prodset=yes
                        fi
                done
                export PRODUCTS
        else
                prodset=yes
        fi #end check if $PRODUCTS already set
        if [ "$prodset" = "yes" ] #start if $PRODUCTS is set
        then
                fchar=`echo ${UPS_DIR:-}|cut -c1`
                if [ "x$fchar" != "x/" ] #start if $UPS_DIR already set
                then
                        setups=no
                        full=${MACH_OS}+`funame -r`
                        for PROD in $PRODUCTS
                        do
                        if [ -f $PROD/ups ]
                        then
                                if [ `grep -c "current.$MACH_OS" $PROD/ups` -eq
0 ]
                                then
                                        continue
                                fi
                                flavor=x
                                for i in `grep "current.$MACH_OS" $PROD/ups|awk
'{print $2}'|sort -r`
                                do
                                        case "$full" in
                                        $i* )   flavor=$i
                                                break;;
                                        *) ;;
                                        esac
                                done
                                if [ $flavor = x ]
                                then
                                        continue
                                fi
#character after ${flavor} and before quote is tab (next two lines)
                                CURRENT=`grep "current.${flavor}        " $PROD/
ups|awk '{print $3}'`
                                UPS_DIR=`grep "^Instance:.*${flavor}    " ${PROD
}/ups |grep \"${CURRENT}\"|awk '{print $4}'`
                        fi
                        fchar=`echo ${UPS_DIR:-}|cut -c1`
                        if [ "x$fchar" = "x/" ]
                        then
                                setups=yes
                                break
                        fi
                        done
                        if [ "$setups" = "yes" ]
                        then
                                export UPS_DIR
                                if [ -f $UPS_DIR/ups/ups_init.sh ]
                                then
                                        . $UPS_DIR/ups/ups_init.sh
                                        setup ups
                                fi
                        fi
                else
                        setups=yes
                fi #end if $UPS_DIR already set
#Even though UPS_DIR may have already been setup, aliases aren't always
# passed along, thus we need to always do the source of ups_init and
# the setup.sh file. We can't simply do a setup of ups, because then you
# get the current version of ups instead of the version of UPS when you
# entered this process. The setup of ups relies on UPS_PROD_VERSION being
# set (although not in a serious way). This process assumes the version is
# the last component of the $UPS_DIR directory. This isn't guaranteed to be
# correct, but will work ok for this situation.
                if [ "$setups" = "yes" ]
                then
                        if [ -f $UPS_DIR/ups/ups_init.sh ]
                        then
                                . $UPS_DIR/ups/ups_init.sh
                                UPS_PROD_VERSION=`basename $UPS_DIR`
                                if [ -f $UPS_DIR/ups/setup.sh ]
                                then
                                        . $UPS_DIR/ups/setup.sh
                                fi
                                unset UPS_PROD_VERSION
                        else
                                echo "\$UPS_DIR set, but \$UPS_DIR/ups/ups_init.
sh doesn't exist. No ups environment setup."
                        fi
                else
                        echo "Unable to set \$UPS_DIR, ups environment not setup
"
                fi
        else
                        echo "Unable to set \$PRODUCTS, ups environment not setup"
        fi #end if $PRODUCTS is set
fi #end if .noupsproducts


UNIX at Fermilab - 10 Apr 1998

[Next] [Previous] [Up] [Top] [Contents] [Index]