2002-03-18 14:09:37 +00:00
|
|
|
#! /bin/echo This file must be sourced inside (ba)sh using: .
|
|
|
|
#
|
|
|
|
# GNUstep-reset.sh
|
|
|
|
#
|
2002-03-18 17:56:25 +00:00
|
|
|
# Shell script resetting the GNUstep environment variables
|
2002-03-18 14:09:37 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2002 Free Software Foundation, Inc.
|
|
|
|
#
|
|
|
|
# Author: Nicola Pero <n.pero@mi.flashnet.it>
|
|
|
|
#
|
|
|
|
# This file is part of the GNUstep Makefile Package.
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
2007-11-07 18:56:37 +00:00
|
|
|
# as published by the Free Software Foundation; either version 3
|
2002-03-18 14:09:37 +00:00
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public
|
2007-11-07 18:56:37 +00:00
|
|
|
# License along with this library; see the file COPYING.
|
2002-03-18 14:09:37 +00:00
|
|
|
# If not, write to the Free Software Foundation,
|
2005-05-22 03:20:14 +00:00
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-03-18 14:09:37 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# This file is used to reset your environment. This is needed if you
|
|
|
|
# want to change LIBRARY_COMBO. You first reset your environment, then
|
|
|
|
# set a new LIBRARY_COMBO variable, then source GNUstep.sh again.
|
|
|
|
|
|
|
|
# This file resets variables in reverse order as they are set in the
|
|
|
|
# GNUstep.sh file.
|
|
|
|
|
2007-02-14 05:25:59 +00:00
|
|
|
# This file only makes sense if you are using the standard GNUstep
|
|
|
|
# filesystem structure. If you're not, then your System Tools
|
|
|
|
# directory could be /usr/bin, but you don't really want to remove
|
|
|
|
# that from your PATH. :-)
|
|
|
|
|
2002-03-18 14:09:37 +00:00
|
|
|
# This function resets a path.
|
2005-01-14 00:53:37 +00:00
|
|
|
# It takes two arguments: the name of the path variable to reset,
|
|
|
|
# and a path fragment which is used to make our guess at what should
|
|
|
|
# be removed more accurate. All paths beginning with GNUSTEP_SYSTEM_ROOT,
|
|
|
|
# GNUSTEP_LOCAL_ROOT, GNUSTEP_NETWORK_ROOT and GNUSTEP_USER_ROOT
|
|
|
|
# followed by the specified path fragment are removed from the path
|
|
|
|
# variable. All other paths are kept unchanged.
|
2002-03-18 14:09:37 +00:00
|
|
|
function reset_path
|
|
|
|
{
|
|
|
|
# Declare local variables
|
|
|
|
local original_path tmp_IFS temp_path dir gnustep_dir found
|
|
|
|
|
|
|
|
# NB: We need to use eval because we want to access a variable
|
|
|
|
# whose name is another variable!
|
2002-04-04 14:13:24 +00:00
|
|
|
original_path=$(eval echo \$$1)
|
2002-03-18 14:09:37 +00:00
|
|
|
tmp_IFS="$IFS"
|
|
|
|
IFS=:
|
|
|
|
temp_path=
|
|
|
|
# Loop on the paths
|
|
|
|
for dir in $original_path; do
|
|
|
|
# For each of them, keep it only if it's not beginning with
|
2002-06-19 03:46:08 +00:00
|
|
|
# a path in GNUSTEP_PATHLIST as prefix
|
2002-03-18 14:09:37 +00:00
|
|
|
found=no;
|
2002-06-19 03:46:08 +00:00
|
|
|
for gnustep_dir in $GNUSTEP_PATHLIST; do
|
2005-01-14 00:53:37 +00:00
|
|
|
if [ -n "$gnustep_dir$2" ]; then
|
2002-06-26 14:56:57 +00:00
|
|
|
case "$dir" in
|
2005-01-14 00:53:37 +00:00
|
|
|
$gnustep_dir$2*) found=yes; break;;
|
2002-04-04 14:13:24 +00:00
|
|
|
*);;
|
|
|
|
esac;
|
|
|
|
fi;
|
2002-03-18 14:09:37 +00:00
|
|
|
done;
|
|
|
|
if [ "$found" = "no" ]; then
|
|
|
|
if [ -z "$temp_path" ]; then
|
|
|
|
temp_path="$dir"
|
|
|
|
else
|
|
|
|
temp_path="$temp_path:$dir"
|
|
|
|
fi;
|
|
|
|
fi
|
|
|
|
done
|
2002-06-26 14:56:57 +00:00
|
|
|
IFS="$tmp_IFS"
|
2002-03-18 14:09:37 +00:00
|
|
|
|
|
|
|
# Not set the path variable.
|
2002-04-04 14:13:24 +00:00
|
|
|
eval "$1=\$temp_path"
|
2002-03-18 14:09:37 +00:00
|
|
|
# Export it only if non empty, otherwise remove it completely from
|
|
|
|
# the shell environment.
|
|
|
|
temp_path=`eval echo \$"$1"`
|
|
|
|
if [ -z "$temp_path" ]; then
|
|
|
|
eval "unset $1"
|
|
|
|
else
|
|
|
|
eval "export $1"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2007-04-12 15:57:09 +00:00
|
|
|
reset_path INFOPATH /Library/Documentation/info
|
2005-01-14 00:53:37 +00:00
|
|
|
reset_path GUILE_LOAD_PATH /Library/Libraries/Guile
|
2007-01-09 11:25:15 +00:00
|
|
|
reset_path CLASSPATH /Library/Libraries/Java
|
2005-01-14 00:53:37 +00:00
|
|
|
reset_path LD_LIBRARY_PATH /Library/Libraries
|
|
|
|
reset_path DYLD_LIBRARY_PATH /Library/Libraries
|
|
|
|
reset_path DYLD_FRAMEWORK_PATH /Library/Frameworks
|
|
|
|
reset_path PATH /Tools
|
2002-03-18 14:09:37 +00:00
|
|
|
|
|
|
|
# Make sure we destroy the reset_path function after using it - we don't
|
|
|
|
# want to pollute the environment with it.
|
|
|
|
unset -f reset_path
|
|
|
|
|
2007-03-06 13:24:25 +00:00
|
|
|
unset GNUSTEP_SYSTEM_USERS_DIR
|
|
|
|
unset GNUSTEP_NETWORK_USERS_DIR
|
|
|
|
unset GNUSTEP_LOCAL_USERS_DIR
|
|
|
|
|
2007-02-13 14:19:37 +00:00
|
|
|
unset GNUSTEP_SYSTEM_APPS
|
2007-02-16 20:14:44 +00:00
|
|
|
unset GNUSTEP_SYSTEM_ADMIN_APPS
|
2007-03-05 16:49:54 +00:00
|
|
|
unset GNUSTEP_SYSTEM_WEB_APPS
|
2007-02-13 14:19:37 +00:00
|
|
|
unset GNUSTEP_SYSTEM_TOOLS
|
2007-02-16 20:14:44 +00:00
|
|
|
unset GNUSTEP_SYSTEM_ADMIN_TOOLS
|
2007-02-13 14:19:37 +00:00
|
|
|
unset GNUSTEP_SYSTEM_LIBRARY
|
|
|
|
unset GNUSTEP_SYSTEM_HEADERS
|
|
|
|
unset GNUSTEP_SYSTEM_LIBRARIES
|
|
|
|
unset GNUSTEP_SYSTEM_RESOURCES
|
|
|
|
unset GNUSTEP_SYSTEM_JAVA
|
2007-02-26 15:20:05 +00:00
|
|
|
unset GNUSTEP_SYSTEM_DOC
|
|
|
|
unset GNUSTEP_SYSTEM_DOC_MAN
|
|
|
|
unset GNUSTEP_SYSTEM_DOC_INFO
|
2007-02-13 14:19:37 +00:00
|
|
|
|
|
|
|
unset GNUSTEP_NETWORK_APPS
|
2007-02-16 20:14:44 +00:00
|
|
|
unset GNUSTEP_NETWORK_ADMIN_APPS
|
2007-03-05 16:49:54 +00:00
|
|
|
unset GNUSTEP_NETWORK_WEB_APPS
|
2007-02-13 14:19:37 +00:00
|
|
|
unset GNUSTEP_NETWORK_TOOLS
|
2007-02-16 20:14:44 +00:00
|
|
|
unset GNUSTEP_NETWORK_ADMIN_TOOLS
|
2007-02-13 14:19:37 +00:00
|
|
|
unset GNUSTEP_NETWORK_LIBRARY
|
|
|
|
unset GNUSTEP_NETWORK_HEADERS
|
|
|
|
unset GNUSTEP_NETWORK_LIBRARIES
|
|
|
|
unset GNUSTEP_NETWORK_RESOURCES
|
|
|
|
unset GNUSTEP_NETWORK_JAVA
|
2007-02-26 15:20:05 +00:00
|
|
|
unset GNUSTEP_NETWORK_DOC
|
|
|
|
unset GNUSTEP_NETWORK_DOC_MAN
|
|
|
|
unset GNUSTEP_NETWORK_DOC_INFO
|
2007-02-13 14:19:37 +00:00
|
|
|
|
2007-03-05 16:49:54 +00:00
|
|
|
unset GNUSTEP_LOCAL_APPS
|
|
|
|
unset GNUSTEP_LOCAL_ADMIN_APPS
|
|
|
|
unset GNUSTEP_LOCAL_WEB_APPS
|
|
|
|
unset GNUSTEP_LOCAL_TOOLS
|
|
|
|
unset GNUSTEP_LOCAL_ADMIN_TOOLS
|
|
|
|
unset GNUSTEP_LOCAL_LIBRARY
|
|
|
|
unset GNUSTEP_LOCAL_HEADERS
|
|
|
|
unset GNUSTEP_LOCAL_LIBRARIES
|
|
|
|
unset GNUSTEP_LOCAL_RESOURCES
|
|
|
|
unset GNUSTEP_LOCAL_JAVA
|
|
|
|
unset GNUSTEP_LOCAL_DOC
|
|
|
|
unset GNUSTEP_LOCAL_DOC_MAN
|
|
|
|
unset GNUSTEP_LOCAL_DOC_INFO
|
|
|
|
|
2007-02-13 14:19:37 +00:00
|
|
|
unset GNUSTEP_USER_APPS
|
2007-02-16 20:14:44 +00:00
|
|
|
unset GNUSTEP_USER_ADMIN_APPS
|
2007-03-05 16:49:54 +00:00
|
|
|
unset GNUSTEP_USER_WEB_APPS
|
2007-02-13 14:19:37 +00:00
|
|
|
unset GNUSTEP_USER_TOOLS
|
2007-02-16 20:14:44 +00:00
|
|
|
unset GNUSTEP_USER_ADMIN_TOOLS
|
2007-02-13 14:19:37 +00:00
|
|
|
unset GNUSTEP_USER_LIBRARY
|
|
|
|
unset GNUSTEP_USER_HEADERS
|
|
|
|
unset GNUSTEP_USER_LIBRARIES
|
|
|
|
unset GNUSTEP_USER_RESOURCES
|
|
|
|
unset GNUSTEP_USER_JAVA
|
2007-02-26 15:20:05 +00:00
|
|
|
unset GNUSTEP_USER_DOC
|
|
|
|
unset GNUSTEP_USER_DOC_MAN
|
|
|
|
unset GNUSTEP_USER_DOC_INFO
|
2007-02-13 14:19:37 +00:00
|
|
|
|
2007-02-14 21:51:12 +00:00
|
|
|
# These should not defined, but might be if something goes wrong
|
|
|
|
# somewhere.
|
|
|
|
unset GNUSTEP_USER_DIR_APPS
|
2007-02-16 20:14:44 +00:00
|
|
|
unset GNUSTEP_USER_DIR_ADMIN_APPS
|
2007-03-05 16:49:54 +00:00
|
|
|
unset GNUSTEP_USER_DIR_WEB_APPS
|
2007-02-14 21:51:12 +00:00
|
|
|
unset GNUSTEP_USER_DIR_TOOLS
|
2007-02-16 20:14:44 +00:00
|
|
|
unset GNUSTEP_USER_DIR_ADMIN_TOOLS
|
2007-02-14 21:51:12 +00:00
|
|
|
unset GNUSTEP_USER_DIR_LIBRARY
|
|
|
|
unset GNUSTEP_USER_DIR_HEADERS
|
|
|
|
unset GNUSTEP_USER_DIR_LIBRARIES
|
|
|
|
unset GNUSTEP_USER_DIR_RESOURCES
|
|
|
|
unset GNUSTEP_USER_DIR_JAVA
|
2007-02-26 15:20:05 +00:00
|
|
|
unset GNUSTEP_USER_DIR_DOC
|
|
|
|
unset GNUSTEP_USER_DIR_DOC_MAN
|
|
|
|
unset GNUSTEP_USER_DIR_DOC_INFO
|
2007-02-14 21:51:12 +00:00
|
|
|
|
2002-06-19 03:46:08 +00:00
|
|
|
unset GNUSTEP_PATHLIST
|
2002-03-18 14:09:37 +00:00
|
|
|
unset GNUSTEP_USER_ROOT
|
|
|
|
unset GNUSTEP_HOST_OS
|
|
|
|
unset GNUSTEP_HOST_VENDOR
|
|
|
|
unset GNUSTEP_HOST_CPU
|
|
|
|
unset GNUSTEP_HOST
|
|
|
|
unset GNUSTEP_NETWORK_ROOT
|
|
|
|
unset GNUSTEP_LOCAL_ROOT
|
|
|
|
unset GNUSTEP_MAKEFILES
|
|
|
|
unset GNUSTEP_FLATTENED
|
2006-10-02 15:54:56 +00:00
|
|
|
unset GNUSTEP_IS_FLATTENED
|
2002-03-18 14:09:37 +00:00
|
|
|
unset GNUSTEP_SYSTEM_ROOT
|
|
|
|
unset GNUSTEP_ROOT
|
|
|
|
unset LIBRARY_COMBO
|
2005-10-13 02:42:10 +00:00
|
|
|
|
|
|
|
unset GNUSTEP_CONFIG_FILE
|
|
|
|
unset GNUSTEP_USER_CONFIG_FILE
|
|
|
|
unset GNUSTEP_USER_DIR
|
|
|
|
unset GNUSTEP_USER_DEFAULTS_DIR
|
2007-02-13 14:19:37 +00:00
|
|
|
|