Skip to content
Snippets Groups Projects
Commit 7591cab6 authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

%[ER: 253]%

Added check for valid $a_root. Fixed bug when cd is an alias.
parent 9ac45319
No related branches found
No related tags found
No related merge requests found
...@@ -28,34 +28,41 @@ ...@@ -28,34 +28,41 @@
# The actual value is filled in by make install (see Makefile.am). # The actual value is filled in by make install (see Makefile.am).
set a_root = . #filled in by install set a_root = . #filled in by install
# First strip the current LOFARROOT from PATH and LD_LIBRARY_PATH # Only modify path variables if $a_root is an existing directory.
# Take care that a possible . is preceeded by a backslash. if (! (-d $a_root) ) then
if ($?LOFARROOT) then echo "LOFAR root directory $a_root does not exist"
else
# First strip the current LOFARROOT from PATH and LD_LIBRARY_PATH
# Take care that a possible . is preceeded by a backslash.
if ($?LOFARROOT) then
set a_path = `echo $LOFARROOT | sed -e 's/\./\\\./g'`
set a_bin = "$a_path/bin"
setenv PATH `echo $PATH | sed -e "s%:${a_bin}:%:%g" -e "s%^${a_bin}:%%" -e "s%:${a_bin}"'$%%' -e "s%^${a_bin}"'$%%'`
set a_lib = "$a_path/lib"
setenv LD_LIBRARY_PATH `echo $LD_LIBRARY_PATH | sed -e "s%:${a_lib}:%:%g" -e "s%^${a_lib}:%%" -e "s%:${a_lib}"'$%%' -e "s%^${a_lib}"'$%%'`
endif
# Now define the new LOFARROOT
setenv LOFARROOT `cd >/dev/null $a_root; pwd` # make path absolute
# Also strip this path from the current paths (in case it is contained in
# it).
set a_path = `echo $LOFARROOT | sed -e 's/\./\\\./g'` set a_path = `echo $LOFARROOT | sed -e 's/\./\\\./g'`
set a_bin = "$a_path/bin" set a_bin = "$a_path/bin"
setenv PATH `echo $PATH | sed -e "s%:${a_bin}:%:%g" -e "s%^${a_bin}:%%" -e "s%:${a_bin}"'$%%' -e "s%^${a_bin}"'$%%'` setenv PATH `echo $PATH | sed -e "s%:${a_bin}:%:%g" -e "s%^${a_bin}:%%" -e "s%:${a_bin}"'$%%' -e "s%^${a_bin}"'$%%'`
set a_lib = "$a_path/lib" set a_lib = "$a_path/lib"
setenv LD_LIBRARY_PATH `echo $LD_LIBRARY_PATH | sed -e "s%:${a_lib}:%:%g" -e "s%^${a_lib}:%%" -e "s%:${a_lib}"'$%%' -e "s%^${a_lib}"'$%%'` setenv LD_LIBRARY_PATH `echo $LD_LIBRARY_PATH | sed -e "s%:${a_lib}:%:%g" -e "s%^${a_lib}:%%" -e "s%:${a_lib}"'$%%' -e "s%^${a_lib}"'$%%'`
endif
# Add the path to the standard paths.
# Now define the new LOFARROOT if (! $?PATH) then
setenv LOFARROOT `cd $a_root; pwd` # make path absolute setenv PATH $LOFARROOT/bin
else
setenv PATH $LOFARROOT/bin:$PATH
endif
if (! $?LD_LIBRARY_PATH) then
setenv LD_LIBRARY_PATH $LOFARROOT/lib
else
setenv LD_LIBRARY_PATH $LOFARROOT/lib:$LD_LIBRARY_PATH
endif
# Also strip this path from the current paths (in case it is contained in it).
set a_path = `echo $LOFARROOT | sed -e 's/\./\\\./g'`
set a_bin = "$a_path/bin"
setenv PATH `echo $PATH | sed -e "s%:${a_bin}:%:%g" -e "s%^${a_bin}:%%" -e "s%:${a_bin}"'$%%' -e "s%^${a_bin}"'$%%'`
set a_lib = "$a_path/lib"
setenv LD_LIBRARY_PATH `echo $LD_LIBRARY_PATH | sed -e "s%:${a_lib}:%:%g" -e "s%^${a_lib}:%%" -e "s%:${a_lib}"'$%%' -e "s%^${a_lib}"'$%%'`
# Add the path to the standard paths.
if (! $?PATH) then
setenv PATH $LOFARROOT/bin
else
setenv PATH $LOFARROOT/bin:$PATH
endif
if (! $?LD_LIBRARY_PATH) then
setenv LD_LIBRARY_PATH $LOFARROOT/lib
else
setenv LD_LIBRARY_PATH $LOFARROOT/lib:$LD_LIBRARY_PATH
endif endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment