From cf68a2d0adaace29a644b600c786bd970866864b Mon Sep 17 00:00:00 2001 From: Ben Clark Date: Thu, 3 Aug 2017 22:17:20 +0100 Subject: [PATCH 1/2] Add OPENHAB_BACKUPS environment variable Signed-off-by: Ben Clark --- resources/etc/default/openhab2 | 5 +++++ resources/etc/init.d/deb/openhab2 | 2 ++ resources/etc/init.d/rpm/openhab2 | 2 ++ resources/etc/profile.d/openhab2.sh | 2 ++ 4 files changed, 11 insertions(+) diff --git a/resources/etc/default/openhab2 b/resources/etc/default/openhab2 index 5d53f8b..c56d593 100644 --- a/resources/etc/default/openhab2 +++ b/resources/etc/default/openhab2 @@ -24,6 +24,11 @@ EXTRA_JAVA_OPTS="" #OPENHAB_USERDATA=/var/lib/openhab2 #OPENHAB_LOGDIR=/var/log/openhab2 # +# Set the following variable if you'd like a custom backup location. +# runtime/bin/backup and runtime/bin/restore will use this path for the zip files. +# +#OPENHAB_BACKUPS=/var/lib/openhab2/backups +# # The user and group that takes ownership of openHAB. Only available for init.d systems. # To edit user and group for systemd, see the service file at /usr/lib/systemd/system/openhab2.service. # diff --git a/resources/etc/init.d/deb/openhab2 b/resources/etc/init.d/deb/openhab2 index 613bcec..e3b2411 100755 --- a/resources/etc/init.d/deb/openhab2 +++ b/resources/etc/init.d/deb/openhab2 @@ -26,6 +26,7 @@ if [ -z "${OPENHAB_HOME}" ]; then OPENHAB_HOME="/usr/share/openhab2"; fi if [ -z "${OPENHAB_CONF}" ]; then OPENHAB_CONF="/etc/openhab2"; fi if [ -z "${OPENHAB_RUNTIME}" ]; then OPENHAB_RUNTIME="${OPENHAB_HOME}/runtime"; fi if [ -z "${OPENHAB_USERDATA}" ]; then OPENHAB_USERDATA="/var/lib/openhab2"; fi +if [ -z "${OPENHAB_BACKUPS}" ]; then OPENHAB_BACKUPS="${OPENHAB_USERDATA}/backups"; fi if [ -z "${OPENHAB_LOGDIR}" ]; then OPENHAB_LOGDIR="/var/log/openhab2"; fi if [ -z "${OPENHAB_USER}" ]; then OPENHAB_USER="openhab"; fi if [ -z "${OPENHAB_GROUP}" ]; then OPENHAB_GROUP="openhab"; fi @@ -36,6 +37,7 @@ export OPENHAB_HOME export OPENHAB_CONF export OPENHAB_RUNTIME export OPENHAB_USERDATA +export OPENHAB_BACKUPS export OPENHAB_LOGDIR export OPENHAB_USER export OPENHAB_GROUP diff --git a/resources/etc/init.d/rpm/openhab2 b/resources/etc/init.d/rpm/openhab2 index 1400699..9dfeebb 100755 --- a/resources/etc/init.d/rpm/openhab2 +++ b/resources/etc/init.d/rpm/openhab2 @@ -26,6 +26,7 @@ if [ -z "${OPENHAB_HOME}" ]; then OPENHAB_HOME="/usr/share/openhab2"; fi if [ -z "${OPENHAB_CONF}" ]; then OPENHAB_CONF="/etc/openhab2"; fi if [ -z "${OPENHAB_RUNTIME}" ]; then OPENHAB_RUNTIME="${OPENHAB_HOME}/runtime"; fi if [ -z "${OPENHAB_USERDATA}" ]; then OPENHAB_USERDATA="/var/lib/openhab2"; fi +if [ -z "${OPENHAB_BACKUPS}" ]; then OPENHAB_BACKUPS="${OPENHAB_USERDATA}/backups"; fi if [ -z "${OPENHAB_LOGDIR}" ]; then OPENHAB_LOGDIR="/var/log/openhab2"; fi if [ -z "${OPENHAB_USER}" ]; then OPENHAB_USER="openhab"; fi if [ -z "${OPENHAB_GROUP}" ]; then OPENHAB_GROUP="openhab"; fi @@ -36,6 +37,7 @@ export OPENHAB_HOME export OPENHAB_CONF export OPENHAB_RUNTIME export OPENHAB_USERDATA +export OPENHAB_BACKUPS export OPENHAB_LOGDIR export OPENHAB_USER export OPENHAB_GROUP diff --git a/resources/etc/profile.d/openhab2.sh b/resources/etc/profile.d/openhab2.sh index 648a2b3..6cf1385 100644 --- a/resources/etc/profile.d/openhab2.sh +++ b/resources/etc/profile.d/openhab2.sh @@ -13,6 +13,7 @@ if [ -z "${OPENHAB_HOME}" ]; then OPENHAB_HOME="/usr/share/openhab2"; fi if [ -z "${OPENHAB_CONF}" ]; then OPENHAB_CONF="/etc/openhab2"; fi if [ -z "${OPENHAB_RUNTIME}" ]; then OPENHAB_RUNTIME="${OPENHAB_HOME}/runtime"; fi if [ -z "${OPENHAB_USERDATA}" ]; then OPENHAB_USERDATA="/var/lib/openhab2"; fi +if [ -z "${OPENHAB_BACKUPS}" ]; then OPENHAB_BACKUPS="${OPENHAB_USERDATA}/backups"; fi if [ -z "${OPENHAB_LOGDIR}" ]; then OPENHAB_LOGDIR="/var/log/openhab2"; fi if [ -z "${OPENHAB_USER}" ]; then OPENHAB_USER="openhab"; fi if [ -z "${OPENHAB_GROUP}" ]; then OPENHAB_GROUP="openhab"; fi @@ -24,6 +25,7 @@ export OPENHAB_CONF export OPENHAB_RUNTIME export OPENHAB_USERDATA export OPENHAB_LOGDIR +export OPENHAB_BACKUPS export OPENHAB_USER export OPENHAB_GROUP From 6877d6216f08c266d2545a128052501709f862ff Mon Sep 17 00:00:00 2001 From: Ben Clark Date: Wed, 9 Aug 2017 22:52:25 +0100 Subject: [PATCH 2/2] Rearrange default vars Signed-off-by: Ben Clark --- resources/etc/default/openhab2 | 77 ++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/resources/etc/default/openhab2 b/resources/etc/default/openhab2 index c56d593..5fac4df 100644 --- a/resources/etc/default/openhab2 +++ b/resources/etc/default/openhab2 @@ -1,42 +1,55 @@ -# openHAB 2 service configuration -# -# Additional options for the JAVA_OPTS environment variable. -# These will be appended to the execution of the openHAB Java runtime in front of all other options. -# -# A couple of independent examples: -# EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0" -# EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0" -# EXTRA_JAVA_OPTS="-Djna.library.path=/lib/arm-linux-gnueabihf/ -Duser.timezone=Europe/Berlin -Dgnu.io.rxtx.SerialPorts=/dev/ttyS0" -EXTRA_JAVA_OPTS="" -# -# The ports openHAB will bind its HTTP/HTTPS web server to. -# +# openHAB 2 service options + +######################### +## PORTS +## The ports openHAB will bind its HTTP/HTTPS web server to. + #OPENHAB_HTTP_PORT=8080 #OPENHAB_HTTPS_PORT=8443 -# -# These settings override the default apt/rpm locations and should be used with caution. -# openHAB will fail to update itself if you're using different paths. -# Only set these if you are testing and are confident in debugging. -# + +######################### +## BACKUP DIRECTORY +## Set the following variable to specify the backup location. +## runtime/bin/backup and runtime/bin/restore will use this path for the zip files. + +#OPENHAB_BACKUPS=/var/lib/openhab2/backups + +######################### +## JAVA OPTIONS +## Additional options for the JAVA_OPTS environment variable. +## These will be appended to the execution of the openHAB Java runtime in front of all other options. +## +## A couple of independent examples: +## EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0" +## EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0" +## EXTRA_JAVA_OPTS="-Djna.library.path=/lib/arm-linux-gnueabihf/ -Duser.timezone=Europe/Berlin -Dgnu.io.rxtx.SerialPorts=/dev/ttyS0" + +EXTRA_JAVA_OPTS="" + +######################### +## OPENHAB DEFAULTS PATHS +## The following settings override the default apt/rpm locations and should be used with caution. +## openHAB will fail to update itself if you're using different paths. +## Only set these if you are testing and are confident in debugging. + #OPENHAB_HOME=/usr/share/openhab2 #OPENHAB_CONF=/etc/openhab2 #OPENHAB_RUNTIME=/usr/share/openhab2/runtime #OPENHAB_USERDATA=/var/lib/openhab2 #OPENHAB_LOGDIR=/var/log/openhab2 -# -# Set the following variable if you'd like a custom backup location. -# runtime/bin/backup and runtime/bin/restore will use this path for the zip files. -# -#OPENHAB_BACKUPS=/var/lib/openhab2/backups -# -# The user and group that takes ownership of openHAB. Only available for init.d systems. -# To edit user and group for systemd, see the service file at /usr/lib/systemd/system/openhab2.service. -# + +######################### +## OPENHAB USER AND GROUP +## The user and group that takes ownership of openHAB. Only available for init.d systems. +## To edit user and group for systemd, see the service file at /usr/lib/systemd/system/openhab2.service. + #OPENHAB_USER=openhab #OPENHAB_GROUP=openhab -# -# The Karaf startmode for the openHAB runtime. Only available for systemctl/systemd systems. -# Defaults to daemon when unset here. Multiple options can be used without quotes. -# debug increases log output. daemon launches the Karaf/openHAB processes. -# + +######################### +## SYSTEMD START MODE +## The Karaf startmode for the openHAB runtime. Only available for systemctl/systemd systems. +## Defaults to daemon when unset here. Multiple options can be used without quotes. +## debug increases log output. daemon launches the Karaf/openHAB processes. + #OPENHAB_STARTMODE=debug