Skip to content

Commit

Permalink
Implemented %u, %i and %% for GNUSTEP_USER_DIR_xxx variables
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@32681 72102866-910b-0410-8b05-ffd578937521
  • Loading branch information
nicola committed Mar 22, 2011
1 parent 10a735b commit a4e3397
Show file tree
Hide file tree
Showing 4 changed files with 311 additions and 4 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2011-03-22 Nicola Pero <[email protected]>

* filesystem.make.in (GNUSTEP_USER_DIR_APPS,
GNUSTEP_USER_DIR_ADMIN_APPS, GNUSTEP_USER_DIR_WEB_APPS,
GNUSTEP_USER_DIR_TOOLS, GNUSTEP_USER_DIR_ADMIN_TOOLS,
GNUSTEP_USER_DIR_LIBRARY, GNUSTEP_USER_DIR_HEADERS,
GNUSTEP_USER_DIR_LIBRARIES, GNUSTEP_USER_DIR_DOC,
GNUSTEP_USER_DIR_DOC_MAN, GNUSTEP_USER_DIR_DOC_INFO): Detect %u,
%i and %% and replace them with the user name, the user id or %.
* filesystem.sh.in: Same.
* filesystem.csh.in: Same.

2011-03-21 Richard Frith-Macdonald <[email protected]>

* gnustep-config.in: allow checking of the CXX variable to see what
Expand Down
101 changes: 101 additions & 0 deletions filesystem.csh.in
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,107 @@ if ( ! ${?GNUSTEP_USER_DIR_DOC_INFO} ) then
setenv GNUSTEP_USER_DIR_DOC_INFO "@GNUSTEP_USER_DIR_DOC_INFO@"
endif

#
# Now, for all the GNUSTEP_USER_DIR_xxx variables above, replace:
#
# %i with the userid
# %u with the username
# %% with %
#
# This allows you to, for example, specify the GNUSTEP_USER_TOOLS
# should be /GNUstep/Users/%u/bin/, and that would mean
# /GNUstep/Users/nicola/bin for user 'nicola' and
# /GNUstep/Users/richard/bin for user 'richard'.
#

