Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-18418

Resolve NUXEO_HOME real path when nuxeoctl is a symlink

    XMLWordPrintable

    Details

      Description

      In nuxeoctl, the NUXEO_HOME variable is resolved with all resolved symlinks in the path. But, in case the nuxeoctl is a symlink, it uses the current path instead of the physical path.

      Some idea to solve it:
      Maven way:

        # need this for relative symlinks
        while [ -h "$PRG" ] ; do
          ls=`ls -ld "$PRG"`
          link=`expr "$ls" : '.*-> \(.*\)$'`
          if expr "$link" : '/.*' > /dev/null; then
            PRG="$link"
          else
            PRG="`dirname "$PRG"`/$link"
          fi
        done
      
      if [ -z "$JAVA_HOME" ]; then
        javaExecutable="`which javac`"
        if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
          # readlink(1) is not available as standard on Solaris 10.
          readLink=`which readlink`
          if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
            if $darwin ; then
              javaHome="`dirname \"$javaExecutable\"`"
              javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
            else
              javaExecutable="`readlink -f \"$javaExecutable\"`"
            fi
            javaHome="`dirname \"$javaExecutable\"`"
            javaHome=`expr "$javaHome" : '\(.*\)/bin'`
            JAVA_HOME="$javaHome"
            export JAVA_HOME
          fi
        fi
      fi
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: