Bernd Kauling created MRM-2020:
----------------------------------

             Summary: 'archiva' shell script for linux generated by 
appassembler plugin does not honor the ARCHIVA_BASE environment variable
                 Key: MRM-2020
                 URL: https://issues.apache.org/jira/browse/MRM-2020
             Project: Archiva
          Issue Type: Bug
          Components: Build, Documentation
    Affects Versions: 2.2.5
            Reporter: Bernd Kauling


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
{code:java}
$ ./archiva start
{code}
i received the following error message:
{noformat}
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{noformat}
After some digging around in the shell script, i noticed this part starting on 
line 44.
{code:java}
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
{code}
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:
{code:java}
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
{code}
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.
h3. 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to