diff --git a/seqs/fhem.sh b/seqs/fhem.sh new file mode 100755 index 0000000..a8d2e0a --- /dev/null +++ b/seqs/fhem.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +toolName="fhem" +toolUser="$toolName" +toolHome="/opt/fhem" +toolVersion="5.9" +toolDpkg="fhem-${toolVersion}.deb" +toolUrl="http://fhem.de/$toolDpkg" +# 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" +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.: +# { use Math::Round qw/nearest/;; nearest('0.01',ReadingsVal("1WT_28_5728E9070000", "temperature", 0)-1.1);; } +toolDeps2+=" libmath-round-perl" +# for fritzbox connection +toolDeps2+=" libsoap-lite-perl libjson-xs-perl" +# for xmpp support (no special solution needed for raspbian buster) +toolDeps2+=" 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() { +# echo "Called once before executing steps." +# echo "e.g. to source a config file:" +# #. "$CONFIG_FILE" +#} + +step_1_info() { echo "Install prerequisits for $toolName"; } +step_1_alias() { ALIAS="install"; } +step_1() { + local aptOpt= + if [ $QUIET != 0 ] ; then + aptOpt="-y" + fi + #exe apt update + exe apt install $toolDeps $toolDeps2 "$aptOpt" + #exe apt install "$toolDeps2" "$aptOpt" + endReturn -o $? "Installation of prerequisits failed" +} + +step_2_info() { echo "Download and install $toolName version $toolVersion"; } +step_2() { + exe wget "$toolUrl" -O "$downPath" + endReturn -o $? "Download of $toolName failed" + exe dpkg -i "$downPath" + endReturn -o $? "Installation of $toolName failed" +} +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_alias() { ALIAS="listdeps"; } +step_20() { + echo " [I] $toolName prerequisits:" + echo "$toolDeps $toolDeps2" +} + +step_30_info() { echo "Create user $toolUser"; } +step_30() { + exe useradd --system --home "$toolHome" --gid dialout --shell /bin/false "$toolUser" + endReturn -o $? "Creating user $toolUser failed" +} + +step_32_info() { echo "Create $toolName systemd service"; } +step_32() { + exe cp "${toolHome}/contrib/init-scripts/fhem.service" "$systemdConfigLoc" + exe systemctl daemon-reload +} +systemdConfigLoc="/etc/systemd/system" + +VERSION_SEQREV=9 +. /usr/local/bin/sequencer.sh diff --git a/seqs/fhem/20-FhemIf.rules b/seqs/fhem/20-FhemIf.rules new file mode 100644 index 0000000..b4f94ff --- /dev/null +++ b/seqs/fhem/20-FhemIf.rules @@ -0,0 +1,6 @@ +# Datei: /etc/udev/rules.d/20-FehmIf.rules +# Gerät CUL868 busware.de (homematic RF) an USB +SUBSYSTEM=="tty", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204b", SYMLINK+="tty_CUL868" +SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="tty_Zwave" +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A40352S9", SYMLINK+="ttyUSB_RS485" +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A103R0XO", SYMLINK+="ttyUSB_LinkUSBi"