Rewrite startup/unix.sh

Remove extraneous things unrelated to EPICS Base.

Make it behave consistently with the other startup scripts.

Make it easy to configure both for a human and a program.
This commit is contained in:
2018-07-20 17:18:22 -05:00
parent e0399478ad
commit 8f161f9463

View File

@ -1,4 +1,3 @@
#!/bin/sh
#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
# National Laboratory.
@ -8,111 +7,94 @@
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
# Site-specific EPICS environment settings
#
# sites should modify these definitions
# Site-specific EPICS environment settings
#
# Attempts to set EPICS_HOST_ARCH. Optionally, adds the EPICS Base
# install host architecture bin directory to PATH.
#
# Location of epics base
if [ -z "${MY_EPICS_BASE}" ] ; then
MY_EPICS_BASE=/usr/local/epics/base
#-----------------------------------------------------------------------
# Site serviceable parts (These definitions may be modified)
#-----------------------------------------------------------------------
# Automatically set up the environment when possible ("yes" or "no").
# If set to yes, as much of the environment will be set up as possible.
# If set to no, just the minimum environment will be set up. More
# specific _auto_* definitions take precedence over this definition.
_auto=no
# Automatically append to PATH ("yes" or "no"). If set to yes, the
# EPICS Base install host architecture bin directory will be added to
# PATH if possible. If set to no, the bin directory will not be added
# to PATH.
_auto_path_append=$_auto
# The program used to run Perl scripts (pathname).
_perl_prog=perl
# The EPICS host architecture specification for EPICS_HOST_ARCH
# (<os>-<arch>[-<toolset>] as defined in configure/CONFIG_SITE). If
# nonempty, the value will be used as the value of EPICS_HOST_ARCH. If
# empty, an attempt will be made to automatically determine the value
# with EpicsHostArch.pl.
_epics_host_arch=
# The install location of EPICS Base (pathname). If nonempty, the
# EpicsHostArch.pl script from it, if it exists, will be used to
# determine EPICS_HOST_ARCH. If nonempty and EPICS_HOST_ARCH was
# determined successfully, it will be used to add the host architecture
# bin directory to PATH if _auto_path_append is yes.
_epics_base=
# The source location of EPICS Base (pathname). If nonempty, the
# EpicsHostArch.pl script from it, if it exists and _epics_base is empty
# or it did not exist in the _epics_base location, will be used to
# determine EPICS_HOST_ARCH.
_epics_base_src=
#-----------------------------------------------------------------------
# Internal parts (There is typically no need to modify these)
#-----------------------------------------------------------------------
# Define the possible locations of EpicsHostArch.pl
_epics_host_arch_pl=
_src_epics_host_arch_pl=
if [ -n "$_epics_base" ]; then
_epics_host_arch_pl="$_epics_base/lib/perl/EpicsHostArch.pl"
fi
if [ -n "$_epics_base_src" ]; then
_src_epics_host_arch_pl="$_epics_base_src/src/tools/EpicsHostArch.pl"
fi
# Location of epics extensions (medm, msi, etc.)
if [ -z "${EPICS_EXTENSIONS}" ] ; then
EPICS_EXTENSIONS=/usr/local/epics/extensions
# Set the EPICS host architecture specification
if [ -n "$_epics_host_arch" ]; then
EPICS_HOST_ARCH=$_epics_host_arch
export EPICS_HOST_ARCH
elif [ -e "$_epics_host_arch_pl" ]; then
_epics_host_arch=$("$_perl_prog" "$_epics_host_arch_pl")
EPICS_HOST_ARCH=$_epics_host_arch
export EPICS_HOST_ARCH
elif [ -e "$_src_epics_host_arch_pl" ]; then
_epics_host_arch=$("$_perl_prog" "$_src_epics_host_arch_pl")
EPICS_HOST_ARCH=$_epics_host_arch
export EPICS_HOST_ARCH
fi
# Postscript printer definition needed by some extensions (eg medm, dp, dm, ...)
if [ -z "${PSPRINTER}" ] ; then
export PSPRINTER=lp
# Add the EPICS Base host architecture bin directory to PATH
if [ "$_auto_path_append" = yes ]; then
if [ -n "$_epics_base" ] && [ -n "$_epics_host_arch" ]; then
PATH="$PATH:$_epics_base/bin/$_epics_host_arch"
export PATH
fi
fi
#Needed only by the idl and ezcaIDL extensions.
#export EPICS_EXTENSIONS
# Needed only by medm extension
#export EPICS_DISPLAY_PATH=/path/to/adl/files
export BROWSER=firefox
# Needed only by orbitscreen extension
#if [ -z "${ORBITSCREENHOME}" ] ; then
# export "ORBITSCREENHOME=${EPICS_EXTENSIONS/src/orbitscreen}"
#fi
# Needed only by adt extension
#if [ -z "${ADTHOME}" ] ; then
# ADTHOME=
# export ADTHOME
#fi
# Needed only by ar extension (archiver)
#EPICS_AR_PORT=7002
#export EPICS_AR_PORT
# Needed for java extensions
if [ -z "${CLASSPATH}" ] ; then
CLASSPATH="${EPICS_EXTENSIONS}/javalib"
else
CLASSPATH="${CLASSPATH}:${EPICS_EXTENSIONS}/javalib"
fi
export CLASSPATH
# Allow private versions of extensions without a bin subdir
if [ -n "${EPICS_EXTENSIONS_PVT}" ] ; then
PATH="${PATH}:${EPICS_EXTENSIONS_PVT}"
fi
#---------------------------------------------------------------
# Start of set R3.14 environment variables
#
EPICS_HOST_ARCH=`"${MY_EPICS_BASE}"/startup/EpicsHostArch.pl`
export EPICS_HOST_ARCH
# Allow private versions of base
if [ -n "${EPICS_BASE_PVT}" ] ; then
if [ -d "${EPICS_BASE_PVT}/bin/${EPICS_HOST_ARCH}" ]; then
PATH="${PATH}:${EPICS_BASE_PVT}/bin/${EPICS_HOST_ARCH}"
fi
fi
# Allow private versions of extensions
if [ -n "${EPICS_EXTENSIONS_PVT}" ] ; then
if [ -d "${EPICS_EXTENSIONS_PVT}/bin/${EPICS_HOST_ARCH}" ]; then
PATH="${PATH}:${EPICS_EXTENSIONS_PVT}/bin/${EPICS_HOST_ARCH}"
fi
fi
PATH="${PATH}:${EPICS_EXTENSIONS}/bin/${EPICS_HOST_ARCH}"
# End of set R3.14 environment variables
#---------------------------------------------------------------
#
## Start of set pre R3.14 environment variables
#
## Time service:
## EPICS_TS_MIN_WEST the local time difference from GMT.
#EPICS_TS_MIN_WEST=360
#export EPICS_TS_MIN_WEST
#
#HOST_ARCH=`"${MY_EPICS_BASE}"/startup/HostArch`
#export HOST_ARCH
#
## Allow private versions of base
#if [ -n "${EPICS_BASE_PVT}" ] ; then
# if [ -d "${EPICS_BASE_PVT}/bin/${HOST_ARCH}" ]; then
# PATH="${PATH}:${EPICS_BASE_PVT}/bin/${HOST_ARCH}"
# fi
#fi
#
## Allow private versions of extensions
#if [ -n "${EPICS_EXTENSIONS_PVT}" ] ; then
# if [ -d "${EPICS_EXTENSIONS_PVT}/bin/${HOST_ARCH}" ]; then
# PATH="${PATH}:${EPICS_EXTENSIONS_PVT}/bin/${HOST_ARCH}"
# fi
#fi
#
#PATH="${PATH}:${EPICS_EXTENSIONS}/lib/${HOST_ARCH}"
#
# End of set pre R3.14 environment variables
#---------------------------------------------------------------
# Don't leak variables into the environment
unset _auto
unset _auto_path_append
unset _perl_prog
unset _epics_host_arch
unset _epics_base
unset _epics_base_src
unset _epics_host_arch_pl
unset _src_epics_host_arch_pl