1# This file must be sourced inside (ba)sh using: . 2# 3# GNUstep-reset.sh 4# 5# Shell script resetting the GNUstep environment variables 6# 7# Copyright (C) 2002 Free Software Foundation, Inc. 8# 9# Author: Nicola Pero <n.pero@mi.flashnet.it> 10# 11# This file is part of the GNUstep Makefile Package. 12# 13# This library is free software; you can redistribute it and/or 14# modify it under the terms of the GNU General Public License 15# as published by the Free Software Foundation; either version 3 16# of the License, or (at your option) any later version. 17# 18# You should have received a copy of the GNU General Public 19# License along with this library; see the file COPYING. 20# If not, write to the Free Software Foundation, 21# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22# 23 24# This file is used to reset your environment. This is needed if you 25# want to change LIBRARY_COMBO. You first reset your environment, then 26# set a new LIBRARY_COMBO variable, then source GNUstep.sh again. 27 28# This file resets variables in reverse order as they are set in the 29# GNUstep.sh file. 30 31# This file only makes sense if you are using the standard GNUstep 32# filesystem structure. If you're not, then your System Tools 33# directory could be /usr/bin, but you don't really want to remove 34# that from your PATH. :-) 35 36# This function resets a path. 37# It takes two arguments: the name of the path variable to reset, 38# and a path fragment which is used to make our guess at what should 39# be removed more accurate. All paths beginning with GNUSTEP_SYSTEM_ROOT, 40# GNUSTEP_LOCAL_ROOT, GNUSTEP_NETWORK_ROOT and GNUSTEP_USER_ROOT 41# followed by the specified path fragment are removed from the path 42# variable. All other paths are kept unchanged. 43function reset_path 44{ 45 # Declare local variables 46 local original_path tmp_IFS temp_path dir gnustep_dir found 47 48 # NB: We need to use eval because we want to access a variable 49 # whose name is another variable! 50 original_path=$(eval echo \$$1) 51 tmp_IFS="$IFS" 52 IFS=: 53 temp_path= 54 # Loop on the paths 55 for dir in $original_path; do 56 # For each of them, keep it only if it's not beginning with 57 # a path in GNUSTEP_PATHLIST as prefix 58 found=no; 59 for gnustep_dir in $GNUSTEP_PATHLIST; do 60 if [ -n "$gnustep_dir$2" ]; then 61 case "$dir" in 62 $gnustep_dir$2*) found=yes; break;; 63 *);; 64 esac; 65 fi; 66 done; 67 if [ "$found" = "no" ]; then 68 if [ -z "$temp_path" ]; then 69 temp_path="$dir" 70 else 71 temp_path="$temp_path:$dir" 72 fi; 73 fi 74 done 75 IFS="$tmp_IFS" 76 77 # Not set the path variable. 78 eval "$1=\$temp_path" 79 # Export it only if non empty, otherwise remove it completely from 80 # the shell environment. 81 temp_path=`eval echo \$"$1"` 82 if [ -z "$temp_path" ]; then 83 eval "unset $1" 84 else 85 eval "export $1" 86 fi 87} 88 89reset_path INFOPATH /Library/Documentation/info 90reset_path GUILE_LOAD_PATH /Library/Libraries/Guile 91reset_path CLASSPATH /Library/Libraries/Java 92reset_path LD_LIBRARY_PATH /Library/Libraries 93reset_path DYLD_LIBRARY_PATH /Library/Libraries 94reset_path DYLD_FRAMEWORK_PATH /Library/Frameworks 95reset_path PATH /Tools 96 97# Make sure we destroy the reset_path function after using it - we don't 98# want to pollute the environment with it. 99unset -f reset_path 100 101unset GNUSTEP_SYSTEM_USERS_DIR 102unset GNUSTEP_NETWORK_USERS_DIR 103unset GNUSTEP_LOCAL_USERS_DIR 104 105unset GNUSTEP_SYSTEM_APPS 106unset GNUSTEP_SYSTEM_ADMIN_APPS 107unset GNUSTEP_SYSTEM_WEB_APPS 108unset GNUSTEP_SYSTEM_TOOLS 109unset GNUSTEP_SYSTEM_ADMIN_TOOLS 110unset GNUSTEP_SYSTEM_LIBRARY 111unset GNUSTEP_SYSTEM_HEADERS 112unset GNUSTEP_SYSTEM_LIBRARIES 113unset GNUSTEP_SYSTEM_RESOURCES 114unset GNUSTEP_SYSTEM_JAVA 115unset GNUSTEP_SYSTEM_DOC 116unset GNUSTEP_SYSTEM_DOC_MAN 117unset GNUSTEP_SYSTEM_DOC_INFO 118 119unset GNUSTEP_NETWORK_APPS 120unset GNUSTEP_NETWORK_ADMIN_APPS 121unset GNUSTEP_NETWORK_WEB_APPS 122unset GNUSTEP_NETWORK_TOOLS 123unset GNUSTEP_NETWORK_ADMIN_TOOLS 124unset GNUSTEP_NETWORK_LIBRARY 125unset GNUSTEP_NETWORK_HEADERS 126unset GNUSTEP_NETWORK_LIBRARIES 127unset GNUSTEP_NETWORK_RESOURCES 128unset GNUSTEP_NETWORK_JAVA 129unset GNUSTEP_NETWORK_DOC 130unset GNUSTEP_NETWORK_DOC_MAN 131unset GNUSTEP_NETWORK_DOC_INFO 132 133unset GNUSTEP_LOCAL_APPS 134unset GNUSTEP_LOCAL_ADMIN_APPS 135unset GNUSTEP_LOCAL_WEB_APPS 136unset GNUSTEP_LOCAL_TOOLS 137unset GNUSTEP_LOCAL_ADMIN_TOOLS 138unset GNUSTEP_LOCAL_LIBRARY 139unset GNUSTEP_LOCAL_HEADERS 140unset GNUSTEP_LOCAL_LIBRARIES 141unset GNUSTEP_LOCAL_RESOURCES 142unset GNUSTEP_LOCAL_JAVA 143unset GNUSTEP_LOCAL_DOC 144unset GNUSTEP_LOCAL_DOC_MAN 145unset GNUSTEP_LOCAL_DOC_INFO 146 147unset GNUSTEP_USER_APPS 148unset GNUSTEP_USER_ADMIN_APPS 149unset GNUSTEP_USER_WEB_APPS 150unset GNUSTEP_USER_TOOLS 151unset GNUSTEP_USER_ADMIN_TOOLS 152unset GNUSTEP_USER_LIBRARY 153unset GNUSTEP_USER_HEADERS 154unset GNUSTEP_USER_LIBRARIES 155unset GNUSTEP_USER_RESOURCES 156unset GNUSTEP_USER_JAVA 157unset GNUSTEP_USER_DOC 158unset GNUSTEP_USER_DOC_MAN 159unset GNUSTEP_USER_DOC_INFO 160 161# These should not defined, but might be if something goes wrong 162# somewhere. 163unset GNUSTEP_MAKE_STRICT_V2_MODE 164unset GNUSTEP_USER_DIR_APPS 165unset GNUSTEP_USER_DIR_ADMIN_APPS 166unset GNUSTEP_USER_DIR_WEB_APPS 167unset GNUSTEP_USER_DIR_TOOLS 168unset GNUSTEP_USER_DIR_ADMIN_TOOLS 169unset GNUSTEP_USER_DIR_LIBRARY 170unset GNUSTEP_USER_DIR_HEADERS 171unset GNUSTEP_USER_DIR_LIBRARIES 172unset GNUSTEP_USER_DIR_RESOURCES 173unset GNUSTEP_USER_DIR_JAVA 174unset GNUSTEP_USER_DIR_DOC 175unset GNUSTEP_USER_DIR_DOC_MAN 176unset GNUSTEP_USER_DIR_DOC_INFO 177 178unset GNUSTEP_PATHLIST 179unset GNUSTEP_USER_ROOT 180unset GNUSTEP_HOST_OS 181unset GNUSTEP_HOST_VENDOR 182unset GNUSTEP_HOST_CPU 183unset GNUSTEP_HOST 184unset GNUSTEP_NETWORK_ROOT 185unset GNUSTEP_LOCAL_ROOT 186unset GNUSTEP_MAKEFILES 187unset GNUSTEP_FLATTENED 188unset GNUSTEP_IS_FLATTENED 189unset GNUSTEP_SYSTEM_ROOT 190unset GNUSTEP_ROOT 191unset LIBRARY_COMBO 192 193unset GNUSTEP_CONFIG_FILE 194unset GNUSTEP_USER_CONFIG_FILE 195unset GNUSTEP_USER_DIR 196unset GNUSTEP_USER_DEFAULTS_DIR 197 198