Hello JB,

I am proposing to set KARAF_SCRIPT to the name of the script without first 
checking if it was already set. This way it is always "start" or "karaf" 
independend if it has been set before.

I don't see a condition where you would want to inherit a different script name 
when initializing the start script.

wheter to use PROGNAME instead of the literal is up for discussion, I would go 
with the literal. It should be aligned with the .bat file however, in the 
moment they differ (and I am not sure why)

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
Von: Jean-Baptiste Onofre <j...@nanthrax.net>
Gesendet: Friday, July 10, 2020 6:39:32 AM
An: dev@karaf.apache.org <dev@karaf.apache.org>
Betreff: Re: KARAF_SCRIPT conditionally set?

Hi Bernd,

I’m not sure to see exactly the issue.

Content of KARAF_SCRIPT is passed to setenv right ?

Basically, you are proposing to use setenv before checking KARAF_SCRIPT, 
correct ?

Regards
JB

> Le 9 juil. 2020 à 12:53, Bernd <e...@zusammenkunft.net> a écrit :
>
> Hello,
>
> The Karaf scripts have a mechanism to set KARAF_SCRIPT and then delegate
> common config settings to setenv. The mechanism has however two quirks,
> first of all if a script already sees a KARAF_SRIPT value it will not reset
> it, and secondly it will use the PROGNAME of the script.
>
> In default Karaf installation this seems to be not an issue, since the
> condition on KARAF_SCRIPT in setenv is only a comment. However we do use
> this mechanism to set settings for the main application server start and
> for all other commands).
>
> We check for KARAF_SCRIPT=start or KARAFAF_SCRIPT=karaf. However if rename
> start to start2 or if I call it from another script which also sets
> KARAF_SCRIPT in both cases the value passed to setenv is not "start" or
> "karaf" and therefore it will pick the wrong settings.
>
> I wonder if it would better to set the KARAF_SCRIPT settings
> unconditionally in start and karaf. Not using PROGNAME would be another
> option, nut sure if it is good or bad that a renamed script uses different
> settings...?
>
> A more general comment, a lot of environemnt variables used internal in the
> scripts might be inherited from the current shell, that is somewhat a
> support problem in our experience. Did you had a discussion on that,
> already?
>
> start:
> https://github.com/apache/karaf/blob/25b1a00ab6b2330a469c244c4abc1389aaad5313/assemblies/features/base/src/main/filtered-resources/resources/bin/start#L71
> if [ "x${KARAF_SCRIPT}" = "x" ]; then
> KARAF_SCRIPT="${PROGNAME}"
> export KARAF_SCRIPT
> fi
> if [ -f "${DIRNAME}/setenv" ]; then
> . "${DIRNAME}/setenv"
> fi

Reply via email to