#!/bin/bash # .login #+ # NAME: # login # PURPOSE: # Sets up common environment for all user accounts. # CALLING SEQUENCE: # This script is probably best added to the global startup # file /etc/bashrc as: # # . /full_dir/login smei_account smei_dir dat_dir ssw_dir sswdb_dir # # full_dir full directory path to this script # smei_account the user name of the SMEI software account # (default: soft) # smei_dir directory assigned to env var $SMEI # (default: /home/soft/smei) # dat_dir directory assigned to env var $DAT # (default: undefined) # ssw_dir directory assigned to SSW tree # (default: undefined) # sswdb_dir directory assigned to SSWDB data base directory # (default: undefined) # OUTPUTS: # Several other env variables are defined to navigate the SMEI # software tree: $COM, $EXE, $HTM # # Equivalent env variables are set up to navigate a # personal software tree: $FOR, $EXE, $PRO, $COM # # Defines IDL_STARTUP=$SMEI/pro/idl_startup.pro # # If the directory $HOME/soft does not exist, it is assumed # that a new user account is accessed for the first time and # a few initializations occur: # - the directory $HOME/soft is created with in it # the subdirectories $for, etc. # - the file ~/LOGFIL.TXT is initialized # - the startup file $HOME/.bash_profile is modified by # adding $EXE and $COM to the path. # CALLS: # newaccount, alias_bash, update_logfile, intel_setup # mkramdisk # PROCEDURE: # The call to this script should be the only place # where directories need to be hardcoded. # MODIFICATION HISTORY: # FEB-2001, Paul Hick (UCSD/CASS) # AUG-2002, Paul Hick (UCSD/CASS) # Introduced command line arguments to set env variables # instead of hardcoding them for each Linux box separately. # JAN-2003, Paul Hick (UCSD/CASS) # Added env var PYTHONPATH # JUN-2003, Paul Hick (UCSD/CASS) # Added env vars SMEIDB, SMEIDB1, SMEIDB2, SMEIDB3 # FEB-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu) # Added env var for CVS depository # Added experimental setup for running ssh-agent2 # JUN-2006, Zachary Vaughan (UCSD/CASS; vaughan.zachary@gmail.com # Added argument for java home directory # JUN-2006, Java is now set up by sourcing script java_setup. # Java-related aliases have been added to alias_bash. #- # $EXE and $COM should be added to the path. # $EXE contains binary executable # $COM contains scripts called directly # $TUB is temporary directory (different for each user) if [ -z "$SMEI" ]; then # Execute only if $SMEI not defined yet # @CLASSIFY # The master copy of the SMEI software tree export SMEI_MASTER=soft@ips.ucsd.edu:/home/soft/smei # Why is this necessary? if [ -z "$HOSTNAME" ]; then export HOSTNAME="unknown_host" fi # Use arguments to initialize a couple of environment variables. # $SMEI, $DAT, $SSW, $SSWDB export SMEI_ACCOUNT=${1:-soft} export SMEI=${2:-/home/$SMEI_ACCOUNT/smei} export SMEI_UCSD=$SMEI/ucsd export SMEI_FOR=$SMEI_UCSD/gen/for export SMEI_CPP=$SMEI_UCSD/gen/cpp export SMEI_EXE=$SMEI_UCSD/gen/exe/linux export SMEI_LIB=$SMEI_UCSD/gen/lib/linux #Obsolete #export SMEI_SUBNET="smei smeidb" export DAT=${3:-/home/$SMEI_ACCOUNT/dat} export NAGOYA=$DAT/nagoya export SSW=${4:-/zshare/ssw} if [ ! -d $SSW ]; then unset SSW fi export SSWDB=${5:-/zshare/sswdb} if [ ! -d $SSWDB ]; then unset SSWDB fi #SSW_INSTR="eit goes lasco sxt mdi trace xray smei" #SSW_INSTR="eit lasco cds sumer mdi uvcs sxt bcs hxt wbs goes smei trace xray xrp uvsp hxrbs cp grs hxis acrim" export SSW_INSTR="acrim ana andril batse bcs cds chianti cp eis eit ethz festival findstuff goes grs hessi hxis hxrbs hxrs hxt hydro lapalma lasco lparl mdi mees norh norp nrh nso ovsa pdl smei soon spartan spex stereo sumer sxig12 sxig13 sxt trace uvcs uvsp vdem wbs xray xrp ztools" # List of all drives with SMEI individual frames # The SMEI frames are on $SMEIDB and up. Write access should be # limited for these drives. # Skymaps are on $SMEIDC export SMEIDBN=/smeidb export SMEIDCN=/smeidc #export SMEIDB1=$SMEIDBN/db1 #export SMEIDB2=$SMEIDBN/db2 #export SMEIDB3=$SMEIDBN/db3 #export SMEIDB4=$SMEIDBN/db4 #export SMEIDB5=$SMEIDBN/db5 #export SMEIDB6=$SMEIDBN/db6 #export SMEIDB7=$SMEIDBN/db7 #export SMEIDB8=$SMEIDBN/db8 #export SMEIDB9=$SMEIDBN/db9 #export SMEIDC1=$SMEIDCN/dc1 #export SMEIDC2=$SMEIDCN/dc2 #export SMEIDC3=$SMEIDCN/dc3 #export SMEIDC4=$SMEIDCN/dc4 #export SMEIDC5=$SMEIDCN/dc5 #export SMEIDC6=$SMEIDCN/dc6 #export SMEIDC7=$SMEIDCN/dc7 #export SMEIDC8=$SMEIDCN/dc8 #export SMEIDC9=$SMEIDCN/dc9 # List of drives with orbital sky maps #export SMEISKY0=$SMEIDCN/sky0 #export SMEISKY1=$SMEIDCN/sky1 #export SMEISKY2=$SMEIDCN/sky2 #export SMEISKY3=$SMEIDCN/sky3 #export SMEISKY4=$SMEIDCN/sky4 # Location of auxilliary SMEI data (patterns, etc.) # Every member of the subnet should have write access to # $SMEIDB0. export SMEIDB=$SSWDB/smeidb export SMEIDB0=$SMEIDB # @UNCLASSIFY # For accounts other than the 'soft' account, create # user-specific environment variables # Define global environment variables export COM=$SMEI/com/linux export FOR=$SMEI/for export EXE=$SMEI/exe/linux export SYS=$SMEI/sys export HTM=/home/soft/html #export EPHEM=$(find $SMEI -name ephem -type d) export EPHEM=$SMEI/ucsd/gen/idl/ephem #export JPL_EPH=$EPHEM/jpl # Location of Python modules (is added to the intrinsic # path set up by Python itself). export PYTHONPATH=$SMEI/ucsd/gen/python export PERL5LIB=$SMEI/ucsd/gen/perl # Add $COM and $EXE to the path. PATH=.:$PATH:$EXE:$COM:$SMEI_EXE:$PYTHONPATH:$PERL5LIB if [ "$1" == "nobody" ]; then export PATH . $COM/idl_setup else export TUB=$HOME/tub # TEMP is still used in Fortran code (see dirspec.h) if [ -z "$TEMP" ]; then export TEMP=$TUB fi export ZTEMP=$HOME/ztemp if [ "$USER" == "$SMEI_ACCOUNT" ]; then user=$SMEI/user else EXE=$HOME/soft/exe if [ "$HOSTNAME" = "ips.ucsd.edu" ]; then BACKUP=$SMEI/user/$USER fi fi # For some reason /usr/local/bin is not in the path # when a script is running from crontab, and hence IDL # is not accessible. Add the directory to the path here # if it is not present yet. if [ -z "$(echo ":$PATH:" | grep ":/usr/local/bin:")" ]; then PATH=$PATH:/usr/local/bin fi if [ ! -d $HOME/bin ]; then mkdir $HOME/bin fi if [ -z "$(echo ":$PATH:" | grep ":$HOME/bin:")" ]; then PATH=$HOME/bin:$PATH fi if [ ! -d $TUB ]; then mkdir $TUB fi if [ ! -h $ZTEMP ]; then if [ -d /ztemp/$USER ]; then ln -s /ztemp/$USER $ZTEMP fi fi if [ "$USER" == "$SMEI_ACCOUNT" ]; then . $COM/mkramdisk else export EXE safe # Add $EXE to the path. PATH=$PATH:$EXE # The non-existence of $HOME/soft in the user home directory is # used to establish that the account is accessed for the first time if [ ! -d $HOME/soft ]; then mkdir $HOME/soft #mkdir $EXE . $COM/update_logfile . $COM/newaccount echo New account initialized. fi fi export PATH #if [ "$USER" == "skyd" ]; then export HTMD=$ZTEMP/htmd export SKYD=$ZTEMP/skyd #fi # Set up CVS. SSH is used for remote acces. CVSROOT=.cvscode if [ "$HOSTNAME" == "ips.ucsd.edu" ]; then export CVSROOT=$SMEI/$CVSROOT else export CVSROOT=:ext:$SMEI_MASTER/$CVSROOT export CVS_RSH=ssh fi # Create/update the ~/LOGFIL.TXT file # Disabled because mkenv checks for existence before assigning # env vars a valu. Creates problems when NFS mounts are involved that # are not currently on line. #. $COM/update_logfile ARCH=$(uname -m)_$(uname -s) . $COM/gnu_setup . $COM/pgi_setup . $COM/absoft_setup . $COM/java_setup . $COM/idl_setup . $COM/lyx_setup . $COM/matlab_setup # Experimental: display mount point $DAT # This should display NFS mounts. #if [ -n "$DAT" ] #then # mount | grep "$DAT" #fi fi fi . $COM/intel_setup # Set up a bunch of aliases . $COM/alias_bash . $COM/magic_setup export PS1="\h:\w\\$ "