#!/bin/bash # Copyright 2012 GRNET S.A. All rights reserved. # # Redistribution and use in source and binary forms, with or # without modification, are permitted provided that the following # conditions are met: # # 1. Redistributions of source code must retain the above # copyright notice, this list of conditions and the following # disclaimer. # 2. Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials # provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # The views and conclusions contained in the software and # documentation are those of the authors and should not be # interpreted as representing official policies, either expressed # or implied, of GRNET S.A. # set -e dirname=$(dirname -- "${0}") if cd "${dirname}"; then XSEG_HOME=$(pwd -P) cd - > /dev/null fi if [ -z "$XSEG_HOME" ]; then echo 'Cannot set $XSEG_HOME' exit 1 fi PEERS=${XSEG_HOME}/peers TOOLS=${XSEG_HOME}/tools LIBS=${XSEG_HOME}/lib/user if [ ! -d "${LIBS}" ] || [ ! -d "${PEERS}" ]; then echo "Cannot find basic xseg layout" exit 1 fi if ! echo ${PATH} | grep -E -e '(^|:)'"${PEERS}"'(:|$)' > /dev/null 2>&1; then PATH=${PATH}:${PEERS} fi if ! echo ${PATH} | grep -E -e '(^|:)'"${TOOLS}"'(:|$)' > /dev/null 2>&1; then PATH=${PATH}:${TOOLS} fi if ! echo ${LD_LIBRARY_PATH} | grep -E -e '(^|:)'"${LIBS}"'(:|$)' > /dev/null 2>&1; then LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${LIBS} fi export PATH LD_LIBRARY_PATH XSEG_HOME source ${XSEG_HOME}/config.env export XSEG_DOMAIN_DIRS XSEG_DIRS if [ "$1" = "show" ]; then echo "export XSEG_HOME="${XSEG_HOME} echo "export XSEG_DIRS="${XSEG_DIRS} echo "export XSEG_DOMAIN_DIRS="${XSEG_DOMAIN_DIRS} echo "export PATH="${PATH} echo "export LD_LIBRARY_PATH="${LD_LIBRARY_PATH} else if [ -z "${NONINTERACTIVE}" ]; then [ -z "$SHELL" ] && SHELL=/bin/bash selfname=$(basename -- "${0}") [ "$selfname" = "envsetup" ] && exec "$SHELL" fi fi