Uploaded image for project: 'Archiva (Retired)'
  1. Archiva (Retired)
  2. MRM-2020

'archiva' shell script for linux generated by appassembler plugin does not honor the ARCHIVA_BASE environment variable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 2.2.5
    • 2.2.7
    • Build, Documentation
    • None

    Description

      I followed the installation guide for the standalone installation: https://archiva.apache.org/docs/2.2.5/adminguide/standalone.html

      I also decided to separate the base from the installation and followed the steps mentioned accordingly. I've split my installation into /opt/archiva and /var/archiva.

      Step 4 indicates, that the ARCHIVA_BASE environment variable has to be set to the new location of archiva, which i have done.

      As i tried to start archiva with

      $ ./archiva start
      

      i received the following error message:

      Starting Apache Archiva...
      FATAL  | wrapper  | Unable to resolve the full path of the configuration file, /opt/archiva/conf/wrapper.conf: No such file or directory

      After some digging around in the shell script, i noticed this part starting on line 44.

      BASEDIR=`dirname "$0"`/..
      BASEDIR=`(cd "$BASEDIR"; pwd)`
      ls -l "$0" | grep -e '->' > /dev/null 2>&1
      if [ $? = 0 ]; then
        #this is softlink
        _PWD=`pwd`
        _EXEDIR=`dirname "$0"`
        cd "$_EXEDIR"
        _BASENAME=`basename "$0"`
        _REALFILE=`ls -l "$_BASENAME" | sed 's/.*->\ //g'`
         BASEDIR=`dirname "$_REALFILE"`/..
         BASEDIR=`(cd "$BASEDIR"; pwd)`
         cd "$_PWD"
      fi
      

      which determines the BASEDIR environment variable which is used to point to the 'wrapper.conf' configuration file which i expected to be now in /var/archiva/conf/wrapper.conf.

      After changing the script to the following:

      if [ -z "$ARCHIVA_BASE" ]; then 
        BASEDIR=`dirname "$0"`/..
        BASEDIR=`(cd "$BASEDIR"; pwd)`
        ls -l "$0" | grep -e '->' > /dev/null 2>&1
        if [ $? = 0 ]; then
          #this is softlink
          _PWD=`pwd`
          _EXEDIR=`dirname "$0"`
          cd "$_EXEDIR"
          _BASENAME=`basename "$0"`
          _REALFILE=`ls -l "$_BASENAME" | sed 's/.*->\ //g'`
           BASEDIR=`dirname "$_REALFILE"`/..
           BASEDIR=`(cd "$BASEDIR"; pwd)`
           cd "$_PWD"
        fi
      else
        BASEDIR=$ARCHIVA_BASE
      fi
      

      Archiva starts up correctly.

      Step 2 of the installation guide instructs the reader to copy the files instead of moving them, because the "move will fail". I can only imagine what that means, but after what i've learned now it may indicate that the "failing part" may not be the move operation itself, but the successful start of archiva, if the 'wrapper.conf' is moved too.

      What i did was to copy the files, delete the old configuration files and to create a readme to remind myself where the config files are now. Including the 'wrapper.conf'.

      That leaves me with two options:

      Either this is a "bug" in the documentation or a bug in the generated shell script.

      Proposal:

       

      So either

      1) The documentation needs to be adjusted to state in step 2 that the wrapper.conf should stay in the base directory if that is what step 2 of the documentation really means.

      or

      2) The generated shell script should include the above mentioned check.

       

      If option 1 is the correct one, i'd volunteer to provide a better documentation for that section.

      If option 2 is the correct one, i am afraid that i don't know how to fix that. I've poked around the source code and i've read the appassembler documentation, but i am not sure if that is even possible with the plugin.

      Attachments

        Activity

          People

            martin_s Martin Schreier
            bkauling Bernd Kauling
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: