fhem - separate step for jabber deps

This commit is contained in:
2022-06-08 17:23:18 +02:00
parent 0da95df9f4
commit 398036d48b

View File

@@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
toolName="fhem" readonly toolName="fhem"
toolUser="$toolName" readonly toolUser="$toolName"
toolHome="/opt/fhem" readonly toolHome="/opt/fhem"
toolVersion="6.0" readonly toolVersion="6.1"
toolDpkg="fhem-${toolVersion}.deb" readonly toolDpkg="fhem-${toolVersion}.deb"
toolUrl="http://fhem.de/$toolDpkg" readonly toolUrl="http://fhem.de/${toolDpkg}"
# default deps listed at https://debian.fhem.de/ # default deps listed at https://debian.fhem.de/
toolDeps="perl-base libdevice-serialport-perl libwww-perl libio-socket-ssl-perl libcgi-pm-perl libjson-perl sqlite3 libdbd-sqlite3-perl libtext-diff-perl libtimedate-perl libmail-imapclient-perl libgd-graph-perl libtext-csv-perl libxml-simple-perl liblist-moreutils-perl fonts-liberation2 libimage-librsvg-perl libgd-text-perl libsocket6-perl libio-socket-inet6-perl libmime-base64-urlsafe-perl libimage-info-perl libusb-1.0-0-dev libnet-server-perl" readonly toolDeps="perl-base libdevice-serialport-perl libwww-perl libio-socket-ssl-perl libcgi-pm-perl libjson-perl sqlite3 libdbd-sqlite3-perl libtext-diff-perl libtimedate-perl libmail-imapclient-perl libgd-graph-perl libtext-csv-perl libxml-simple-perl liblist-moreutils-perl fonts-liberation2 libimage-librsvg-perl libgd-text-perl libsocket6-perl libio-socket-inet6-perl libmime-base64-urlsafe-perl libimage-info-perl libusb-1.0-0-dev libnet-server-perl"
toolDeps2="libdate-manip-perl libhtml-treebuilder-xpath-perl libmojolicious-perl libxml-bare-perl libauthen-oath-perl libconvert-base32-perl libmodule-pluggable-perl libnet-bonjour-perl libcrypt-urandom-perl" toolDeps2="libdate-manip-perl libhtml-treebuilder-xpath-perl libmojolicious-perl libxml-bare-perl libauthen-oath-perl libconvert-base32-perl libmodule-pluggable-perl libnet-bonjour-perl libcrypt-urandom-perl"
# for rounding operations e.g.: # for rounding operations e.g.:
# { use Math::Round qw/nearest/;; nearest('0.01',ReadingsVal("1WT_28_5728E9070000", "temperature", 0)-1.1);; } # { use Math::Round qw/nearest/;; nearest('0.01',ReadingsVal("1WT_28_5728E9070000", "temperature", 0)-1.1);; }
@@ -15,15 +15,7 @@ toolDeps2+=" libmath-round-perl"
# for fritzbox connection # for fritzbox connection
toolDeps2+=" libsoap-lite-perl libjson-xs-perl" toolDeps2+=" libsoap-lite-perl libjson-xs-perl"
# for xmpp support (no special solution needed for raspbian buster) # for xmpp support (no special solution needed for raspbian buster)
toolDeps2+=" libnet-xmpp-perl libxml-stream-perl libnet-jabber-perl" toolDepsJabber=" libnet-xmpp-perl libxml-stream-perl libnet-jabber-perl"
# Get script working directory
# (when called from a different directory)
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
WSUBDIR="${WDIR}/${toolName}"
#CONFIG_FILE="$WDIR/${toolName}.cfg"
#CONFIG_FILE_DEFAULT="${CONFIG_FILE}.example"
#step_config() { #step_config() {
# echo "Called once before executing steps." # echo "Called once before executing steps."
@@ -44,20 +36,22 @@ step_1() {
endReturn -o $? "Installation of prerequisits failed" endReturn -o $? "Installation of prerequisits failed"
} }
step_2_info() { echo "Download and install $toolName version $toolVersion"; } step_2_info() { echo "Install jabber prerequisits"; echoinfo "(May be skipped)"; }
step_2() { step_2() {
exe apt install $toolDepsJabber "$aptOpt"
endReturn -o $? "Installation of prerequisits for jabber failed"
}
step_3_info() { echo "Download and install $toolName version $toolVersion"; }
step_3() {
exe wget "$toolUrl" -O "$downPath" exe wget "$toolUrl" -O "$downPath"
endReturn -o $? "Download of $toolName failed" endReturn -o $? "Download of $toolName failed"
exe dpkg -i "$downPath" exe dpkg -i "$downPath"
endReturn -o $? "Installation of $toolName failed" endReturn -o $? "Installation of $toolName failed"
info "$toolName is now running on http://$(hostname -I | cut -d " " -f 1):8083"
} }
downPath="/tmp/$toolDpkg" downPath="/tmp/$toolDpkg"
step_3_info() { echo "Start $toolName service"; }
step_3() {
exe systemctl restart fhem.service
}
step_20_info() { echo "List $toolName prerequisits"; } step_20_info() { echo "List $toolName prerequisits"; }
step_20_alias() { echo "listdeps"; } step_20_alias() { echo "listdeps"; }
step_20() { step_20() {
@@ -147,7 +141,7 @@ step_40_info() { echo "Execute fhem [COMMAND]"; }
step_40_alias() { echo "exe"; } step_40_alias() { echo "exe"; }
step_40() { step_40() {
shift shift
exe perl "${toolHome}/fhem.pl" 7072 "$1" exe perl "${toolHome}/fhem.pl" 7072 "${1:-}"
} }
readonly sqr_minVersion=16 readonly sqr_minVersion=16