1#!/bin/sh 2# 3 4# 5# CDDL HEADER START 6# 7# The contents of this file are subject to the terms of the Common Development 8# and Distribution License Version 1.0 (the "License"). 9# 10# You can obtain a copy of the license at 11# http://www.opensource.org/licenses/CDDL-1.0. See the License for the 12# specific language governing permissions and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each file and 15# include the License file in a prominent location with the name LICENSE.CDDL. 16# If applicable, add the following below this CDDL HEADER, with the fields 17# enclosed by brackets "[]" replaced with your own identifying information: 18# 19# Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved. 20# 21# CDDL HEADER END 22# 23 24# 25# Copyright (c) 2018--2020, Regents of the University of Minnesota. 26# All rights reserved. 27# 28# Contributors: 29# Ryan S. Elliott 30# Yaser Afshar 31# 32 33# 34# Release: This file is part of the kim-api-2.2.1 package. 35# 36 37 38# Ensure that this script is sourced, not executed 39BASENAME_SOURCE=`basename -- "$0" 2> /dev/null` 40 41if test -n "${ZSH_VERSION}"; then 42 if test $options[posixargzero] != "on"; then 43 setopt posixargzero 44 BASENAME_SOURCE=`basename -- "$0" 2> /dev/null` 45 setopt posixargzero 46 fi 47fi 48 49if test x"${BASENAME_SOURCE}" = x"@PROJECT_NAME@-deactivate"; then 50 (>&2 printf "\nError:\t@PROJECT_NAME@-deactivate must be sourced.\n" 51 printf "\tRun 'source @PROJECT_NAME@-deactivate' not " 52 printf "'@PROJECT_NAME@-deactivate'.\n\n") 53 exit 1 54fi 55 56 57if test -n "${ORIGIN}"; then 58 OLD_KIM_ORIGIN="${ORIGIN}" 59fi 60if test -n "${ZSH_VERSION}"; then 61 ORIGIN=$(cd "$(dirname "${(%):-%x}")" && pwd) 62else 63 # Get ORIGIN location of this script: 64 SOURCE="${BASH_SOURCE[0]}" 65 # https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself 66 if command -v readlink >/dev/null 2>&1; then 67 while test -h "$SOURCE"; do # resolve $SOURCE until the file is no longer a symlink 68 DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" 69 SOURCE="$(readlink "$SOURCE")" 70 [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 71 done 72 fi 73 ORIGIN="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" 74fi 75 76export PATH=`printf "${PATH}" | sed -e "s|:${ORIGIN}|:|g" \ 77 -e "s|^${ORIGIN}:*||" \ 78 -e "s|:${ORIGIN}$||"` 79_libdir_rel=$(cd "@_libdir_rel@" && pwd) 80export PKG_CONFIG_PATH=`printf "${PKG_CONFIG_PATH}" | \ 81 sed -e "s|:${_libdir_rel}/pkgconfig|:|g" \ 82 -e "s|^${_libdir_rel}/pkgconfig:*||" \ 83 -e "s|:${_libdir_rel}/pkgconfig$||"` 84unset _libdir_rel 85if test -z "${PKG_CONFIG_PATH}"; then unset PKG_CONFIG_PATH; fi 86 87unset @KIM_API_ENVIRONMENT_CMAKE_PREFIX_DIR@ 88 89if test -n "${ZSH_VERSION}"; then 90 _completion_dir="@_zshcompdir_rel@" 91else 92 _completion_dir="@_bashcompdir_rel@" 93fi 94 95for _func in `grep "_@KIM_API_C_ID_PROJECT_NAME@_.*[[:space:]]*()" \ 96 "${_completion_dir}/@PROJECT_NAME@-collections-management.bash"`; do 97 _func=`printf "${_func}" | sed -e 's|[[:space:]]*().*||'` 98 unset -f "${_func}" 99done 100 101unset _func 102unset _completion_dir 103 104if test -n "${OLD_KIM_ORIGIN}"; then 105 ORIGIN="${OLD_KIM_ORIGIN}" 106 unset OLD_KIM_ORIGIN 107else 108 unset ORIGIN 109fi 110