# Check if any of the strings contain %i ...
switch ("${GNUSTEP_USER_DIR_APPS}\
${GNUSTEP_USER_DIR_ADMIN_APPS}\
${GNUSTEP_USER_DIR_WEB_APPS}\
${GNUSTEP_USER_DIR_TOOLS}\
${GNUSTEP_USER_DIR_ADMIN_TOOLS}\
${GNUSTEP_USER_DIR_LIBRARY}\
${GNUSTEP_USER_DIR_HEADERS}\
${GNUSTEP_USER_DIR_LIBRARIES}\
${GNUSTEP_USER_DIR_DOC}\
${GNUSTEP_USER_DIR_DOC_MAN}\
${GNUSTEP_USER_DIR_DOC_INFO}")
case *%i*:
# ... and if so, do the replacement.
setenv GNUSTEP__USERID `id -u`
setenv GNUSTEP_USER_DIR_APPS `echo ${GNUSTEP_USER_DIR_APPS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_ADMIN_APPS `echo ${GNUSTEP_USER_DIR_ADMIN_APPS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_WEB_APPS `echo ${GNUSTEP_USER_DIR_WEB_APPS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_TOOLS `echo ${GNUSTEP_USER_DIR_TOOLS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_ADMIN_TOOLS `echo ${GNUSTEP_USER_DIR_ADMIN_TOOLS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_LIBRARY `echo ${GNUSTEP_USER_DIR_LIBRARY} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_HEADERS `echo ${GNUSTEP_USER_DIR_HEADERS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_LIBRARIES `echo ${GNUSTEP_USER_DIR_LIBRARIES} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_DOC `echo ${GNUSTEP_USER_DIR_DOC} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_DOC_MAN `echo ${GNUSTEP_USER_DIR_DOC_MAN} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
setenv GNUSTEP_USER_DIR_DOC_INFO `echo ${GNUSTEP_USER_DIR_DOC_INFO} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
unsetenv GNUSTEP__USERID
breaksw
endsw

# Check if any of the strings contain %u ...
switch ("${GNUSTEP_USER_DIR_APPS}\
${GNUSTEP_USER_DIR_ADMIN_APPS}\
${GNUSTEP_USER_DIR_WEB_APPS}\
${GNUSTEP_USER_DIR_TOOLS}\
${GNUSTEP_USER_DIR_ADMIN_TOOLS}\
${GNUSTEP_USER_DIR_LIBRARY}\
${GNUSTEP_USER_DIR_HEADERS}\
${GNUSTEP_USER_DIR_LIBRARIES}\
${GNUSTEP_USER_DIR_DOC}\
${GNUSTEP_USER_DIR_DOC_MAN}\
${GNUSTEP_USER_DIR_DOC_INFO}")
case *%u*:
# ... and if so, do the replacement.
setenv GNUSTEP__USERNAME `id -u -n`
setenv GNUSTEP_USER_DIR_APPS `echo ${GNUSTEP_USER_DIR_APPS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_ADMIN_APPS `echo ${GNUSTEP_USER_DIR_ADMIN_APPS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_WEB_APPS `echo ${GNUSTEP_USER_DIR_WEB_APPS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_TOOLS `echo ${GNUSTEP_USER_DIR_TOOLS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_ADMIN_TOOLS `echo ${GNUSTEP_USER_DIR_ADMIN_TOOLS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_LIBRARY `echo ${GNUSTEP_USER_DIR_LIBRARY} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_HEADERS `echo ${GNUSTEP_USER_DIR_HEADERS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_LIBRARIES `echo ${GNUSTEP_USER_DIR_LIBRARIES} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_DOC `echo ${GNUSTEP_USER_DIR_DOC} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_DOC_MAN `echo ${GNUSTEP_USER_DIR_DOC_MAN} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
setenv GNUSTEP_USER_DIR_DOC_INFO `echo ${GNUSTEP_USER_DIR_DOC_INFO} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
unsetenv GNUSTEP__USERNAME
breaksw
endsw

# Check if any of the strings contain %% ...
switch ("${GNUSTEP_USER_DIR_APPS}\
${GNUSTEP_USER_DIR_ADMIN_APPS}\
${GNUSTEP_USER_DIR_WEB_APPS}\
${GNUSTEP_USER_DIR_TOOLS}\
${GNUSTEP_USER_DIR_ADMIN_TOOLS}\
${GNUSTEP_USER_DIR_LIBRARY}\
${GNUSTEP_USER_DIR_HEADERS}\
${GNUSTEP_USER_DIR_LIBRARIES}\
${GNUSTEP_USER_DIR_DOC}\
${GNUSTEP_USER_DIR_DOC_MAN}\
${GNUSTEP_USER_DIR_DOC_INFO}")
case *%%*:
# ... and if so, replace %% with %
setenv GNUSTEP_USER_DIR_APPS `echo ${GNUSTEP_USER_DIR_APPS} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_ADMIN_APPS `echo ${GNUSTEP_USER_DIR_ADMIN_APPS} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_WEB_APPS `echo ${GNUSTEP_USER_DIR_WEB_APPS} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_TOOLS `echo ${GNUSTEP_USER_DIR_TOOLS} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_ADMIN_TOOLS `echo ${GNUSTEP_USER_DIR_ADMIN_TOOLS} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_LIBRARY `echo ${GNUSTEP_USER_DIR_LIBRARY} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_HEADERS `echo ${GNUSTEP_USER_DIR_HEADERS} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_LIBRARIES `echo ${GNUSTEP_USER_DIR_LIBRARIES} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_DOC `echo ${GNUSTEP_USER_DIR_DOC} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_DOC_MAN `echo ${GNUSTEP_USER_DIR_DOC_MAN} | sed -e 's/%%/%/g'`
setenv GNUSTEP_USER_DIR_DOC_INFO `echo ${GNUSTEP_USER_DIR_DOC_INFO} | sed -e 's/%%/%/g'`
breaksw
endsw

switch ("${GNUSTEP_USER_DIR_APPS}")
case /*: # An absolute path
setenv GNUSTEP_USER_APPS "${GNUSTEP_USER_DIR_APPS}"
Expand Down
103 changes: 99 additions & 4 deletions filesystem.make.in
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ GNUSTEP_LOCAL_JAVA = $(GNUSTEP_LOCAL_LIBRARY)/Libraries/Java

#
# USER domain
# Please note that here the GNUstep.conf values are called GNUSTEP_USER_DIR_*
# which we convert into the actual GNUSTEP_USER_* after prepending (if needed)
# Please note that here the GNUstep.conf values are called
# GNUSTEP_USER_DIR_* which we convert into the actual GNUSTEP_USER_*
# after replacing %u, %i and %% and prepending (if needed)
# GNUSTEP_HOME.
#
GNUSTEP_USER_DIR_APPS ?= @GNUSTEP_USER_DIR_APPS@
Expand All @@ -149,6 +150,101 @@ GNUSTEP_USER_DIR_DOC ?= @GNUSTEP_USER_DIR_DOC@
GNUSTEP_USER_DIR_DOC_MAN ?= @GNUSTEP_USER_DIR_DOC_MAN@
GNUSTEP_USER_DIR_DOC_INFO ?= @GNUSTEP_USER_DIR_DOC_INFO@

#
# Now, for all the GNUSTEP_USER_DIR_xxx variables above, replace:
#
# %u with the username
# %i with the userid
# %% with %
#
# This allows you to, for example, specify the GNUSTEP_USER_TOOLS
# should be /GNUstep/Users/%u/bin/, and that would mean
# /GNUstep/Users/nicola/bin for user 'nicola' and
# /GNUstep/Users/richard/bin for user 'richard'.
#

# Avoid attempting the replacement of %u and %i if there are no %u or
# %i to replace. Determining the user name and id requires a shell
# commands, which is slow. So, before we do that, try to figure out
# if doing the substitutions is required or not.

# FIXME: Even with this protection, we'd still do the subshell call
# once per sub-make invocation.

# Check if any of the strings contain %i...
ifneq ($(findstring %i,\
$(GNUSTEP_USER_DIR_APPS)\
$(GNUSTEP_USER_DIR_ADMIN_APPS)\
$(GNUSTEP_USER_DIR_WEB_APPS)\
$(GNUSTEP_USER_DIR_TOOLS)\
$(GNUSTEP_USER_DIR_ADMIN_TOOLS)\
$(GNUSTEP_USER_DIR_LIBRARY)\
$(GNUSTEP_USER_DIR_HEADERS)\
$(GNUSTEP_USER_DIR_LIBRARIES)\
$(GNUSTEP_USER_DIR_DOC)\
$(GNUSTEP_USER_DIR_DOC_MAN)\
$(GNUSTEP_USER_DIR_DOC_INFO)),)
# ... and if so, do the replacement.
GNUSTEP__USERID := $(shell id -u)
GNUSTEP_USER_DIR_APPS := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_APPS))
GNUSTEP_USER_DIR_ADMIN_APPS := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_ADMIN_APPS))
GNUSTEP_USER_DIR_WEB_APPS := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_WEB_APPS))
GNUSTEP_USER_DIR_TOOLS := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_TOOLS))
GNUSTEP_USER_DIR_ADMIN_TOOLS := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_ADMIN_TOOLS))
GNUSTEP_USER_DIR_LIBRARY := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_LIBRARY))
GNUSTEP_USER_DIR_HEADERS := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_HEADERS))
GNUSTEP_USER_DIR_LIBRARIES := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_LIBRARIES))
GNUSTEP_USER_DIR_DOC := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_DOC))
GNUSTEP_USER_DIR_DOC_MAN := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_DOC_MAN))
GNUSTEP_USER_DIR_DOC_INFO := $(subst %i,$(GNUSTEP__USERID),$(GNUSTEP_USER_DIR_DOC_INFO))
endif

# Check if any of the strings contain %u ...
ifneq ($(findstring %u,\
$(GNUSTEP_USER_DIR_APPS)\
$(GNUSTEP_USER_DIR_ADMIN_APPS)\
$(GNUSTEP_USER_DIR_WEB_APPS)\
$(GNUSTEP_USER_DIR_TOOLS)\
$(GNUSTEP_USER_DIR_ADMIN_TOOLS)\
$(GNUSTEP_USER_DIR_LIBRARY)\
$(GNUSTEP_USER_DIR_HEADERS)\
$(GNUSTEP_USER_DIR_LIBRARIES)\
$(GNUSTEP_USER_DIR_DOC)\
$(GNUSTEP_USER_DIR_DOC_MAN)\
$(GNUSTEP_USER_DIR_DOC_INFO)),)
# ... and if so, do the replacement.
GNUSTEP__USERNAME := $(shell id -u -n)
GNUSTEP_USER_DIR_APPS := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_APPS))
GNUSTEP_USER_DIR_ADMIN_APPS := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_ADMIN_APPS))
GNUSTEP_USER_DIR_WEB_APPS := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_WEB_APPS))
GNUSTEP_USER_DIR_TOOLS := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_TOOLS))
GNUSTEP_USER_DIR_ADMIN_TOOLS := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_ADMIN_TOOLS))
GNUSTEP_USER_DIR_LIBRARY := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_LIBRARY))
GNUSTEP_USER_DIR_HEADERS := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_HEADERS))
GNUSTEP_USER_DIR_LIBRARIES := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_LIBRARIES))
GNUSTEP_USER_DIR_DOC := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_DOC))
GNUSTEP_USER_DIR_DOC_MAN := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_DOC_MAN))
GNUSTEP_USER_DIR_DOC_INFO := $(subst %u,$(GNUSTEP__USERNAME),$(GNUSTEP_USER_DIR_DOC_INFO))
endif

# Warning (FIXME?): If the username itself contains '%%' (eg, a user
# with name 'nicola%%'), then such occurrences would get replaced with
# '%' by the following.

# Always replace '%%' with '%'.
GNUSTEP_USER_DIR_APPS := $(subst %%,%,$(GNUSTEP_USER_DIR_APPS))
GNUSTEP_USER_DIR_ADMIN_APPS := $(subst %%,%,$(GNUSTEP_USER_DIR_ADMIN_APPS))
GNUSTEP_USER_DIR_WEB_APPS := $(subst %%,%,$(GNUSTEP_USER_DIR_WEB_APPS))
GNUSTEP_USER_DIR_TOOLS := $(subst %%,%,$(GNUSTEP_USER_DIR_TOOLS))
GNUSTEP_USER_DIR_ADMIN_TOOLS := $(subst %%,%,$(GNUSTEP_USER_DIR_ADMIN_TOOLS))
GNUSTEP_USER_DIR_LIBRARY := $(subst %%,%,$(GNUSTEP_USER_DIR_LIBRARY))
GNUSTEP_USER_DIR_HEADERS := $(subst %%,%,$(GNUSTEP_USER_DIR_HEADERS))
GNUSTEP_USER_DIR_LIBRARIES := $(subst %%,%,$(GNUSTEP_USER_DIR_LIBRARIES))
GNUSTEP_USER_DIR_DOC := $(subst %%,%,$(GNUSTEP_USER_DIR_DOC))
GNUSTEP_USER_DIR_DOC_MAN := $(subst %%,%,$(GNUSTEP_USER_DIR_DOC_MAN))
GNUSTEP_USER_DIR_DOC_INFO := $(subst %%,%,$(GNUSTEP_USER_DIR_DOC_INFO))


# Now, any directories in the user domain that are relative (ie, they
# don't start with '/') get automatically prefixed with GNUSTEP_HOME.

Expand All @@ -158,7 +254,7 @@ ifneq ($(filter /%, $(GNUSTEP_USER_DIR_APPS)),)
else
# Path does no start with '/', consider it as relative to GNUSTEP_HOME
GNUSTEP_USER_APPS = $(GNUSTEP_HOME)/$(GNUSTEP_USER_DIR_APPS)
endif
endif

ifneq ($(filter /%, $(GNUSTEP_USER_DIR_ADMIN_APPS)),)
# Path starts with '/', so we can use it as it is
Expand Down Expand Up @@ -224,7 +320,6 @@ else
GNUSTEP_USER_DOC_INFO = $(GNUSTEP_HOME)/$(GNUSTEP_USER_DIR_DOC_INFO)
endif


#
# USER domain, variables that are fixed to subdirs of LIBRARY
#
Expand Down
99 changes: 99 additions & 0 deletions filesystem.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,105 @@ if [ -z "$GNUSTEP_USER_DIR_DOC_INFO" ];
then GNUSTEP_USER_DIR_DOC_INFO="@GNUSTEP_USER_DIR_DOC_INFO@"
fi

#
# Now, for all the GNUSTEP_USER_DIR_xxx variables above, replace:
#
# %i with the userid
# %u with the username
# %% with %
#
# This allows you to, for example, specify the GNUSTEP_USER_TOOLS
# should be /GNUstep/Users/%u/bin/, and that would mean
# /GNUstep/Users/nicola/bin for user 'nicola' and
# /GNUstep/Users/richard/bin for user 'richard'.
#

# Check if any of the strings contain %i ...
case "${GNUSTEP_USER_DIR_APPS}\
${GNUSTEP_USER_DIR_ADMIN_APPS}\
${GNUSTEP_USER_DIR_WEB_APPS}\
${GNUSTEP_USER_DIR_TOOLS}\
${GNUSTEP_USER_DIR_ADMIN_TOOLS}\
${GNUSTEP_USER_DIR_LIBRARY}\
${GNUSTEP_USER_DIR_HEADERS}\
${GNUSTEP_USER_DIR_LIBRARIES}\
${GNUSTEP_USER_DIR_DOC}\
${GNUSTEP_USER_DIR_DOC_MAN}\
${GNUSTEP_USER_DIR_DOC_INFO}" in
*%i*)
# ... and if so, do the replacement.
GNUSTEP__USERID=`id -u`
GNUSTEP_USER_DIR_APPS=`echo ${GNUSTEP_USER_DIR_APPS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_ADMIN_APPS=`echo ${GNUSTEP_USER_DIR_ADMIN_APPS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_WEB_APPS=`echo ${GNUSTEP_USER_DIR_WEB_APPS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_TOOLS=`echo ${GNUSTEP_USER_DIR_TOOLS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_ADMIN_TOOLS=`echo ${GNUSTEP_USER_DIR_ADMIN_TOOLS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_LIBRARY=`echo ${GNUSTEP_USER_DIR_LIBRARY} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_HEADERS=`echo ${GNUSTEP_USER_DIR_HEADERS} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_LIBRARIES=`echo ${GNUSTEP_USER_DIR_LIBRARIES} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_DOC=`echo ${GNUSTEP_USER_DIR_DOC} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_DOC_MAN=`echo ${GNUSTEP_USER_DIR_DOC_MAN} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
GNUSTEP_USER_DIR_DOC_INFO=`echo ${GNUSTEP_USER_DIR_DOC_INFO} | sed -e "s/%i/${GNUSTEP__USERID}/g"`
unset GNUSTEP__USERID;;
esac

# Check if any of the strings contain %u ...
case "${GNUSTEP_USER_DIR_APPS}\
${GNUSTEP_USER_DIR_ADMIN_APPS}\
${GNUSTEP_USER_DIR_WEB_APPS}\
${GNUSTEP_USER_DIR_TOOLS}\
${GNUSTEP_USER_DIR_ADMIN_TOOLS}\
${GNUSTEP_USER_DIR_LIBRARY}\
${GNUSTEP_USER_DIR_HEADERS}\
${GNUSTEP_USER_DIR_LIBRARIES}\
${GNUSTEP_USER_DIR_DOC}\
${GNUSTEP_USER_DIR_DOC_MAN}\
${GNUSTEP_USER_DIR_DOC_INFO}" in
*%u*)
# ... and if so, do the replacement.
GNUSTEP__USERNAME=`id -u -n`
GNUSTEP_USER_DIR_APPS=`echo ${GNUSTEP_USER_DIR_APPS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_ADMIN_APPS=`echo ${GNUSTEP_USER_DIR_ADMIN_APPS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_WEB_APPS=`echo ${GNUSTEP_USER_DIR_WEB_APPS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_TOOLS=`echo ${GNUSTEP_USER_DIR_TOOLS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_ADMIN_TOOLS=`echo ${GNUSTEP_USER_DIR_ADMIN_TOOLS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_LIBRARY=`echo ${GNUSTEP_USER_DIR_LIBRARY} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_HEADERS=`echo ${GNUSTEP_USER_DIR_HEADERS} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_LIBRARIES=`echo ${GNUSTEP_USER_DIR_LIBRARIES} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_DOC=`echo ${GNUSTEP_USER_DIR_DOC} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_DOC_MAN=`echo ${GNUSTEP_USER_DIR_DOC_MAN} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
GNUSTEP_USER_DIR_DOC_INFO=`echo ${GNUSTEP_USER_DIR_DOC_INFO} | sed -e "s/%u/${GNUSTEP__USERNAME}/g"`
unset GNUSTEP__USERNAME;;
esac

# Check if any of the strings contain %% ...
case "${GNUSTEP_USER_DIR_APPS}\
${GNUSTEP_USER_DIR_ADMIN_APPS}\
${GNUSTEP_USER_DIR_WEB_APPS}\
${GNUSTEP_USER_DIR_TOOLS}\
${GNUSTEP_USER_DIR_ADMIN_TOOLS}\
${GNUSTEP_USER_DIR_LIBRARY}\
${GNUSTEP_USER_DIR_HEADERS}\
${GNUSTEP_USER_DIR_LIBRARIES}\
${GNUSTEP_USER_DIR_DOC}\
${GNUSTEP_USER_DIR_DOC_MAN}\
${GNUSTEP_USER_DIR_DOC_INFO}" in
*%%*)
# ... and if so, replace %% with %
GNUSTEP_USER_DIR_APPS=`echo ${GNUSTEP_USER_DIR_APPS} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_ADMIN_APPS=`echo ${GNUSTEP_USER_DIR_ADMIN_APPS} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_WEB_APPS=`echo ${GNUSTEP_USER_DIR_WEB_APPS} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_TOOLS=`echo ${GNUSTEP_USER_DIR_TOOLS} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_ADMIN_TOOLS=`echo ${GNUSTEP_USER_DIR_ADMIN_TOOLS} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_LIBRARY=`echo ${GNUSTEP_USER_DIR_LIBRARY} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_HEADERS=`echo ${GNUSTEP_USER_DIR_HEADERS} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_LIBRARIES=`echo ${GNUSTEP_USER_DIR_LIBRARIES} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_DOC=`echo ${GNUSTEP_USER_DIR_DOC} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_DOC_MAN=`echo ${GNUSTEP_USER_DIR_DOC_MAN} | sed -e 's/%%/%/g'`
GNUSTEP_USER_DIR_DOC_INFO=`echo ${GNUSTEP_USER_DIR_DOC_INFO} | sed -e 's/%%/%/g'`
;;
esac

#
# Now for all directories in the USER domain, check if they are
# relative; if so, consider them as subdirs of GNUSTEP_HOME.
Expand Down

0 comments on commit a4e3397

Please sign in to comment.