app-misc/fhem: New package
authorConrad Kostecki <conrad@kostecki.com>
Sat, 7 Jul 2018 22:27:18 +0000 (00:27 +0200)
committerTony Vroon <chainsaw@gentoo.org>
Wed, 11 Jul 2018 08:20:35 +0000 (09:20 +0100)
Closes: https://bugs.gentoo.org/605628
Package-Manager: Portage-2.3.41, Repoman-2.3.9
Closes: https://github.com/gentoo/gentoo/pull/9110

app-misc/fhem/Manifest [new file with mode: 0644]
app-misc/fhem/fhem-5.8.ebuild [new file with mode: 0644]
app-misc/fhem/files/fhem.cfg [new file with mode: 0644]
app-misc/fhem/files/fhem.initd [new file with mode: 0644]
app-misc/fhem/metadata.xml [new file with mode: 0644]

diff --git a/app-misc/fhem/Manifest b/app-misc/fhem/Manifest
new file mode 100644 (file)
index 0000000..2e890af
--- /dev/null
@@ -0,0 +1 @@
+DIST fhem-5.8.tar.gz 22139481 BLAKE2B 444b041b591d3c960036a262e6eb3fda026d4b229a21df16d7817c32a1fd57282a7fbe5559164b760bd9cfad314c2977e7d6f611320d35be090cdb9df66fb8fd SHA512 6cfaa14288ce553a2418db4cb47c719f2d5edbccbde9e76f221cd47cf8a175a67125031c4971f9f9972b218fc709a267757c2abefe6a33be47eb4bb45e23be57
diff --git a/app-misc/fhem/fhem-5.8.ebuild b/app-misc/fhem/fhem-5.8.ebuild
new file mode 100644 (file)
index 0000000..70fd300
--- /dev/null
@@ -0,0 +1,99 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit user
+
+DESCRIPTION="A GPL'd perl server for house automation"
+HOMEPAGE="https://www.fhem.de/"
+SRC_URI="https://www.fhem.de/${P}.tar.gz"
+
+KEYWORDS="~amd64 ~x86"
+LICENSE="GPL-2+"
+SLOT="0"
+IUSE="doc"
+
+RDEPEND="dev-perl/Crypt-CBC
+       dev-perl/Device-SerialPort
+       dev-perl/Digest-CRC
+       dev-perl/JSON"
+
+DEPEND="media-gfx/pngcrush"
+
+QA_PREBUILT="opt/fhem/contrib/lcd4linux/fritzbox_dpf/lcd4linux
+       opt/fhem/contrib/lcd4linux/rpi_dpf/lcd4linux"
+
+pkg_setup() {
+       enewgroup fhem
+       enewuser fhem -1 -1 /opt/fhem fhem
+}
+
+src_prepare() {
+       default
+
+       # Allow install path to be set by DESTDIR in Makefile
+       sed -i -e 's,^\(BINDIR=\),\1'\$\(DESTDIR\)',' Makefile || die
+
+       # Remove docs in Makefile, as they will be installed manually
+       sed -i -e 's/docs//g' Makefile || die
+       sed -i -e '/README_DEMO.txt/d' Makefile || die
+
+       # Remove manpage in Makefile, as it will be installed manually
+       sed -i -e '/fhem.pl.1/d' Makefile || die
+
+       # Remove log dir, as it will be replaced with a symlink
+       rm -r log || die
+
+       # Fix fhemicon_darksmall.png, as it reports "broken IDAT window length"
+       # Reported to Upstream: https://forum.fhem.de/index.php/topic,86238.0.html
+       pngcrush -fix -force -ow www/images/default/fhemicon_darksmall.png || die
+
+       cp "${FILESDIR}"/fhem.cfg fhem.cfg || die
+}
+
+src_compile() {
+       :
+}
+
+src_install() {
+       local DOCS=(
+               "CHANGED"
+               "HISTORY"
+               "README.SVN"
+               "README_DEMO.txt"
+               "docs"/*.txt
+               "docs"/*.patch
+               "docs"/*.pdf
+               "docs/changelog"
+               "docs/copyright"
+               "docs/dotconfig"
+               "docs/fhem.odg.readme"
+               "docs/LIESMICH.update-thirdparty"
+               "docs"/README*
+               "docs/X10"
+       )
+
+       if use doc; then
+               local DOCS+=( "docs/X10" )
+               local HTML_DOCS=( "docs/"*.eps "docs/"*.html "docs"/*.jpg "docs"/*.js "docs"/*.odg "docs/"*.png "docs/km271" )
+       fi
+
+       diropts -o fhem -g fhem
+       keepdir "/var/lib/fhem"
+       keepdir "/var/log/fhem"
+
+       dosym ../../var/lib/fhem /opt/fhem/data
+       dosym ../../var/log/fhem /opt/fhem/log
+
+       default
+
+       newinitd "${FILESDIR}"/fhem.initd fhem
+
+       newman docs/fhem.man fhem.pl.1
+
+       echo 'CONFIG_PROTECT="/opt/fhem /var/lib/fhem"' > "${T}"/99fhem || die
+       doenvd "${T}"/99fhem
+
+       fowners fhem:fhem /opt/fhem/fhem.cfg
+}
diff --git a/app-misc/fhem/files/fhem.cfg b/app-misc/fhem/files/fhem.cfg
new file mode 100644 (file)
index 0000000..04f7ae9
--- /dev/null
@@ -0,0 +1,27 @@
+attr global logfile ./log/fhem-%Y-%m.log
+attr global pidfilename /run/fhem/fhem.pid 
+attr global modpath .
+attr global statefile ./data/fhem.save
+attr global verbose 3
+attr global updateInBackground
+
+define telnetPort telnet 7072 global
+
+define WEB FHEMWEB 8083 global
+
+define WEBphone FHEMWEB 8084 global
+attr WEBphone stylesheetPrefix smallscreen
+
+define WEBtablet FHEMWEB 8085 global
+attr WEBtablet stylesheetPrefix touchpad
+
+# Fake FileLog entry, to access the fhem log from FHEMWEB 
+define Logfile FileLog ./log/fhem-%Y-%m.log fakelog
+
+define autocreate autocreate
+attr autocreate filelog ./data/%NAME-%Y.log
+
+define eventTypes eventTypes ./data/eventTypes.txt
+
+# Disable this to avoid looking for new USB devices on startup
+define initialUsbCheck notify global:INITIALIZED usb create 
diff --git a/app-misc/fhem/files/fhem.initd b/app-misc/fhem/files/fhem.initd
new file mode 100644 (file)
index 0000000..4249487
--- /dev/null
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+home="/opt/fhem"
+command="${home}/fhem.pl"
+command_args="${home}/fhem.cfg"
+command_group="fhem"
+command_user="fhem"
+name="FHEM"
+pidfile_path="/run/fhem"
+pidfile="${pidfile_path}/fhem.pid"
+start_stop_daemon_args="--chdir ${home}"
+
+start_pre() {
+       checkpath -d  -o "${command_user}:${command_group}" -q "${pidfile_path}"
+}
diff --git a/app-misc/fhem/metadata.xml b/app-misc/fhem/metadata.xml
new file mode 100644 (file)
index 0000000..92b4329
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>ck+gentoo@bl4ckb0x.de</email>
+               <name>Conrad Kostecki</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>proxy-maint@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <longdescription>
+               FHEM is a GPL'd perl server for house automation.
+               It is used to automate some common tasks in the household like
+               switching lamps, shutters, heating and to log events like
+               temperature, humidity, power consumption.
+               In order to use FHEM you'll need some attached hardware
+               like the CUL-, EnOcean- or Z-Wave-USB-Stick to access the actors and sensors.
+       </longdescription>
+</pkgmetadata>