Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-3461

bin/karaf doesn't use the provided KARAF_HOME

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.2, 3.0.4, 4.0.0.M3
    • Component/s: karaf
    • Labels:
      None

      Description

      Currently, if the user sets a KARAF_HOME env variable, Karaf doesn't use it and display a warning:

      locateHome() {
          if [ "x$KARAF_HOME" != "x" ]; then
              warn "Ignoring predefined value for KARAF_HOME"
          fi
      
          # In POSIX shells, CDPATH may cause cd to write to stdout
          (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
      
          KARAF_HOME=`cd "$DIRNAME/.."; pwd`
          if [ ! -d "$KARAF_HOME" ]; then
              die "KARAF_HOME is not valid: $KARAF_HOME"
          fi
      }
      

      This behaviour prevents to place karaf script in /usr/bin for instance (or we have to use a symlink).

      It's particulary interesting with docker.io images (where we can to place karaf script directly in /bin for instance).

      Actually, we should do something like:

      locateHome() {
          if [ "x$KARAF_HOME" = "x" ]; then
            # In POSIX shells, CDPATH may cause cd to write to stdout
          (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
            KARAF_HOME=`cd "$DIRNAME/.."; pwd`
          fi
      
          if [ ! -d "$KARAF_HOME" ]; then
              die "KARAF_HOME is not valid: $KARAF_HOME"
          fi
      }
      

      With this change, if the user sets KARAF_HOME, we use it, else we "fallback" to define the KARAF_HOME relatively to DIRNAME.

        Attachments

          Activity

            People

            • Assignee:
              jbonofre Jean-Baptiste Onofré
              Reporter:
              jbonofre Jean-Baptiste Onofré
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: