openhab / openhab-linuxpkg

Repo for Linux packages
Eclipse Public License 2.0
18 stars 33 forks source link

Use EXTRA_JAVA_OPTS also if started manually #210

Closed fwolter closed 2 years ago

fwolter commented 2 years ago

The karaf script is started with exec in start.sh to let it run in the same shell process, but exec creates a new scope for local variables. So, variables loaded via the . command won't be visible to the karaf script. Coincidentally, it works for some config variables as they are exported in /etc/profile.d/openhab.sh.

I tried to run the karaf script with the . command to keep the variables visible to it, but there's a pretty complicated function in the karaf script to determine the local path. This code fails under some circumstances, e.g. when start.sh is ran by openhab-cli.

As the . command in start.sh to /etc/default/openhab has no effect, I removed it. The variables in /etc/default/openhab are loaded by /etc/profile.d/openhab.sh anyway. To make all of them visible to the karaf script, I added the missing ones to the exports.

Side note: When started by systemd, all variables in /etc/default/openhab are visible to the karaf script as systemd adds all of them to the process' environment.

Signed-off-by: Fabian Wolter github@fabian-wolter.de

fwolter commented 2 years ago

@BClark09 ping