From 3459680e408950183509a0749cb08ba8675912d2 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 21:54:31 +0100 Subject: [PATCH] complete setup as systemd service [release 2020.2-2mamba;Wed Sep 30 2020] --- README.md | 2 + domoticz.conf | 11 +++++ domoticz.service | 14 ++++++ domoticz.spec | 113 ++++++++++++++++++++++++++++++++++++++++++++++ domoticz.sysusers | 4 ++ domoticz.tmpfiles | 1 + 6 files changed, 145 insertions(+) create mode 100644 domoticz.conf create mode 100644 domoticz.service create mode 100644 domoticz.spec create mode 100644 domoticz.sysusers create mode 100644 domoticz.tmpfiles diff --git a/README.md b/README.md index b4afc8b..eb204d0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # domoticz +Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device. + diff --git a/domoticz.conf b/domoticz.conf new file mode 100644 index 0000000..324ef0b --- /dev/null +++ b/domoticz.conf @@ -0,0 +1,11 @@ +WWW_PORT=8080 +SSL_PORT=8443 +SSLCERT="/var/lib/domoticz/domoticz.pem" +SSLPASS="" +SSLMETHOD="" +SSLOPTIONS="" +SSLDHPARAM="" +APP_ROOT="/usr/share/domoticz" +DBASE="/var/lib/domoticz/domoticz.db" +USERDATA="/var/lib/domoticz/" +LOGLEVEL="1" diff --git a/domoticz.service b/domoticz.service new file mode 100644 index 0000000..c55370e --- /dev/null +++ b/domoticz.service @@ -0,0 +1,14 @@ +[Unit] +Description=Domoticz daemon +After=network.target + +[Service] +User=domoticz +Group=domoticz +EnvironmentFile=/etc/sysconfig/domoticz +ExecStart=/usr/share/domoticz/domoticz -www $WWW_PORT -sslwww $SSL_PORT -sslcert $SSLCERT -sslpass $SSLPASS -sslmethod $SSLMETHOD -ssloptions $SSLOPTIONS -ssldhparam $SSLDHPARAM -approot $APP_ROOT -dbase $DBASE -userdata $USERDATA -loglevel $LOGLEVEL -pidfile /run/domoticz/domoticz.pid +PIDFile=/run/domoticz/domoticz.pid +WorkingDirectory=/usr/share/domoticz + +[Install] +WantedBy=multi-user.target diff --git a/domoticz.spec b/domoticz.spec new file mode 100644 index 0000000..9dab261 --- /dev/null +++ b/domoticz.spec @@ -0,0 +1,113 @@ +Name: domoticz +Version: 2020.2 +Release: 2mamba +Summary: A Home Automation System that lets you monitor and configure various devices +Group: System/Kernel and Hardware +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://www.domoticz.com/ +Source: https://github.com/domoticz/domoticz.git/%{version}/domoticz-%{version}.tar.bz2 +Source1: domoticz.service +Source2: domoticz.tmpfiles +Source3: domoticz.sysusers +Source4: domoticz.conf +License: GPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: ldconfig +BuildRequires: libcurl-devel +BuildRequires: libjsoncpp-devel +BuildRequires: liblua-devel +BuildRequires: libminizip-devel +BuildRequires: libmosquitto-devel +BuildRequires: libopenssl-devel +BuildRequires: libsqlite-devel +BuildRequires: libusb-compat-devel +BuildRequires: libz-devel +## AUTOBUILDREQ-END +BuildRequires: libcereal-devel +BuildRequires: cmake +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device. + +%debug_package + +%prep +%setup -q + +%build +%cmake -d build \ + -DCMAKE_INSTALL_PREFIX=%{_datadir}/domoticz \ + -DUSE_BUILTIN_SQLITE=NO \ + -DUSE_BUILTIN_MQTT=NO \ + -DUSE_BUILTIN_JSONCPP=NO \ + -DUSE_BUILTIN_MINIZIP=NO \ + -DGIT_SUBMODULE=OFF + +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall -C build + +install -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/domoticz.service +install -D -m0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/domoticz.conf +install -D -m0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/domoticz.conf +install -D -m0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/domoticz +install -d -m0755 %{buildroot}/var/lib/domoticz + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%pre +%sysusers_create_package domoticz %{SOURCE3} +%tmpfiles_create_package domoticz %{SOURCE2} +: + +%post +%systemd_post domoticz +: + +%preun +%systemd_preun domoticz +: + +%postun +%systemd_postun_with_restart domoticz +: + +%files +%defattr(-,root,root) +%config(noreplace) %{_sysconfdir}/sysconfig/domoticz +%{_unitdir}/domoticz.service +%{_sysusersdir}/domoticz.conf +%{_tmpfilesdir}/domoticz.conf +%dir %{_datadir}/domoticz +%{_datadir}/domoticz/History.txt +%{_datadir}/domoticz/License.txt +%{_datadir}/domoticz/domoticz +%{_datadir}/domoticz/server_cert.pem +%{_datadir}/domoticz/updatedomo +%dir %{_datadir}/domoticz/Config +%{_datadir}/domoticz/Config/* +%dir %{_datadir}/domoticz/dzVents +%{_datadir}/domoticz/dzVents/* +%{_datadir}/domoticz/dzVents/.gitignore +%dir %{_datadir}/domoticz/plugins +%{_datadir}/domoticz/plugins/* +%dir %{_datadir}/domoticz/scripts +%{_datadir}/domoticz/scripts/* +%dir %{_datadir}/domoticz/www +%{_datadir}/domoticz/www/* +%attr(0750,domoticz,domoticz) /var/lib/domoticz +%doc License.txt + +%changelog +* Wed Sep 30 2020 Silvan Calarco 2020.2-2mamba +- complete setup as systemd service + +* Tue Sep 29 2020 Silvan Calarco 2020.2-1mamba +- package created using the webbuild interface diff --git a/domoticz.sysusers b/domoticz.sysusers new file mode 100644 index 0000000..6ddf2c7 --- /dev/null +++ b/domoticz.sysusers @@ -0,0 +1,4 @@ +#Type Name ID GECOS Home directory Shell +g domoticz - +u domoticz - "Domoticz daemon user" +m domoticz domoticz diff --git a/domoticz.tmpfiles b/domoticz.tmpfiles new file mode 100644 index 0000000..25f8237 --- /dev/null +++ b/domoticz.tmpfiles @@ -0,0 +1 @@ +d /run/domoticz 755 domoticz domoticz