--- Scripts/bin/SymlinkProgram	2007-09-18 10:16:56.000000000 +0200
+++ MyTools/1-Oct-2007/Scripts/bin/SymlinkProgram	2007-10-01 11:29:53.000000000 +0200
@@ -6,6 +6,7 @@
 Import OptionParser
 Import Process
 Import String
+Import Directories
 
 helpOnNoArguments=yes
 scriptDescription="Link a program from the ${goboPrograms} hierarchy in the ${goboSystem} tree."
@@ -55,9 +56,9 @@
 # Creates links from one directory into another.
 function link_directory() {
    Parameters "$@" from to
-   local rfrom here j
+   local rfrom here j nofollow
 
-   rfrom=`readlink -f "$from"`
+   rfrom=$from
 
    if ! Is_Empty_Directory "$rfrom"
    then
@@ -67,13 +68,21 @@
 
       Boolean "relative" && relative="--relative" || relative=""
       [ "${conflict}" = "overwrite" ] && overwrite="--overwrite" || overwrite=""
+
+      if Dir_Set Install
+	  then
+		  nofollow="--no-follow"
+	  else
+		  nofollow=""
+	  fi
+
       if [ `type -p LinkOrExpandAll` ]
       then
-         LinkOrExpandAll "$rfrom" "$overwrite" "$relative"
+         LinkOrExpandAll "$rfrom" "$overwrite" "$relative" "$nofollow"
       else
          Log_Error "LinkOrExpandAll not found.  Fallback to python code."
          Boolean "relative" && relative="True" || relative="False"         
-         Link_Or_Expand_All "$rfrom" "$overwrite" "$relative"
+         Link_Or_Expand_All "$rfrom" "$overwrite" "$relative" "$nofollow"
       fi
       cd "$here"
    else
@@ -134,6 +143,8 @@
    version="$youngestdir"
 fi
 
+currentversion=${current%/*}/$version
+
 Log_Normal "Symlinking ${package} ${version}."
 
 ################################################################################
@@ -186,7 +197,7 @@
 if [ "$linktasks" != "no" ]
 then
    Log_Normal "Symlinking tasks..."
-   link_directory "$current/Resources/Tasks" "$goboTasks"
+   link_directory "$currentversion/Resources/Tasks" "$goboTasks"
 fi
 
 ################################################################################
@@ -194,11 +205,11 @@
 if ! Boolean "no-variable"
 then
    Log_Normal "Storing variable files..."
-   vardir="$current/../Variable"
-   if Is_Directory "$current/Resources/Defaults/Variable"
+   vardir="$currentversion/../Variable"
+   if Is_Directory "$currentversion/Resources/Defaults/Variable"
    then
       Is_Directory "$vardir" || Make_Directory "$vardir"
-      Quiet cp -dR --preserve=mode,timestamps,links --reply=no "$current/Resources/Defaults/Variable"/* "$vardir"
+      Quiet cp -dR --preserve=mode,timestamps,links --reply=no "$currentversion/Resources/Defaults/Variable"/* "$vardir"
    fi
    if ! Is_Empty_Directory "$vardir"
    then
@@ -214,12 +225,12 @@
 if [ "$linklibraries" != "no" ] 
 then
    Log_Normal "Symlinking libraries..."
-   link_directory "$current/lib" "$goboLibraries" && {
+   link_directory "$currentversion/lib" "$goboLibraries" && {
       Log_Normal "Updating library database (ldconfig)..."
       Quiet ldconfig
-      if [ -d "$current/lib" ]
+      if [ -d "$currentversion/lib" ]
       then
-         Quiet pushd "$current/lib"
+         Quiet pushd "$currentversion/lib"
          if ! [[ $((` ls *.la 2> /dev/null | wc -l`)) == 0 ]]
          then
             Log_Normal "Correcting libtool entries..."
@@ -235,7 +246,7 @@
 if [ "$linkheaders" != "no" ]
 then
    Log_Normal "Symlinking headers..."
-   link_directory "$current/include" "$goboHeaders"
+   link_directory "$currentversion/include" "$goboHeaders"
 fi
 
 ################################################################################
@@ -243,10 +254,10 @@
 if ! Boolean "no-doc"
 then
    Log_Normal "Symlinking info..."
-   Quiet rm -- "$current/info/dir"
-   link_directory "$current/info" "$goboManuals/info"
+   Quiet rm -- "$currentversion/info/dir"
+   link_directory "$currentversion/info" "$goboManuals/info"
    Log_Normal "Updating info dir..."
-   for f in `ls -1 "${current}/info/" 2> /dev/null | grep "[^0-9]$" | sed 's%.*/%%g'`
+   for f in `ls -1 "${currentversion}/info/" 2> /dev/null | grep "[^0-9]$" | sed 's%.*/%%g'`
    do
       Log_Verbose "$f"
       install-info "$goboManuals/info/" "$goboManuals/info/dir" 2> /dev/null
@@ -256,16 +267,16 @@
    # cd "$current"
    # SymlinkManuals
    
-   link_directory "$current/man/man0" "$goboManuals/man0"
-   link_directory "$current/man/man1" "$goboManuals/man1"
-   link_directory "$current/man/man2" "$goboManuals/man2"
-   link_directory "$current/man/man3" "$goboManuals/man3"
-   link_directory "$current/man/man4" "$goboManuals/man4"
-   link_directory "$current/man/man5" "$goboManuals/man5"
-   link_directory "$current/man/man6" "$goboManuals/man6"
-   link_directory "$current/man/man7" "$goboManuals/man7"
-   link_directory "$current/man/man8" "$goboManuals/man8"
-   cd $current
+   link_directory "$currentversion/man/man0" "$goboManuals/man0"
+   link_directory "$currentversion/man/man1" "$goboManuals/man1"
+   link_directory "$currentversion/man/man2" "$goboManuals/man2"
+   link_directory "$currentversion/man/man3" "$goboManuals/man3"
+   link_directory "$currentversion/man/man4" "$goboManuals/man4"
+   link_directory "$currentversion/man/man5" "$goboManuals/man5"
+   link_directory "$currentversion/man/man6" "$goboManuals/man6"
+   link_directory "$currentversion/man/man7" "$goboManuals/man7"
+   link_directory "$currentversion/man/man8" "$goboManuals/man8"
+   cd $currentversion
 fi
 
 ################################################################################
@@ -273,14 +284,14 @@
 if [ "$linkexecutables" != "no" ]
 then
    Log_Normal "Symlinking executables..."
-   link_directory "$current/bin" "$goboExecutables"
-   link_directory "$current/sbin" "$goboExecutables"
+   link_directory "$currentversion/bin" "$goboExecutables"
+   link_directory "$currentversion/sbin" "$goboExecutables"
 fi
 
 if [ "$linkwrappers" != "no" ]
 then
    Log_Normal "Symlinking wrappers..."
-   wrapdir="$current/Resources/Wrappers"
+   wrapdir="$currentversion/Resources/Wrappers"
    if [ -d "$wrapdir" ]
    then
       chmod +x "$wrapdir"/*
@@ -295,10 +306,10 @@
    if [ "$goboIndex" ]
    then
       Log_Normal "Symlinking shared..."
-      link_directory "$current/share" "$goboShared"
+      link_directory "$currentversion/share" "$goboShared"
    else
       Log_Normal "Symlinking shared..."
-      cd "$current"
+      cd "$currentversion"
       Quiet rmdir "share"
       Quiet rmdir "Shared"
       if Is_Real_Directory "share"
@@ -319,7 +330,7 @@
                Quiet ln -snf "$goboShared" share
             fi
          fi
-         link_directory "$current/Shared" "$goboShared"
+         link_directory "$currentversion/Shared" "$goboShared"
       fi
       if ! Is_Real_Directory "Shared" && Is_Link "share"
       then
@@ -327,8 +338,8 @@
       fi
       Quiet cd -
    fi
-   Is_Real_Nonempty_Directory "${current}/Shared/mime/packages" && Rebuild_MIME_Database
-   Is_Real_Nonempty_Directory "${current}/Shared/applications" && Rebuild_Desktop_Database
+   Is_Real_Nonempty_Directory "${currentversion}/Shared/mime/packages" && Rebuild_MIME_Database
+   Is_Real_Nonempty_Directory "${currentversion}/Shared/applications" && Rebuild_Desktop_Database
    # it's ok to install the GConf schemas even if they are already installed
    # we do this to ensure that the schemas are really installed
    Is_Real_Nonempty_Directory "${goboPrograms}/${package}/Settings/gconf/schemas" && Install_GConf_Schemas "${package}"
@@ -336,16 +347,16 @@
 
 ################################################################################
 
-if [ -f $current/Resources/UnmanagedFiles ] && {
+if [ -f $currentversion/Resources/UnmanagedFiles ] && {
    { Is_Entry "unmanaged" "ask" && {
         Log_Normal "The program wishes to install files to these unmanaged locations:"
-        cat $current/Resources/UnmanagedFiles
+        cat $currentversion/Resources/UnmanagedFiles
         Ask "Do you want to install the unmanaged files?"
      }
    } || Is_Entry "unmanaged" "install"; }
 then
    Log_Normal "Installing unmanaged files..."
-   Install_Unmanaged_Files "$current/Resources/UnmanagedFiles" "$current/Resources/Unmanaged"
+   Install_Unmanaged_Files "$currentversion/Resources/UnmanagedFiles" "$currentversion/Resources/Unmanaged"
 fi
 
 ################################################################################
@@ -356,7 +367,7 @@
    then
       envfile="../../../$goboPrograms/$package/$version/Resources/Environment"
    else
-      envfile="$current/Resources/Environment"
+      envfile="$currentversion/Resources/Environment"
    fi
    if [ -e "$envfile" ]
    then
