openhab / openhab-linuxpkg

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

Introduce additional openhab2 service options file #139

Closed paulianttila closed 4 years ago

paulianttila commented 5 years ago

During distro update, default openhab2 (/etc/default/openhab2) service options file is easily/accidentally overwritten by the user and all manual configuration (e.g. EXTRA_JAVA_OPTS) are gone. Also if new parameters are introduced to default file, user should merge manual settings to new file, which can be cumbersome for many users. This PR introduce new user specific options file which will never be updated during distro update. As new file is placed to /etc/openhab2, it will be also part of the user backups.

If this is accepted, I will update this PR also cover the rpm package.

Signed-off-by: Pauli Anttila pauli.anttila@gmail.com

ThomDietrich commented 5 years ago

The solution is somewhat controversial but your reasoning makes sense. In addition to the logic we would need some way for the user to understand this option. That is why I wonder if it would be more meaningful to source the new file from within /etc/default/openhab2. Accompanied by a simple comment line the addition would immediately be understood by most

paulianttila commented 5 years ago

That is why I wonder if it would be more meaningful to source the new file from within /etc/default/openhab2

You mean there is a e.g. /etc/default/openhab2.user file? Actually, this is how I originally did it, but then change the path to ${OPENHAB_CONF} as user normally backup all files in that path and it can be easily edited e.g. via Visual Studio Code. But I'm fine with both solutions.

In addition to the logic we would need some way for the user to understand this option.

My intention is to modify openhabian to configure EXTRA_JAVA_OPTS to user file rather than default file.

Quick example... ${OPENHAB_CONF}/openhab2:

MEMORY_OPTS="-Xms1024m -Xmx2048m"
SERIAL_PORTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyUSB1"
USER_OPTS=""
...
EXTRA_JAVA_OPTS="${MEMORY_OPTS} ${SERIAL_PORTS} ${USER_OPTS}"

Then openhabian is easier to modify the settings and add new configuration options (like custom memory settings) as one variable is specific for one thing.

ThomDietrich commented 5 years ago

I think you misread my comment :)

paulianttila commented 5 years ago

@ThomDietrich, @BClark09 Better?

paulianttila commented 4 years ago

Ping @ThomDietrich, @BClark09

ThomDietrich commented 4 years ago

Fine by me. @BClark09 ?

BClark09 commented 4 years ago

Sorry for the delay @paulianttila! Your changes look good to me!