Permalink
Browse files

Update fuer OpenHab 2.4.0

  • Loading branch information...
il il
il authored and il committed Dec 18, 2018
1 parent d13dd85 commit cc771f39b4eedf43dbd98c29312f0b3fa55b39f1
@@ -4,7 +4,7 @@ export PT = 'spitzenPasswort'

# Pfad zu den Openhab-Installationsdateien:
#
# - openhab-2.1.0.zip
# - openhab-2.4.0.zip
# - jdk-8u151-linux-arm32-vfp-hflt.tar.gz
##############################################################################
export OPENHABDOWNLOADS_DIR = /home/misterX/Downloads/openhab_downloads
@@ -1,7 +1,7 @@
CONF = /home/il/Dropbox/HCAN/HI_SERVER/openhab2_conf_mqtt
include $(CONF)/myconf.inc

OPENHABVERSION = openhab-2.3.0
OPENHABVERSION = openhab-2.4.0
HCAN_INSTALLATION = installation.xml


@@ -5,7 +5,7 @@ openHAB2 für openHCAN verwenden - [hcanhab](https://github.com/hcanIngo/openHCA


2. conf-Ordner (=BeispielKonfiguration) in Verzeichnis xy legen und mindestens folgende Dateien anpassen:
- Openhab-Installationsdateien besorgen (http://www.openhab.org/downloads.html)
- Openhab-Installationsdatei "openhab-2.4.0.zip" besorgen (https://www.openhab.org/download/)
- [myconf.inc](https://github.com/hcanIngo/openHCAN/tree/master/hcanhab2_mqtt/BeispielKonfiguration/myconf.inc)
- [installation.xml nach vorgegebenen Schema anpassen](https://github.com/hcanIngo/openHCAN/tree/master/hcanhab2_mqtt/BeispielKonfiguration/installation.xml)

@@ -20,6 +20,13 @@ openHAB2 für openHCAN verwenden - [hcanhab](https://github.com/hcanIngo/openHCA
- make all @ openHCAN/hcanhab2_mqtt/



5. Openhab starten (per Makefile ausführen):
- Fuer localhost: make start (mit log-Datei: make start > ~/tmp/openhabMeldungen.txt)
- make run_webclient oder z.B. Habdroid-App verwenden

6. - auf dem Bananapi openhab manuell starten:
-> ssh tt@bananapi
-> ./myOpenHabInstallation/start.sh
-> feature:install openhab-runtime-compat1x (binding-mqtt1 - 1.13.0 ermoeglichen)

@@ -31,17 +31,14 @@ install_oracle_arm_jre:
$(_SSH) $(ZIEL_USER)@$(ZIEL_PC) rm -f -R /home/$(ZIEL_USER)/$(ZIEL_ORDNER)/../jdk1.8.0
$(_SSH) $(ZIEL_USER)@$(ZIEL_PC) mkdir -p /home/$(ZIEL_USER)/jdk1.8.0
@#
@# zuvor: jdk-8u151-linux-arm32-vfp-hflt.tar.gz
@# cd $(OPENHABDOWNLOADS_DIR); tar xfvz $(OPENHABDOWNLOADS_DIR)/jdk-8u171-linux-arm32-vfp-hflt.tar.gz
$(_SCP) $(OPENHABDOWNLOADS_DIR)/jdk1.8.0_171/* $(SCP_ZIEL_DIR)/../jdk1.8.0
@# zuvor: jdk-8u171-linux-arm32-vfp-hflt.tar.gz
cd $(OPENHABDOWNLOADS_DIR); tar xfvz $(OPENHABDOWNLOADS_DIR)/jdk-8u191-linux-arm32-vfp-hflt.tar.gz
$(_SCP) $(OPENHABDOWNLOADS_DIR)/jdk1.8.0_191/* $(SCP_ZIEL_DIR)/../jdk1.8.0
# Falls noetig, auf dem Bananapi: sudo chmod 755 /home/tt/jdk1.8.0/*

openhab_start_withScreen:
$(_SSH) $(ZIEL_USER)@$(ZIEL_PC) sudo apt-get install screen mc vim git htop
@# Damit wird das richtige JDK verwendet und die Ausgaben von Screen gemanaged werden:
@# screen -S 'OpenHAB Server' -dm /home/bananapi/jdk1.8.0/bin/java in der start.sh (./Bananian_1504/start.sh) voranstellen
$(_SCP) $(HCANHAB_DIR)/bananapi/start.sh $(SCP_ZIEL_DIR)/start.sh
$(_SCP) $(HCANHAB_DIR)/bananapi/start_debug.sh $(SCP_ZIEL_DIR)/start_debug.sh
$(_SCP) $(HCANHAB_DIR)/bananapi/setenv $(SCP_ZIEL_DIR)/runtime/bin/setenv

myopenhab:
@@ -18,9 +18,9 @@

#
# handle specific scripts; the SCRIPT_NAME is exactly the name of the Karaf
# script; for example karaf, start, stop, admin, client, ...
# script: client, instance, shell, start, status, stop, karaf
#
# if [ "$KARAF_SCRIPT" == "SCRIPT_NAME" ]; then
# if [ "${KARAF_SCRIPT}" == "SCRIPT_NAME" ]; then
# Actions go here...
# fi

@@ -32,25 +32,44 @@
#

#
# The following section shows the possible configuration options for the default
# The following section shows the possible configuration options for the default
# karaf scripts
#
export JAVA_HOME="/home/tt/jdk1.8.0" # Location of Java installation
# export JAVA_MIN_MEM # Minimum memory for the JVM
# export JAVA_MAX_MEM # Maximum memory for the JVM
# export JAVA_PERM_MEM # Minimum perm memory for the JVM
# export JAVA_MAX_PERM_MEM # Maximum perm memory for the JVM
# export EXTRA_JAVA_OPTS # Additional JVM options
# export KARAF_HOME # Karaf home folder
# export KARAF_DATA # Karaf data folder
# export KARAF_BASE # Karaf base folder
# export KARAF_ETC # Karaf etc folder
# export KARAF_SYSTEM_OPTS # First citizen Karaf options
# export KARAF_OPTS # Additional available Karaf options
# export KARAF_DEBUG # Enable debug mode
# export KARAF_REDIRECT # Enable/set the std/err redirection when using bin/start
# export KARAF_NOROOT # Prevent execution as root if set to true

#
# Import openHAB 2 directory layout
#
. "$DIRNAME/oh2_dir_layout"

#
# Import Karaf shared functions
#
. "$DIRNAME/inc"

#
# set listen address for HTTP(S) server
#
if [ ! -z ${OPENHAB_HTTP_ADDRESS} ]; then
HTTP_ADDRESS=${OPENHAB_HTTP_ADDRESS}
else
HTTP_ADDRESS=0.0.0.0
fi

#
# set ports for HTTP(S) server
#
@@ -77,6 +96,10 @@ export JAVA_OPTS="${JAVA_OPTS}
-Dopenhab.userdata=${OPENHAB_USERDATA}
-Dopenhab.logdir=${OPENHAB_LOGDIR}
-Dfelix.cm.dir=${OPENHAB_USERDATA}/config
-Djava.library.path=${OPENHAB_USERDATA}/tmp/lib
-Djetty.host=${HTTP_ADDRESS}
-Djetty.http.compliance=RFC2616
-Dorg.ops4j.pax.web.listening.addresses=${HTTP_ADDRESS}
-Dorg.osgi.service.http.port=${HTTP_PORT}
-Dorg.osgi.service.http.port.secure=${HTTPS_PORT}"

@@ -94,94 +117,44 @@ esac
export EXTRA_JAVA_OPTS="${EXTRA_JAVA_OPTS_COMMON} ${EXTRA_JAVA_OPTS_ARCH} ${EXTRA_JAVA_OPTS}"


# The functions below are copied from the karaf script to set JAVA_HOME to a default value.
# The functions below are modified from the Karaf inc script to set JAVA_HOME to a default value.
# This avoids Karaf printing a warning message at startup.

detectOS() {
# OS specific support (must be 'true' or 'false').
cygwin=false;
darwin=false;
aix=false;
os400=false;
case "`uname`" in
CYGWIN*)
cygwin=true
;;
Darwin*)
darwin=true
;;
AIX*)
aix=true
;;
OS400*)
os400=true
;;
esac
# For AIX, set an environment variable
if $aix; then
export LDR_CNTRL=MAXDATA=0xB0000000@DSA
fi
}

pathCanonical() {
local dst="${1}"
while [ -h "${dst}" ] ; do
ls=`ls -ld "${dst}"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
dst="$link"
else
dst="`dirname "${dst}"`/$link"
fi
done
local bas=`basename "${dst}"`
local dir=`dirname "${dst}"`
if [ "$bas" != "$dir" ]; then
dst="`pathCanonical "$dir"`/$bas"
fi
echo "${dst}" | sed -e 's#//#/#g' -e 's#/./#/#g' -e 's#/[^/]*/../#/#g'
die() {
# echo and exit, && command true delays the exit for systemd logging (workaround).
echo "$*" && command true
exit 1
}

locateJava() {
# Setup the Java Virtual Machine
if $cygwin ; then
[ -n "$JAVA" ] && JAVA=`cygpath --unix "$JAVA"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
if ${cygwin} ; then
[ -n "${JAVA}" ] && JAVA=$(cygpath --unix "${JAVA}")
[ -n "${JAVA_HOME}" ] && JAVA_HOME=$(cygpath --unix "${JAVA_HOME}")
fi

if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then
if [ "x${JAVA_HOME}" = "x" ] && [ "${darwin}" = "true" ]; then
JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
fi
if [ "x$JAVA" = "x" ] && [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
if [ "x${JAVA}" = "x" ] && [ -r /etc/gentoo-release ] ; then
JAVA_HOME=$(java-config --jre-home)
fi
if [ "x$JAVA" = "x" ]; then
if [ "x$JAVA_HOME" != "x" ]; then
if [ ! -d "$JAVA_HOME" ]; then
die "JAVA_HOME is not valid: $JAVA_HOME"
if [ "x${JAVA}" = "x" ]; then
if [ "x${JAVA_HOME}" != "x" ]; then
if [ ! -d "${JAVA_HOME}" ]; then
die "JAVA_HOME is not valid: ${JAVA_HOME}"
fi
JAVA="$JAVA_HOME/bin/java"
JAVA="${JAVA_HOME}/bin/java"
else
JAVA=`type java`
JAVA=`expr "$JAVA" : '.* \(/.*\)$'`
if [ "x$JAVA" = "x" ]; then
JAVA=$(command -v java)
if [ "x${JAVA}" = "x" ]; then
die "java command not found"
fi
fi
fi
if [ "x$JAVA_HOME" = "x" ]; then
JAVA_HOME="$(dirname $(dirname $(pathCanonical "$JAVA")))"
export JAVA_HOME
if [ "x${JAVA_HOME}" = "x" ]; then
JAVA_HOME="$(dirname "$(dirname "$(pathCanonical "${JAVA}")")")"
fi

}

checkJvmVersion() {
VERSION=`$JAVA -version 2>&1 | egrep '"([0-9].[0-9]\..*[0-9]).*"' | awk '{print substr($3,2,length($3)-2)}' | awk '{print substr($1, 3, 3)}' | sed -e 's;\.;;g'`
if [ "$VERSION" -lt "80" ]; then
echo "Java 1.8 or higher is required. Aborting launch."
exit 1;
fi
}

detectOS

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

0 comments on commit cc771f3

Please sign in to comment.